2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
[external/binutils.git] / gold / ChangeLog
1 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2
3         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
4         the maximum segment alignment is larger than the page size.
5         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
6         correctly aligns the symbols with large alignemnt.
7         * testsuite/Makefile.in: Regenerate.
8         * testsuite/large_symbol_alignment.cc: New file.
9
10 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
11             Sriraman Tallam  <tmsriram@google.com>
12
13         * options.h (sort_section): New option.
14         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
15         Rename from Input_section_sort_section_name_special_ordering_compare.
16         (Input_section_sort_section_name_compare): New struct.
17         * output.cc (Output_section::Input_section_sort_section_name_compare::
18         operator()): New function.
19         (Output_section::sort_attached_input_sections): Use new sort function
20         for .text if --sort-section=name is specified.
21         * layout.cc (Layout::make_output_section):
22         Add sorting by name when --sort-section=name is specified.
23         * testsuite/Makefile.am (text_section_grouping): Test option
24         --sort-section=name.
25         * testsuite/Makefile.in: Regenerate.
26         * testsuite/section_sorting_name.cc: New file.
27         * testsuite/section_sorting_name.sh: New file.
28
29 2013-05-21  Cary Coutant  <ccoutant@google.com>
30
31         * symtab.h (Symbol::is_cxx_vtable): New function.
32         * target-reloc.h (relocate_section): Check for vtable symbol.
33         * testsuite/Makefile.am (missing_key_func.sh): New test case.
34         * testsuite/Makefile.in: Regenerate.
35         * testsuite/missing_key_func.cc: New test source.
36         * testsuite/missing_key_func.sh: New test script.
37
38 2013-05-21  Cary Coutant  <ccoutant@google.com>
39
40         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
41         type of enclosing symbol.
42         (Relocate_info::location): Check symbol type when describing symbol.
43         * object.h (Symbol_location_info): Remove unused line_number;
44         add enclosing_symbol_type.
45         * testsuite/debug_msg.sh: Adjust expected output.
46
47 2013-05-13  Cary Coutant  <ccoutant@google.com>
48
49         * configure.ac: Export DEFAULT_TARGET.
50         * configure: Regenerate.
51         * Makefile.in: Regenerate.
52         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
53         * testsuite/Makefile.in: Regenerate.
54         * testsuite/debug_msg.sh: Delete duplicate tests.
55         Don't check undef_int error message match for powerpc where the
56         source file and line number aren't available.
57
58 2013-05-10  Roland McGrath  <mcgrathr@google.com>
59
60         * options.h (General_options): Add --rosegment-gap option.
61         * options.cc (finalize): --rosegment-gap implies --rosegment.
62         * layout.cc (set_segment_offsets): Let user option override
63         target->rosegment_gap().
64
65 2013-05-10  Roland McGrath  <mcgrathr@google.com>
66
67         * options.h (General_options): Remove leading space from help
68         messages for -nostdlib and --rosegment.
69
70 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
71
72         PR ld/15365
73         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
74
75 2013-05-03  Alan Modra  <amodra@gmail.com>
76
77         * merge.cc (Output_merge_string::do_add_input_section): Correct
78         scan for number of strings.  Rename vars to avoid shadowing.
79         Include missing terminator in input_size_.
80
81 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
82
83         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
84         Restore empty string handling.
85
86 2013-05-01  Cary Coutant  <ccoutant@google.com>
87
88         * stringpool.cc (Stringpool_template::new_key_offset): Fix
89         uninitialized warning.
90
91 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
92
93         * output.cc (Output_section::add_merge_input_section): Allow
94         to merge sections if the alignment is more than character size.
95         * merge.h (Output_merge_string::Output_merge_string): Remove
96         assert.
97         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
98         only not-null strings. Check the alignment of strings.
99         * stringpool.h
100         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
101         alignment as the argument.
102         (Stringpool_template<Stringpool_char>::addralign_): New class member.
103         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
104         Align non-zero length strings according to the addralign_.
105         (Stringpool_template<Stringpool_char>::set_string_offsets):
106         Updating offsets according to the given alignment.
107         * testsuite/Makefile.am (text_section_grouping): Test if string
108         literals are getting merged.
109         * testsuite/Makefile.in: Regenerate.
110         * testsuite/merge_string_literals_1.c: New file.
111         * testsuite/merge_string_literals_2.c: Ditto.
112         * testsuite/merge_string_literals.sh: Ditto.
113
114 2013-04-26  Ian Lance Taylor  <iant@google.com>
115
116         * target-reloc.h (relocate_section): If the reloc offset is out of
117         range, pass VIEW as NULL to relocate.relocate.
118         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
119         * i386.cc (Target_i386::Relocate::relocate): Likewise.
120         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
121         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
122         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
123         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
124
125 2013-04-26  Geoff Pike  <gpike@chromium.org>
126
127         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
128         * layout.cc (Hash_task): New class.
129         (Layout::queue_build_id_tasks): New function.
130         (Layout::write_build_id): Handle single-thread portion of build ID
131         computation.  (In some cases, all of it is single-threaded.)  Replace
132         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
133         functionality in fewer lines of code.
134         * layout.h (Layout::queue_build_id_tasks): New function declaration.
135         * options.h (General_options): make "--build-id" default to tree
136         rather than sha1.  Add two new options related to --build-id=tree:
137         --build-id-chunk-size-for-treehash and
138         --build-id-min-file-size-for-treehash.
139         * Makefile.am: add testing of --build-id=tree and related new options
140         (these tests will be invoked by "make check").
141         * Makefile.in: Regenerate.
142
143 2013-04-25  Alan Modra  <amodra@gmail.com>
144
145         * configure.tgt: Add powerpcle and powerpc64le.
146
147 2013-04-22  Alan Modra  <amodra@gmail.com>
148
149         PR gold/15355
150         * layout.cc (Layout::segment_precedes): Allow more than one
151         segment with the same type and flags.
152
153 2013-04-15  Cary Coutant  <ccoutant@google.com>
154
155         * layout.cc (Layout::set_relocatable_section_offsets): Don't
156         allocate space in file for BSS sections.
157
158 2013-04-15  Cary Coutant  <ccoutant@google.com>
159
160         * script-sections.cc (Orphan_output_section): Reset address
161         to zero after each orphaned section for relocatable links.
162
163 2013-04-15  Cary Coutant  <ccoutant@google.com>
164
165         * symtab.cc (Symbol_table::sized_write_globals): Subtract
166         section starting address for relocatable link.
167         * testsuite/Makefile.am (script_test_11): New test.
168         * testsuite/Makefile.in: Regenerate.
169         * testsuite/script_test_11.c: New source file.
170         * testsuite/script_test_11.t: New linker script.
171
172 2013-04-13  Alan Modra  <amodra@gmail.com>
173
174         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
175         owner when sections are not adjacent and exceed group size.
176         (Target_powerpc::group_sections): Handle corner case.
177         (Target_powerpc::Branch_info::make_stub): Handle case where
178         stub table doesn't exist due to branches in non-exec sections.
179         (Target_powerpc::Relocate::relocate): Likewise.
180
181 2013-04-11  Alan Modra  <amodra@gmail.com>
182
183         PR gold/15354
184         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
185         .branch_lt to match bfd ld.  Adjust comments throughout file.
186
187 2013-04-04  Ian Lance Taylor  <iant@google.com>
188
189         GCC PR c++/56840
190         * object.cc (do_layout_deferred_sections): Handle .eh_frame
191         sections before checking whether they are included in the link.
192
193 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
194
195         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
196         object before calling the plugin claim_file handler.  Pass the elf
197         object of the archive to the plugin. Delete the elf object if the
198         plugin claims the file.
199
200 2013-03-21  Alan Modra  <amodra@gmail.com>
201
202         * layout.cc (Layout::set_segment_offsets): Accept writable .text
203         segment when omagic.
204
205 2013-03-21  Alan Modra  <amodra@gmail.com>
206
207         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
208         comparison warning.
209         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
210         uninitialized" warning.
211
212 2013-03-20  Alan Modra  <amodra@gmail.com>
213
214         * symtab.h (Symbol::clear_version): New function.
215         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
216         is_needed by weak references.  Clear version for symbols defined
217         in as-needed objects that are not needed.
218
219 2013-03-15  Alan Modra  <amodra@gmail.com>
220
221         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
222         static and public.  Add report_err param.  Return false for data refs.
223         (Target_powerpc::rela_dyn_section): New overloaded function.
224         (Target_powerpc::plt_, iplt_): Elucidate.
225         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
226         (Output_data_plt_powerpc::do_write): Don't write .iplt.
227         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
228         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
229         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
230         push_branch and make_plt_entry for ifunc syms when
231         reloc_needs_plt_for_ifunc.
232         (Target_powerpc::Relocate::relocate): Don't use plt entry value
233         for ifunc unless reloc_needs_plt_for_ifunc.
234
235 2013-03-15  Alan Modra  <amodra@gmail.com>
236
237         * gc.h (gc_process_relocs): Don't look through function descriptors.
238         * icf.cc (get_section_contents): Do so here instead.
239
240 2013-03-13  Alan Modra  <amodra@gmail.com>
241
242         * powerpc.cc (is_branch_reloc): Forward declare.
243         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
244         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
245         false for 64-bit, true for 32-bit non-branch relocs.
246         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
247         * testsuite/Makefile.am (icf_test): Use linker map file instead of
248         nm output.
249         (icf_safe_test): Generate linker map file as well as nm output.
250         (icf_safe_so_test): Likewise.
251         * testsuite/Makefile.in: Regenerate.
252         * testsuite/icf_test.sh: Parse linker map file to determine
253         section folding.
254         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
255         * testsuite/icf_safe_so_test.sh: Likewise.
256         (X86_32_or_ARM_specific_safe_fold): Merge into..
257         (arch_specific_safe_fold): ..this.
258         (X86_64_specific_safe_fold): Delete unused function.
259
260 2013-03-12  Alan Modra  <amodra@gmail.com>
261
262         * gc.h (gc_process_relocs): Look through function descriptors
263         to determine shndx, symvalue and addend used by ICF.  Tidy
264         variable duplication.
265
266 2013-03-11  Alan Modra  <amodra@gmail.com>
267
268         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
269         * layout.cc (Layout_task_runner::run): ..to here.
270         * symtab.h (struct Symbol_location): Extract from..
271         (class Symbol_table): ..here.
272         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
273         * target.h (class Target): Add function_location and
274         do_function_location functions.
275         (class Sized_target): Add do_function_location.
276         * object.h (class Sized_relobj_file): Move find_shdr..
277         (class Object): ..to here.
278         * object.cc: Likewise.  Update to suit.  Instantiate.
279         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
280         * powerpc.cc (class Powerpc_dynobj): New.
281         (Target_powerpc::do_function_location): New function.
282         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
283         (Powerpc_dynobj::do_read_symbols): New function.
284         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
285
286 2013-03-08  Ian Lance Taylor  <iant@google.com>
287
288         * options.cc (General_options::string_to_object_format): Accept
289         "default".
290
291 2013-03-08  Alan Modra  <amodra@gmail.com>
292
293         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
294         pointer to Post_fde.
295         (struct Post_fde): Move definition to here..
296         * ehframe.cc (struct Post_fde): ..from here.
297         (Cie::write): Don't alloc Post_fde.
298         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
299
300 2013-03-07  Alan Modra  <amodra@gmail.com>
301
302         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
303         relocation referencing .LC0.
304         * testsuite/discard_locals_test.sh: Remove FIXMEs.
305
306 2013-03-07  Alan Modra  <amodra@gmail.com>
307
308         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
309         always_inline.  Add assembly for powerpc to avoid GOT.
310
311 2013-03-07  Alan Modra  <amodra@gmail.com>
312
313         * testsuite/script_test_10.sh: Don't test .bss section
314         header number.
315
316 2013-03-06  Alan Modra  <amodra@gmail.com>
317
318         * powerpc.cc (class Powerpc_relobj): Move some member functions.
319         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
320         all callers.  Handle folded sections.
321         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
322         to Powerpc_relobj.
323         (Global_symbol_visitor_opd::operator()): Likewise.
324
325 2013-03-04  Alan Modra  <amodra@gmail.com>
326
327         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
328         * testsuite/Makefile.in: Regenerate.
329
330 2013-03-01  Cary Coutant  <ccoutant@google.com>
331
332         Add dwp support for v2 DWARF package file format.
333         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
334         tu_length parameter.  Adjust all callers.
335         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
336         * dwp.cc: Include dwarf.h.
337         (Section_bounds): New struct type.
338         (Unit_set): New struct type.
339         (Dwo_file::Dwo_file): Initialize new data member.
340         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
341         Combine and rename to...
342         (Dwo_file::read_unit_index): ...this.
343         (Dwo_file::sized_read_compunit_index)
344         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
345         (Dwo_file::sized_read_unit_index): ...this.
346         (Dwo_file::copy_section): Remove section_name, is_str_offsets
347         parameters; add section_id parameter.
348         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
349         (Dwo_file::add_unit_set): ...this.
350         (Dwo_file::shndx_map_): Remove.
351         (Dwo_file::sect_offsets_): New data member.
352         (Dwp_output_file::Dwp_output_file): Initialize new data members.
353         (Dwp_output_file::add_section): Rename to...
354         (Dwp_output_file::add_contribution): ...this.
355         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
356         (Dwp_output_file::add_tu_set): Likewise.
357         (Dwp_output_file::Contribution): New type.
358         (Dwp_output_file::Section::contributions): New data member.
359         (Dwp_output_file::Cu_or_tu_set): Remove.
360         (Dwp_output_file::Section::Section): New ctor.
361         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
362         (Dwp_output_file::Dwp_index::Section_table): New type.
363         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
364         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
365         parameter.
366         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
367         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
368         (Dwp_output_file::Dwp_index::section_table): New member function.
369         (Dwp_output_file::Dwp_index::section_table_end): New member function.
370         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
371         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
372         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
373         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
374         (Dwp_output_file::Dwp_index::section_table_): New data member.
375         (Dwp_output_file::Dwp_index::section_mask_): New data member.
376         (Dwp_output_file::add_output_section): New member function.
377         (Dwp_output_file::write_new_section): New member function.
378         (Dwp_output_file::write_contributions): New member function.
379         (Dwp_output_file::section_id_map_): New data member.
380         (class Dwo_id_info_reader): Remove.
381         (class Unit_reader): New class.
382         (get_dwarf_section_name): New function.
383         (Dwo_file::read_executable): Adjust initializations of class data.
384         (Dwo_file::read): Add support for v2 package file format.
385         (Dwo_file::read_unit_index): Likewise.
386         (Dwo_file::sized_read_unit_index): Likewise.
387         (Dwo_file::copy_section): Likewise.
388         (Dwo_file::add_unit_set): Likewise.
389         (Dwp_output_file::add_output_section): Likewise.
390         (Dwp_output_file::add_contribution): Likewise.
391         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
392         for empty slot.
393         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
394         file format.
395         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
396         slot.
397         (Dwp_output_file::initialize): Remove unused function.
398         (Dwp_output_file::finalize): Add support for v2 package file format.
399         (Dwp_output_file::write_index): Likewise.
400         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
401         function prototype.
402
403 2013-03-01  Cary Coutant  <ccoutant@google.com>
404
405         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
406         function into class definition in header file.
407         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
408         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
409         New function.
410         (Dwarf_info_reader::check_buffer): Move here from .cc file.
411
412 2013-02-28  Alan Modra  <amodra@gmail.com>
413
414         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
415         * target.cc (Target::do_plt_fde_location): New function.
416         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
417         accessor function, and constructor param.
418         (struct Post_fde, Post_fdes): Declare.
419         (Cie::write): Add post_fdes param.
420         * ehframe.cc (Fde::write): Use plt_fde_location.
421         (struct Post_fde): Define.
422         (Cie::write): Stash FDEs added post merge mapping.
423         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
424         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
425         (Eh_frame::do_sized_write): Arrange to write post map FDES after
426         other FDEs.
427         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
428         (Target_powerpc::has_glink): New function.
429         (Target_powerpc::do_relax): Add eh_frame info for stubs.
430         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
431         glink_eh_frame_fde_32, default_fde): New data.
432         (Stub_table::eh_frame_added_): New var.
433         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
434         Make const.
435         (Stub_table::add_eh_frame): New function.
436         (Output_data_glink::add_eh_frame): New function.
437         (Target_powerpc::make_glink_section): Call add_eh_frame.
438
439 2013-02-15  Ian Lance Taylor  <iant@google.com>
440
441         * options.h (DEFINE_uint64_alias): Define.
442         (class General_options): Add -Ttext-segment as an alias for
443         -Ttext.
444
445 2013-02-15  Alan Modra  <amodra@gmail.com>
446
447         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
448         (Stub_table::do_write): ..here, two places.
449         (Stub_table::plt_call_size): Use it here too.
450
451 2013-02-11  Ian Lance Taylor  <iant@google.com>
452
453         * descriptors.cc (Descriptors::close_all): New function.
454         * descriptors.h (class Descriptors): Declare close_all.
455         (close_all_descriptors): New inline function.
456         * plugin.cc: Include "descriptors.h".
457         (Plugin_manager::cleanup): Call close_all_descriptors.
458
459 2013-02-06  Alan Modra  <amodra@gmail.com>
460
461         * README: Update coding style link.
462
463 2013-01-28  Cary Coutant  <ccoutant@google.com>
464
465         * dwp.cc (File_list): New typedef.
466         (Dwo_name_info_reader): New class.
467         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
468         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
469         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
470         (Dwo_file::read_executable): New function.
471         (Dwo_file::read): Move common setup code to ...
472         (Dwo_file::make_object): ... here.
473         (dwp_options): Add --exec/-e.
474         (usage): Likewise.
475         (main): Likewise.
476
477 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
478
479         * layout.cc (Layout::layout): Check for option text_reorder.
480         (Layout::make_output_section): Ditto.
481         * options.h (text_reorder): New option.
482         * output.cc (Input_section_sort_compare): Remove special ordering
483         of section names.
484         (Output_section::
485          Input_section_sort_section_name_special_ordering_compare::
486          operator()): New function.
487         (Output_section::sort_attached_input_sections): Use new sort function
488         for .text.
489         * output.h (Input_section_sort_section_name_special_ordering_compare):
490         New struct.
491         * testsuite/Makefile.am (text_section_grouping): Test option
492         --no-text-reorder
493         * testsuite/Makefile.in: Regenerate.
494         * testsuite/text_section_grouping.sh: Check order of functions without
495         default text reordering.
496
497 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
498
499         * options.h (General_options): Change default to true for new_dtags.
500
501 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
502
503         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
504         when enable_new_dtags is false.  Only add DT_RUNPATH when
505         enable_new_dtags is true.
506
507 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
508
509         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
510         used in declaration and definition consistent.
511         (Target_powerpc::symval_for_branch): Ditto.
512
513 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
514
515         * testsuite/plugin_final_layout.cc: Fix comment.
516
517 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
518
519         * layout.cc (Layout::layout): Do not do default sorting for
520         text sections when section ordering is specified.
521         (make_output_section): Ditto.
522         * testsuite/plugin_final_layout.cc: Name the function sections
523         to catch reordering issues.
524
525 2013-01-15  Alan Modra  <amodra@gmail.com>
526
527         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
528         plt-thread-safe.
529
530 2013-01-15  Alan Modra  <amodra@gmail.com>
531
532         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
533         * testsuite/Makefile.in: Regenerate.
534
535 2013-01-14  Alan Modra  <amodra@gmail.com>
536
537         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
538         * testsuite/Makefile.in: Regenerate.
539
540 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
541
542         PR bfd/14430
543         Fix mingw gold build with plugins enabled
544         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
545         * configure.ac: Export DLOPEN_LIBS and add headers check.
546         * plugin.cc: Handle non-dlfcn case.
547         * Makefile.in: Regenerate.
548         * config.in: Regenerate.
549         * configure: Regenerate.
550         * testsuite/Makefile.in: Regenerate.
551
552 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
553
554         * output.h (sort_attached_input_sections): Change to be public.
555         * script-sections.cc
556         (Output_section_definition::set_section_addresses): Sort
557         attached input sections according to section order before linker
558         script assigns section addresses.
559         (Orphan_output_section::set_section_addresses): Sort
560         attached input sections according to section order before linker
561         script assigns section addresses.
562         * Makefile.am (final_layout.sh): Use a simple linker script to
563         check if section ordering still works.
564         * Makefile.in: Regenerate.
565
566 2013-01-09  Ben Cheng  <bccheng@google.com>
567
568         * arm.cc (Target_arm::attributes_accept_div): New function.
569         (Target_arm::attributes_forbid_div): New function.
570         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
571         attribute using the same new functions as what bfd/elf32_arm.c
572         does.
573
574 2013-01-07  Cary Coutant  <ccoutant@google.com>
575
576         PR gold/14993
577         * output.cc (Output_section::add_input_section): For incremental
578         updates, don't track input sections that are allocated from patch
579         space.
580
581 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
582             Ian Lance Taylor  <iant@google.com>
583
584         PR gold/14897
585         * configure.ac (--enable-ld): Removed.
586         (install_as_default): Set to yes only for --enable-gold=default
587         or --disable-ld.
588         * configure: Regenerated.
589
590 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
591
592         * options.h (General_options): Add -fuse-ld= for GCC linker
593         option compatibility.
594
595 2013-01-04  Cary Coutant  <ccoutant@google.com>
596
597         * configure.ac: Fix typo restoring CXXFLAGS.
598         * configure: Regenerate.
599
600 2013-01-04  Cary Coutant  <ccoutant@google.com>
601
602         * testsuite/Makefile.am (CXXLINK_S): New macro.
603         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
604         * testsuite/Makefile.in: Regenerate.
605
606 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
607
608         * version.cc (print_version): Update copyright year to 2013.
609
610 2012-12-20  Ian Lance Taylor  <iant@google.com>
611
612         * layout.cc (Layout::special_ordering_of_input_section): New
613         function.
614         (Layout::layout): If input section requires special ordering, must
615         sort input sections.
616         (Layout::make_output_section): May sort .text input sections.
617         (Layout::is_section_name_prefix_grouped): Remove.
618         * layout.h (class Layout): Declare
619         special_ordering_of_input_section.  Don't declare
620         is_section_name_prefix_grouped.
621         * output.cc (Output_section::add_input_section): Revert last
622         change.
623         (Output_section::Input_section_sort::match_file_name): Don't crash
624         if called on output section data.
625         (Output_section::Input_section_sort_compare): Sort based on
626         special ordering.
627         (Output_section::Input_section_sort_section_order_index_compare):
628         Revert last patch.
629         (Output_section::sort_attached_input_sections): Likewise.
630
631 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
632
633         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
634         * layout.h (Layout::is_section_name_prefix_grouped): New function.
635         * output.cc (Output_section::add_input_section): Check if section
636         name contains special prefix.  Keep input sections to sort such
637         sections.
638         (Output_section::Input_section_sort_section_order_index_compare
639          ::operator()): Group sections according to prefixes.
640         (Output_section::sort_attached_input_sections): Add condition to
641         Input_section_entry constructor call.
642         * testsuite/Makefile.am (text_section_grouping): New test.
643         * testsuite/Makefile.in: Regenerate.
644         * testsuite/text_section_grouping.cc: New file.
645         * testsuite/text_section_grouping.sh: New file.
646
647 2012-12-17  Nick Clifton  <nickc@redhat.com>
648
649         * Makefile.am: Add copyright notice.
650         * NEWS: Likewise.
651         * README: Likewise.
652         * configure.ac: Likewise.
653         * ftruncate.c: Likewise.
654         * Makefile.in: Regenerate.
655
656 2012-12-14  Cary Coutant  <ccoutant@google.com>
657
658         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
659         --no-as-needed flag.
660         (exception_separate_shared_12_test): Likewise.
661         (incremental_copy_test): Likewise.
662         * testsuite/Makefile.in: Regenerate.
663
664 2012-12-14  Cary Coutant  <ccoutant@google.com>
665
666         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
667         (Dwp_output_file::Dwp_index::enter_set): Add assert.
668
669 2012-12-12  Alan Modra  <amodra@gmail.com>
670
671         * powerpc.cc (class Track_tls): New.
672         (class Relocate, class Scan): Inherit Track_tls.
673         (Target_powerpc::Scan::local, global): Track tls optimization
674         and avoid creating plt entry for __tls_get_addr if all uses
675         are optimized away.
676         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
677
678 2012-12-12  Alan Modra  <amodra@gmail.com>
679
680         * options.h (General_options): Add --toc-sort/--no-toc-sort.
681         Replace no_toc_optimize with toc_optimize.
682         * output.h (Output_section::input_sections): Provide non-const variant.
683         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
684         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
685         accessors.
686         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
687         (class Sort_toc_sections): New.
688         (Target_powerpc::do_finalize_sections): Sort toc sections.
689         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
690
691 2012-12-10  Roland McGrath  <mcgrathr@google.com>
692
693         * testsuite/binary_unittest.cc (read_all): New function.
694         (Sized_binary_test): Use it instead of ::read.
695         * fileread.cc (do_read): Don't assume pread always reads the whole
696         amount in a single call.
697
698 2012-12-10  Alan Modra  <amodra@gmail.com>
699
700         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
701         Set EM_PPC64 or EM_PPC here.
702         (Target_selector_powerpc::do_recognize): Delete.
703
704 2012-12-10  Alan Modra  <amodra@gmail.com>
705
706         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
707         stub_table_.
708         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
709
710 2012-12-07  Roland McGrath  <mcgrathr@google.com>
711
712         * testsuite/binary_unittest.cc (Sized_binary_test):
713         Use open_descriptor rather than ::open.
714
715 2012-12-07  Alan Modra  <amodra@gmail.com>
716
717         * powerpc.cc (Stub_table::do_write): Delete redundant Address
718         typedef and invalid_address constant.
719         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
720         instantiate constants.
721
722 2012-12-06  Roland McGrath  <mcgrathr@google.com>
723
724         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
725         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
726         * aclocal.m4: Regenerate.
727         * configure: Regenerate.
728         * Makefile.in: Regenerate.
729         * testsuite/Makefile.in: Regenerate.
730
731 2012-12-07  Alan Modra  <amodra@gmail.com>
732
733         * options.h (General_options): Add no_toc_optimize.
734         * powerpc.cc (ok_lo_toc_insn): New function.
735         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
736
737 2012-12-06  Alan Modra  <amodra@gmail.com>
738
739         * options.h (General_options): Add plt_align, plt_static_chain,
740         plt_thread_safe.  Update stub_group_size help text.
741         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
742         for new plt_thread_safe_ var.
743         (use_plt_offset): Correct comments.
744         (Target_powerpc::do_relax): Look for thread creation symbols to
745         determine default plt_thread_safe value.  Clear plt call stubs
746         as well as branch stubs each iteration.
747         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
748         insn constants.
749         (l, hi, ha, write_insn): Move earlier.
750         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
751         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
752         plt stubs too.
753         (Stub_table::update_size): Adjust.
754         (Stub_table::prev_size, set_prev_size): Delete.
755         (Stub_table::stub_align): Let --plt-align affect result.
756         (Stub_table::plt_call_size): Calculate sizes for various stubs.
757         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
758         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
759         (Stub_table::do_write): Support more stub variants.
760
761 2012-12-04  Alan Modra  <amodra@gmail.com>
762
763         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
764         (Target_powerpc::do_define_standard_symbols): New function.
765
766 2012-12-03  Alan Modra  <amodra@gmail.com>
767
768         * output.h: Formatting, whitespace.
769
770 2012-12-03  Alan Modra  <amodra@gmail.com>
771
772         * layout.h (Layout::get_executable_sections): Declare.
773         * layout.cc (Layout::get_executable_sections): New function.
774         * arm.cc (Target_arm::group_sections): Use it.
775         (Arm_output_section::group_sections): Delete now redundant test.
776         * output.cc (Output_reloc::Output_reloc): Add is_relative.
777         param to handle relative relocs.
778         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
779         (Output_data_reloc::add_absolute): Adjust.
780         (Output_data_reloc::add_relative): New function.
781         (Output_data::reset_data_size): New function.
782         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
783         (Output_section::set_addralign): New function.
784         (Output_section::checkpoint_set_addralign): New function.
785         (Output_section::clear_section_offsets_need_adjustment): New function.
786         (Output_section::input_sections): Make public.
787         * powerpc.cc (class Output_data_brlt_powerpc): New.
788         (class Stub_table, class Stub_control): New.
789         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
790         stub_table_, set_stub_table, stub_table): New vectors and accessor
791         functions.
792         (Target_powerpc::do_may_relax, do_relax, push_branch,
793         new_stub_table, stub_tables, brlt_section, group_sections,
794         add_branch_lookup_table, find_branch_lookup_table,
795         write_branch_lookup_table, make_brlt_section): New functions.
796         (Target_powerpc::struct Sort_sections, class Branch_info): New.
797         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
798         branch_info_): New vars.
799         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
800         make call stubs here.
801         (Output_data_glink): Remove all call stub handling from this class.
802         (Target_powerpc::Scan::local, global): Save interesting branch
803         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
804         (Target_powerpc::do_finalize_sections): Only make reg save/restore
805         functions on final link.
806         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
807         Handle long branch destinations too.
808         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
809         do_plt_address_for_local): Adjust lookup of plt call stubs.
810
811 2012-11-30  Alan Modra  <amodra@gmail.com>
812
813         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
814         relocs against protected symbols when building 32-bit shared libs.
815
816 2012-11-30  Alan Modra  <amodra@gmail.com>
817
818         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
819         param.  Call got_section() to make .got.  Update all callers
820         and their callers and so on.
821
822 2012-11-30  Alan Modra  <amodra@gmail.com>
823
824         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
825         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
826         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
827         value if it already exists.
828
829 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
830
831         PR gold/14858
832         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
833
834 2012-11-14  Roland McGrath  <mcgrathr@google.com>
835
836         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
837         than bfc instruction for data sandboxing.
838
839 2012-11-08  Alan Modra  <amodra@gmail.com>
840
841         * po/POTFILES.in: Regenerate.
842
843 2012-11-05  Alan Modra  <amodra@gmail.com>
844
845         * configure.ac: Apply 2012-09-10 change to config.in here.
846         * configure: Regenerate.
847
848 2012-11-05  Alan Modra  <amodra@gmail.com>
849
850         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
851         (struct Opd_ent): Use "Address" rather than "Offset".
852         (Output_data_got_powerpc::got_base_offset): Return Valtype.
853         (Target_powerpc::got_section): Make public.
854         (Target_powerpc::scan_relocs): Move code setting symbols..
855         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
856         Create _SDA_BASE_ only when referenced.
857
858 2012-11-02  Roland McGrath  <mcgrathr@google.com>
859
860         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
861         from last change.
862
863 2012-11-01  Roland McGrath  <mcgrathr@google.com>
864
865         * target.h (Sized_target::relocate_relocs): Use Elf_Off
866         for offset_in_output_section parameter.
867         (Sized_target::relocate_special_relocatable): Likewise.
868         * arm.cc (Target_arm::relocate_relocs): Likewise.
869         (Target_arm::relocate_special_relocatable): Likewise.
870         * i386.cc (Target_i386::relocate_relocs): Likewise.
871         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
872         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
873         * target-reloc.h (relocate_relocs): Likewise.
874         * testsuite/testfile.cc (Target_test): Likewise.
875         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
876         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
877
878         * system.h: Move inclusion of <clocale> to after <libintl.h> in
879         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
880
881         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
882         parameter, which is unused in the [!F_SETFD] case.
883
884         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
885         SYMNDX to off_t before comparing it to this->data_size().
886         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
887         * incremental.cc (Output_section_incremental_inputs::do_write):
888         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
889
890         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
891
892 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
893
894         * gold.cc (Target_arm::do_adjust_elf_header): Add the
895         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
896         in EABI_VER5.
897
898 2012-10-29  Cary Coutant  <ccoutant@google.com>
899
900         * dwp.cc (usage): Add file and exit status parameters;
901         add --help and --version options.
902         (print_version): New function.
903         (main): Add --help and --version options.
904
905 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
906
907         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
908         final_layout_sequence.txt.
909         * testsuite/Makefile.in: Regenerated.
910
911 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
912
913         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
914         COMPILE generated by automake.
915         (LINK1): Likewise.
916         (CXXCOMPILE1): Likewise.
917         (CXXLINK1): Likewise.
918         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
919         (LINK): Likewise.
920         (CXXCOMPILE): Likewise.
921         (CXXLINK): Likewise.
922         * testsuite/Makefile.in: Regenerated.
923
924 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
925
926         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
927         on bad fwrite return.
928
929 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
930
931         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
932         on val.
933
934 2012-10-23  Cary Coutant  <ccoutant@google.com>
935
936         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
937         * testsuite/Makefile.in: Regenerate.
938         * testsuite/dwp_test.h: New source file.
939         * testsuite/dwp_test_1.cc: New source file.
940         * testsuite/dwp_test_1.s: New source file.
941         * testsuite/dwp_test_1.sh: New source file.
942         * testsuite/dwp_test_1b.cc: New source file.
943         * testsuite/dwp_test_1b.s: New source file.
944         * testsuite/dwp_test_2.cc: New source file.
945         * testsuite/dwp_test_2.s: New source file.
946         * testsuite/dwp_test_2.sh: New source file.
947         * testsuite/dwp_test_main.cc: New source file.
948         * testsuite/dwp_test_main.s: New source file.
949
950 2012-10-23  Cary Coutant  <ccoutant@google.com>
951
952         * dwp.h: New header file.
953         * dwp.cc: New source file.
954         * gold.h: Move shared declarations to system.h.
955         * system.h: New header file.
956         * Makefile.am: Add dwp.
957         * Makefile.in: Regenerate.
958
959 2012-10-23  Cary Coutant  <ccoutant@google.com>
960
961         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
962         Dwarf_info_reader::read_from_pointer.
963         (Dwarf_pubnames_table::read_header): Likewise.
964         (Dwarf_pubnames_table::next_name): Likewise.
965         (Dwarf_die::read_attributes): Likewise.
966         (Dwarf_die::skip_attributes): Likewise.
967         (Dwarf_info_reader::read_from_pointer): New function template.
968         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
969         (Dwarf_pubnames_table): Likewise.
970         (Dwarf_info_reader::read_from_pointer): New function template.
971         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
972         Dwarf_pubnames_table ctor.
973
974 2012-10-23  Cary Coutant  <ccoutant@google.com>
975
976         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
977         abbrev_shndx.
978         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
979         abbrev_shndx_.
980         (Dwarf_info_reader::set_abbrev_shndx): New method.
981         (Dwarf_info_reader::abbrev_shndx_): New data member.
982
983 2012-10-23  Cary Coutant  <ccoutant@google.com>
984
985         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
986         from object, not parameters.
987         (Dwarf_info_reader::parse): Likewise.
988         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
989         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
990         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
991         methods.
992
993 2012-10-23  Cary Coutant  <ccoutant@google.com>
994
995         * fileread.cc (Input_file::Input_file): New constructor.
996         * fileread.h (class Input_file): Add new constructor.
997
998 2012-10-18  Alan Modra  <amodra@gmail.com>
999
1000         PR gold/14727
1001         * object.cc (Relobj::is_section_name_included): Also match
1002         .sdata personality section.
1003
1004 2012-10-18  Alan Modra  <amodra@gmail.com>
1005
1006         * target-reloc.h (class Default_comdat_behavior): New, package up..
1007         (get_comdat_behaviour): ..this.
1008         (relocate_section): Add Relocate_comdat_behavior template arg,
1009         adjust code to suit.
1010         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1011         (Target_arm::scan_reloc_section): Likewise.
1012         * i386.cc (Target_i386::relocate_section): Likewise.
1013         * sparc.cc (Target_sparc::relocate_section): Likewise.
1014         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1015         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1016         * powerpc.cc (class Relocate_comdat_behavior): New.
1017         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1018         gold::relocate_section with new template arg.
1019
1020 2012-10-18  Alan Modra  <amodra@gmail.com>
1021
1022         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1023         dynamic relocs for GOT_TPREL got entries, without symbol if
1024         resolving locally.
1025         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1026         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1027         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1028
1029 2012-10-17  Alan Modra  <amodra@gmail.com>
1030
1031         PR gold/14726
1032         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1033
1034 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1035
1036         * layout.cc (Layout::include_section): Keep sections marked
1037         SHF_EXCLUDE when doing relocatable links.
1038
1039 2012-10-16  Alan Modra  <amodra@gmail.com>
1040
1041         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1042         (Target_powerpc::do_finalize_sections): Call it.
1043         (Output_data_save_res): New class and supporting functions.
1044         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1045         normal symbols defined in object files.
1046
1047 2012-10-12  Alan Modra  <amodra@gmail.com>
1048
1049         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1050         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1051         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1052         section if scan_opd_relocs not yet called.
1053         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1054
1055 2012-10-12  Alan Modra  <amodra@gmail.com>
1056
1057         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1058         add_local_ifunc_entry): Revert last change.
1059         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1060
1061 2012-10-05  Alan Modra  <amodra@gmail.com>
1062
1063         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1064         do_plt_address_for_global): New functions.
1065         (Output_data_got_powerpc::do_write): Don't segfault when linking
1066         statically.
1067         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1068         add_local_ifunc_entry): Return true on adding entry..
1069         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1070         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1071         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1072         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1073         set up symbols here.
1074         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1075         syms here.  Do so even when no .iplt.  Don't segfault when linking
1076         statically.
1077         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1078         new variants without reloc param.
1079         (Glink_sym_ent::Glink_sym_ent): Likewise.
1080         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1081         reloc when refs will resolve to plt call stub.
1082         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1083         R_PPC_PLTREL24 to resolve locally.
1084         (Target_powerpc::Scan::global): Correct ifunc handling.
1085         (Target_powerpc::Relocate::relocate): Correct local sym glink
1086         lookup.  Don't destroy "value" when we have a plt call stub,
1087         and when checking plt call validity.
1088         (Target_powerpc::do_dynsym_value): Simplify.
1089
1090 2012-10-05  Alan Modra  <amodra@gmail.com>
1091
1092         * i386.cc (Output_data_plt_i386::address_for_global,
1093         address_for_local): Add plt offset to returned value.  Adjust uses.
1094         * sparc.cc (Output_data_plt_sparc::address_for_global,
1095         address_for_local): Likewise.
1096         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1097         address_for_local): Likewise.
1098         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1099         address_for_local): Likewise.
1100         * target.h (Target::plt_address_for_global, plt_address_for_local):
1101         Update comment.
1102         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1103         (Output_data_got::Got_entry::write): Nor here.
1104         * output.h: Comment fix.
1105
1106 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1107
1108         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1109         global_offset_table_ value for larget got.
1110         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1111
1112 2012-09-29  Alan Modra  <amodra@gmail.com>
1113
1114         * powerpc.cc (Target_powerpc::iplt_): New output section.
1115         (Target_powerpc::iplt_section, make_iplt_section,
1116         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1117         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1118         Target_powerpc::plt_entry_count): Count iplt entries too.
1119         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1120         reloc section in constructor.  New params.
1121         (Target_powerpc::make_plt_section): Create reloc section here instead.
1122         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1123         functions.
1124         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1125         (Output_data_glink::add_entry, find_entry): New functions to
1126         deal with local syms.
1127         (Glink_sym_ent): Add support for local syms.
1128         (Output_data_glink::do_write): Handle ifunc plt entries.
1129         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1130         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1131         (Target_powerpc::Relocate::relocate): Likewise.
1132         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1133
1134 2012-09-25  Alan Modra  <amodra@gmail.com>
1135
1136         * object.h (Sized_relobj_file::adjust_local_symbol,
1137         do_adjust_local_symbol): New functions.
1138         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1139         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1140         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1141         and irregular opd entry spacing.
1142         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1143         (Global_symbol_visitor_opd): New functor.
1144         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1145         on deleted opd entries.
1146
1147 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1148
1149         * tilegx.cc: New file.
1150         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1151         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1152         * configure.tgt: Add entries for tilegx*.
1153         * configure.ac: Likewise.
1154         * Makefile.in: Rebuild.
1155         * configure: Likewise.
1156         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1157         tilegx.
1158
1159 2012-09-13  Alan Modra  <amodra@gmail.com>
1160
1161         * target-reloc.h (scan_relocs): Call scan.local for relocs
1162         against symbols in discarded sections.  Pass is_discarded
1163         param.
1164         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1165         Add is_discarded param.
1166         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1167         is_discarded to flag opd entry as discarded.  Don't emit dyn
1168         relocs on such entries.
1169         (Target_powerpc::Scan::global): Similarly detect and handle
1170         such opd entries.
1171         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1172         opd_ent_.  Update all uses.
1173         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1174         (Target_powerpc::relocate_section): Zero out discarded opd
1175         entry relocs.
1176
1177 2012-09-12  Ian Lance Taylor  <iant@google.com>
1178
1179         PR gold/14570
1180         * output.cc: Rename Output_data_got template parameter from size
1181         to got_size for all functions.  Compile all variants of
1182         Output_data_got.
1183         (Output_data_got::Got_entry::write): Correct use of size for
1184         symbol value.  Use local_is_tls rather than casting to
1185         Sized_relobj_file.
1186         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1187         (class Sized_relobj_file): Add do_local_is_tls.
1188         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1189
1190 2012-09-11  Alan Modra  <amodra@gmail.com>
1191
1192         PR gold/14566
1193         * layout.cc (Layout::set_segment_offsets): When using
1194         common-page-size alignment, ensure we are on a new max-page-size
1195         page.
1196         * output.cc (Output_segment::set_section_addresses): Use
1197         abi_pagesize, not common_pagesize for relro boundary.
1198         (Output_segment::set_offset): Likewise.
1199
1200 2012-09-11  Alan Modra  <amodra@gmail.com>
1201
1202         * output.h (Output_data_got::add_global_tls, add_local_tls,
1203         add_local_tls_pair): New functions.
1204         (Output_data_got::add_local_pair_with_rel): Remove second
1205         reloc param.  Expand comment.
1206         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1207         use_plt_or_tls_offset_, similarly for constructor param.
1208         (Output_data_got::Got_entry::write): Add got_index param.
1209         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1210         add_local_tls_pair): New functions.
1211         (Output_data_got::Got_entry::write): Handle tls symbols
1212         with use_plt_or_tls_offset_ set specially.
1213         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1214         (Output_data_got::do_write): Replace iterator with index, pass
1215         index to entry write function.
1216         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1217         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1218         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1219         call.
1220         * i386.cc (Target_i386::Scan::local): Likewise.
1221         * sparc.cc (Target_sparc::Scan::local): Likewise.
1222         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1223         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1224         do_tls_offset_for_global): New functions.
1225         (Target_powerpc::Scan::local): Correct TLS relocations and got
1226         entry values.
1227         (Target_powerpc::Scan::global): Don't emit unnecessary
1228         dynamic relocations on TLS GOT entries.
1229
1230 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1231
1232         * config.in: Disable sanity check for kfreebsd.
1233
1234 2012-09-10  Sterling Augustine  <saugustine@google.com>
1235
1236         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1237         (Gdb_index::pubtypes_read): New parameter.
1238         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1239         to calls.
1240         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1241         pubtypes_object_.
1242
1243 2012-09-09  Alan Modra  <amodra@gmail.com>
1244
1245         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1246         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1247         * gc.h (gc_process_relocs): Call target gc_add_reference.
1248         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1249         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1250         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1251         unnecessary cast.
1252         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1253         to cater for when we don't need code offset.  Update use.
1254         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1255         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1256         set_opd_valid): New functions.
1257         (Target_powerpc::do_gc_add_reference): New function.
1258         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1259         stashed refs.
1260         (Target_powerpc::do_gc_mark_symbol): New function.
1261
1262 2012-09-06  Cary Coutant  <ccoutant@google.com>
1263
1264         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1265         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1266         (Dwarf_die::skip_attributes): Likewise.
1267         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1268         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1269         (main): Call it.
1270         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1271
1272 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1273
1274         * testsuite/script_test_3.t: Add .got.plt output section
1275         statement.
1276         * testsuite/script_test_4.t: Likewise.
1277
1278 2012-09-05  Alan Modra  <amodra@gmail.com>
1279
1280         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1281         update all uses and lose "enum" when using type.
1282
1283 2012-09-05  Alan Modra  <amodra@gmail.com>
1284
1285         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1286         * configure: Regenerate.
1287         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1288         (plugin_final_layout.stdout): Likewise.
1289         (memory_test): Set page sizes to 0x1000.
1290         * testsuite/Makefile.in: Regenerate.
1291         * testsuite/discard_locals_test.sh: Add FIXME comment.
1292         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1293         * testsuite/pr14265.t: Add .got output section statement.
1294         * testsuite/script_test_2.t: Likewise.
1295         * testsuite/script_test_3.t: Likewise.
1296         * testsuite/script_test_4.t: Likewise.
1297         * testsuite/script_test_5.t: Likewise.
1298         * testsuite/script_test_6.t: Likewise.
1299         * testsuite/script_test_7.t: Likewise.
1300         * testsuite/script_test_9.t: Likewise.
1301
1302 2012-09-05  Alan Modra  <amodra@gmail.com>
1303
1304         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1305         (Powerpc_relocate_functions::Status): New typedef.
1306         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1307         (Target_powerpc::Scan::local): Handle REL64.
1308         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1309         for REL32 and REL64.
1310         (Target_powerpc::symval_for_branch): New function, extracted from..
1311         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1312         checks.  Report overflow errors.
1313
1314 2012-09-05  Alan Modra  <amodra@gmail.com>
1315
1316         * object.h (Sized_relobj_file::emit_relocs): Delete.
1317         (Sized_relobj_file::emit_relocs_reltype): Delete.
1318         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1319         relocate_relocs for --emit-relocs.
1320         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1321         * output.h: Update comment.
1322         (Output_segment::first_section): New function.
1323         (Output_segment::first_section_load_address): Use first_section.
1324         * output.cc (Output_segment::first_section): New function extracted..
1325         (Output_segment::first_section_load_address): ..from here.  Delete.
1326         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1327         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1328         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1329         adjust call to target.h function.
1330         * i386.cc (Target_i386): Likewise.
1331         * sparc.cc (Target_sparc): Likewise.
1332         * x86_64.cc (Target_x86_64): Likewise.
1333         * powerpc.cc (Target_powerpc): Likewise.
1334         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1335         first tls section has section symbol for optimised local dynamic
1336         output relocs.
1337         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1338         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1339         optimised tls code.
1340         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1341         Rename to relocate_relocs.  Update error message.
1342
1343 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1344
1345         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1346         --just-symbols.
1347
1348 2012-08-31  Alan Modra  <amodra@gmail.com>
1349
1350         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1351         (Powerpc_relobj::toc_base_offset): New stub function.
1352         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1353         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1354         (Target_powerpc::Relocate::enum skip_tls): New.
1355         (Target_powerpc::call_tls_get_addr_): New var.
1356         (Target_powerpc::is_branch_reloc): Move to file scope.
1357         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1358         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1359         New functions.
1360         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1361         (powerpc_info): Correct common_pagesize for ppc64.
1362         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1363         (Powerpc_relocate_functions): Add overflow check enums and functions.
1364         Add non-shift version of rela, rela_ua.  Delete all rel public
1365         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1366         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1367         addr16_ha3, addr14 functions.
1368         (Output_data_got_powerpc::add_constant_pair): New function.
1369         (Output_data_got_powerpc::got_base_offset): Likewise.
1370         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1371         (instruction constants): Sort, add some more.
1372         (Output_data_glink::do_write): Add and use Address typedef.  Use
1373         object->toc_base_offset() stub for 64-bit.
1374         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1375         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1376         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1377         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1378         Always treat .opd relocs as against locally defined symbol.
1379         Correct condition for RELATIVE relocs.
1380         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1381         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1382         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1383         calculations.  Handle TLS relocs, and more.  Add overflow
1384         checking and adjust for Powerpc_relocate_functions changes.
1385         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1386         Reinstate --emit-relocs code with FIXME.
1387
1388 2012-08-30  Alan Modra  <amodra@gmail.com>
1389
1390         * layout.cc (Layout::set_segment_offsets): Set p_align to
1391         abi_pagesize, not common_pagesize.
1392         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1393         to determine whether file header can go in segment.
1394
1395 2012-08-30  Alan Modra  <amodra@gmail.com>
1396
1397         * output.h (Output_reloc::Output_reloc <output section>): Add
1398         is_relative param.  Adjust calls.
1399         (Output_reloc::add_output_section_relative): New functions.
1400         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1401         is_relative.
1402         (Output_reloc::symbol_value): Handle SECTION_CODE.
1403
1404 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1405
1406         * gold.cc (queue_middle_tasks): Call layout again when unique
1407         segments for sections is desired.
1408         * layout.cc (Layout::Layout): Initialize new members.
1409         (Layout::get_output_section_flags): New function.
1410         (Layout::choose_output_section): Call get_output_section_flags.
1411         (Layout::layout): Make output section for mapping to a unique segment.
1412         (Layout::insert_section_segment_map): New function.
1413         (Layout::attach_allocated_section_to_segment): Make unique segment for
1414         output sections marked so.
1415         (Layout::segment_precedes): Check for unique segments when sorting.
1416         * layout.h (Layout::Unique_segment_info): New struct.
1417         (Layout::Section_segment_map): New typedef.
1418         (Layout::insert_section_segment_map): New function.
1419         (Layout::get_output_section_flags): New function.
1420         (Layout::is_unique_segment_for_sections_specified): New function.
1421         (Layout::set_unique_segment_for_sections_specified): New function.
1422         (Layout::unique_segment_for_sections_specified_): New member.
1423         (Layout::section_segment_map_): New member.
1424         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1425         Rename is_gc_pass_one to is_pass_one.
1426         Rename is_gc_pass_two to is_pass_two.
1427         Rename is_gc_or_icf to is_two_pass.
1428         Check for which pass based on whether symbols data is present.
1429         Make it two pass when unique segments for sections is desired.
1430         * output.cc (Output_section::Output_section): Initialize new
1431         members.
1432         * output.h (Output_section::is_unique_segment): New function.
1433         (Output_section::set_is_unique_segment): New function.
1434         (Output_section::is_unique_segment_): New member.
1435         (Output_section::extra_segment_flags): New function.
1436         (Output_section::set_extra_segment_flags): New function.
1437         (Output_section::extra_segment_flags_): New member.
1438         (Output_section::segment_alignment): New function.
1439         (Output_section::set_segment_alignment): New function.
1440         (Output_section::segment_alignment_): New member.
1441         (Output_segment::Output_segment): Initialize is_unique_segment_.
1442         (Output_segment::is_unique_segment): New function.
1443         (Output_segment::set_is_unique_segment): New function.
1444         (Output_segment::is_unique_segment_): New member.
1445         * plugin.cc (allow_unique_segment_for_sections): New function.
1446         (unique_segment_for_sections): New function.
1447         (Plugin::load): Add new functions to transfer vector.
1448         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1449         * Makefile.in: Regenerate.
1450         * testsuite/plugin_final_layout.sh: Check if unique segment
1451         functionality works.
1452         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1453         are available.
1454         (allow_unique_segment_for_sections): New global.
1455         (unique_segment_for_sections): New global.
1456         (claim_file_hook): Call allow_unique_segment_for_sections.
1457         (all_symbols_read_hook): Call unique_segment_for_sections.
1458
1459 2012-08-22  Cary Coutant  <ccoutant@google.com>
1460
1461         * layout.cc (Layout::include_section): Don't assert on GROUP
1462         sections with --emit-relocs.
1463
1464 2012-08-21  Cary Coutant  <ccoutant@google.com>
1465
1466         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1467         if --export-dynamic-symbol names an undef symbol.
1468
1469 2012-08-18  Alan Modra  <amodra@gmail.com>
1470
1471         * powerpc.cc: Formatting and white space.
1472         (Powerpc_relobj): Rename got2_section_ to special_.
1473         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1474         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1475         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1476         (Target_powerpc): Add Address typedef and invalid_address.  Use
1477         throughout.
1478         (Target_powerpc::is_branch_reloc): New function.
1479         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1480         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1481         for dst_mask, value and addend.
1482         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1483         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1484         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1485         uint16_t for 24-bit offset.  Use get_output_section_offset and
1486         check return.
1487         (Target_powerpc::Scan::local): Handle more relocs.
1488         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1489         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1490         Plug in toc restoring insn after plt calls.  Translate branches
1491         to function descriptor symbols to corresponding entry point.
1492         (Target_powerpc::relocate_for_relocatable): Check return from
1493         get_output_section_offset.
1494         * symtab.h: Comment typo.
1495
1496 2012-08-14  Ian Lance Taylor  <iant@google.com>
1497
1498         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1499         unsupported_relocal_local to call unsupported_reloc_global.
1500
1501 2012-08-14  Nick Clifton  <nickc@redhat.com>
1502
1503         PR ld/14265
1504         * script-sections.cc (Sections_element::output_section_name): Add
1505         keep return parameter.
1506         (Output_section_element::match_name): Add keep return parameter.
1507         Return the value of the keep_ member.
1508         * script-sections.h (class Output_section): Update
1509         output_section_name prototype.
1510         * layout.cc (Layout::keep_input_section): New public member
1511         function.
1512         (Layout::choose_output_section): Pass keep parameter to
1513         output_section_name.
1514         * layout.h (class Layout): Add keep_input_section.
1515         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1516         sections.
1517         * testsuite/Makefile.am: Add a test.
1518         * testsuite/Makefile.in: Regenerate.
1519         * testsuite/pr14265.c: Source file for the test.
1520         * testsuite/pr14265.t: Linker script for the test.
1521         * testsuite/pr14265.sh: Shell script for the test.
1522
1523 2012-08-14  Alan Modra  <amodra@gmail.com>
1524
1525         * target.h (Target::output_section_name): New function.
1526         (Target::do_output_section_name): New function.
1527         * layout.cc (Layout::choose_output_section): Call the above.
1528         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1529
1530 2012-08-14  Alan Modra  <amodra@gmail.com>
1531
1532         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1533         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1534         for replace_constant call.
1535         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1536         (Output_data_glink::do_print_to_mapfile): New function.
1537         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1538         (Target_powerpc::Relocate::relocate): Likewise.
1539
1540 2012-08-14  Alan Modra  <amodra@gmail.com>
1541
1542         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1543         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1544         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1545         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1546         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1547         here.
1548         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1549         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1550         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1551         here.
1552         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1553         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1554
1555 2012-08-12  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1558         (glink insn constants): Use uint32_t.
1559         (Output_data_glink::add_entry): Use insert, not [] operator.
1560
1561 2012-08-11  Alan Modra  <amodra@gmail.com>
1562
1563         * object.h (Sized_relobj_file::find_shdr): New function.
1564         (Sized_relobj_file::find_special_sections): New function.
1565         * object.cc (Sized_relobj_file::find_shdr): New function.
1566         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1567         (Sized_relobj_file::find_special_sections): New function, split out..
1568         (Sized_relobj_file::do_read_symbols): ..from here.
1569         * output.h (Output_data_got::replace_constant): New function.
1570         (Output_data_got::num_entries): New function.
1571         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1572         (Output_data_got::got_offset): Protected rather than private.
1573         (Output_data_got::replace_got_entry): New function.
1574         * output.cc (Output_data_got::replace_got_entry): New function.
1575         * powerpc.cc (class Powerpc_relobj): New.
1576         (class Powerpc_relocate_functions): Delete all psymval variants or
1577         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1578         Implement _ha functions using corresponding _hi function.
1579         (Powerpc_relobj::find_special_sections): New function.
1580         (Target_powerpc::do_make_elf_object): New function.
1581         (class Output_data_got_powerpc): New.
1582         (class Output_data_glink): New.
1583         (class Powerpc_scan_relocatable_reloc): New.
1584         Many more changes througout file.
1585
1586 2012-08-09  Nick Clifton  <nickc@redhat.com>
1587
1588         * po/vi.po: Updated Vietnamese translation.
1589
1590 2012-08-07  Ian Lance Taylor  <iant@google.com>
1591
1592         * layout.cc (Layout::add_target_dynamic_tags): If
1593         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1594         plt_rel.
1595
1596 2012-07-30  Nick Clifton  <nickc@redhat.com>
1597
1598         * po/gold.pot: Updated template.
1599         * po/es.po: Updated Spanish translation.
1600
1601 2012-07-18  Cary Coutant  <ccoutant@google.com>
1602
1603         PR gold/14344
1604         * configure.ac: Add check for -gpubnames support.
1605         * configure: Regenerate.
1606         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1607         support; force -gno-pubnames.
1608         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1609         support.
1610         (gdb_index_test_4): New test.
1611         * testsuite/Makefile.in: Regenerate.
1612         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1613         * testsuite/gdb_index_test_2.sh: Likewise.
1614         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1615         * testsuite/gdb_index_test_4.sh: New script.
1616         * testsuite/gdb_index_test_comm.sh: New script with common code;
1617         don't look for space after colon.
1618
1619 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1620
1621         * gold.cc (queue_middle_tasks): Update function order only after
1622         deferred objects due to plugins are processed.
1623
1624 2012-07-11  Ian Lance Taylor  <iant@google.com>
1625
1626         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1627         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1628         (Target_arm::scan_reloc_for_stub): Likewise.
1629         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1630         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1631         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1632         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1633         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1634
1635 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1636             Ian Lance Taylor  <iant@google.com>
1637
1638         PR gold/14309
1639         * configure.ac: Test whether std::tr1::hash<off_t> works.
1640         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1641         needed.
1642         * output.h (class Output_fill): Add virtual destructor.
1643         * configure, config.in: Rebuild.
1644
1645 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1646
1647         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1648
1649 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1650
1651         * plugin.cc (Plugin::load): Handle position independent executables.
1652
1653 2012-06-06  Cary Coutant  <ccoutant@google.com>
1654
1655         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1656         add .debug_macro.
1657         (lines_only_debug_sections): Likewise.
1658         (gdb_fast_lookup_sections): New static array.
1659         (is_gdb_debug_section): Rename formal parameter.
1660         (is_lines_only_debug_section): Likewise.
1661         (is_gdb_fast_lookup_section): New function.
1662         (Layout::include_section): Check for ".zdebug_" prefix; pass
1663         section name suffix to is_gdb_debug_section, et al.; check for
1664         fast-lookup sections when building .gdb_index.
1665         * options.h (--strip-debug-gdb): Update GDB version number.
1666
1667 2012-06-06  Cary Coutant  <ccoutant@google.com>
1668
1669         * configure.ac: Add check for fallocate.
1670         * configure: Regenerate.
1671         * config.in: Regenerate.
1672
1673         * options.h (class General_options): Add --mmap-output-file and
1674         --posix-fallocate options.
1675         * output.cc: (posix_fallocate): Remove; replace with...
1676         (gold_fallocate): New function.
1677         (Output_file::map_no_anonymous): Call gold_fallocate.
1678         (Output_file::map): Check --mmap-output-file option.
1679
1680 2012-06-05  Jing Yu  <jingyu@google.com>
1681
1682         * gold.h (textdomain): Add do {} to empty while(0).
1683         (bindtextdomain): Likewise.
1684
1685 2012-06-04  Cary Coutant  <ccoutant@google.com>
1686
1687         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1688         has_dynsym_index.
1689
1690 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1691
1692         * symtab.cc (Symbol_table::define_special_symbol):
1693         Initialize *poldsym to prevent uninitialized variable errors.
1694
1695 2012-05-23  Cary Coutant  <ccoutant@google.com>
1696
1697         * layout.cc (Layout::section_name_mapping): Add rules to handle
1698         exact match on .data.rel.ro.local or .data.rel.ro.
1699         (Layout::output_section_name): Check for exact matches.
1700
1701 2012-05-23  Cary Coutant  <ccoutant@google.com>
1702
1703         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1704         more carefully.
1705
1706 2012-05-22  Cary Coutant  <ccoutant@google.com>
1707
1708         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1709         object before exporting symbol.
1710
1711 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1712
1713         * testsuite/tls_test.cc: Include "config.h" first.
1714         * testsuite/tls_test_c.c: Likewise.
1715
1716 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1717             Nick Clifton  <nickc@redhat.com>
1718
1719         PR 14072
1720         * configure.in: Add check that sysdep.h has been included before
1721         any system header files.
1722         * configure: Regenerate.
1723         * config.in: Regenerate.
1724
1725 2012-05-14  Cary Coutant  <ccoutant@google.com>
1726
1727         * layout.cc (Layout::make_output_section): Mark .tdata section
1728         as RELRO.
1729         * testsuite/relro_test.cc: Add a TLS variable.
1730
1731 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1732
1733         PR gold/14091
1734         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1735         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1736         R_X86_64_64.
1737
1738 2012-05-08  Cary Coutant  <ccoutant@google.com>
1739
1740         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1741         (lines_only_debug_sections): Likewise.
1742
1743 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1744
1745         * nacl.cc: New file.
1746         * nacl.h: New file.
1747         * Makefile.am (CCFILES, HFILES): Add them.
1748         * Makefile.in: Regenerate.
1749         * i386.cc (Output_data_plt_i386_nacl): New class.
1750         (Output_data_plt_i386_nacl_exec): New class.
1751         (Output_data_plt_i386_nacl_dyn): New class.
1752         (Target_i386_nacl): New class.
1753         (Target_selector_i386_nacl): New class.
1754         (target_selector_i386): Use it instead of Target_selector_i386.
1755         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1756         (Target_x86_64_nacl): New class.
1757         (Target_selector_x86_64_nacl): New class.
1758         (target_selector_x86_64, target_selector_x32): Use it instead of
1759         Target_selector_x86_64.
1760         * arm.cc (Output_data_plt_arm_nacl): New class.
1761         (Target_arm_nacl): New class.
1762         (Target_selector_arm_nacl): New class.
1763         (target_selector_arm, target_selector_armbe): Use it instead of
1764         Target_selector_arm.
1765
1766         * target-select.cc (select_target): Take new Input_file* and off_t
1767         arguments, pass them on to recognize method of selector.
1768         * object.cc (make_elf_sized_object): Update caller.
1769         * parameters.cc (parameters_force_valid_target): Likewise.
1770         * incremental.cc (make_sized_incremental_binary): Likewise.
1771         * target-select.h: Update decl.
1772         (Target_selector::recognize): Take new Input_file* argument,
1773         pass it on to do_recognize.
1774         (Target_selector::do_recognize): Take new Input_file* argument.
1775         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1776         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1777         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1778         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1779
1780         * target.h (Target::Target_info): New members isolate_execinstr
1781         and rosegment_gap.
1782         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1783         * arm.cc (Target_arm::arm_info): Update initializer.
1784         * i386.cc (Target_i386::i386_info): Likewise.
1785         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1786         * sparc.cc (Target_sparc::sparc_info): Likewise.
1787         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1788         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1789         * layout.cc (Layout::attach_allocated_section_to_segment):
1790         Take new const Target* argument.  If target->isolate_execinstr(), act
1791         like --rosegment.
1792         (Layout::find_first_load_seg): Take new const Target* argument;
1793         if target->isolate_execinstr(), reject PF_X segments.
1794         (Layout::relaxation_loop_body): Update caller.
1795         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1796         reset file offset to zero when we hit LOAD_SEG, and then do a second
1797         loop over the segments before LOAD_SEG to reassign offsets after
1798         addresses have been determined.  Handle target->rosegment_gap().
1799         (Layout::attach_section_to_segment): Take new const Target* argument;
1800         pass it to attach_allocated_section_to_segment.
1801         (Layout::make_output_section): Update caller.
1802         (Layout::attach_sections_to_segments): Take new const Target* argument;
1803         pass it to attach_section_to_segment.
1804         * gold.cc (queue_middle_tasks): Update caller.
1805         * layout.h (Layout): Update method decls with new arguments.
1806
1807         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1808         Target_info pointer to use.
1809         (Target_arm::do_make_data_plt): New virtual method.
1810         (Target_arm::make_data_plt): New method that calls it.
1811         (Target_arm::make_plt_entry): Use it.
1812         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1813         for the section alignment.
1814         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1815         method.
1816         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1817         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1818         method.
1819         (Output_data_plt_arm::get_plt_entry_size): Call it.
1820         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1821         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1822         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1823         method.
1824         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1825         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1826         method instead of sizeof(plt_entry).
1827         (Output_data_plt_arm::add_entry): Likewise.
1828         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1829         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1830         than static method.
1831         (Target_arm::plt_entry_size): Likewise.
1832         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1833         Move to ...
1834         (Output_data_plt_arm_standard): ... here, new class.
1835         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1836         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1837         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1838
1839         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1840         Take additional argument for the PLT entry size.
1841         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1842         Use get_plt_entry_size method rather than plt_entry_size variable.
1843         (Output_data_plt_x86_64::reserve_slot): Likewise.
1844         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1845         (Output_data_plt_x86_64::add_entry): Likewise.
1846         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1847         (Output_data_plt_x86_64::address_for_global): Likewise.
1848         (Output_data_plt_x86_64::address_for_local): Likewise.
1849         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1850         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1851         Make method non-static.
1852         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1853         method.
1854         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1855         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1856         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1857         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1858         virtual method.
1859         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1860         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1861         virtual method.
1862         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1863         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1864         virtual method.
1865         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1866         (Output_data_plt_x86_64::plt_entry_size)
1867         (Output_data_plt_x86_64::first_plt_entry)
1868         (Output_data_plt_x86_64::plt_entry)
1869         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1870         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1871         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1872         (Output_data_plt_x86_64_standard): ... here, new class.
1873         (Target_x86_64::Target_x86_64): Take optional argument for the
1874         Target_info pointer to use.
1875         (Target_x86_64::do_make_data_plt): New virtual method.
1876         (Target_x86_64::make_data_plt): New method to call it.
1877         (Target_x86_64::init_got_plt_for_update): Use that.
1878         Call this->plt_->add_eh_frame method here.
1879         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1880         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1881         rather than static method.
1882         (Target_x86_64::plt_entry_size): Likewise.
1883         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1884         rather than plt_entry_size variable.  Move guts of PLT filling to...
1885         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1886         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1887         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1888
1889         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1890         additional argument for the section alignment.
1891         Don't do add_eh_frame_for_plt here.
1892         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1893         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1894         variable.
1895         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1896         method.
1897         (Output_data_plt_i386::get_plt_entry_size): Call it.
1898         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1899         (Output_data_plt_i386::add_eh_frame): New method to call it.
1900         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1901         method.
1902         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1903         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1904         method.
1905         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1906         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1907         method instead of plt_entry_size.
1908         (Output_data_plt_i386::plt_entry_size)
1909         (Output_data_plt_i386::plt_eh_frame_fde_size)
1910         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1911         (Output_data_plt_i386_standard): ... here, new class.
1912         (Output_data_plt_i386_exec): New class.
1913         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1914         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1915         (Output_data_plt_i386::exec_plt_entry): Move to ...
1916         (Output_data_plt_i386_exec::plt_entry): ... here.
1917         (Output_data_plt_i386_dyn): New class.
1918         (Output_data_plt_i386::first_plt_entry): Move to ...
1919         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1920         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1921         (Output_data_plt_i386_dyn::plt_entry): ... here.
1922         (Target_i386::Target_i386): Take optional argument for the Target_info
1923         pointer to use.
1924         (Target_i386::do_make_data_plt): New virtual method.
1925         (Target_i386::make_data_plt): New method to call it.
1926         (Target_i386::make_plt_section): Use that.
1927         Call this->plt_->add_eh_frame method here.
1928         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1929         rather than plt_entry_size variable.
1930         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1931         (Output_data_plt_i386::address_for_local): Likewise.
1932         (Output_data_plt_i386::do_write): Likewise.
1933         Move guts of PLT filling to...
1934         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1935         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1936         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1937         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1938
1939 2012-05-01  Cary Coutant  <ccoutant@google.com>
1940
1941         * dwarf_reader.cc (Dwarf_die::read_attributes)
1942         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1943         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1944         * reduced_debug_output.cc
1945         (Output_reduced_debug_info_section::get_die_end): Remove
1946         DW_FORM_GNU_ref_index.  Add default case.
1947
1948 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1949
1950         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1951         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1952         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1953         DW_AT_high_pc as offset from DW_AT_low_pc.
1954
1955         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1956         * testsuite/Makefile.in: Regenerate.
1957         * testsuite/gdb_index_test_3.c: New test source file.
1958         * testsuite/gdb_index_test_3.sh: New test source file.
1959
1960 2012-04-25  Ian Lance Taylor  <iant@google.com>
1961
1962         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1963         pointer.
1964         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1965         as a class, not a struct.
1966         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1967         (Target_arm::apply_cortex_a8_workaround): Likewise.
1968         * gc.h: Declare Reloc_types as a struct, not a class.
1969         * object.h: Declare Symbols_data as a struct.
1970         * reloc.h: Declare Read_relocs_data as a struct.
1971         * target.h: Declare Relocate_info as a struct.
1972
1973 2012-04-24  David S. Miller  <davem@davemloft.net>
1974
1975         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1976         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1977         and R_SPARC_WPLT30.
1978
1979 2012-04-24  Cary Coutant  <ccoutant@google.com>
1980
1981         * incremental-dump.cc (find_input_containing_global): Replace
1982         magic number with symbolic constant.
1983         (dump_incremental_inputs): Update version number.
1984         * incremental.cc (Output_section_incremental_inputs): Update version
1985         number; import symbolic constants from Incremental_inputs_reader.
1986         (Incremental_inputs::create_data_sections): Align relocations
1987         section correctly for 64-bit targets.
1988         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1989         constants; add padding.
1990         (Output_section_incremental_inputs::write_header): Add assert for
1991         header_size.
1992         (Output_section_incremental_inputs::write_input_files): Add assert
1993         for input_entry_size.
1994         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1995         add assert for object_info_size, input_section_entry_size,
1996         global_sym_entry_size.
1997         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1998         for data structure sizes; use them.
1999         (Incremental_input_entry_reader): Import symbolic constants from
2000         Incremental_inputs_reader; use them.
2001
2002 2012-04-23  David S. Miller  <davem@davemloft.net>
2003
2004         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2005         and elf_flags_set_.
2006         (Target_sparc::Target_sparc): Initialize new fields.
2007         (Target_sparc::do_make_elf_object): New function.
2008         (Target_sparc::do_adjust_elf_header): New function.
2009
2010 2012-04-23  Cary Coutant  <ccoutant@google.com>
2011
2012         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2013         CU range table of gdb index.
2014
2015 2012-04-20  David S. Miller  <davem@davemloft.net>
2016
2017         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2018         instead of false.
2019
2020 2012-04-16  David S. Miller  <davem@davemloft.net>
2021
2022         * sparc.cc (Target_sparc::got_address): New function.
2023         (Sparc_relocate_functions::gdop_hix22): New function.
2024         (Sparc_relocate_functions::gdop_lox10): New function.
2025         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2026         relocs.
2027         (Target_sparc::Scan::local): Likewise if the global symbol is not
2028         preemptible and is not IFUNC.
2029         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2030         transformations for local and non-preemptible non-IFUNC global
2031         symbols.
2032
2033         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2034         writing out 64-bit part of ranges.
2035
2036         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2037         -fpic and -fpie respectively.
2038         * Makefile.in: Regenerate.
2039
2040         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2041         (Target_sparc::Target_sparc): Initialize new field.
2042         (Target_sparc::do_plt_section_for_global): New function.
2043         (Target_sparc::do_plt_section_for_local): New function.
2044         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2045         (Target_sparc::make_plt_section): New function, broken out of
2046         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2047         (Target_sparc::make_plt_entry): Call make_plt_section.
2048         (Target_sparc::make_local_ifunc_plt_entry): New function.
2049         (Target_sparc::rela_ifunc_section): New function.
2050         (Target_sparc::plt_section): Remove const.
2051         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2052         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2053         and ifunc_count_ fields.
2054         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2055         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2056         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2057         (Output_data_plt_sparc::rela_ifunc): New function.
2058         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2059         (Output_data_plt_sparc::has_ifunc_section): New function.
2060         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2061         (Output_data_plt_sparc::address_for_global): New function.
2062         (Output_data_plt_sparc::address_for_local): New function.
2063         (Output_data_plt_sparc::plt_index_to_offset): New function.
2064         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2065         and entry_count.
2066         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2067         entry_count.
2068         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2069         R_SPARC_JMP_IREL to switch.
2070         (Target_sparc::Scan::check_non_pic): Likewise.
2071         (Target_sparc::Scan::local): Handle IFUNC symbols.
2072         (Target_sparc::Scan::local): Likewise.
2073         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2074         and plt_address_for_local.
2075         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2076         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2077
2078         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2079         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2080         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2081         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2082         global relocs too.
2083         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2084         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2085         calls.
2086         * sparc.cc (Target_sparc::Scan::global): Likewise.
2087         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2088
2089 2012-04-16  Cary Coutant  <ccoutant@google.com>
2090
2091         * archive.cc (Library_base::should_include_member): Check for
2092         --export-dynamic-symbol.
2093         * options.h (class General_options): Add --export-dynamic-symbol.
2094         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2095         --export-dynamic-symbol.
2096         (Symbol_table::gc_mark_undef_symbols): Likewise.
2097         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2098
2099 2012-04-12  David S. Miller  <davem@davemloft.net>
2100
2101         * sparc.cc (Reloc::wdisp10): New relocation method.
2102         (Reloc::h34): Likewise.
2103         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2104         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2105         R_SPARC_WDISP10.
2106         (Target_sparc::Scan::local): Likewise.
2107         (Target_sparc::Scan::global): Likewise.
2108         (Target_sparc::Relocate::relocate): Likewise.
2109
2110 2012-04-09  Cary Coutant  <ccoutant@google.com>
2111
2112         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2113         low_pc == 0.
2114
2115 2012-04-06  Ian Lance Taylor  <iant@google.com>
2116
2117         * timer.cc: #include <unistd.h>.
2118
2119 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2120
2121         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2122         * config.in: Regenerate.
2123         * configure: Regenerate.
2124
2125 2012-04-05  Nick Clifton  <nickc@redhat.com>
2126
2127         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2128         (AM_LC_MESSAGES): Add.
2129         * aclocal.m4: Regenerate.
2130         * config.in: Regenerate.
2131         * configure: Regenerate.
2132
2133 2012-03-21  Cary Coutant  <ccoutant@google.com>
2134
2135         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2136         * Makefile.in: Regenerate.
2137         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2138         (Sized_elf_reloc_mapper::symbol_section): New function.
2139         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2140         (make_elf_reloc_mapper): New function.
2141         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2142         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2143         (Dwarf_abbrev_table::do_get_abbrev): New function.
2144         (Dwarf_ranges_table::read_ranges_table): New function.
2145         (Dwarf_ranges_table::read_range_list): New function.
2146         (Dwarf_pubnames_table::read_section): New function.
2147         (Dwarf_pubnames_table::read_header): New function.
2148         (Dwarf_pubnames_table::next_name): New function.
2149         (Dwarf_die::Dwarf_die): New function.
2150         (Dwarf_die::read_attributes): New function.
2151         (Dwarf_die::skip_attributes): New function.
2152         (Dwarf_die::set_name): New function.
2153         (Dwarf_die::set_linkage_name): New function.
2154         (Dwarf_die::attribute): New function.
2155         (Dwarf_die::string_attribute): New function.
2156         (Dwarf_die::int_attribute): New function.
2157         (Dwarf_die::uint_attribute): New function.
2158         (Dwarf_die::ref_attribute): New function.
2159         (Dwarf_die::child_offset): New function.
2160         (Dwarf_die::sibling_offset): New function.
2161         (Dwarf_info_reader::check_buffer): New function.
2162         (Dwarf_info_reader::parse): New function.
2163         (Dwarf_info_reader::do_parse): New function.
2164         (Dwarf_info_reader::do_read_string_table): New function.
2165         (Dwarf_info_reader::lookup_reloc): New function.
2166         (Dwarf_info_reader::get_string): New function.
2167         (Dwarf_info_reader::visit_compilation_unit): New function.
2168         (Dwarf_info_reader::visit_type_unit): New function.
2169         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2170         Sized_elf_reloc_mapper.
2171         (Sized_dwarf_line_info::symbol_section): Remove function.
2172         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2173         (Sized_dwarf_line_info::read_line_mappings): Remove object
2174         parameter, adjust callers.
2175         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2176         * dwarf_reader.h: Include <sys/types.h>.
2177         (class Track_relocs): Remove forward declaration.
2178         (class Elf_reloc_mapper): New class.
2179         (class Sized_elf_reloc_mapper): New class.
2180         (class Dwarf_abbrev_table): New class.
2181         (class Dwarf_range_list): New class.
2182         (class Dwarf_ranges_table): New class.
2183         (class Dwarf_pubnames_table): New class.
2184         (class Dwarf_die): New class.
2185         (class Dwarf_info_reader): New class.
2186         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2187         (Sized_dwarf_line_info::symbol_section): Remove member function.
2188         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2189         base class.
2190         * gdb-index.cc: New source file.
2191         * gdb-index.h: New source file.
2192         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2193         and .debug_types sections, call Layout::add_to_gdb_index.
2194         (Sized_relobj_incr::do_section_name): Implement.
2195         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2196         return type; Implement.
2197         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2198         return type.
2199         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2200         parameter list and return type.
2201         (Sized_incr_dynobj::do_section_contents): Likewise.
2202         * layout.cc: Include gdb-index.h.
2203         (Layout::Layout): Initialize gdb_index_data_.
2204         (Layout::init_fixed_output_section): Check for .gdb_index section.
2205         (Layout::add_to_gdb_index): New function. Instantiate.
2206         * layout.h: Add forward declaration for class Gdb_index.
2207         (Layout::add_to_gdb_index): New member function.
2208         (Layout::gdb_index_data_): New data member.
2209         * main.cc: Include gdb-index.h.
2210         (main): Print statistics for gdb index.
2211         * object.cc (Object::section_contents): Move code into
2212         do_section_contents.
2213         (need_decompressed_section): Check for sections needed when building
2214         gdb index.
2215         (build_compressed_section_map): Likewise.
2216         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2217         gdb index.
2218         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2219         sections; call Layout::add_to_gdb_index.
2220         (Sized_relobj_file::do_decompressed_section_contents): Call
2221         do_section_contents directly.
2222         * object.h (Object::do_section_contents): Adjust parameter list and
2223         return type.
2224         (Object::do_decompressed_section_contents): Call do_section_contents
2225         directly.
2226         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2227         return type.
2228         * options.h (class General_options): Add --gdb-index option.
2229         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2230         list and return type.
2231         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2232         * reloc.h (Track_relocs::checkpoint): New function.
2233         (Track_relocs::reset): New function.
2234
2235         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2236         New test cases.
2237         * testsuite/Makefile.in: Regenerate.
2238         * testsuite/gdb_index_test.cc: New test source file.
2239         * testsuite/gdb_index_test_1.sh: New test source file.
2240         * testsuite/gdb_index_test_2.sh: New test source file.
2241
2242 2012-03-19  Doug Kwan  <dougkwan@google.com>
2243
2244         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2245         (Target_arm::do_finalize_sections): Remove code which defines
2246         __exidx_start and __exidx_end.  Make symbol table parameter
2247         anonymous as it is not used.
2248         * gold.cc (queue_middle_tasks): Call target hook to define any
2249         target-specific symbols.
2250         * target.h (Target::define_standard_symbols): New method.
2251         (Target::do_define_standard_symbols): Same.
2252         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2253         * testsuite/Makefile.in: Regenerate.
2254         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2255         and __exidx_end.
2256         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2257         relocations are generated for __exidx_start and __exidx_end.
2258
2259 2012-03-16  Doug Kwan  <dougkwan@google.com>
2260
2261         * testsuite/Makefile.am: Disable test initpri3b.
2262         * testsuite/Makefile.in: Regenerate.
2263
2264 2012-03-15  Doug Kwan  <dougkwan@google.com>
2265
2266         * arm.cc (Target_arm::got_section): Make .got section read-only
2267         if -z now is given.
2268
2269 2012-03-15  Ian Lance Taylor  <iant@google.com>
2270
2271         PR gold/13850
2272         * layout.cc (Layout::make_output_section): Correctly mark
2273         SHT_INIT_ARRAY, et. al., as relro.
2274
2275 2012-03-14  Doug Kwan  <dougkwan@google.com>
2276
2277         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2278         dynamic relocations for protected symbols in shared objects.
2279
2280 2012-03-13  Ian Lance Taylor  <iant@google.com>
2281
2282         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2283         keep the larger alignment.
2284
2285 2012-03-12  Cary Coutant  <ccoutant@google.com>
2286
2287         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2288         handling of DW_LNE_define_file.
2289
2290 2012-03-12  Cary Coutant  <ccoutant@google.com>
2291
2292         * reduced_debug_output.cc
2293         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2294         codes to switch.
2295
2296 2012-02-29  Cary Coutant  <ccoutant@google.com>
2297
2298         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2299
2300 2012-02-29  Cary Coutant  <ccoutant@google.com>
2301
2302         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2303         Call Object::decompressed_section_contents.
2304         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2305         New dtor.
2306         (Sized_dwarf_line_info::buffer_start_): New data member.
2307         * merge.cc (Output_merge_data::do_add_input_section): Call
2308         Object::decompressed_section_contents.
2309         (Output_merge_string::do_add_input_section): Likewise.
2310         * object.cc (need_decompressed_section): New function.
2311         (build_compressed_section_map): Decompress sections needed later.
2312         (Sized_relobj_file::do_decompressed_section_contents): New function.
2313         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2314         * object.h (Object::decompressed_section_contents): New function.
2315         (Object::discard_decompressed_sections): New function.
2316         (Object::do_decompressed_section_contents): New function.
2317         (Object::do_discard_decompressed_sections): New function.
2318         (Compressed_section_info): New type.
2319         (Compressed_section_map): Include decompressed section contents.
2320         (Sized_relobj_file::do_decompressed_section_contents): New function.
2321         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2322
2323 2012-02-16  Cary Coutant  <ccoutant@google.com>
2324
2325         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2326         * testsuite/Makefile.in: Regenerate.
2327
2328 2012-02-14  Cary Coutant  <ccoutant@google.com>
2329
2330         * options.cc (General_options::finalize): Disallow -pie and -static.
2331
2332 2012-02-03  Doug Kwan  <dougkwan@google.com>
2333
2334         * arm.cc (Arm_relocate_functions::abs8,
2335         Arm_relocate_functions::abs16): Use
2336         Bits::has_signed_unsigned_overflow32.
2337         (Arm_relocate_functions::thm_abs8): Correct range of
2338         overflow check.
2339         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2340         in assertions.
2341
2342 2012-02-02  Doug Kwan  <dougkwan@google.com>
2343
2344         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2345         position independent outputs, not just shared objects.
2346
2347 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2348
2349         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2350         * configure: Regenerated.
2351
2352 2012-01-27  Ian Lance Taylor  <iant@google.com>
2353
2354         * reloc.h (Bits): New class with static functions, copied from
2355         namespace utils in arm.cc.
2356         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2357         instead.
2358
2359 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2360
2361         * incremental.cc (write_info_blocks): Correct relocation offset.
2362
2363 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2364
2365         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2366         (Relocate::tls_gd_to_le): Likewise.
2367
2368 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2369
2370         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2371
2372 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2373
2374         * configure.ac: Check if -mcmodel=medium works.
2375         * configure: Regenerated.
2376
2377 2012-01-24  Cary Coutant  <ccoutant@google.com>
2378
2379         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2380         definition and ...
2381         (read_unsigned_LEB_128_x): ... this new function.
2382         (read_signed_LEB_128): Replaced with inline definition and ...
2383         (read_signed_LEB_128_x): ... this new function.
2384         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2385         (read_unsigned_LEB_128): Add inline definition.
2386         (read_signed_LEB_128_x): New function.
2387         (read_signed_LEB_128): Add inline definition.
2388         * testsuite/Makefile.am (leb128_unittest): New unit test.
2389         * testsuite/Makefile.in: Regenerate.
2390         * testsuite/leb128_unittest.cc: New unit test.
2391
2392 2012-01-23  Ian Lance Taylor  <iant@google.com>
2393
2394         PR gold/13617
2395         * i386.cc (Target_i386::do_code_fill): When using a jmp
2396         instruction, pad with nop instructions.
2397         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2398
2399 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2400
2401         * x86_64.cc (gc_process_relocs): Add typename on types used in
2402         template.
2403         (scan_relocs): Likewise.
2404         (relocate_section): Likewise.
2405         (apply_relocation): Likewise.
2406
2407 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2408
2409         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2410         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2411         under x32.
2412
2413 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2414
2415         * x86_64.cc: Initial support for x32.
2416
2417 2012-01-03  Cary Coutant  <ccoutant@google.com>
2418
2419         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2420         Use abstract base class for GOT.
2421         * gold/output.h (class Output_data_got_base): New abstract base class.
2422         (class Output_data_got): Derive from new base class, adjust ctors.
2423         (Output_data_got::reserve_slot): Make virtual; rename to
2424         do_reserve_slot; Adjust callers.
2425         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2426         pointer to abstract base class.
2427         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2428
2429 2011-12-18  Ian Lance Taylor  <iant@google.com>
2430
2431         * object.h (Relobj::local_symbol_value): New function.
2432         (Relobj::local_plt_offset): New function.
2433         (Relobj::local_has_got_offset): New function.
2434         (Relobj::local_got_offset): New function.
2435         (Relobj::set_local_got_offset): New function.
2436         (Relobj::do_local_symbol_value): New pure virtual function.
2437         (Relobj::do_local_plt_offset): Likewise.
2438         (Relobj::do_local_has_got_offset): Likewise.
2439         (Relobj::do_local_got_offset): Likewise.
2440         (Relobj::do_set_local_got_offset): Likewise.
2441         (Sized_relobj::do_local_has_got_offset): Rename from
2442         local_has_got_offset.
2443         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2444         (Sized_relobj::do_set_local_got_offset): Rename from
2445         set_local_got_offset.
2446         (Sized_relobj_file::do_local_plt_offset): Rename from
2447         local_plt_offset.
2448         (Sized_relobj_file::do_local_symbol_value): New function.
2449         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2450         local_plt_offset.
2451         * output.cc (Output_data_got::Got_entry::write): Change object to
2452         Relobj.  Use local_symbol_value.
2453         (Output_data_got::add_global_with_rel): Change rel_dyn to
2454         Output_data_reloc_generic*.  Use add_global_generic.
2455         (Output_data_got::add_global_with_rela): Remove.  Change all
2456         callers to use add_global_with_rel.
2457         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2458         Output_data_reloc_generic*.  Use add_global_generic.
2459         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2460         callers to use add_global_pair_with_rel.
2461         (Output_data_got::add_local): Change object to Relobj*.
2462         (Output_data_got::add_local_plt): Likewise.
2463         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2464         change rel_dyn to Output_data_reloc_generic*.  Use
2465         add_local_generic.
2466         (Output_data_got::add_local_with_rela): Remove.  Change all
2467         callers to use all_local_with_rel.
2468         (Output_data_got::add_local_pair_with_rel): Change object to
2469         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2470         add_output_section_generic.
2471         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2472         callers to use add_local_pair_with_rel.
2473         (Output_data_got::reserve_local): Change object to Relobj*.
2474         * output.h: (class Output_data_reloc_generic): Add pure virtual
2475         declarations for add_global_generic, add_local_generic,
2476         add_output_section_generic.
2477         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2478         functions for Output_data_reloc_generic.  Update declarations for
2479         changes listed in output.cc.
2480         (class Output_data_got): Change template parameter to got_size.
2481         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2482         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2483         function.
2484         (Sized_relobj_incr::do_local_plt_offset): New function.
2485         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2486         add_global_generic.
2487
2488 2011-12-17  Cary Coutant  <ccoutant@google.com>
2489
2490         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2491         * resolve.cc (Symbol_table::resolve): Likewise.
2492         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2493         arrays.
2494         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2495
2496 2011-12-16  Ian Lance Taylor  <iant@google.com>
2497
2498         * output.h (Output_data_reloc_generic::add): Only call
2499         add_dynamic_reloc if this is a dynamic reloc section.
2500
2501 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2502
2503         PR gold/13505
2504         * target-reloc.h (apply_relocation): Replace <64, false> with
2505         <size, big_endian>.
2506
2507 2011-11-25  Nick Clifton  <nickc@redhat.com>
2508
2509         * po/it.po: New Italian translation.
2510
2511 2011-11-17  Sterling Augustine  <saugustine@google.com>
2512
2513         * script.cc (script_include_directive): Implement.
2514         (read_script_file): New local variables name and search_path. Update
2515         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2516         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2517         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2518
2519 2011-11-11  Sterling Augustine  <saugustine@google.com>
2520
2521         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2522         (file_or_sections_cmd): Likewise.
2523
2524 2011-11-11  Doug Kwan  <dougkwan@google.com>
2525
2526         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2527         if --just-symbols is given.
2528
2529 2011-11-10  Doug Kwan  <dougkwan@google.com>
2530
2531         PR gold/13362
2532         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2533         when processing data relocs.
2534         * reloc.h (Relocate_functions::rel_unaligned): New method.
2535         (Relocate_functions::pcrel_unaligned): Ditto.
2536         (Relocate_functions::rel32_unaligned): Ditto.
2537         (Relocate_functions::pcrel32_unaligned): Ditto.
2538
2539 2011-11-09  Doug Kwan  <dougkwan@google.com>
2540
2541         PR gold/13362
2542         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2543         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2544         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2545         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2546         (Relocate_functions::rel_unaligned): New.
2547         (Relocate_functions::rel32_unaligned): New.
2548         * target-reloc.h (relocate_for_relocatable): Add code to handle
2549         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2550         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2551         arm_unaligned_reloc_r): New targets.
2552         * testsuite/Makefile.in: Regenerate.
2553         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2554         linking.
2555
2556 2011-11-02  Ian Lance Taylor  <iant@google.com>
2557
2558         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2559         NATIVE_LINKER.
2560         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2561         * options.cc (General_options::finalize): Use library search path
2562         from configure script if specified.  If not native and no sysroot,
2563         only search TOOLLIBDIR.
2564         * options.h (Search_directory::Search_directory): Change name to
2565         const std::string&.
2566         (General_options::add_to_library_path_with_sysroot): Change arg to
2567         const std::string&.
2568         * configure, Makefile.in, config.in: Rebuild.
2569
2570 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2571
2572         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2573         we are working around the ARM1176 Erratum.
2574         * options.h (General_options::fix_arm1176): Add option.
2575         * testsuite/Makefile.am: Add testcases, and keep current ones
2576         working.
2577         * testsuite/Makefile.in: Regenerate.
2578         * testsuite/arm_fix_1176.s: New file.
2579         * testsuite/arm_fix_1176.sh: Likewise.
2580
2581 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2582
2583         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2584         may_use_blx_.
2585         (Target_arm::may_use_blx): Remove method.
2586         (Target_arm::set_may_use_blx): Likewise.
2587         (Target_arm::may_use_v4t_interworking): New method.
2588         (Target_arm::may_use_v5t_interworking): Likewise.
2589         (Target_arm::may_use_blx_): Remove member variable.
2590         (Arm_relocate_functions::arm_branch_common): Check for v5T
2591         interworking.
2592         (Arm_relocate_functions::thumb_branch_common): Likewise.
2593         (Reloc_stub::stub_type_for_reloc): Likewise.
2594         (Target_arm::do_finalize_sections): Correct interworking checks.
2595         * testsuite/Makefile.am: Add new tests.
2596         * testsuite/Makefile.in: Regenerate.
2597         * testsuite/arm_farcall_arm_arm.s: New test.
2598         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2599         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2600         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2601         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2602         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2603         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2604         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2605
2606 2011-10-31  Cary Coutant  <ccoutant@google.com>
2607
2608         PR gold/13023
2609         * expression.cc (Expression::eval_with_dot): Add
2610         is_section_dot_assignment parameter.
2611         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2612         absolute and assigning to dot within a section.
2613         * script-sections.cc
2614         (Output_section_element_assignment::set_section_addresses): Pass
2615         dot_section to set_if_absolute.
2616         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2617         as is_section_dot_assignment flag to eval_with_dot.
2618         (Output_section_element_dot_assignment::set_section_addresses):
2619         Likewise.
2620         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2621         parameter.  Also set value if relative to dot_section; set the
2622         symbol's output_section.
2623         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2624         parameter.  Adjust all callers.
2625         (Expression::eval_maybe_dot): Likewise.
2626         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2627         Adjust all callers.
2628         * testsuite/script_test_2.t: Test assignment of an absolute value
2629         to dot within an output section element.
2630
2631 2011-10-31  Cary Coutant  <ccoutant@google.com>
2632
2633         * options.h (class General_options): Add --[no-]gnu-unique options.
2634         * symtab.cc (Symbol_table::sized_write_globals): Convert
2635         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2636
2637 2011-10-31  Cary Coutant  <ccoutant@google.com>
2638
2639         PR gold/13359
2640         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2641         unnecessary assertion.
2642         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2643
2644 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2645
2646         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2647         gc_mark_symbol.
2648         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2649         gc_mark_symbol.
2650         Change to just keep the section associated with symbol.
2651         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2652         they are externally visible and --export-dynamic is turned on.
2653         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2654
2655 2011-10-19  Ian Lance Taylor  <iant@google.com>
2656
2657         PR gold/13163
2658         * script-sections.cc
2659         (Output_section_element_dot_assignment::needs_output_section): New
2660         function.
2661
2662 2011-10-19  Ian Lance Taylor  <iant@google.com>
2663
2664         PR gold/13204
2665         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2666         --section-start option was seen.
2667         * options.h (General_options::any_section_start): New function.
2668
2669 2011-10-18  David S. Miller  <davem@davemloft.net>
2670
2671         PR binutils/13301
2672         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2673         member to track relocation locations that have moved during TLS
2674         reloc optimizations.
2675         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2676         (Target_sparc::Relocate::relocate): Adjust view down by 4
2677         bytes if it matches reloc_adjust_addr_.
2678         (Target_sparc::Relocate::relocate_tls): Always move the
2679         __tls_get_addr call delay slot instruction forward 4 bytes when
2680         performing relaxation.
2681
2682 2011-10-18  Cary Coutant  <ccoutant@google.com>
2683
2684         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2685         (Output_file::map_no_anonymous): Check for non-zero
2686         return code from posix_fallocate.
2687
2688 2011-10-17  Cary Coutant  <ccoutant@google.com>
2689
2690         PR gold/13245
2691         * plugin.cc (is_visible_from_outside): Check for symbols
2692         referenced from dynamic objects.
2693         * resolve.cc (Symbol_table::resolve): Don't count references
2694         from dynamic objects as references from real ELF files.
2695         * testsuite/plugin_test_2.sh: Adjust expected result.
2696
2697 2011-10-17  Cary Coutant  <ccoutant@google.com>
2698
2699         * gold.cc: Include timer.h.
2700         (queue_middle_tasks): Stamp time.
2701         (queue_final_tasks): Likewise.
2702         * main.cc (main): Store timer in parameters.  Print timers
2703         for each pass.
2704         * parameters.cc (Parameters::Parameters): Initialize timer_.
2705         (Parameters::set_timer): New function.
2706         (set_parameters_timer): New function.
2707         * parameters.h (Parameters::set_timer): New function.
2708         (Parameters::timer): New function.
2709         (Parameters::timer_): New data member.
2710         (set_parameters_timer): New function.
2711         * timer.cc (Timer::stamp): New function.
2712         (Timer::get_pass_time): New function.
2713         * timer.h (Timer::stamp): New function.
2714         (Timer::get_pass_time): New function.
2715         (Timer::pass_times_): New data member.
2716
2717 2011-10-17  Cary Coutant  <ccoutant@google.com>
2718
2719         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2720         task for members of lib groups.
2721
2722 2011-10-17  Cary Coutant  <ccoutant@google.com>
2723
2724         PR gold/13288
2725         * fileread.cc (File_read::find_view): Add assert.
2726         (File_read::make_view): Move bounds check (replace with assert)...
2727         (File_read::find_or_make_view): ... to here.
2728
2729 2011-10-12  Cary Coutant  <ccoutant@google.com>
2730
2731         * output.cc (Output_file::open_base_file): Handle case where
2732         ::read returns less than requested size.
2733
2734 2011-10-10  Cary Coutant  <ccoutant@google.com>
2735
2736         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2737         Initialize defined_count_.
2738         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2739         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2740         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2741         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2742         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2743         * incremental.h (Sized_relobj_incr::defined_count_): New data
2744         member.
2745         (Sized_incr_dynobj::defined_count_): New data member.
2746         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2747         Return zeroes instead of internal error.
2748
2749 2011-10-10  Cary Coutant  <ccoutant@google.com>
2750
2751         PR gold/13249
2752         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2753         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2754         * output.h (class Output_reloc): Add use_plt_offset flag.
2755         (Output_reloc::type_): Adjust size of bit field.
2756         (Output_reloc::use_plt_offset_): New bit field.
2757         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2758         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2759         flag.  Adjust all callers.
2760         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2761         creating RELATIVE relocations.
2762
2763 2011-10-10  Nick Clifton  <nickc@redhat.com>
2764
2765         * po/es.po: Updated Spanish translation.
2766         * po/fi.po: Updated Finnish translation.
2767
2768 2011-10-03   Diego Novillo  <dnovillo@google.com>
2769
2770         * options.cc (parse_uint): Fix dereference of RETVAL.
2771
2772 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2773
2774         * layout.h (section_order_map_): New member.
2775         (get_section_order_map): New member function.
2776         * output.cc (Output_section::add_input_section): Check for patterns
2777         only when --section-ordering-file is specified.
2778         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2779         output_sections have been formed.
2780         * layout.cc (Layout_Layout): Initialize section_order_map_.
2781         * plugin.cc (update_section_order): Store order in order_map. Do not
2782         update the order.
2783         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2784         * testsuite/Makefile.in: Regenerate.
2785         * testsuite/plugin_section_order.c: New file.
2786         * testsuite/plugin_final_layout.cc: New file.
2787         * testsuite/plugin_final_layout.sh: New file.
2788
2789 2011-09-29  Cary Coutant  <ccoutant@google.com>
2790
2791         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2792         Check for NULL.
2793         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2794         symbols during incremental update.
2795         (Symbol_table::add_from_dynobj): Likewise.
2796
2797 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2798             Ian Lance Taylor  <iant@google.com>
2799
2800         * symtab.cc (Symbol_table::define_special_symbol): Always
2801         canonicalize version string.
2802
2803 2011-09-26  Cary Coutant  <ccoutant@google.com>
2804
2805         * gold.cc (queue_initial_tasks): Move option checks ...
2806         * options.cc (General_options::finalize): ... to here. Disable
2807         some options; make others fatal.
2808
2809 2011-09-26  Cary Coutant  <ccoutant@google.com>
2810
2811         gcc PR lto/47247
2812         * plugin.cc (get_symbols_v2): New function.
2813         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2814         (is_referenced_from_outside): New function.
2815         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2816         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2817         (get_symbols): Pass version parameter.
2818         (get_symbols_v2): New function.
2819         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2820         parameter.
2821         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2822         (onload): Add LDPT_GET_SYMBOLS_V2.
2823         (all_symbols_read_hook): Use get_symbols_v2; check for
2824         LDPR_PREVAILING_DEF_IRONLY_EXP.
2825         * testsuite/plugin_test_3.sh: Update expected results.
2826
2827 2011-09-23  Simon Baldwin  <simonb@google.com>
2828
2829         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2830         configuration options.
2831         * configure: Regenerate.
2832         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2833         * Makefile.in: Regenerate.
2834         * testsuite/Makefile.in: Regenerate.
2835
2836 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2837
2838         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2839
2840 2011-09-19  Cary Coutant  <ccoutant@google.com>
2841
2842         * incremental.cc (can_incremental_update): Fix typo in comment.
2843         * incremental.h (can_incremental_update): Likewise.
2844
2845 2011-09-18  Cary Coutant  <ccoutant@google.com>
2846
2847         * incremental.cc (can_incremental_update): New function.
2848         * incremental.h (can_incremental_update): New function.
2849         * layout.cc (Layout::init_fixed_output_section): Call it.
2850         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2851         * object.cc (Sized_relobj_file::do_layout): Call
2852         can_incremental_update.
2853
2854 2011-09-13  Cary Coutant  <ccoutant@google.com>
2855
2856         * configure.ac: Check for glibc support for gnu_indirect_function
2857         support with static linking, setting automake conditional
2858         IFUNC_STATIC.
2859         * Makefile.in: Regenerate.
2860         * configure: Regenerate.
2861
2862         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2863         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2864         for IFUNC_STATIC.
2865         * testsuite/Makefile.in: Regenerate.
2866
2867 2011-09-13  Cary Coutant  <ccoutant@google.com>
2868
2869         * incremental.cc (Sized_relobj_incr::do_layout): Call
2870         report_comdat_group for kept comdat sections.
2871         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2872         * testsuite/Makefile.in: Regenerate.
2873         * testsuite/incr_comdat_test_1.cc: New source file.
2874         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2875         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2876         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2877
2878 2011-09-13  Ian Lance Taylor  <iant@google.com>
2879
2880         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2881         variable external_symbols_offset.
2882
2883 2011-09-12  Ian Lance Taylor  <iant@google.com>
2884
2885         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2886         triggered if object has no symbols.
2887
2888 2011-09-09  David S. Miller  <davem@davemloft.net>
2889
2890         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2891         (Output_fill_debug_line::do_write): Likewise.
2892
2893 2011-08-29  Cary Coutant  <ccoutant@google.com>
2894
2895         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2896         casts to match formatting specs.
2897         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2898
2899 2011-08-26  Cary Coutant  <ccoutant@google.com>
2900
2901         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2902         remaining hole size when allocating.
2903         (Layout::make_output_section): Set fill methods for debug sections.
2904         * layout.h (Free_list::Free_list_node): Move from private to
2905         public.
2906         (Free_list::set_min_hole_size): New function.
2907         (Free_list::begin, Free_list::end): New functions.
2908         (Free_list::min_hole_): New data member.
2909         * output.cc: Include dwarf.h.
2910         (Output_fill_debug_info::do_minimum_hole_size): New function.
2911         (Output_fill_debug_info::do_write): New function.
2912         (Output_fill_debug_line::do_minimum_hole_size): New function.
2913         (Output_fill_debug_line::do_write): New function.
2914         (Output_section::Output_section): Initialize new data member.
2915         (Output_section::set_final_data_size): Ensure patch space is larger
2916         than minimum hole size.
2917         (Output_section::do_write): Fill holes in debug sections.
2918         * output.h (Output_fill): New class.
2919         (Output_fill_debug_info): New class.
2920         (Output_fill_debug_line): New class.
2921         (Output_section::set_free_space_fill): New function.
2922         (Output_section::free_space_fill_): New data member.
2923         * testsuite/Makefile.am (incremental_test_3): Add
2924         --incremental-patch option.
2925         (incremental_test_4): Likewise.
2926         (incremental_test_5): Likewise.
2927         (incremental_test_6): Likewise.
2928         (incremental_copy_test): Likewise.
2929         (incremental_common_test_1): Likewise.
2930         * testsuite/Makefile.in: Regenerate.
2931
2932 2011-08-26  Nick Clifton  <nickc@redhat.com>
2933
2934         * po/es.po: Updated Spanish translation.
2935
2936 2011-08-01  Cary Coutant  <ccoutant@google.com>
2937
2938         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2939         * gold/testsuite/Makefile.in: Regenerate.
2940         * gold/testsuite/justsyms_exec.c: New source file.
2941         * gold/testsuite/justsyms_lib.c: New source file.
2942
2943 2011-08-01  Cary Coutant  <ccoutant@google.com>
2944
2945         * layout.cc (Layout::set_segment_offsets): Don't realign text
2946         segment if -Ttext was specified.
2947         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2948         file type.
2949         * object.h (Sized_relobj_file::e_type): New function.
2950         (Sized_relobj_file::e_type_): New data member.
2951         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2952         base address for ET_EXEC files.
2953         * target.cc (Target::do_make_elf_object_implementation): Allow
2954         ET_EXEC files with --just-symbols option.
2955
2956 2011-07-28  Cary Coutant  <ccoutant@google.com>
2957
2958         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2959         Add thread_number parameter.
2960         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2961         * workqueue-threads.cc
2962         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2963         current thread if its thread number is greater than desired thread
2964         count.
2965         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2966         Add thread_number parameter.
2967         (Workqueue::should_cancel_thread): Likewise.
2968         (Workqueue::find_runnable_or_wait): Pass thread_number to
2969         should_cancel_thread.
2970         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2971         parameter.
2972
2973 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2974
2975         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2976         only after checking if it cannot be forced local.
2977         * symtab.h (is_externally_visible): Check if the symbol is not forced
2978         local.
2979
2980 2011-07-15  Ian Lance Taylor  <iant@google.com>
2981
2982         * options.h (class General_options): Add --print-output-format.
2983         Move -EL next to -EB, for  better --help output.
2984         * target-select.cc: Include <cstdio>, "options.h", and
2985         "parameters.h".
2986         (Target_selector::do_target_bfd_name): New function.
2987         (print_output_format): New function.
2988         * target-select.h (class Target_selector): Update declarations.
2989         (Target_selector::target_bfd_name): New function.
2990         (print_output_format): Declare.
2991         * main.cc: Include "target-select.h".
2992         (main): Handle --print-output-format.
2993         * gold.cc: Include "target-select.h".
2994         (queue_initial_tasks): Handle --print-output-format when there are
2995         no input files.
2996         * parameters.cc (parameters_force_valid_target): Give a better
2997         error message if -EB/-EL does not match target.
2998         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2999         function.
3000
3001 2011-07-15  Ian Lance Taylor  <iant@google.com>
3002
3003         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3004         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3005         (Output_data_plt_i386::do_write): Write address of .dynamic
3006         section to first entry in .got.plt section.
3007         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3008         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3009         Initialize layout_.
3010         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3011         section to first entry in .got.plt section.
3012         * layout.h (Layout::dynamic_section): New function.
3013
3014 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3015
3016         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3017         to claim_file call.
3018         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3019         input_section_position_, and input_section_glob_.
3020         (read_layout_from_file): Call function section_ordering_specified.
3021         * layout.h (is_section_ordering_specified): New function.
3022         (section_ordering_specified): New function.
3023         (section_ordering_specified_): New boolean member.
3024         * main.cc(main): Call load_plugins after layout object is defined.
3025         * output.cc (Output_section::add_input_section): Use
3026         function section_ordering_specified to check if section ordering is
3027         needed.
3028         * output.cc (Output_section::add_relaxed_input_section): Use
3029         function section_ordering_specified to check if section ordering is
3030         needed.
3031         (Output_section::update_section_layout): New function.
3032         (Output_section::sort_attached_input_sections): Check if input section
3033         must be reordered.
3034         * output.h (Output_section::update_section_layout): New function.
3035         * plugin.cc (get_section_count): New function.
3036         (get_section_type): New function.
3037         (get_section_name): New function.
3038         (get_section_contents): New function.
3039         (update_section_order): New function.
3040         (allow_section_ordering): New function.
3041         (Plugin::load): Add the new interfaces to the transfer vector.
3042         (Plugin_manager::load_plugins): New parameter.
3043         (Plugin_manager::all_symbols_read): New parameter.
3044         (Plugin_manager::claim_file): New parameter. Save the elf object for
3045         unclaimed objects.
3046         (Plugin_manager::get_elf_object): New function.
3047         (Plugin_manager::get_view): Change to directly use the bool to check
3048         if get_view is called from claim_file_hook.
3049         * plugin.h (input_objects): New function
3050         (Plugin__manager::load_plugins): New parameter.
3051         (Plugin_manager::claim_file): New parameter.
3052         (Plugin_manager::get_elf_object): New function.
3053         (Plugin_manager::in_claim_file_handler): New function.
3054         (Plugin_manager::in_claim_file_handler_): New member.
3055         (layout): New function.
3056         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3057         handler with an extra parameter. Make the elf object before calling
3058         claim_file handler.
3059         * testsuite/plugin_test.c (get_section_count): New function pointer.
3060         (get_section_type): New function pointer.
3061         (get_section_name): New function pointer.
3062         (get_section_contents): New function pointer.
3063         (update_section_order): New function pointer.
3064         (allow_section_ordering): New function pointer.
3065         (onload): Check if the new interfaces exist.
3066
3067 2011-07-13  Ian Lance Taylor  <iant@google.com>
3068
3069         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3070         relro section.
3071         * x86_64.cc (Target_x86_64::got_section): Likewise.
3072         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3073         (relro_now_test_SOURCES): New variable.
3074         (relro_now_test_DEPENDENCIES): New variable.
3075         (relro_now_test_LDFLAGS): New variable.
3076         (relro_now_test_LDADD): New variable.
3077         (relro_now_test.so): New target.
3078         * testsuite/Makefile.in: Rebuild.
3079
3080 2011-07-12  Ian Lance Taylor  <iant@google.com>
3081
3082         PR gold/12980
3083         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3084         GLOB_DAT relocation rather than a RELATIVE relocation for a
3085         protected symbol when creating a shared library.
3086         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3087         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3088         * testsuite/protected_main_1.cc (main): Test that protected
3089         function has same address.
3090
3091 2011-07-11  Ian Lance Taylor  <iant@google.com>
3092
3093         PR gold/12979
3094         * options.h (class General_options): Add -Bgroup.
3095         * options.cc (General_options::finalize): If -Bgroup is set,
3096         default to --unresolved-symbols=report-all.
3097         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3098         * target-reloc.h (issue_undefined_symbol_error): Handle
3099         --unresolved-symbols=report-all.
3100
3101 2011-07-08  Ian Lance Taylor  <iant@google.com>
3102
3103         PR gold/11985
3104         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3105         if linker script discards key sections.
3106         (Layout::create_dynamic_symtab): Likewise.
3107         (Layout::assign_local_dynsym_offsets): Likewise.
3108         (Layout::sized_create_version_sections): Likewise.
3109         (Layout::create_interp): Likewise.
3110         (Layout::finish_dynamic_section): Likewise.
3111         (Layout::set_dynamic_symbol_size): Likewise.
3112
3113 2011-07-08  Ian Lance Taylor  <iant@google.com>
3114
3115         PR gold/12386
3116         * options.h (class General_options): Add --unresolved-symbols.
3117         * target-reloc.h (issue_undefined_symbol_error): Check
3118         --unresolved-symbols.  Add comments.
3119
3120 2011-07-08  Ian Lance Taylor  <iant@google.com>
3121
3122         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3123         expression more complex.
3124
3125 2011-07-08  Ian Lance Taylor  <iant@google.com>
3126
3127         PR gold/11317
3128         * target-reloc.h (issue_undefined_symbol_error): New inline
3129         function, broken out of relocate_section.
3130         (relocate_section): Call issue_undefined_symbol_error.
3131         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3132         there is no TLS segment if we are about to issue an undefined
3133         symbol error.
3134         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3135
3136 2011-07-08  Ian Lance Taylor  <iant@google.com>
3137
3138         PR gold/12279
3139         * resolve.cc (Symbol_table::should_override): Add fromtype
3140         parameter.  Change all callers.  Give error when linking together
3141         TLS and non-TLS symbol.
3142         (Symbol_table::should_override_with_special): Add fromtype
3143         parameter.  Change all callers.
3144         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3145         there is no TLS segment if we have reported some errors.
3146         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3147
3148 2011-07-08  Ian Lance Taylor  <iant@google.com>
3149
3150         PR gold/12372
3151         * target.h (Target::plt_address_for_global): New function.
3152         (Target::plt_address_for_local): New function.
3153         (Target::plt_section_for_global): Remove.
3154         (Target::plt_section_for_local): Remove.
3155         (Target::do_plt_address_for_global): New virtual function.
3156         (Target::do_plt_address_for_local): New virtual function.
3157         (Target::do_plt_section_for_global): Remove.
3158         (Target::do_plt_section_for_local): Remove.
3159         (Target::register_global_plt_entry): Add Symbol_table and Layout
3160         parameters.
3161         * output.cc (Output_data_got::Got_entry::write): Use
3162         plt_address_for_global and plt_address_for_local.
3163         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3164         address of output section.
3165         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3166         got_irelative_, and irelative_count_ fields.  Update
3167         declarations.
3168         (Output_data_plt_i386::has_irelative_section): New function.
3169         (Output_data_plt_i386::entry_count): Add irelative_count_.
3170         (Output_data_plt_i386::set_final_data_size): Likewise.
3171         (class Target_i386): Add got_irelative_ and rel_irelative_
3172         fields.  Update declarations.
3173         (Target_i386::Target_i386): Initialize new fields.
3174         (Target_i386::do_plt_address_for_global): New function replacing
3175         do_plt_section_for_global.
3176         (Target_i386::do_plt_address_for_local): New function replacing
3177         do_plt_section_for_local.
3178         (Target_i386::got_section): Create got_irelative_.
3179         (Target_i386::rel_irelative_section): New function.
3180         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3181         fields.  Don't define __rel_iplt_{start,end}.
3182         (Output_data_plt_i386::add_entry): Add symtab and layout
3183         parameters.  Change all callers.  Use different PLT and GOT for
3184         IFUNC symbols.
3185         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3186         layout parameters.  Change all callers.  Use different PLT and
3187         GOT.
3188         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3189         (Output_data_plt_i386::rel_irelative): New function.
3190         (Output_data_plt_i386::address_for_global): New function.
3191         (Output_data_plt_i386::address_for_local): New function.
3192         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3193         IRELATIVE GOT when changing IFUNC GOT entries.
3194         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3195         reloc.
3196         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3197         if we didn't create an IRELATIVE GOT.
3198         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3199         plt_address_for_local.
3200         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3201         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3202         got_irelative_, and irelative_count_ fields.  Update
3203         declarations.
3204         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3205         Initialize new fields.  Remove symtab parameter.  Change all
3206         callers.
3207         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3208         irelative_count_.
3209         (Output_data_plt_x86_64::has_irelative_section): New function.
3210         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3211         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3212         fields.  Update declarations.
3213         (Target_x86_64::Target_x86_64): Initialize new fields.
3214         (Target_x86_64::do_plt_address_for_global): New function replacing
3215         do_plt_section_for_global.
3216         (Target_x86_64::do_plt_address_for_local): New function replacing
3217         do_plt_section_for_local.
3218         (Target_x86_64::got_section): Create got_irelative_.
3219         (Target_x86_64::rela_irelative_section): New function.
3220         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3221         all callers.  Don't create __rel_iplt_{start,end}.
3222         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3223         parameters.  Change all callers.  Use different PLT and GOT for
3224         IFUNC symbols.
3225         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3226         layout parameters.  Change all callers.  Use different PLT and
3227         GOT.
3228         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3229         parameters.  Change all callers.  Use different PLT and GOT for
3230         IFUNC symbols.
3231         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3232         (Output_data_plt_x86_64::rela_irelative): New function.
3233         (Output_data_plt_x86_64::address_for_global): New function.
3234         (Output_data_plt_x86_64::address_for_local): New function.
3235         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3236         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3237         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3238         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3239         parameters.
3240         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3241         reloc.
3242         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3243         symbols if we didn't create an IRELATIVE GOT.
3244         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3245         plt_address_for_local.
3246         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3247         * testsuite/ifuncvar1.c: New test file.
3248         * testsuite/ifuncvar2.c: New test file.
3249         * testsuite/ifuncvar3.c: New test file.
3250         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3251         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3252         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3253         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3254         * testsuite/Makefile.in: Rebuild.
3255
3256 2011-07-07  Cary Coutant  <ccoutant@google.com>
3257
3258         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3259         (two_file_test_1_ndebug.o): Likewise.
3260         (two_file_test_1b_ndebug.o): Likewise.
3261         (two_file_test_2_ndebug.o): Likewise.
3262         (two_file_test_main_ndebug.o): Likewise.
3263         (incremental_test_2): Link with no-debug versions.
3264
3265 2011-07-06  Cary Coutant  <ccoutant@google.com>
3266
3267         * gold/incremental.cc
3268         (Output_section_incremental_inputs::write_info_blocks): Check for
3269         hidden and internal symbols.
3270
3271 2011-07-06  Cary Coutant  <ccoutant@google.com>
3272
3273         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3274         Check disposition for startup file.
3275         (Incremental_inputs::report_command_line): Ignore
3276         --incremental-startup-unchanged option.
3277         * options.cc (General_options::parse_incremental_startup_unchanged):
3278         New function.
3279         (General_options::General_options): Initialize new data member.
3280         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3281         (General_options): Add --incremental-startup-unchanged option.
3282         (General_options::incremental_startup_disposition): New function.
3283         (General_options::incremental_startup_disposition_): New data member.
3284
3285 2011-07-06  Cary Coutant  <ccoutant@google.com>
3286
3287         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3288         input file index to Script_info ctor.
3289         (Sized_incremental_binary::do_file_has_changed): Find the
3290         command-line argument for files named in scripts.
3291         * incremental.h (Script_info::Script_info): New ctor
3292         with input file index.
3293         (Script_info::input_file_index): New function.
3294         (Script_info::input_file_index_): New data member.
3295         (Incremental_binary::get_library): Add const.
3296         (Incremental_binary::get_script_info): Add const.
3297         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3298         * testsuite/Makefile.am (incremental_test_5): New test case.
3299         (incremental_test_6): New test case.
3300         * testsuite/Makefile.in: Regenerate.
3301
3302 2011-07-06  Cary Coutant  <ccoutant@google.com>
3303
3304         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3305         debug output when command lines differ.
3306
3307 2011-07-06  Cary Coutant  <ccoutant@google.com>
3308
3309         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3310         --incremental-patch option.
3311         * layout.cc (Free_list::allocate): Extend allocation beyond original
3312         end if enabled.
3313         (Layout::make_output_section): Mark sections that should get
3314         patch space.
3315         * options.cc (parse_percent): New function.
3316         * options.h (parse_percent): New function.
3317         (DEFINE_percent): New macro.
3318         (General_options): Add --incremental-patch option.
3319         * output.cc (Output_section::Output_section): Initialize new data
3320         members.
3321         (Output_section::add_input_section): Print section name when out
3322         of patch space.
3323         (Output_section::add_output_section_data): Likewise.
3324         (Output_section::set_final_data_size): Add patch space when
3325         doing --incremental-full.
3326         (Output_section::do_reset_address_and_file_offset): Remove patch
3327         space.
3328         (Output_segment::set_section_list_addresses): Print debug output
3329         only if --incremental-update.
3330         * output.h (Output_section::set_is_patch_space_allowed): New function.
3331         (Output_section::is_patch_space_allowed_): New data member.
3332         (Output_section::patch_space_): New data member.
3333         * parameters.cc (Parameters::incremental_full): New function.
3334         * parameters.h (Parameters::incremental_full): New function
3335         * testsuite/Makefile.am (incremental_test_2): Add test for
3336         --incremental-patch option.
3337         * testsuite/Makefile.in: Regenerate.
3338         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3339         (t18): Remove function body.
3340
3341 2011-07-05  Doug Kwan  <dougkwan@google.com>
3342
3343         PR gold/12771
3344         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3345         Arm_Address type for relocation result.
3346         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3347         overflow check.
3348         (Arm_relocate_functions::abs32): Use unaligned access.
3349         (Arm_relocate_functions::rel32): Ditto.
3350         (Arm_relocate_functions::prel31): Ditto.
3351         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3352         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3353         static data relocations.
3354         * testsuite/Makefile.in: Regnerate.
3355         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3356
3357 2011-07-05  Ian Lance Taylor  <iant@google.com>
3358
3359         PR gold/12392
3360         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3361         symbols if necessary.
3362         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3363
3364 2011-07-05  Ian Lance Taylor  <iant@google.com>
3365
3366         PR gold/12952
3367         * resolve.cc (Symbol::override_base_with_special): Simply override
3368         version with special symbol version, ignoring previous version.
3369
3370 2011-07-05  Ian Lance Taylor  <iant@google.com>
3371
3372         * object.cc (Sized_relobj_file::include_section_group): Add
3373         information to comment about signature location.
3374
3375 2011-07-02  Ian Lance Taylor  <iant@google.com>
3376
3377         PR gold/12957
3378         * options.h (class General_options): Add -f and -F.
3379         * options.cc (General_options::finalize): Fatal error if -f/-F
3380         are used without -shared.
3381         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3382
3383 2011-07-02  Ian Lance Taylor  <iant@google.com>
3384
3385         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3386
3387 2011-07-01  Ian Lance Taylor  <iant@google.com>
3388
3389         PR gold/12525
3390         PR gold/12952
3391         * resolve.cc (Symbol::override_base_with_special): Don't override
3392         the version if the overriding symbol has a different name.
3393         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3394         all callers.  If we give an error about an undefined version,
3395         define the base version if necessary.
3396         * dynobj.h (class Versions): Update declaration.
3397         * testsuite/weak_alias_test_5.cc: New file.
3398         * testsuite/weak_alias_test.script: New file.
3399         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3400         and versioned_alias have the right value, and call t2.
3401         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3402         weak_alias_test_5.so.
3403         (weak_alias_test_LDADD): Likewise.
3404         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3405         * testsuite/Makefile.in: Rebuild.
3406
3407 2011-07-01  Ian Lance Taylor  <iant@google.com>
3408
3409         PR gold/12525
3410         * options.h (class General_options): Support -z notext.
3411         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3412         -Wl,-z,notext.
3413         (two_file_shared_nonpic.so): Likewise.
3414         (two_file_shared_mixed.so): Likewise.
3415         (two_file_shared_mixed_1.so): Likewise.
3416         (weak_undef_lib_nonpic.so): Likewise.
3417         (alt/weak_undef_lib_nonpic.so): Likewise.
3418         (tls_test_shared_nonpic.so): Likewise.
3419         * testsuite/Makefile.in: Rebuild.
3420
3421 2011-07-01  Ian Lance Taylor  <iant@google.com>
3422
3423         PR gold/12525
3424         * configure.ac: Test whether static linking works, setting
3425         the automake conditional HAVE_STATIC.
3426         * testsuite/Makefile.am: Disable tests using -static if
3427         HAVE_STATIC is not true.
3428         * configure, testsuite/Makefile.in: Rebuild.
3429
3430 2011-07-01  Ian Lance Taylor  <iant@google.com>
3431
3432         PR gold/12525
3433         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3434         Assert if we see DW_EH_PE_indirect.
3435         * target.h (Target::ehframe_datarel_base): New function.
3436         (Target::do_ehframe_datarel_base): New target function.
3437         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3438         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3439         function.
3440
3441 2011-07-01  Ian Lance Taylor  <iant@google.com>
3442
3443         PR gold/12571
3444         * options.h (class General_options): Add
3445         --ld-generated-unwind-info.
3446         * ehframe.cc (Fde::write): Add address parameter.  Change all
3447         callers.  If associated with PLT, fill in address and size.
3448         (Cie::set_output_offset): Only add merge mapping if there is an
3449         object.
3450         (Cie::write): Add address parameter.  Change all callers.
3451         (Eh_frame::add_ehframe_for_plt): New function.
3452         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3453         input_offset_ fields into union u_, with new plt field.
3454         (Fde::Fde): Adjust for new union field.
3455         (Fde::Fde) [Output_data version]: New constructor.
3456         (Fde::add_mapping): Only add merge mapping if there is an object.
3457         (class Cie): Update declarations.
3458         (class Eh_frame): Declare add_ehframe_for_plt.
3459         * layout.cc (Layout::layout_eh_frame): Break out code into
3460         make_eh_frame_section, and call it.
3461         (Layout::make_eh_frame_section): New function.
3462         (Layout::add_eh_frame_for_plt): New function.
3463         * layout.h (class Layout): Update declarations.
3464         * merge.cc (Merge_map::add_mapping): Add assertion.
3465         * i386.cc: Include "dwarf.h".
3466         (class Output_data_plt_i386): Make first_plt_entry,
3467         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3468         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3469         and plt_eh_frame_fde.
3470         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3471         boundary.  Call add_eh_frame_for_plt if appropriate.
3472         * x86_64.cc: Include "dwarf.h".
3473         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3474         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3475         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3476         and plt_eh_frame_fde.
3477         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3478         appropriate.
3479
3480 2011-06-29  Ian Lance Taylor  <iant@google.com>
3481
3482         PR gold/12629
3483         * object.cc (Sized_relobj_file::layout_section): Change shdr
3484         parameter to be const.
3485         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3486         out of do_layout.
3487         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3488         appropriate.  Call layout_eh_frame_section.
3489         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3490         sections.
3491         * object.h (class Sized_relobj_file): Update declarations.
3492
3493 2011-06-29  Ian Lance Taylor  <iant@google.com>
3494
3495         PR gold/12652
3496         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3497         modifier.
3498         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3499
3500 2011-06-29  Ian Lance Taylor  <iant@google.com>
3501
3502         PR gold/12675
3503         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3504         SHT_X86_64_UNWIND.
3505         * layout.cc (Layout::layout_eh_frame): Likewise.
3506
3507 2011-06-29  Ian Lance Taylor  <iant@google.com>
3508
3509         PR gold/12695
3510         * layout.cc (Layout::symtab_section_shndx): New function.
3511         * layout.h (class Layout): Declare symtab_section_shndx.
3512         * output.cc (Output_section::write_header): Call it.
3513
3514 2011-06-29  Ian Lance Taylor  <iant@google.com>
3515
3516         PR gold/12818
3517         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3518         symbols which are not used in a relocation.
3519
3520 2011-06-28  Ian Lance Taylor  <iant@google.com>
3521
3522         PR gold/12898
3523         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3524         script create indistinguishable segments.
3525         (Layout::set_segment_offsets): Use stable_sort when sorting
3526         segments.  Pass this to Compare_segments constructor.
3527         * layout.h (class Layout): Make segment_precedes non-static.
3528         (class Compare_segments): Change from struct to class.  Add
3529         layout_ field.  Add constructor.
3530         * script-sections.cc
3531         (Script_sections::attach_sections_using_phdrs_clause): Rename
3532         local orphan to is_orphan.  Don't report failure to put empty
3533         section in segment.  On attachment failure, report name of
3534         section, and attach to first PT_LOAD segment.
3535
3536 2011-06-28  Ian Lance Taylor  <iant@google.com>
3537
3538         PR gold/12934
3539         * target-select.cc (Target_selector::Target_selector): Add
3540         emulation parameter.  Change all callers.
3541         (select_target_by_bfd_name): Rename from select_target_by_name.
3542         Change all callers.
3543         (select_target_by_emulation): New function.
3544         (supported_emulation_names): New function.
3545         * target-select.h (class Target_selector): Add emulation_ field.
3546         Update declarations.
3547         (Target_selector::recognize_by_bfd_name): Rename from
3548         recognize_by_name.  Change all callers.
3549         (Target_selector::supported_bfd_names): Rename from
3550         supported_names.  Change all callers.
3551         (Target_selector::recognize_by_emulation): New function.
3552         (Target_selector::supported_emulations): New function.
3553         (Target_selector::emulation): New function.
3554         (Target_selector::do_recognize_by_bfd_name): Rename from
3555         do_recognize_by_name.  Change all callers.
3556         (Target_selector::do_supported_bfd_names): Rename from
3557         do_supported_names.  Change all callers.
3558         (Target_selector::do_recognize_by_emulation): New function.
3559         (Target_selector::do_supported_emulations): New function.
3560         (select_target_by_bfd_name): Change name in declaration.
3561         (select_target_by_emulation): Declare.
3562         (supported_emulation_names): Declare.
3563         * parameters.cc (parameters_force_valid_target): Try to find
3564         target based on emulation from -m option.
3565         * options.h (class General_options): Change doc string for -m.
3566         * options.cc (help): Print emulations.
3567         (General_options::parse_V): Likewise.
3568         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3569         Add emulation parameter.  Change all callers.
3570
3571 2011-06-28  Ian Lance Taylor  <iant@google.com>
3572
3573         * target.h (class Target): Add osabi_ field.
3574         (Target::osabi): New function.
3575         (Target::set_osabi): New function.
3576         (Target::Target): Initialize osabi_.
3577         (Target::do_adjust_elf_header): Make pure virtual.
3578         (Sized_target::do_adjust_elf_header): Declare.
3579         * target.cc (Sized_target::do_adjust_elf_header): New function.
3580         (class Sized_target): Instantiate all versions.
3581         * freebsd.h (class Target_freebsd): Remove.
3582         (Target_selector_freebsd::do_recognize): Call set_osabi on
3583         Target.
3584         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3585         (Target_selector_freebsd::set_osabi): Remove.
3586         * i386.cc (class Target_i386): Inherit from Sized_target rather
3587         than Target_freebsd.
3588         * x86_64.cc (class Target_x86_64): Likewise.
3589
3590 2011-06-28  Ian Lance Taylor  <iant@google.com>
3591
3592         * target.h (Target::can_check_for_function_pointers): Rewrite.
3593         Make non-virtual.
3594         (Target::can_icf_inline_merge_sections): Likewise.
3595         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3596         (Target::Target_info): Add can_icf_inline_merge_sections field.
3597         (Target::do_can_check_for_function_pointers): New virtual
3598         function.
3599         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3600         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3601         from can_check_for_function_pointers, move in file.
3602         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3603         section_may_have_icf_unsafe_poineters, move in file.
3604         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3605         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3606         Rename from can_check_for_function_pointers, move in file.
3607         (Target_i386::can_icf_inline_merge_sections): Remove.
3608         (Target_i386::i386_info): Initialize
3609         can_icf_inline_merge_sections.
3610         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3611         Initialize can_icf_inline_merge_sections.
3612         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3613         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3614         Rename from can_check_for_function_pointers, move in file.
3615         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3616         (Target_x86_64::x86_64_info): Initialize
3617         can_icf_inline_merge_sections.
3618         * testsuite/testfile.cc (Target_test::test_target_info):
3619         Likewise.
3620         * icf.cc (get_section_contents): Correct formatting.
3621
3622 2011-06-27  Ian Lance Taylor  <iant@google.com>
3623
3624         * symtab.cc (Symbol::versioned_name): New function.
3625         (Symbol_table::add_to_final_symtab): Use versioned_name when
3626         appropriate.
3627         (Symbol_table::sized_write_symbol): Likewise.
3628         * symtab.h (class Symbol): Declare versioned_name.
3629         * stringpool.h (class Stringpool_template): Add variant of add
3630         which takes a std::basic_string.
3631         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3632         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3633         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3634         (ver_test_12.o): New target.
3635         * testsuite/Makefile.in: Rebuild.
3636
3637 2011-06-27  Doug Kwan  <dougkwan@google.com>
3638
3639         * arm.cc (Arm_relocate_functions::thm_jump8,
3640         Arm_relocate_functions::thm_jump11): Use a wider signed
3641         type to compute offset.
3642         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3643         arm_thm_jump8.
3644         * testsuite/Makefile.in: Regenerate.
3645         * testsuite/arm_branch_in_range.sh: Check test results of
3646         arm_thm_jump11 and arm_thm_jump8.
3647         * testsuite/arm_thm_jump11.s: New test source file.
3648         * testsuite/arm_thm_jump11.t: New linker script.
3649         * testsuite/arm_thm_jump8.s: New test source file.
3650         * testsuite/arm_thm_jump8.t: New linker script.
3651
3652 2011-06-24  Ian Lance Taylor  <iant@google.com>
3653
3654         * layout.cc: Include "object.h".
3655         (ctors_sections_in_init_array): New static variable.
3656         (Layout::is_ctors_in_init_array): New function.
3657         (Layout::layout): Add entry to ctors_sections_in_init_array if
3658         appropriate.
3659         * layout.h (class Layout): Declare is_ctors_in_init_array.
3660         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3661         is_ctors_reverse_view is set.
3662         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3663         all callers.  Set is_ctors_reverse_view field of View_size.
3664         (Sized_relobj_file::reverse_words): New function.
3665         * object.h (Sized_relobj_file::View_size): Add
3666         is_ctors_reverse_view field.
3667         (class Sized_relobj_file): Update declarations.
3668         * testsuite/initpri3.c: New test.
3669         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3670         initpri3b.
3671         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3672         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3673         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3674         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3675         * testsuite/Makefile.in: Rebuild.
3676
3677 2011-06-24  Cary Coutant  <ccoutant@google.com>
3678
3679         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3680         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3681         (debug_msg_cdebug.err): New targets.
3682         * testsuite/Makefile.in: Regenerate.
3683         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3684         Fix checks for link with shared library.
3685
3686 2011-06-24  Doug Kwan  <dougkwan@google.com>
3687
3688         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3689         skip empty text sections.
3690         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3691
3692 2011-06-22  Ian Lance Taylor  <iant@google.com>
3693
3694         PR gold/12910
3695         * options.h (class General_options): Add --ctors-in-init-array.
3696         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3697         friends as SHT_PROGBITS for merging sections.
3698         (Layout::layout): Remove special handling of .init_array and
3699         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3700         and .dtors if ctors_in_init_array.
3701         (Layout::make_output_section): Force correct section types for
3702         .init_array and friends.  Don't sort if doing relocatable link,
3703         Don't sort .ctors and .dtors if ctors_in_init_array.
3704         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3705         (Layout::output_section_name): Add relobj parameter.  Change all
3706         callers.  Handle .ctors. and .dtors. in code rather than table.
3707         Handle .ctors and .dtors if ctors_in_init_array.
3708         (Layout::match_file_name): New function, moved from output.cc.
3709         * layout.h (class Layout): Update declarations.
3710         * output.cc: Include "layout.h".
3711         (Input_section_sort_entry::get_priority): New function.
3712         (Input_section_sort_entry::match_file_name): Just call
3713         Layout::match_file_name.
3714         (Output_section::Input_section_sort_init_fini_compare::operator()):
3715         Handle .ctors and .dtors.  Sort by explicit priority rather than
3716         by name.
3717         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3718         * testsuite/initpri2.c: New test.
3719         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3720         (check_PROGRAMS): Add initpri2.
3721         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3722         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3723         * configure, testsuite/Makefile.in: Rebuild.
3724
3725 2011-06-19  Ian Lance Taylor  <iant@google.com>
3726
3727         PR gold/12880
3728         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3729         .interp section to a PT_INTERP segment even if we have seen a
3730         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3731         clause in a linker script.
3732         (Layout::finalize): Don't create a .interp section if we've
3733         already create a PT_INTERP segment.
3734         (Layout::create_interp): Always call choose_output_section (revert
3735         patch of 2011-06-17).  Don't create PT_INTERP segment.
3736         * script-sections.cc
3737         (Script_sections::create_note_and_tls_segments): Add a .interp
3738         section to a PT_INTERP segment even if we have seen a
3739         --dynamic-linker option.
3740
3741 2011-06-18  Ian Lance Taylor  <iant@google.com>
3742
3743         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3744         merely because a non-PT_LOAD segment has a dynamic reloc.
3745
3746 2011-06-18  Ian Lance Taylor  <iant@google.com>
3747
3748         * layout.cc (Layout::finish_dynamic_section): Don't create
3749         DT_FLAGS entry if not needed.
3750
3751 2011-06-18  Ian Lance Taylor  <iant@google.com>
3752
3753         PR gold/12745
3754         * layout.cc (Layout::layout_eh_frame): Correct handling of
3755         writable .eh_frame section.
3756
3757 2011-06-17  Ian Lance Taylor  <iant@google.com>
3758
3759         PR gold/12893
3760         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3761         symbol is redefined with the exact same object and value.
3762
3763 2011-06-17  Ian Lance Taylor  <iant@google.com>
3764
3765         PR gold/12880
3766         * layout.h (class Layout): Add interp_segment_ field.
3767         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3768         (Layout::attach_allocated_section_to_segment): If making shared
3769         library, put .interp section in PT_INTERP segment.
3770         (Layout::finalize): Also call create_interp if -dynamic-linker
3771         option was used.
3772         (Layout::create_interp): Assert that there is no PT_INTERP
3773         segment.  If not using a SECTIONS clause, use make_output_section.
3774         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3775         * script-sections.cc
3776         (Script_sections::create_note_and_tls_segments): If making shared
3777         library, put .interp section in PT_INTERP segment.
3778
3779 2011-06-17  Ian Lance Taylor  <iant@google.com>
3780
3781         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3782         when making a shared library.
3783
3784 2011-06-17  Ian Lance Taylor  <iant@google.com>
3785
3786         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3787         parameter.  Change all callers.  Don't issue warning about PC32
3788         against locally defined symbol.
3789
3790 2011-06-16  Ian Lance Taylor  <iant@google.com>
3791
3792         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3793         occurs in same object.
3794
3795 2011-06-14  Alan Modra  <amodra@gmail.com>
3796
3797         * po/POTFILES.in: Regenerate.
3798
3799 2011-06-09  Ian Lance Taylor  <iant@google.com>
3800
3801         * script-sections.cc
3802         (Orphan_output_section::set_section_addresses): For a relocatable
3803         link set address to 0.
3804
3805 2011-06-09  Cary Coutant  <ccoutant@google.com>
3806
3807         PR gold/12804
3808         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3809         used with --compress-debug-sections.
3810         * gold/object.cc (Sized_relobj_file::do_layout): Report
3811         uncompressed size of compressed input sections.
3812
3813 2011-06-08  Cary Coutant  <ccoutant@google.com>
3814
3815         PR gold/12804
3816         * testsuite/two_file_test_2_v1.cc: Change initialization of
3817         v2 to keep it in .data.
3818
3819 2011-06-07  Cary Coutant  <ccoutant@google.com>
3820
3821         * common.cc (Symbol_table::do_allocate_commons_list): Call
3822         gold_fallback.
3823         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3824         (Errors::fallback): New function.
3825         (gold_fallback): New function.
3826         * errors.h (Errors::fallback): New function.
3827         * gold.cc (gold_exit): Change status parameter to enum; adjust
3828         all callers.
3829         (queue_initial_tasks): Call gold_fallback.
3830         * gold.h: Include cstdlib.
3831         (Exit_status): New enum type.
3832         (gold_exit): Change status parameter to enum.
3833         (gold_fallback): New function.
3834         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3835         (Layout::create_symtab_sections): Likewise.
3836         (Layout::create_shdrs): Likewise.
3837         * main.cc (main): Adjust call to gold_exit.
3838         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3839         (Output_data_got::add_got_entry_pair): Likewise.
3840         (Output_section::add_input_section): Likewise.
3841         (Output_section::add_output_section_data): Likewise.
3842         (Output_segment::set_section_list_addresses): Likewise.
3843         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3844
3845 2011-06-07  Cary Coutant  <ccoutant@google.com>
3846
3847         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3848         for incremental links.
3849         * output.cc (Output_segment::set_section_list_addresses): Remove
3850         FIXME and test for TLS or BSS.
3851
3852 2011-06-07  Cary Coutant  <ccoutant@google.com>
3853
3854         * testsuite/Makefile.am: Add incremental_copy_test,
3855         incremental_common_test_1.
3856         * testsuite/Makefile.in: Regenerate.
3857         * testsuite/common_test_1_v1.c: New source file.
3858         * testsuite/common_test_1_v2.c: New source file.
3859         * testsuite/copy_test_v1.cc: New source file.
3860
3861 2011-06-07  Cary Coutant  <ccoutant@google.com>
3862
3863         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3864         update, allocate common from bss section's free list.
3865         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3866         linker-defined symbols.
3867         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3868         Skip GOT and PLT entries that are no longer referenced.
3869         (Output_section_incremental_inputs::write_info_blocks): Mark
3870         linker-defined symbols.
3871         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3872         * output.cc (Output_section::allocate): New function.
3873         * output.h (Output_section::allocate): New function.
3874         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3875         linker-defined symbols.
3876         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3877         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3878         (Symbol::init_base_output_data): Likewise.
3879         (Symbol::init_base_output_segment): Likewise.
3880         (Symbol::init_base_constant): Likewise.
3881         (Sized_symbol::init_output_data): Likewise.
3882         (Sized_symbol::init_output_segment): Likewise.
3883         (Sized_symbol::init_constant): Likewise.
3884         (Symbol_table::do_define_in_output_data): Likewise.
3885         (Symbol_table::do_define_in_output_segment): Likewise.
3886         (Symbol_table::do_define_as_constant): Likewise.
3887         * symtab.h (Symbol::is_predefined): New function.
3888         (Symbol::init_base_output_data): Add is_predefined parameter.
3889         (Symbol::init_base_output_segment): Likewise.
3890         (Symbol::init_base_constant): Likewise.
3891         (Symbol::is_predefined_): New data member.
3892         (Sized_symbol::init_output_data): Add is_predefined parameter.
3893         (Sized_symbol::init_output_segment): Likewise.
3894         (Sized_symbol::init_constant): Likewise.
3895         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3896
3897 2011-06-07  Cary Coutant  <ccoutant@google.com>
3898
3899         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3900         instead of emit_copy_reloc.
3901         (Copy_relocs::emit_copy_reloc): Refactor.
3902         (Copy_relocs::make_copy_reloc): New function.
3903         (Copy_relocs::add_copy_reloc): Remove.
3904         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3905         section.
3906         (Copy_relocs::make_copy_reloc): New function.
3907         (Copy_relocs::add_copy_reloc): Remove.
3908         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3909         unchanged input files.
3910         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3911         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3912         Reserve BSS space for COPY relocations.
3913         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3914         (Output_section_incremental_inputs::write_info_blocks): Record
3915         whether a symbol is copied from a shared object.
3916         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3917         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3918         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3919         (Incremental_input_entry_reader::get_output_symbol_index): Add
3920         is_copy parameter.
3921         (Incremental_binary::emit_copy_relocs): New function.
3922         (Incremental_binary::do_emit_copy_relocs): New function.
3923         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3924         new data member.
3925         (Sized_incremental_binary::add_copy_reloc): New function.
3926         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3927         (Sized_incremental_binary::Copy_reloc): New struct.
3928         (Sized_incremental_binary::Copy_relocs): New typedef.
3929         (Sized_incremental_binary::copy_relocs_): New data member.
3930         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3931         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3932         * target.h (Sized_target::emit_copy_reloc): New function.
3933         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3934
3935 2011-06-02  Cary Coutant  <ccoutant@google.com>
3936
3937         PR gold/12163
3938         * gold/archive.cc (Archive::Archive): Initialize new data member.
3939         (Archive::include_all_members): Return if archive has already been
3940         included.
3941         * gold/archive.h (Archive::include_all_members_): New data member.
3942
3943 2011-06-02  Nick Clifton  <nickc@redhat.com>
3944
3945         * dynobj.h: Fix spelling mistake in comment.
3946         * output.cc: Likewise.
3947
3948 2011-05-31  Doug Kwan  <dougkwan@google.com>
3949             Asier Llano
3950
3951         PR gold/12826
3952         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3953         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3954         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3955         redundant arm_exidx_test.so.
3956         * testsuite/Makefile.in: Regenerate.
3957         (check_SCRIPTS): Add pr12826.sh
3958         (check_DATA): Add pr12826.stdout
3959         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3960         * testsuite/pr12826.sh: New file.
3961         * testsuite/pr12826_1.s: Ditto.
3962         * testsuite/pr12826_1.s: Ditto.
3963
3964 2011-05-30  Ian Lance Taylor  <iant@google.com>
3965
3966         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3967         sections.
3968
3969 2011-05-29  Ian Lance Taylor  <iant@google.com>
3970
3971         PR gold/12804
3972         * testsuite/Makefile.am: Use different file name for two_file_test
3973         temporary file for each incremental test.
3974         * testsuite/Makefile.in: Rebuild.
3975
3976 2011-05-29  Ian Lance Taylor  <iant@google.com>
3977
3978         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3979         binary input file is empty.
3980
3981 2011-05-27  Ian Lance Taylor  <iant@google.com>
3982
3983         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3984         (ver_test_9.so): Likewise.
3985         * testsuite/Makefile.in: Rebuild.
3986
3987 2011-05-26 Cary Coutant  <ccoutant@google.com>
3988
3989         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3990         * incremental.cc (Incremental_inputs::report_input_section): Fix
3991         comment, indentation.
3992         (Incremental_inputs::report_comdat_group): New function.
3993         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3994         of data for incremental input file entry.
3995         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3996         group count, COMDAT group signatures.
3997         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3998         an unchanged input file.
3999         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4000         Initialize new data member.
4001         (Incremental_object_entry::add_comdat_group): New function.
4002         (Incremental_object_entry::get_comdat_group_count): New function.
4003         (Incremental_object_entry::get_comdat_signature_key): New function.
4004         (Incremental_object_entry::groups_): New data member.
4005         (Incremental_inputs::report_comdat_group): New function.
4006         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4007         data for incremental input file entry.
4008         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4009         (Incremental_input_entry_reader::get_input_section): Adjust size of
4010         data for incremental input file entry.
4011         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4012         (Incremental_input_entry_reader::get_comdat_group_signature): New
4013         function.
4014         * object.cc (Sized_relobj::include_section_group): Report kept
4015         COMDAT groups for incremental links.
4016
4017 2011-05-24  David Meyer  <pdox@google.com>
4018
4019         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4020         with name parameter.  Add found_name parameter.
4021         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4022         * dirsearch.h (class Dirsearch): Update declaration.
4023
4024 2011-05-24  Ian Lance Taylor  <iant@google.com>
4025
4026         * archive.cc (Library_base::should_include_member): Pull in object
4027         from archive if it defines the entry symbol.
4028         * parameters.cc (Parameters::entry): New function.
4029         * parameters.h (class Parameters): Declare entry.
4030         * output.h (class Output_file_header): Remove entry_ field.
4031         * output.cc (Output_file_header::Output_file_header): Remove entry
4032         parameter.  Change all callers.
4033         (Output_file_header::entry): Use parameters->entry.
4034         * gold.cc (queue_middle_tasks): Likewise.
4035         * plugin.cc (Plugin_hook::run): Likewise.
4036
4037 2011-05-24 Cary Coutant  <ccoutant@google.com>
4038
4039         * gold.cc (queue_initial_tasks): Pass incremental base filename
4040         to Output_file::open_base_file; don't print error message.
4041         * incremental-dump.cc (main): Adjust call to
4042         Output_file::open_for_modification.
4043         * incremental-dump.cc (main): Likewise.
4044         * incremental.cc (Incremental_inputs::report_command_line):
4045         Ignore --incremental-base option when comparing command lines.
4046         Ignore parameter when given as separate argument.
4047         * options.h (class General_options): Add --incremental-base.
4048         * output.cc (Output_file::Output_file):
4049         (Output_file::open_base_file): Add base_name and writable parameters;
4050         read base file into new file; print error message here.
4051         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4052         callers.
4053         * output.h (Output_file::open_for_modification): Rename to...
4054         (Output_file::open_base_file): ...this; add base_name and
4055         writable parameters; adjust all callers.
4056         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4057         callers.
4058         * testsuite/Makefile.am (incremental_test_4): Test
4059         --incremental-base.
4060         * testsuite/Makefile.in: Regenerate.
4061
4062 2011-05-24 Cary Coutant  <ccoutant@google.com>
4063
4064         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4065         incremental_test_4.
4066         * testsuite/Makefile.in: Regenerate.
4067         * testsuite/two_file_test_1_v1.cc: New test source file.
4068         * testsuite/two_file_test_1b_v1.cc: New test source file.
4069         * testsuite/two_file_test_2_v1.cc: New test source file.
4070
4071 2011-05-24 Cary Coutant  <ccoutant@google.com>
4072
4073         * dynobj.h (Dynobj::do_dynobj): New function.
4074         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4075         flag and soname for shared objects.
4076         * incremental.cc (Incremental_inputs::report_object): Make
4077         either Incremental_object_entry or Incremental_dynobj_entry; add
4078         soname to string table.
4079         (Incremental_inputs::report_input_section): Add assertion.
4080         (Output_section_incremental_inputs::set_final_data_size): Adjust
4081         type of input file entry for shared libraries; adjust size of
4082         shared library info entry.
4083         (Output_section_incremental_inputs::write_input_files): Write
4084         as_needed flag for shared libraries.
4085         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4086         of input file entry for shared libraries; write soname.
4087         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4088         soname from incremental info.
4089         * incremental.h (enum Incremental_input_flags): Add
4090         INCREMENTAL_INPUT_AS_NEEDED.
4091         (Incremental_input_entry::Incremental_input_entry): Initialize new
4092         data member.
4093         (Incremental_input_entry::set_as_needed): New function.
4094         (Incremental_input_entry::as_needed): New function.
4095         (Incremental_input_entry::do_dynobj_entry): New function.
4096         (Incremental_input_entry::as_needed_): New data member.
4097         (Incremental_object_entry::Incremental_object_entry): Don't check
4098         for shared library.
4099         (Incremental_object_entry::do_type): Likewise.
4100         (class Incremental_dynobj_entry): New class.
4101         (Incremental_input_entry_reader::as_needed): New function.
4102         (Incremental_input_entry_reader::get_soname): New function.
4103         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4104         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4105         size of shared library info entry.
4106         * layout.cc (Layout::finish_dynamic_section): Don't test for
4107         incremental link when adding DT_NEEDED entries.
4108         * object.h (Object::Object): Initialize new data member.
4109         (Object::dynobj): New function.
4110         (Object::set_as_needed): New function.
4111         (Object::as_needed): New function.
4112         (Object::do_dynobj): New function.
4113         (Object::as_needed_): New data member.
4114
4115 2011-05-24 Cary Coutant  <ccoutant@google.com>
4116
4117         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4118         info; adjust display of GOT entries.
4119         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4120         vector of input objects; remove file_status_.
4121         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4122         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4123         got_plt reader; call target hooks to reserve GOT entries.
4124         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4125         of input file info header and GOT info entry.
4126         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4127         relocation info.
4128         (Got_plt_view_info::got_descriptor): Remove.
4129         (Got_plt_view_info::sym_index): New data member.
4130         (Got_plt_view_info::input_index): New data member.
4131         (Local_got_offset_visitor::visit): Write input file index.
4132         (Global_got_offset_visitor::visit): Write 0 for input file index.
4133         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4134         with sym_index and input_index.
4135         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4136         incremental info GOT entry; replace got_descriptor with input_index.
4137         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4138         map from input file index to object.
4139         (Sized_relobj_incr::do_layout): Replace direct data member reference
4140         with accessor function.
4141         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4142         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4143         Adjust size of input file info header.
4144         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4145         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4146         (Incremental_input_entry_reader::get_input_section): Adjust size of
4147         input file info header.
4148         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4149         of incremental info GOT entry.
4150         (Incremental_got_plt_reader::get_got_desc): Remove.
4151         (Incremental_got_plt_reader::get_got_symndx): New function.
4152         (Incremental_got_plt_reader::get_got_input_index): New function.
4153         (Sized_incremental_binary::Sized_incremental_binary): Remove
4154         file_status_; add input_objects_.
4155         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4156         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4157         (Sized_incremental_binary::file_is_unchanged): Remove.
4158         (Sized_incremental_binary::set_input_object): New function.
4159         (Sized_incremental_binary::input_object): New function.
4160         (Sized_incremental_binary::file_status_): Remove.
4161         (Sized_incremental_binary::input_objects_): New data member.
4162         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4163         references.
4164         (Sized_relobj_incr::invalid_address): Move to base class.
4165         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4166         class.
4167         (Sized_relobj_incr::do_output_section_offset): Likewise.
4168         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4169         (Sized_relobj_incr::section_offsets_): Likewise.
4170         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4171         function.
4172         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4173         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4174         with accessor function.
4175         (Sized_relobj_file::do_layout): Likewise.
4176         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4177         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4178         (Sized_relobj_file::compute_final_local_value): Replace refs to
4179         section_offsets_ with accessor function.
4180         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4181         * object.h (Relobj::Relobj): Initialize new data members.
4182         (Relobj::add_dyn_reloc): New function.
4183         (Relobj::first_dyn_reloc): New function.
4184         (Relobj::dyn_reloc_count): New function.
4185         (Relobj::first_dyn_reloc_): New data member.
4186         (Relobj::dyn_reloc_count_): New data member.
4187         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4188         references.
4189         (Sized_relobj::Address): New typedef.
4190         (Sized_relobj::invalid_address): Move here from child class.
4191         (Sized_relobj::Sized_relobj): Initialize new data members.
4192         (Sized_relobj::sized_relobj): New function.
4193         (Sized_relobj::is_output_section_offset_invalid): Move here from
4194         child class.
4195         (Sized_relobj::get_output_section_offset): Likewise.
4196         (Sized_relobj::local_has_got_offset): Likewise.
4197         (Sized_relobj::local_got_offset): Likewise.
4198         (Sized_relobj::set_local_got_offset): Likewise.
4199         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4200         (Sized_relobj::clear_got_offsets): New function.
4201         (Sized_relobj::section_offsets): Move here from child class.
4202         (Sized_relobj::do_output_section_offset): Likewise.
4203         (Sized_relobj::do_set_section_offset): Likewise.
4204         (Sized_relobj::Local_got_offsets): Likewise.
4205         (Sized_relobj::local_got_offsets_): Likewise.
4206         (Sized_relobj::section_offsets_): Likewise.
4207         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4208         references.
4209         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4210         class.
4211         (Sized_relobj_file::sized_relobj): New function
4212         (Sized_relobj_file::local_has_got_offset): Move to base class.
4213         (Sized_relobj_file::local_got_offset): Likewise.
4214         (Sized_relobj_file::set_local_got_offset): Likewise.
4215         (Sized_relobj_file::get_output_section_offset): Likewise.
4216         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4217         (Sized_relobj_file::do_output_section_offset): Likewise.
4218         (Sized_relobj_file::do_set_section_offset): Likewise.
4219         (Sized_relobj_file::Local_got_offsets): Likewise.
4220         (Sized_relobj_file::local_got_offsets_): Likewise.
4221         (Sized_relobj_file::section_offsets_): Likewise.
4222         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4223         (all constructors).
4224         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4225         (Output_reloc::get_symbol_index): Likewise.
4226         (Output_reloc::local_section_offset): Likewise.
4227         (Output_reloc::get_address): Likewise.
4228         (Output_reloc::symbol_value): Likewise.
4229         (Output_data_got::reserve_slot): Move to class definition.
4230         (Output_data_got::reserve_local): New function.
4231         (Output_data_got::reserve_slot_for_global): Remove.
4232         (Output_data_got::reserve_global): New function.
4233         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4234         (all constructors, two instantiations).
4235         (Output_reloc::get_relobj): New function (two instantiations).
4236         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4237         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4238         (Output_data_reloc::add_global): Adjust type of relobj.
4239         (Output_data_reloc::add_global_relative): Likewise.
4240         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4241         (Output_data_reloc::add_local): Likewise.
4242         (Output_data_reloc::add_local_relative): Likewise.
4243         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4244         (Output_data_reloc::add_local_section): Likewise.
4245         (Output_data_reloc::add_output_section): Likewise.
4246         (Output_data_reloc::add_absolute): Likewise.
4247         (Output_data_reloc::add_target_specific): Likewise.
4248         (Output_data_got::reserve_slot): Move definition here.
4249         (Output_data_got::reserve_local): New function.
4250         (Output_data_got::reserve_global): New function.
4251         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4252         section_offsets_ with accessor function.
4253         (Sized_relobj_file::write_sections): Likewise.
4254         (Sized_relobj_file::do_relocate_sections): Likewise.
4255         * target.h (Sized_target::reserve_local_got_entry): New function.
4256         (Sized_target::reserve_global_got_entry): New function.
4257         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4258         (Target_x86_64::reserve_global_got_entry): New function.
4259         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4260
4261 2011-05-23 Cary Coutant  <ccoutant@google.com>
4262
4263         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4264         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4265         bit when checking got_type.
4266         * incremental.cc (Sized_incremental_binary::setup_readers):
4267         Store symbol table and string table locations; initialize bit vector
4268         of file status flags.
4269         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4270         unchanged files.
4271         (Sized_incremental_binary::do_process_got_plt): New function.
4272         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4273         (Output_section_incremental_inputs::set_final_data_size): Record
4274         file index for each input file.
4275         (Output_section_incremental_inputs::write_got_plt): Store file index
4276         instead of input entry offset for each GOT entry.
4277         * incremental.h
4278         (Incremental_input_entry::Incremental_input_entry): Initialize new
4279         data member.
4280         (Incremental_input_entry::set_offset): Store file index.
4281         (Incremental_input_entry::get_file_index): New function.
4282         (Incremental_input_entry::file_index_): New data member.
4283         (Incremental_binary::process_got_plt): New function.
4284         (Incremental_binary::do_process_got_plt): New function.
4285         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4286         data members.
4287         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4288         (Sized_incremental_binary::set_file_is_unchanged): New function.
4289         (Sized_incremental_binary::file_is_unchanged): New function.
4290         (Sized_incremental_binary::do_process_got_plt): New function.
4291         (Sized_incremental_binary::file_status_): New data member.
4292         (Sized_incremental_binary::main_symtab_loc_): New data member.
4293         (Sized_incremental_binary::main_strtab_loc_): New data member.
4294         * output.cc (Output_data_got::Got_entry::write): Add case
4295         RESERVED_CODE.
4296         (Output_data_got::add_global): Call add_got_entry.
4297         (Output_data_got::add_global_plt): Likewise.
4298         (Output_data_got::add_global_with_rel): Likewise.
4299         (Output_data_got::add_global_with_rela): Likewise.
4300         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4301         (Output_data_got::add_global_pair_with_rela): Likewise.
4302         (Output_data_got::add_local): Call add_got_entry.
4303         (Output_data_got::add_local_plt): Likewise.
4304         (Output_data_got::add_local_with_rel): Likewise.
4305         (Output_data_got::add_local_with_rela): Likewise.
4306         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4307         (Output_data_got::add_local_pair_with_rela): Likewise.
4308         (Output_data_got::reserve_slot): New function.
4309         (Output_data_got::reserve_slot_for_global): New function.
4310         (Output_data_got::add_got_entry): New function.
4311         (Output_data_got::add_got_entry_pair): New function.
4312         (Output_section::add_output_section_data): Edit FIXME.
4313         * output.h
4314         (Output_section_data_build::Output_section_data_build): New
4315         constructor with size parameter.
4316         (Output_data_space::Output_data_space): Likewise.
4317         (Output_data_got::Output_data_got): Initialize new data member; new
4318         constructor with size parameter.
4319         (Output_data_got::add_constant): Call add_got_entry.
4320         (Output_data_got::reserve_slot): New function.
4321         (Output_data_got::reserve_slot_for_global): New function.
4322         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4323         (Output_data_got::add_got_entry): New function.
4324         (Output_data_got::add_got_entry_pair): New function.
4325         (Output_data_got::free_list_): New data member.
4326         * target.h (Sized_target::init_got_plt_for_update): New function.
4327         (Sized_target::register_global_plt_entry): New function.
4328         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4329         Initialize new data member; call init; add constructor with PLT count.
4330         (Output_data_plt_x86_64::init): New function.
4331         (Output_data_plt_x86_64::add_relocation): New function.
4332         (Output_data_plt_x86_64::reserve_slot): New function.
4333         (Output_data_plt_x86_64::free_list_): New data member.
4334         (Target_x86_64::init_got_plt_for_update): New function.
4335         (Target_x86_64::register_global_plt_entry): New function.
4336         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4337         incremental updates.
4338         (Output_data_plt_x86_64::add_relocation): New function.
4339         * testsuite/object_unittest.cc (Object_test): Set default options.
4340
4341 2011-05-16  Ian Lance Taylor  <iant@google.com>
4342
4343         * options.h (class General_options): Make -i a synonym for -r.
4344
4345 2011-05-16  Ian Lance Taylor  <iant@google.com>
4346
4347         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4348
4349 2011-05-10 Cary Coutant  <ccoutant@google.com>
4350
4351         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4352         strip_all (-s).
4353
4354 2011-05-06  Ian Lance Taylor  <iant@google.com>
4355
4356         * layout.cc (Layout::layout): If the output section flags change,
4357         update the ordering.
4358
4359 2011-04-25 Cary Coutant  <ccoutant@google.com>
4360
4361         * incremental-dump.cc (dump_incremental_inputs): Print local
4362         symbol info for each input file.
4363         * incremental.cc
4364         (Output_section_incremental_inputs::set_final_data_size): Add local
4365         symbol info to input file entries in incremental info.
4366         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4367         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4368         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4369         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4370         implementation.
4371         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4372         (Sized_incr_relobj::do_relocate): Write the local symbols.
4373         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4374         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4375         Adjust size of input file header.
4376         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4377         (Incremental_inputs_reader::get_local_symbol_count): New function.
4378         (Incremental_inputs_reader::get_input_section): Adjust size of input
4379         file header.
4380         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4381         (Sized_incr_relobj::This): New typedef.
4382         (Sized_incr_relobj::sym_size): New const data member.
4383         (Sized_incr_relobj::Local_symbol): New struct.
4384         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4385         (Sized_incr_relobj::do_local_symbol_offset): New function.
4386         (Sized_incr_relobj::local_symbol_count_): New data member.
4387         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4388         (Sized_incr_relobj::local_symbol_index_): New data member.
4389         (Sized_incr_relobj::local_symbol_offset_): New data member.
4390         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4391         (Sized_incr_relobj::local_symbols_): New data member.
4392         * object.h (Relobj::output_local_symbol_count): New function.
4393         (Relobj::local_symbol_offset): New function.
4394         (Relobj::do_output_local_symbol_count): New function.
4395         (Relobj::do_local_symbol_offset): New function.
4396         (Sized_relobj::do_output_local_symbol_count): New function.
4397         (Sized_relobj::do_local_symbol_offset): New function.
4398
4399 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4400
4401         * descriptors.cc (set_close_on_exec): New function.
4402         (Descriptors::open): Use set_close_on_exec.
4403         * output.cc (S_ISLNK): Define if not defined.
4404
4405 2011-04-22 Cary Coutant  <ccoutant@google.com>
4406
4407         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4408         global symbol map.
4409         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4410         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4411         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4412         relocations.
4413         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4414         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4415         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4416         * incremental.h
4417         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4418         function.
4419         (Incremental_binary::apply_incremental_relocs): New function.
4420         (Incremental_binary::do_apply_incremental_relocs): New function.
4421         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4422         data member.
4423         (Sized_incremental_binary::add_global_symbol): New function.
4424         (Sized_incremental_binary::global_symbol): New function.
4425         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4426         (Sized_incremental_binary::symbol_map_): New data member.
4427         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4428         * target.h (Sized_target::apply_relocation): New function.
4429         * target-reloc.h (apply_relocation): New function.
4430         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4431
4432 2011-04-22  Doug Kwan  <dougkwan@google.com>
4433
4434         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4435         flag of a SHT_ARM_EXIDX section.
4436         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4437         * testsuite/Makefile.in: Regenerate.
4438         * testsuite/arm_exidx_test.s: New file.
4439         * testsuite/arm_exidx_test.sh: Same.
4440
4441 2011-04-20 Cary Coutant  <ccoutant@google.com>
4442
4443         PR gold/12689
4444         * archive.h (Incremental_archive_entry::Archive_member):
4445         Initialize arg_serial_ (second constructor).
4446
4447 2011-04-17  Ian Lance Taylor  <iant@google.com>
4448
4449         * object.cc (Relocate_info::location): Simplify location string.
4450         * errors.cc (Errors::error_at_location): Don't print program
4451         name.
4452         (Errors::warning_at_location): Likewise.
4453         (Errors::undefined_symbol): Likewise.
4454         * testsuite/debug_msg.sh: Update accordingly.
4455
4456 2011-04-14 Cary Coutant  <ccoutant@google.com>
4457
4458         * gold/layout.cc (Layout::symtab_section_offset): New function.
4459         * gold/layout.h (Layout::symtab_section_offset): New function.
4460         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4461
4462 2011-04-12  Ian Lance Taylor  <iant@google.com>
4463
4464         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4465         with MREMAP_MAYMOVE.
4466         * output.h (class Output_file): Add map_is_allocated_ field.
4467         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4468         not available, provide stubs.  If mremap is not available, #define
4469         it to gold_mremap.
4470         (MREMAP_MAYMOVE): Define if not defined.
4471         (Output_file::Output_file): Initialize map_is_allocated_.
4472         (Output_file::resize): Check map_is_allocated_.
4473         (Output_file::map_anonymous): If mmap fails, use malloc.
4474         (Output_file::unmap): Don't do anything for an anonymous map.
4475         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4476         is not available, provide stubs.
4477         (File_read::View::~View): Use free rather than delete[].
4478         (File_read::make_view): Use malloc rather than new[].  If mmap
4479         fails, use malloc.
4480         (File_read::find_or_make_view): Use malloc rather than new[].
4481         * gold.h: Remove HAVE_REMAP code.
4482         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4483         exists.  Rename mremap to gold_mremap.  If mmap is not available
4484         don't do anything.
4485         * configure, config.in: Rebuild.
4486
4487 2011-04-11  Ian Lance Taylor  <iant@google.com>
4488
4489         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4490         initialize local variable v.
4491
4492 2011-04-11  Cary Coutant  <ccoutant@google.com>
4493
4494         * archive.cc (Archive::include_member): Adjust call to
4495         report_object.
4496         (Add_archive_symbols::run): Track argument serial numbers.
4497         (Lib_group::include_member): Likewise.
4498         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4499         * archive.h (Incremental_archive_entry::Archive_member):
4500         Initialize arg_serial_.
4501         (Archive_member::arg_serial_): New data member.
4502         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4503         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4504         incremental link.
4505         (Sized_dynobj::do_for_all_local_got_entries): New function.
4506         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4507         function.
4508         * fileread.cc (get_mtime): New function.
4509         * fileread.h (get_mtime): New function.
4510         * gold.cc (queue_initial_tasks): Check for incremental update.
4511         (process_incremental_input): New function.
4512         (queue_middle_tasks): Don't force valid target for incremental
4513         update.
4514         * incremental-dump.cc (find_input_containing_global): Adjust
4515         size of symbol info entry.
4516         (dump_incremental_inputs): Dump argument serial number and
4517         in_system_directory flag; bias shndx by 1; print symbol names
4518         when dumping per-file symbol lists; use new symbol info readers.
4519         * incremental.cc
4520         (Output_section_incremental_inputs:update_data_size): New function.
4521         (Sized_incremental_binary::setup_readers): Setup input readers
4522         for each input file; build maps for files added from libraries
4523         and scripts.
4524         (Sized_incremental_binary::check_input_args): New function.
4525         (Sized_incremental_binary::do_check_inputs): Build map of argument
4526         serial numbers to input arguments.
4527         (Sized_incremental_binary::do_file_has_changed): Rename
4528         do_file_is_unchanged to this; compare file modification times.
4529         (Sized_incremental_binary::do_init_layout): New function.
4530         (Sized_incremental_binary::do_reserve_layout): New function.
4531         (Sized_incremental_binary::do_get_input_reader): Remove.
4532         (Sized_incremental_binary::get_symtab_view): New function.
4533         (Incremental_checker::can_incrementally_link_output_file): Remove.
4534         (Incremental_inputs::report_command_line): Exclude --debug options.
4535         (Incremental_inputs::report_archive_begin): Add parameter; track
4536         argument serial numbers; don't put input file entry for archive
4537         before archive members.
4538         (Incremental_inputs::report_archive_end): Put input file entry
4539         for archive after archive members.
4540         (Incremental_inputs::report_object): Add parameter; track argument
4541         serial numbers and in_system_directory flag.
4542         (Incremental_inputs::report_script): Add parameter; track argument
4543         serial numbers.
4544         (Output_section_incremental_inputs::set_final_data_size): Adjust
4545         size of symbol info entry; check for forwarding symbols.
4546         (Output_section_incremental_inputs::write_input_files): Write
4547         in_system_directory flag and argument serial number.
4548         (Output_section_incremental_inputs::write_info_blocks): Map section
4549         indices between incremental info and original input file; store
4550         input section index for each symbol.
4551         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4552         change operator() to visit().
4553         (class Global_got_offset_visitor): Likewise.
4554         (class Global_symbol_visitor_got_plt):
4555         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4556         classes.
4557         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4558         (Sized_incr_relobj::do_read_symbols): New function.
4559         (Sized_incr_relobj::do_layout): New function.
4560         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4561         (Sized_incr_relobj::do_add_symbols): New function.
4562         (Sized_incr_relobj::do_should_include_member): New function.
4563         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4564         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4565         (Sized_incr_relobj::do_section_size): New function.
4566         (Sized_incr_relobj::do_section_name): New function.
4567         (Sized_incr_relobj::do_section_contents): New function.
4568         (Sized_incr_relobj::do_section_flags): New function.
4569         (Sized_incr_relobj::do_section_entsize): New function.
4570         (Sized_incr_relobj::do_section_address): New function.
4571         (Sized_incr_relobj::do_section_type): New function.
4572         (Sized_incr_relobj::do_section_link): New function.
4573         (Sized_incr_relobj::do_section_info): New function.
4574         (Sized_incr_relobj::do_section_addralign): New function.
4575         (Sized_incr_relobj::do_initialize_xindex): New function.
4576         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4577         (Sized_incr_relobj::do_read_relocs): New function.
4578         (Sized_incr_relobj::do_gc_process_relocs): New function.
4579         (Sized_incr_relobj::do_scan_relocs): New function.
4580         (Sized_incr_relobj::do_count_local_symbols): New function.
4581         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4582         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4583         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4584         (Sized_incr_relobj::do_relocate): New function.
4585         (Sized_incr_relobj::do_set_section_offset): New function.
4586         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4587         (Sized_incr_dynobj::do_read_symbols): New function.
4588         (Sized_incr_dynobj::do_layout): New function.
4589         (Sized_incr_dynobj::do_add_symbols): New function.
4590         (Sized_incr_dynobj::do_should_include_member): New function.
4591         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4592         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4593         (Sized_incr_dynobj::do_section_size): New function.
4594         (Sized_incr_dynobj::do_section_name): New function.
4595         (Sized_incr_dynobj::do_section_contents): New function.
4596         (Sized_incr_dynobj::do_section_flags): New function.
4597         (Sized_incr_dynobj::do_section_entsize): New function.
4598         (Sized_incr_dynobj::do_section_address): New function.
4599         (Sized_incr_dynobj::do_section_type): New function.
4600         (Sized_incr_dynobj::do_section_link): New function.
4601         (Sized_incr_dynobj::do_section_info): New function.
4602         (Sized_incr_dynobj::do_section_addralign): New function.
4603         (Sized_incr_dynobj::do_initialize_xindex): New function.
4604         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4605         (make_sized_incremental_object): New function.
4606         (Incremental_library::copy_unused_symbols): New function.
4607         (Incremental_library::do_for_all_unused_symbols): New function.
4608         * incremental.h (enum Incremental_input_flags): New type.
4609         (class Incremental_checker): Remove.
4610         (Incremental_input_entry::Incremental_input_entry): Add argument
4611         serial number.
4612         (Incremental_input_entry::arg_serial): New function.
4613         (Incremental_input_entry::set_is_in_system_directory): New function.
4614         (Incremental_input_entry::is_in_system_directory): New function.
4615         (Incremental_input_entry::arg_serial_): New data member.
4616         (Incremental_input_entry::is_in_system_directory_): New data member.
4617         (class Script_info): Move here from script.h.
4618         (Script_info::Script_info): Add filename parameter.
4619         (Script_info::filename): New function.
4620         (Script_info::filename_): New data member.
4621         (Incremental_script_entry::Incremental_script_entry): Add argument
4622         serial number.
4623         (Incremental_object_entry::Incremental_object_entry): Likewise.
4624         (Incremental_object_entry::add_input_section): Build list of input
4625         sections with map to original shndx.
4626         (Incremental_object_entry::get_input_section_index): New function.
4627         (Incremental_object_entry::shndx_): New data member.
4628         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4629         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4630         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4631         serial number.
4632         (Incremental_inputs::report_archive_begin): Likewise.
4633         (Incremental_inputs::report_object): Likewise.
4634         (Incremental_inputs::report_script): Likewise.
4635         (class Incremental_global_symbol_reader): New class.
4636         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4637         and store flags and input file type.
4638         (Incremental_input_entry_reader::arg_serial): New function.
4639         (Incremental_input_entry_reader::type): Extract type from flags.
4640         (Incremental_input_entry_reader::is_in_system_directory): New function.
4641         (Incremental_input_entry_reader::get_input_section_count): Call
4642         accessor function for type.
4643         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4644         function for type; adjust size of global symbol entry.
4645         (Incremental_input_entry_reader::get_global_symbol_count): Call
4646         accessor function for type.
4647         (Incremental_input_entry_reader::get_object_count): Likewise.
4648         (Incremental_input_entry_reader::get_object_offset): Likewise.
4649         (Incremental_input_entry_reader::get_member_count): Likewise.
4650         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4651         (Incremental_input_entry_reader::get_member_offset): Likewise.
4652         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4653         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4654         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4655         (Incremental_input_entry_reader::get_global_symbol_reader): New
4656         function.
4657         (Incremental_input_entry_reader::get_output_symbol_index): New
4658         function.
4659         (Incremental_input_entry_reader::type_): Remove.
4660         (Incremental_input_entry_reader::flags_): New data member.
4661         (Incremental_inputs_reader::input_file_offset): New function.
4662         (Incremental_inputs_reader::input_file_index): New function.
4663         (Incremental_inputs_reader::input_file): Call input_file_offset.
4664         (Incremental_inputs_reader::input_file_at_offset): New function.
4665         (Incremental_relocs_reader::get_r_type): Reformat.
4666         (Incremental_relocs_reader::get_r_shndx): Reformat.
4667         (Incremental_relocs_reader::get_r_offset): Reformat.
4668         (Incremental_relocs_reader::data): New function.
4669         (Incremental_binary::Incremental_binary): Initialize new data members.
4670         (Incremental_binary::check_inputs): Add cmdline parameter.
4671         (Incremental_binary::file_is_unchanged): Remove.
4672         (Input_reader::arg_serial): New function.
4673         (Input_reader::get_unused_symbol_count): New function.
4674         (Input_reader::get_unused_symbol): New function.
4675         (Input_reader::do_arg_serial): New function.
4676         (Input_reader::do_get_unused_symbol_count): New function.
4677         (Input_reader::do_get_unused_symbol): New function.
4678         (Incremental_binary::input_file_count): New function.
4679         (Incremental_binary::get_input_reader): Change signature to use
4680         index instead of filename.
4681         (Incremental_binary::file_has_changed): New function.
4682         (Incremental_binary::get_input_argument): New function.
4683         (Incremental_binary::get_library): New function.
4684         (Incremental_binary::get_script_info): New function.
4685         (Incremental_binary::init_layout): New function.
4686         (Incremental_binary::reserve_layout): New function.
4687         (Incremental_binary::output_file): New function.
4688         (Incremental_binary::do_check_inputs): New function.
4689         (Incremental_binary::do_file_is_unchanged): Remove.
4690         (Incremental_binary::do_file_has_changed): New function.
4691         (Incremental_binary::do_init_layout): New function.
4692         (Incremental_binary::do_reserve_layout): New function.
4693         (Incremental_binary::do_input_file_count): New function.
4694         (Incremental_binary::do_get_input_reader): Change signature.
4695         (Incremental_binary::input_args_map_): New data member.
4696         (Incremental_binary::library_map_): New data member.
4697         (Incremental_binary::script_map_): New data member.
4698         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4699         new data members.
4700         (Sized_incremental_binary::output_section): New function.
4701         (Sized_incremental_binary::inputs_reader): Add const.
4702         (Sized_incremental_binary::symtab_reader): Add const.
4703         (Sized_incremental_binary::relocs_reader): Add const.
4704         (Sized_incremental_binary::got_plt_reader): Add const.
4705         (Sized_incremental_binary::get_symtab_view): New function.
4706         (Sized_incremental_binary::Inputs_reader): New typedef.
4707         (Sized_incremental_binary::Input_entry_reader): New typedef.
4708         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4709         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4710         (Sized_incremental_binary::do_file_has_changed): New function.
4711         (Sized_incremental_binary::do_init_layout): New function.
4712         (Sized_incremental_binary::do_reserve_layout): New function.
4713         (Sized_input_reader::Inputs_reader): Remove.
4714         (Sized_input_reader::Input_entry_reader): Remove.
4715         (Sized_input_reader::do_arg_serial): New function.
4716         (Sized_input_reader::do_get_unused_symbol_count): New function.
4717         (Sized_input_reader::do_get_unused_symbol): New function.
4718         (Sized_incremental_binary::do_input_file_count): New function.
4719         (Sized_incremental_binary::do_get_input_reader): Change signature;
4720         use index instead of filename.
4721         (Sized_incremental_binary::section_map_): New data member.
4722         (Sized_incremental_binary::input_entry_readers_): New data member.
4723         (class Sized_incr_relobj): New class.
4724         (class Sized_incr_dynobj): New class.
4725         (make_sized_incremental_object): New function.
4726         (class Incremental_library): New class.
4727         * layout.cc (Free_list::num_lists): New static data member.
4728         (Free_list::num_nodes): New static data member.
4729         (Free_list::num_removes): New static data member.
4730         (Free_list::num_remove_visits): New static data member.
4731         (Free_list::num_allocates): New static data member.
4732         (Free_list::num_allocate_visits): New static data member.
4733         (Free_list::init): New function.
4734         (Free_list::remove): New function.
4735         (Free_list::allocate): New function.
4736         (Free_list::dump): New function.
4737         (Free_list::print_stats): New function.
4738         (Layout_task_runner::run): Resize output file for incremental updates.
4739         (Layout::Layout): Initialize new data members.
4740         (Layout::set_incremental_base): New function.
4741         (Layout::init_fixed_output_section): New function.
4742         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4743         incremental updates.
4744         (Layout::create_gold_note): Do not create gold note section for
4745         incremental updates.
4746         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4747         for incremental updates.
4748         (Layout::set_section_offsets): For incremental updates, allocate space
4749         from free list.
4750         (Layout::create_symtab_sections): Layout with offsets relative to
4751         start of section; for incremental updates, allocate space from free
4752         list.
4753         (Layout::create_shdrs): For incremental updates, allocate space from
4754         free list.
4755         (Layout::finish_dynamic_section): For incremental updates, do not
4756         check --as-needed (fixed in subsequent patch).
4757         * layout.h (class Free_list): New class.
4758         (Layout::set_incremental_base): New function.
4759         (Layout::incremental_base): New function.
4760         (Layout::init_fixed_output_section): New function.
4761         (Layout::allocate): New function.
4762         (Layout::incremental_base_): New data member.
4763         (Layout::free_list_): New data member.
4764         * main.cc (main): Print Free_list statistics.
4765         * object.cc (Relobj::finalize_incremental_relocs): Add
4766         clear_counts parameter; clear counts only when clear_counts is set.
4767         (Sized_relobj::Sized_relobj): Initialize new base class.
4768         (Sized_relobj::do_layout): Don't report special sections.
4769         (Sized_relobj::do_for_all_local_got_entries): New function.
4770         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4771         symtab_off to all symbol table offsets.
4772         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4773         * object.h (class Got_offset_list): Move to top of file.
4774         (Object::Object): Allow case where input_file == NULL.
4775         (Object::~Object): Likewise.
4776         (Object::input_file): Assert that input_file != NULL.
4777         (Object::lock): Allow case where input_file == NULL.
4778         (Object::unlock): Likewise.
4779         (Object::is_locked): Likewise.
4780         (Object::token): Likewise.
4781         (Object::release): Likewise.
4782         (Object::is_incremental): New function.
4783         (Object::get_mtime): New function.
4784         (Object::for_all_local_got_entries): New function.
4785         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4786         (Object::set_is_in_system_directory): New function.
4787         (Object::is_in_system_directory): New function.
4788         (Object::do_is_incremental): New function.
4789         (Object::do_get_mtime): New function.
4790         (Object::do_for_all_local_got_entries): New function.
4791         (Object::is_in_system_directory_): New data member.
4792         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4793         (class Sized_relobj_base): New class.
4794         (class Sized_relobj): Derive from Sized_relobj_base.
4795         (class Sized_relobj::Symbols): Redeclare from base class.
4796         (class Sized_relobj::local_got_offset_list): Remove.
4797         (class Sized_relobj::Output_sections): Redeclare from base class.
4798         (class Sized_relobj::do_for_all_local_got_entries): New function.
4799         (class Sized_relobj::write_local_symbols): Add offset parameter.
4800         (class Sized_relobj::local_symbol_offset_): Update comment.
4801         (class Sized_relobj::local_dynsym_offset_): Update comment.
4802         * options.cc (Input_arguments::add_file): Remove const.
4803         * options.h (Input_file_argument::Input_file_argument):
4804         Initialize arg_serial_ (all constructors).
4805         (Input_file_argument::set_arg_serial): New function.
4806         (Input_file_argument::arg_serial): New function.
4807         (Input_file_argument::arg_serial_): New data member.
4808         (Input_arguments::Input_arguments): Initialize file_count_.
4809         (Input_arguments::add_file): Remove const.
4810         (Input_arguments::number_of_input_files): New function.
4811         (Input_arguments::file_count_): New data member.
4812         (Command_line::number_of_input_files): Call
4813         Input_arguments::number_of_input_files.
4814         * output.cc (Output_segment_headers::Output_segment_headers):
4815         Set current size.
4816         (Output_section::Input_section::current_data_size): New function.
4817         (Output_section::Output_section): Initialize new data members.
4818         (Output_section::add_input_section): Don't do merge sections for
4819         an incremental link; allocate space from free list for an
4820         incremental update.
4821         (Output_section::add_output_section_data): Allocate space from
4822         free list for an incremental update.
4823         (Output_section::update_data_size): New function.
4824         (Output_section::set_fixed_layout): New function.
4825         (Output_section::reserve): New function.
4826         (Output_segment::set_section_addresses): Remove const.
4827         (Output_segment::set_section_list_addresses): Remove const; allocate
4828         space from free list for an incremental update.
4829         (Output_segment::set_offset): Adjust size of RELRO segment for an
4830         incremental update.
4831         * output.h (Output_data::current_data_size): Move here from
4832         child classes.
4833         (Output_data::pre_finalize_data_size): New function.
4834         (Output_data::update_data_size): New function.
4835         (Output_section_headers::update_data_size): new function.
4836         (Output_section_data_build::current_data_size): Move to Output_data.
4837         (Output_data_strtab::update_data_size): New function.
4838         (Output_section::current_data_size): Move to Output_data.
4839         (Output_section::set_fixed_layout): New function.
4840         (Output_section::has_fixed_layout): New function.
4841         (Output_section::reserve): New function.
4842         (Output_section::update_data_size): New function.
4843         (Output_section::has_fixed_layout_): New data member.
4844         (Output_section::free_list_): New data member.
4845         (Output_segment::set_section_addresses): Remove const.
4846         (Output_segment::set_section_list_addresses): Remove const.
4847         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4848         New function.
4849         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4850         New function.
4851         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4852         parameter when calling Add_symbols constructor; store argument
4853         serial number for members of a lib group.
4854         (Add_symbols::locks): Allow case where token == NULL.
4855         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4856         (Read_member::~Read_member): New function.
4857         (Read_member::is_runnable): New function.
4858         (Read_member::locks): New function.
4859         (Read_member::run): New function.
4860         (Check_script::~Check_script): New function.
4861         (Check_script::is_runnable): New function.
4862         (Check_script::locks): New function.
4863         (Check_script::run): New function.
4864         (Check_library::~Check_library): New function.
4865         (Check_library::is_runnable): New function.
4866         (Check_library::locks): New function.
4867         (Check_library::run): New function.
4868         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4869         (Add_symbols::library_): New data member.
4870         (class Read_member): New class.
4871         (class Check_script): New class.
4872         (class Check_library): New class.
4873         * reloc.cc (Read_relocs::is_runnable): Allow case where
4874         token == NULL.
4875         (Read_relocs::locks): Likewise.
4876         (Scan_relocs::locks): Likewise.
4877         (Relocate_task::locks): Likewise.
4878         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4879         to clear counters.
4880         (Sized_relobj::incremental_relocs_scan): Fix comment.
4881         (Sized_relobj::do_relocate): Pass output file offset to
4882         write_local_symbols.
4883         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4884         from class declaration.
4885         * script.cc (read_input_script): Allocate Script_info; pass
4886         argument serial number to report_script.
4887         * script.h (class Script_info): Move to incremental.h.
4888         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4889         * symtab.h (Symbol_table::add_from_incrobj): New function.
4890         (Symbol_table::set_file_offset): New function.
4891
4892 2011-04-05  Cary Coutant  <ccoutant@google.com>
4893
4894         * incremental-dump.cc (dump_incremental_inputs): Change signature
4895         to take a Sized_incremental_binary; change caller.  Use readers
4896         in Sized_incremental_binary.
4897         * incremental.cc
4898         (Sized_incremental_binary::find_incremental_inputs_sections):
4899         Rename do_find_incremental_inputs_sections to this.
4900         (Sized_incremental_binary::setup_readers): New function.
4901         (Sized_incremental_binary::do_check_inputs): Check
4902         has_incremental_info_ flag; move setup code to setup_readers;
4903         use input readers.
4904         (Sized_incremental_binary::do_file_is_unchanged): New function.
4905         (Sized_incremental_binary::do_get_input_reader): New function.
4906         * incremental.h (class Incremental_binary): Move to end of file.
4907         (Incremental_binary::file_is_unchanged): New function.
4908         (Incremental_binary::do_file_is_unchanged): New function.
4909         (Incremental_binary::Input_reader): New class.
4910         (Incremental_binary::get_input_reader): New function.
4911         (class Sized_incremental_binary): Move to end of file.
4912         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4913         input section reader classes.
4914         (Sized_incremental_binary::has_incremental_info): New function.
4915         (Sized_incremental_binary::inputs_reader): New function.
4916         (Sized_incremental_binary::symtab_reader): New function.
4917         (Sized_incremental_binary::relocs_reader): New function.
4918         (Sized_incremental_binary::got_plt_reader): New function.
4919         (Sized_incremental_binary::do_file_is_unchanged): New function.
4920         (Sized_incremental_binary::Sized_input_reader): New class.
4921         (Sized_incremental_binary::get_input_reader): New function.
4922         (Sized_incremental_binary::find_incremental_inputs_sections):
4923         Rename do_find_incremental_inputs_sections to this.
4924         (Sized_incremental_binary::setup_readers): New function.
4925         (Sized_incremental_binary::has_incremental_info_): New data member.
4926         (Sized_incremental_binary::inputs_reader_): New data member.
4927         (Sized_incremental_binary::symtab_reader_): New data member.
4928         (Sized_incremental_binary::relocs_reader_): New data member.
4929         (Sized_incremental_binary::got_plt_reader_): New data member.
4930         (Sized_incremental_binary::current_input_file_): New data member.
4931
4932 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4933
4934         PR gold/12640
4935         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4936         violation.
4937
4938 2011-03-30  Cary Coutant  <ccoutant@google.com>
4939
4940         * archive.cc (Archive::include_member): Adjust call to report_object.
4941         (Add_archive_symbols::run): Add script_info to call to
4942         report_archive_begin.
4943         (Lib_group::include_member): Adjust call to report_object.
4944         (Add_lib_group_symbols::run): Adjust call to report_object.
4945         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4946         blocks.  Add object count for script input files.
4947         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4948         script_info parameter; change all callers.
4949         (Incremental_inputs::report_object): Add script_info parameter;
4950         change all callers.
4951         (Incremental_inputs::report_script): Store backpointer to
4952         incremental info entry.
4953         (Output_section_incremental_inputs::set_final_data_size): Record
4954         additional information for scripts.
4955         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4956         * incremental.h (Incremental_script_entry::add_object): New function.
4957         (Incremental_script_entry::get_object_count): New function.
4958         (Incremental_script_entry::get_object): New function.
4959         (Incremental_script_entry::objects_): New data member; adjust
4960         constructor.
4961         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4962         (Incremental_inputs::report_object): Add script_info parameter.
4963         (Incremental_inputs_reader::get_object_count): New function.
4964         (Incremental_inputs_reader::get_object_offset): New function.
4965         * options.cc (Input_arguments::add_file): Return reference to
4966         new input argument.
4967         * options.h (Input_argument::set_script_info): New function.
4968         (Input_argument::script_info): New function.
4969         (Input_argument::script_info_): New data member; adjust all
4970         constructors.
4971         (Input_file_group::add_file): Return reference to new input argument.
4972         (Input_file_lib::add_file): Likewise.
4973         (Input_arguments::add_file): Likewise.
4974         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4975         * script.cc (Parser_closure::Parser_closure): Add script_info
4976         parameter; adjust all callers.
4977         (Parser_closure::script_info): New function.
4978         (Parser_closure::script_info_): New data member.
4979         (read_input_script): Report scripts earlier to incremental info.
4980         (script_add_file): Set script_info in Input_argument.
4981         (script_add_library): Likewise.
4982         * script.h (Script_options::Script_info): Rewrite class.
4983
4984 2011-03-29  Cary Coutant  <ccoutant@google.com>
4985
4986         * archive.cc (Library_base::should_include_member): Move
4987         method here from class Archive.
4988         (Archive::Archive): Initialize base class.
4989         (Archive::should_include_member): Move to base class.
4990         (Archive::do_for_all_unused_symbols): New function.
4991         (Add_archive_symbols::run): Remove redundant access to
4992         incremental_inputs.
4993         (Lib_group::Lib_group): Initialize base class.
4994         (Lib_group::do_filename): New function.
4995         (Lib_group::include_member): Pass pointer to Lib_group to
4996         report_object.
4997         (Lib_group::do_for_all_unused_symbols): New function.
4998         (Add_lib_group_symbols::run): Report archive information for
4999         incremental links.
5000         * archive.h (class Library_base): New base class.
5001         (class Archive): Derive from Library_base.
5002         (Archive::filename): Move to base class.
5003         (Archive::set_incremental_info): Likewise.
5004         (Archive::incremental_info): Likewise.
5005         (Archive::Should_include): Likewise.
5006         (Archive::should_include_member): Likewise.
5007         (Archive::Armap_entry): Remove.
5008         (Archive::Unused_symbol_iterator): Remove.
5009         (Archive::unused_symbols_begin): Remove.
5010         (Archive::unused_symbols_end): Remove.
5011         (Archive::do_filename): New function.
5012         (Archive::do_get_mtime): New function.
5013         (Archive::do_for_all_unused_symbols): New function.
5014         (Archive::task_): Move to base class.
5015         (Archive::incremental_info_): Likewise.
5016         (class Lib_group): Derive from Library_base.
5017         (Lib_group::do_filename): New function.
5018         (Lib_group::do_get_mtime): New function.
5019         (Lib_group::do_for_all_unused_symbols): New function.
5020         (Lib_group::task_): Move to base class.
5021         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5022         function.
5023         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5024         function.
5025         * incremental.cc (Incremental_inputs::report_archive_begin):
5026         Use Library_base; call library's get_mtime; add incremental inputs
5027         entry before members.
5028         (class Unused_symbol_visitor): New class.
5029         (Incremental_inputs::report_archive_end): Use Library_base; use
5030         visitor class to record unused symbols; don't add incremental inputs
5031         entry after members.
5032         (Incremental_inputs::report_object): Use Library_base.
5033         * incremental.h
5034         (Incremental_archive_entry::Incremental_archive_entry): Remove
5035         unused Archive parameter.
5036         (Incremental_inputs::report_archive_begin): Use Library_base.
5037         (Incremental_inputs::report_archive_end): Likewise.
5038         (Incremental_inputs::report_object): Likewise.
5039         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5040         function.
5041         * object.h (Object::for_all_global_symbols): New function.
5042         (Object::do_for_all_global_symbols): New function.
5043         (Sized_relobj::do_for_all_global_symbols): New function.
5044         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5045         function.
5046         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5047         function.
5048
5049 2011-03-27  Ian Lance Taylor  <iant@google.com>
5050
5051         * archive.cc (Archive::interpret_header): Return -1 if something
5052         goes wrong.  Change callers accordingly.
5053
5054 2011-03-25  Cary Coutant  <ccoutant@google.com>
5055
5056         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5057         * testsuite/Makefile.in: Regenerate.
5058
5059 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5060
5061         * plugin.cc (get_view): New.
5062         (Plugin::load): Pass get_view to the plugin.
5063         (Plugin_manager::get_view): New.
5064
5065 2011-03-21  Ian Lance Taylor  <iant@google.com>
5066
5067         * testsuite/final_layout.sh: Rewrite to not use dc.
5068         * testsuite/relro_test.sh: Fail if dc is not present.
5069
5070 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5071
5072         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5073         Change == to -eq.
5074         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5075         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5076         Change == to -eq.
5077         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5078         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5079
5080 2011-03-14  Ian Lance Taylor  <iant@google.com>
5081
5082         * script-sections.cc (Sort_output_sections::script_compare):
5083         Rename from is_before, change return type.
5084         (Sort_output_sections::operator()): Adjust accordingly.
5085
5086 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5087
5088         PR gold/12572
5089         * testsuite/odr_violation2.cc: Add comment to make all error line
5090         numbers double digits.
5091         * testsuite/debug_msg.sh: Adjust expected errors.
5092
5093 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5094
5095         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5096         but mark earlier ones as non-canonical
5097         (offset_to_iterator): Update search target and example
5098         (do_addr2line): Return extra lines in a vector*
5099         (format_file_lineno): Extract from do_addr2line
5100         (one_addr2line): Add vector* out-param
5101         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5102         when a lineno entry appeared last for its instruction
5103         (Dwarf_line_info): Add vector* out-param
5104         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5105         * symtab.cc (Odr_violation_compare): Include the lineno in the
5106         comparison again.
5107         (linenos_from_loc): New. Combine the canonical line for an
5108         address with its other lines.
5109         (True_if_intersect): New. Helper functor to make
5110         std::set_intersection a query.
5111         (detect_odr_violations): Compare sets of lines instead of just
5112         one line for each function. This became less deterministic, but
5113         has fewer false positives.
5114         * symtab.h: Declarations.
5115         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5116         mix an optimized and non-optimized object in the same binary
5117         (odr_violation2.so): Same.
5118         * testsuite/Makefile.in: Regenerate from Makefile.am.
5119         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5120         * testsuite/debug_msg.sh: Update line numbers and add
5121         assertions.
5122         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5123         non-optimized context.
5124         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5125         isn't inlined, and use OdrDerived in an optimized context.
5126         * testsuite/odr_header1.h: Defines OdrDerived, where
5127         optimization will change the
5128         first-instruction-in-the-destructor's file and line number.
5129         * testsuite/odr_header2.h: Defines OdrBase.
5130
5131 2011-03-09  Ian Lance Taylor  <iant@google.com>
5132
5133         * fileread.cc (File_read::clear_views): Don't delete the whole
5134         file view.
5135
5136 2011-03-08  Ian Lance Taylor  <iant@google.com>
5137
5138         PR gold/12525
5139         * fileread.cc: #include <climits>.
5140         (GOLD_IOV_MAX): Define.
5141         (File_read::read_multiple): Limit number of entries by iov_max.
5142         * fileread.h (class File_read): Always set max_readv_entries to
5143         128.
5144
5145 2011-03-07  Ian Lance Taylor  <iant@google.com>
5146
5147         PR gold/12525
5148         * options.h (class General_options): Add -dy and -dn.
5149
5150 2011-03-02  Cary Coutant  <ccoutant@google.com>
5151
5152         * testsuite/script_test_9.t: Add TLS segment.
5153
5154 2011-03-02  Simon Baldwin  <simonb@google.com>
5155
5156         * configure.ac: Add check for gnu_indirect_function support in
5157         the toolchain building binutils.
5158         * configure: Rebuild.
5159
5160 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5161
5162         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5163         plugin only symbols.
5164         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5165         in plugin files as not needed in the symbol table.
5166
5167 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5168
5169         * output.cc (Output_section::add_input_section): Delay fill
5170         generation for section ordering.
5171
5172 2011-02-09  Ian Lance Taylor  <iant@google.com>
5173
5174         PR gold/12316
5175         * object.h (class Sized_relobj): Remove clear_local_symbols.
5176         * reloc.cc (Sized_relobj::do_relocate): Don't call
5177         clear_local_symbols.
5178
5179 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5180
5181         * plugin.cc (is_visible_from_outside): Return true for symbols
5182         in the -u option.
5183
5184 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5185
5186         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5187         filename.
5188
5189 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5190
5191         * icf.h (is_section_foldable_candidate): Change type of parameter
5192         to std::string.
5193         * icf.cc (Icf::find_identical_sections): Change type of local variable
5194         section_name to be std::string.
5195         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5196
5197 2011-01-25  Ian Lance Taylor  <iant@google.com>
5198
5199         * script.cc (script_add_extern): Rewrite to use
5200         add_symbol_reference.
5201
5202 2011-01-25  Doug Kwan  <dougkwan@google.com>
5203
5204         * icf.cc (get_section_contents): Always lock section's object.
5205
5206 2011-01-24  Ian Lance Taylor  <iant@google.com>
5207
5208         * options.h (class General_options): Accept
5209         --no-detect-odr-violations.
5210
5211 2011-01-24  Ian Lance Taylor  <iant@google.com>
5212
5213         * version.cc (version_string): Bump to 1.11.
5214
5215 2011-01-24  Ian Lance Taylor  <iant@google.com>
5216
5217         * plugin.cc (class Plugin_rescan): Define new class.
5218         (Plugin_manager::claim_file): Set any_claimed_.
5219         (Plugin_manager::save_archive): New function.
5220         (Plugin_manager::save_input_group): New function.
5221         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5222         necessary.
5223         (Plugin_manager::new_undefined_symbol): New function.
5224         (Plugin_manager::rescan): New function.
5225         (Plugin_manager::rescannable_defines): New function.
5226         (Plugin_manager::add_input_file): Set any_added_.
5227         * plugin.h (class Plugin_manager): define new fields rescannable_,
5228         undefined_symbols_, any_claimed_, and any_added_.  Declare
5229         Plugin_rescan as friend.  Declare new functions.
5230         (Plugin_manager::Rescannable): Define type.
5231         (Plugin_manager::Rescannable_list): Define type.
5232         (Plugin_manager::Undefined_symbol_list): Define type.
5233         (Plugin_manager::Plugin_manager): Initialize new fields.
5234         * archive.cc (Archive::defines_symbol): New function.
5235         (Add_archive_symbols::run): Pass archive to plugins if any.
5236         * archive.h (class Archive): Declare defines_symbol.
5237         * readsyms.cc (Input_group::~Input_group): New function.
5238         (Finish_group::run): Pass input_group to plugins if any.
5239         * readsyms.h (class Input_group): Declare destructor.
5240         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5241         any.
5242
5243 2011-01-10  Ian Lance Taylor  <iant@google.com>
5244
5245         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5246         section as relro.
5247         (Layout::set_segment_offsets): Reset increase_relro before calling
5248         set_section_addresses a second time.
5249
5250 2011-01-04  Cary Coutant  <ccoutant@google.com>
5251
5252         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5253         sections before NOBITS sections.
5254
5255 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5256
5257         * version.cc (print_version): Update copyright to 2011.
5258
5259 2010-12-23  Cary Coutant  <ccoutant@google.com>
5260
5261         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5262         of OS to this->add.  Add OD parameter to second form of the function.
5263
5264 2010-12-20  Ian Lance Taylor  <iant@google.com>
5265
5266         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5267         second of two consecutive entries with same offset.
5268
5269 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5270
5271         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5272         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5273         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5274         to avoid unneeded links against $(LDADD).
5275         * testsuite/Makefile.in: Regenerate.
5276
5277 2010-12-15  Ian Lance Taylor  <iant@google.com>
5278
5279         PR gold/12324
5280         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5281         for R_X86_64_32 and R_X86_64_PC32.
5282         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5283         ver_matching_def_pic.o.
5284         (ver_matching_def_pic.o): New target.
5285
5286 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5287
5288         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5289         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5290         Move definition before File_read::View member definitions.
5291         (File_read::View::~View): Initialize and hold lock before
5292         updating current_mapped_bytes.
5293
5294 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5295
5296         * dwarf_reader.cc: Remove outdated comment.
5297         * gold-threads.cc: Fix typo in error message.
5298         * archive.cc: Fix typos in comments.
5299         * archive.h: Likewise.
5300         * arm-reloc-property.cc: Likewise.
5301         * arm-reloc-property.h: Likewise.
5302         * arm-reloc.def: Likewise.
5303         * arm.cc: Likewise.
5304         * attributes.h: Likewise.
5305         * cref.cc: Likewise.
5306         * ehframe.cc: Likewise.
5307         * fileread.h: Likewise.
5308         * gold.h: Likewise.
5309         * i386.cc: Likewise.
5310         * icf.cc: Likewise.
5311         * incremental.h: Likewise.
5312         * int_encoding.cc: Likewise.
5313         * layout.h: Likewise.
5314         * main.cc: Likewise.
5315         * merge.h: Likewise.
5316         * object.cc: Likewise.
5317         * object.h: Likewise.
5318         * options.cc: Likewise.
5319         * readsyms.cc: Likewise.
5320         * reduced_debug_output.cc: Likewise.
5321         * reloc.cc: Likewise.
5322         * script-sections.cc: Likewise.
5323         * sparc.cc: Likewise.
5324         * symtab.h: Likewise.
5325         * target-reloc.h: Likewise.
5326         * target.cc: Likewise.
5327         * target.h: Likewise.
5328         * timer.cc: Likewise.
5329         * timer.h: Likewise.
5330         * x86_64.cc: Likewise.
5331
5332 2010-12-09  Cary Coutant  <ccoutant@google.com>
5333
5334         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5335         stack.
5336         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5337         parameter; change all callers.
5338         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5339         * options.h (warn_execstack): New option.
5340
5341 2010-12-07  Doug Kwan  <dougkwan@google.com>
5342
5343         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5344         like function call relocations.
5345
5346 2010-12-07  Ian Lance Taylor  <iant@google.com>
5347
5348         * archive.cc (Archive::get_elf_object_for_member): Permit
5349         punconfigured to be NULL.
5350         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5351         (Archive::include_member): Pass NULL to get_elf_object_for_member
5352         if we searched for the archive and this is the first included
5353         object.
5354
5355 2010-12-01  Ian Lance Taylor  <iant@google.com>
5356
5357         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5358         track_relocs_type_ field.
5359         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5360         Set track_relocs_type_.
5361         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5362         contents when using RELA relocs.
5363         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5364         reloc_map_.
5365         * reloc.cc (Track_relocs::next_addend): New function.
5366         * reloc.h (class Track_relocs): Declare next_addend.
5367
5368 2010-12-01  Ian Lance Taylor  <iant@google.com>
5369
5370         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5371         virtual destructor.
5372
5373 2010-12-01  Ian Lance Taylor  <iant@google.com>
5374
5375         * README: Update compilers known to work and fail.
5376
5377 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5378
5379         * configure.in: For --enable-gold, handle value `default' instead of
5380         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5381         not the default.
5382         * configure: Regenerate.
5383
5384 2010-11-18  Doug Kwan  <dougkwan@google.com>
5385
5386         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5387         and right_alignment to be zero.  Store result alignment only if it is
5388         greater than existing alignment.
5389
5390 2010-11-16  Cary Coutant  <ccoutant@google.com>
5391
5392         PR gold/12220
5393         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5394         Check for ".zdebug_line".
5395
5396 2010-11-16  Doug Kwan  <dougkwan@google.com>
5397             Cary Coutant  <ccoutant@google.com>
5398
5399         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5400         by reference; adjust all callers.
5401         * output.cc (Output_segment::set_section_addresses): Adjust references
5402         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5403         list is empty.
5404         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5405         end at page boundary.
5406
5407 2010-11-16  Cary Coutant  <ccoutant@google.com>
5408
5409         PR gold/12220
5410         * layout.cc (Layout::choose_output_section): Transform names of
5411         compressed sections even when using a script with a SECTIONS clause.
5412         (Layout::output_section_name): Remove code to transform
5413         compressed debug section names.
5414         * output.cc (Output_section::add_input_section): Use uncompressed
5415         section size when tracking input sections.
5416
5417 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5418
5419         * symtab.h (Symbol::NON_PIC_REF): Remove.
5420         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5421         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5422         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5423         (Symbol::use_plt_offset): Take a flags argument and pass it
5424         directly to needs_dynamic_reloc.  Restrict check for undefined
5425         weak symbols to function calls.
5426         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5427         (Target_arm::Scan::global): Use it.
5428         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5429         (Target_arm::Relocate::relocate): Likewise.
5430         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5431         parameter with an r_type parameter.  Use get_reference_flags
5432         to get the flags.
5433         (Target_arm::Relocate::relocate): Update accordingly.
5434         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5435         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5436         (Target_i386::Scan::global): Likewise.
5437         (Target_i386::Relocate::relocate): Likewise.
5438         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5439         parameter with an r_type parameter.  Use get_reference_flags
5440         to get the flags.
5441         (Target_i386::Relocate::relocate): Update accordingly.
5442         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5443         (Target_powerpc::Scan::global): Use it.
5444         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5445         (Target_powerpc::Relocate::relocate): Likewise.
5446         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5447         (Target_sparc::Scan::global): Use it.
5448         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5449         (Target_sparc::Relocate::relocate): Likewise.
5450         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5451         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5452         (Target_x86_64::Scan::global): Likewise.
5453         (Target_x86_64::Relocate::relocate): Likewise.
5454
5455 2010-11-08  Doug Kwan  <dougkwan@google.com>
5456             Cary Coutant  <ccoutant@google.com>
5457
5458         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5459         (Arm_exidx_merge_section::section_contents_): New data member.
5460         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5461         (Arm_input_section::~Arm_input_section): De-allocate memory.
5462         (Arm_input_section::original_contents_): New data member.
5463         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5464         in parameters instead of calling Object::section_contents without
5465         locking.
5466         (Arm_output_section::group_section): New parameter TASK.  Pass it
5467         to callees that need locking objects.
5468         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5469         to lock EXIDX input sections.  Fix a formatting issue.  Call
5470         Arm_exidx_merged_section::build_contents to create merged section
5471         contents.
5472         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5473         to lock object of stub table owner.
5474         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5475         TEXT_SIZE to initialize data member TEXT_SIZE_.
5476         (Arm_exidx_input_section::addralign): Fix typo in comment.
5477         (Arm_exidx_input_section::text_size): New method.
5478         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5479         that require locking objects.  Lock objects before scanning for stubs
5480         and updating local symbols.
5481         (Arm_input_section<big_endian>::init): Copy contents of original
5482         input section.
5483         (Arm_input_section<big_endian>::do_write): Use saved contents of
5484         original input section instead of calling Object::section_contents
5485         without locking.
5486         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5487         size without calling Object::section_size().
5488         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5489         for size.  Allocate a buffer for merged EXIDX entries.
5490         (Arm_exidx_merged_section::build_contents): New method.
5491         (Arm_exidx_merged_section::do_write): Move merge section contents
5492         building code to Arm_exidx_merged_section::build_contetns.  Write
5493         out contetns in buffer instead of building it on the fly.
5494         (Arm_relobj::make_exidx_input_section): Also pass text section size
5495         to Arm_exidx_input_section constructor.
5496         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5497         (Arm_dynobj::do_read_symbols): Fix memory leak.
5498         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5499         * target.h: (class Task): Add forward declaration.
5500         (Target::relax): Add new parameter TASK and pass it to
5501         Target::do_relax().
5502         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5503
5504 2010-11-05  Cary Coutant  <ccoutant@google.com>
5505
5506         PR gold/10708
5507         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5508         object when reading from the file.
5509         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5510         second layout pass.
5511         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5512         when reading section contents.
5513         (get_section_contents): Likewise.
5514         (icf::find_identical_sections): Likewise.
5515         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5516         object when reading from the file.
5517         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5518         the object when doing deferred section layout.
5519
5520 2010-11-03  Nick Clifton  <nickc@redhat.com>
5521
5522         PR gold/12001
5523         * script.h (class Symbol_assignment: name): New member.  Returns
5524         the name of the symbol.
5525         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5526         Returns true if the given symbol name is on the list of
5527         assignments wating to be processed.
5528         * archive.cc (should_incldue_member): If the symbol is undefined,
5529         check to see if it is on the list of symbols pending assignment.
5530
5531 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5532
5533         * script-sections.cc (Script_sections::find_memory_region): Check
5534         for a NULL output section pointer.
5535
5536 2010-10-29  Doug Kwan  <dougkwan@google.com>
5537
5538         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5539         Output_section::add_relaxed_input_section.
5540         * output.cc (Output_section::add_relaxed_input_section): Add new
5541         arguments LAYOUT and NAME.  Set section order index.
5542         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5543         Copy section order index.
5544         * output.h (Output_section::add_relaxed_input_section): Add new
5545         arguments LAYOUT and NAME.
5546
5547 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5548
5549         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5550         NATIVE_OR_CROSS_LINKER.
5551         * testsuite/Makefile.in: Regenerate.
5552
5553 2010-10-20  Doug Kwan  <dougkwan@google.com>
5554
5555         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5556         without SHF_LINK_ORDER flags.
5557         * layout.cc (Layout::choose_output_section): Do not filter
5558         SHF_LINK_ORDER flag in a relocatable link.
5559
5560 2010-10-17  Cary Coutant  <ccoutant@google.com>
5561
5562         * output.h (Output_segment::set_section_addresses): Change function
5563         signature.  Update all callers.
5564         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5565         sections.
5566         (Output_segment::set_section_addresses): Align after last TLS
5567         section.  Add padding before last relro section instead of after.
5568
5569 2010-10-17  Doug Kwan  <dougkwan@google.com>
5570
5571         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5572         GOT output section to be writable.
5573
5574 2010-10-14  Cary Coutant  <ccoutant@google.com>
5575
5576         * debug.h (DEBUG_INCREMENTAL): New flag.
5577         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5578         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5579         mode.
5580         * incremental.cc (report_command_line): Ignore all forms of
5581         --incremental.
5582         * layout.cc (Layout::Layout): Check parameters for incremental link
5583         mode.
5584         * options.cc (General_options::parse_incremental): New function.
5585         (General_options::parse_no_incremental): New function.
5586         (General_options::parse_incremental_full): New function.
5587         (General_options::parse_incremental_update): New function.
5588         (General_options::incremental_mode_): New data member.
5589         (General_options::finalize): Check incremental_mode_.
5590         * options.h (General_options): Update help text for --incremental.
5591         Add --no-incremental, --incremental-full, --incremental-update.
5592         (General_options::Incremental_mode): New enum type.
5593         (General_options::incremental_mode): New function.
5594         (General_options::incremental_mode_): New data member.
5595         * parameters.cc (Parameters::incremental_mode_): New data member.
5596         (Parameters::set_options): Set incremental_mode_.
5597         (Parameters::set_incremental_full): New function.
5598         (Parameters::incremental): New function.
5599         (Parameters::incremental_update): New function.
5600         (set_parameters_incremental_full): New function.
5601         * parameters.h (Parameters::set_incremental_full): New function.
5602         (Parameters::incremental): New function.
5603         (Parameters::incremental_update): New function.
5604         (Parameters::incremental_mode_): New data member.
5605         (set_parameters_incremental_full): New function.
5606         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5607         incremental link mode.
5608         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5609         (Sized_relobj::do_relocate_sections): Likewise.
5610         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5611         option.
5612         * testsuite/Makefile.in: Regenerate.
5613         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5614
5615 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5616
5617         * script-sections.h (class Script_sections): Make
5618         Sections_elements typedef public.
5619         * script-sections.cc (class Sort_output_sections): Add elements_
5620         field.  Add constructor which sets it; change all callers.
5621         (Sort_output_sections::is_before): New function.
5622         (Sort_output_sections::operator()): Call is_before.
5623         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5624         conditional.
5625         * testsuite/script_test_10.sh: New test. Test script section
5626         order.
5627         * testsuite/script_test_10.t: Likewise.
5628         * testsuite/script_test_10.s: Likewise.
5629         * testsuite/Makefile.am: Wrap the cross linker tests and the
5630         common tests into NATIVE_OR_CROSS_LINKER.
5631         (check_SCRIPTS): Add script_test_10.sh.
5632         (check_DATA): Add script_test_10.stdout.
5633         (script_test_10.o, script_test_10): New targets.
5634         (script_test_10.stdout): New target.
5635         * configure, testsuite/Makefile.in: Regenerate.
5636
5637 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5638
5639         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5640         error for the deprecated relocations.
5641         (Target_arm::Scan::global): Likewise.
5642         (Target_arm::Relocate::relocate): Likewise.
5643
5644 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5645
5646         * fileread.cc (Input_file::find_file): Initialize *found_name
5647         and *namep when using the fallback search for case 4.
5648
5649 2010-10-11  Cary Coutant  <ccoutant@google.com>
5650
5651         * options.h (class General_options): Redefine -z lazy as an alias for
5652         the negation of -z now.
5653
5654 2010-10-11  Ian Lance Taylor  <iant@google.com>
5655
5656         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5657         binding.
5658
5659 2010-10-06  Nick Clifton  <nickc@redhat.com>
5660
5661         * script-sections.cc(class Memory_region): Remove
5662         current_lma_offset_ field.  Rename current_vma_offset_ to
5663         current_offset_.  Add last_section_ field.
5664         (Memory_region::get_current_vma_address): Rename to
5665         get_current_address.
5666         (Memory_region::get_current_lma_address): Delete.
5667         (Memory_region::increment_vma_offset): Rename to
5668         increment_offset.
5669         (Memory_region::increment_lma_offset): Delete.
5670         (Memory_region::attributes_compatible): New method.  Returns
5671         true if the provided section is compatible with the region.
5672         (Memory_region::get_last_section): New method.  Returns the last
5673         section to use the region.
5674         (Memory_region::set_last_section): New method.  Stores the last
5675         section to use the region.
5676         (Script_sections::block_in_region): New method.  Returns true if
5677         a block of memory is contained within a region.
5678         (Script_sections::find_memory_region): New method.  Locates a
5679         memory region to be used to set a VMA or LMA address.
5680         (Output_section_definition::set_section_addresses): Add code to
5681         check for addresses set by memory regions.
5682         (Output_segment::set_section_addresses): Remove memory region
5683         walking code.
5684         (Script_sections::create_segment): Add a warning if a header
5685         segment is created outside of any region.
5686         * script-sections.h (class Script_sections): Add prototypes for
5687         find_memory_region and block_in_region methods.
5688         * testsuite/memory_test.s: Use .long instead of .word.
5689         * testsuite/memory_test.t: Add some more output sections.
5690         * testsuite/memory_test.sh: Update expected output.
5691
5692 2010-10-02  Doug Kwan  <dougkwan@google.com>
5693
5694         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5695         defintion to symtab.h
5696         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5697         declaration to defintion.
5698
5699 2010-10-01  Nick Clifton  <nickc@redhat.com>
5700
5701         * expression.cc (eval): Replace dummy argument with NULL.
5702         (eval_maybe_dot): Check for a NULL result section pointer.
5703         (Symbol_expression::value): Likewise.
5704         (Dot_expression::value): Likewise.
5705         (BINARY_EXPRESSION): Likewise.
5706         (Max_expression::value): Likewise.
5707         (Min_expression::value): Likewise.
5708         (Absolute_expression::value): Likewise.
5709         (Addr_expression::value_from_output_section): Likewise.
5710         (Loaddddr_expression::value_from_output_section): Likewise.
5711         (Segment_start_expression::value): Likewise.
5712         * script-sections.cc
5713         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5714         argument with NULL.
5715         (Sections_elememt_dot_assignment::set_section_addresses):
5716         Likewise.
5717         (Output_data_expression::do_write_to_buffer): Likewise.
5718         (Output_section_definition::finalize_symbols): Likewise.
5719         (Output_section_definition::set_section_addresses): Likewise.
5720
5721 2010-09-30  Doug Kwan  <dougkwan@google.com>
5722
5723         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5724
5725 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5726
5727         * target.h (Target::can_icf_inline_merge_sections): New virtual
5728         function.
5729         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5730         virtual function.
5731         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5732         virtual function.
5733         * icf.cc (get_section_contents): Inline merge sections only when
5734         target allows it.
5735
5736 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5737
5738         * configure: Regenerate.
5739
5740 2010-09-17  Ian Lance Taylor  <iant@google.com>
5741
5742         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5743         * testsuite/Makefile.am (memory_test.o): New target.
5744         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5745         memory_test.t.
5746         * testsuite/Makefile.in: Rebuild.
5747
5748 2010-09-17  Doug Kwan  <dougkwan@google.com>
5749
5750         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5751         defintion if relocation uses GOT entries of the symbol.
5752         * testsuite/icf_safe_test.sh: Fix test.
5753         * testsuite/icf_safe_so_test.sh: Fix test.
5754
5755 2010-09-16  Cary Coutant  <ccoutant@google.com>
5756
5757         * script_sections.cc (class Memory_region): Remove "NULL" from
5758         vector initializations.
5759
5760 2010-09-15  Cary Coutant  <ccoutant@google.com>
5761
5762         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5763         Resolve forwarding symbols.
5764
5765 2010-09-15  Doug Kwan  <dougkwan@google.com>
5766
5767         * gold/testsuite/script_test_3.t: Add ARM special sections.
5768         * gold/testsuite/script_test_4.t: Same.
5769         * gold/testsuite/script_test_5.t: Same.
5770         * gold/testsuite/script_test_6.t: Same.
5771         * gold/testsuite/script_test_7.t: Same.
5772         * gold/testsuite/script_test_7.t: Same.
5773         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5774
5775 2010-09-14  Cary Coutant  <ccoutant@google.com>
5776
5777         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5778         (Target_x86_64::Relocate::relocate_tls): Replace check for
5779         saw_tls_block_reloc_ with test for executable section.
5780
5781 2010-09-12  Cary Coutant  <ccoutant@google.com>
5782
5783         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5784         position-independent executables to shared libraries need dynamic
5785         relocations.
5786         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5787         position-independent executables.
5788         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5789         * testsuite/Makefile.in: Regenerate.
5790
5791 2010-09-10  Nick Clifton  <nickc@redhat.com>
5792
5793         PR gold/11997
5794         * testsuite/memory_test.t: Discard any sections that are not
5795         needed.
5796
5797 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5798
5799         PR gold/11996
5800         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5801         "This::" to work around a bug in gcc 4.2.
5802
5803         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5804
5805 2010-09-09  Rafael Espindola  <espindola@google.com>
5806
5807         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5808         sections with different PF_X flags in the same segment.
5809         (Layout::find_first_load_seg): Search all segments to find the first
5810         one.
5811         * options.h (rosegment): New.
5812
5813 2010-09-08  Rafael Espindola  <espindola@google.com>
5814
5815         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5816
5817 2010-09-08  Doug Kwan  <dougkwan@google.com>
5818
5819         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5820         (Arm_relobj::do_relocate_sections): Add new parameter for output
5821         file to match the parent.
5822         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5823         of local symbols instead of input values.  Update code to track
5824         changes in gold::relocate_section.
5825         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5826         (Sized_relobj::compute_final_local_value_internal): New methods.
5827         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5828         body into private version of Sized_relobj::compute_final_local_value.
5829         Call the inline method.
5830         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5831         merged symbol value if there is one.
5832         (Symbol_value::has_output_value): New method defintiion.
5833         (Sized_relobj::Compute_final_local_value_status): New enum type.
5834         (Sized_relobj::compute_final_local_value): New methods.
5835         (Sized_relobj::compute_final_local_value_internal): New methods.
5836         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5837         and arm_cortex_a8.sh.
5838         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5839         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5840         New tests.
5841         * Makefile.in: Regenerate.
5842         * testsuite/arm_bl_out_of_range.s: Update test.
5843         * testsuite/thumb_bl_out_of_range.s: Ditto.
5844         * testsuite/thumb_blx_out_of_range.s: Ditto.
5845         * testsuite/arm_branch_out_of_range.sh: New file.
5846         * testsuite/arm_cortex_a8.sh: Ditto.
5847         * testsuite/arm_cortex_a8_b.s: Ditto.
5848         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5849         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5850         * testsuite/arm_cortex_a8_bl.s: Ditto.
5851         * testsuite/arm_cortex_a8_blx.s: Ditto.
5852         * testsuite/arm_cortex_a8_local.s: Ditto.
5853         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5854         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5855
5856 2010-09-08  Rafael Espindola  <espindola@google.com>
5857
5858         * Makefile.am (memory_test.stdout): Run readelf with -W.
5859         * Makefile.in: Regenerate.
5860         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5861         64 bit output.
5862
5863 2010-09-08  Rafael Espindola  <espindola@google.com>
5864
5865         * script-sections.cc (Script_sections::add_memory_region): Convert
5866         field precision to int.
5867         * script.cc (script_set_section_region, script_set_section_region):
5868         Convert field precision to int.
5869
5870 2010-09-08  Rafael Espindola  <espindola@google.com>
5871
5872         * arm.cc (do_finalize_sections): Create the __exidx_start and
5873         __exdix_end symbols even when the section is missing.
5874
5875 2010-09-08  Nick Clifton  <nickc@redhat.com>
5876
5877         * README: Remove claim that MEMORY is not supported.
5878         * expression.cc (script_exp_function_origin)
5879         (script_exp_function_length): Move from here to ...
5880         * script.cc: ... here.
5881         (script_set_section_region, script_add_memory)
5882         (script_parse_memory_attr, script_include_directive): New
5883         functions.
5884         * script-sections.cc
5885         (class Memory_region): New class.
5886         (class Output_section_definition): Add set_memory_region,
5887         set_section_vma, set_section_lma and get_section_name methods.
5888         (class Script_Sections): Add add_memory_region,
5889         find_memory_region, find_memory_region_origin,
5890         find_memory_region_length and set_memory_region methods.
5891         Have set_section_addresses method walk the list of set memory
5892         regions.
5893         Extend the print methos to display memory regions.
5894         * script-sections.h: Add prototypes for new methods.
5895         Add enum for MEMORY region attributes.
5896         * yyscript.y: Add support for parsing MEMORY regions.
5897         * script-c.h: Add prototypes for new functions.
5898         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5899         * testsuite/Makefile.in: Regenerate.
5900         * testsuite/memory_test.sh: New script.
5901         * testsuite/memory_test.s: New assembler source file.
5902         * testsuite/memory_test.t: New linker script.
5903
5904 2010-08-27  Doug Kwan  <dougkwan@google.com>
5905
5906         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5907         reference override an existing dynamic weak reference.
5908         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5909         * testsuite/Makefile.in: Regenerate.
5910         * testsuite/dyn_weak_ref.sh: New file.
5911         * testsuite/dyn_weak_ref_1.c: Ditto.
5912         * testsuite/dyn_weak_ref_2.c: Ditto.
5913
5914 2010-08-27  Ian Lance Taylor  <iant@google.com>
5915
5916         * incremental.h (class Incremental_input_entry): Add virtual
5917         destructor.
5918
5919 2010-08-27  Ian Lance Taylor  <iant@google.com>
5920
5921         * testsuite/start_lib_test_3.c: Mark t3 as used.
5922
5923 2010-08-27  Nick Clifton  <nickc@redhat.com>
5924
5925         * options.cc (version_script): Fix small typo in previous
5926         whitespace tidyup.
5927
5928 2010-08-25  Nick Clifton  <nickc@redhat.com>
5929
5930         * archive.cc: Formatting fixes: Remove whitespace between
5931         typename and following asterisk.  Remove whitespace between
5932         function name and opening parenthesis.
5933         * archive.h: Likewise.
5934         * arm.cc: Likewise.
5935         * attributes.cc: Likewise.
5936         * attributes.h: Likewise.
5937         * common.cc: Likewise.
5938         * copy-relocs.cc: Likewise.
5939         * dirsearch.h: Likewise.
5940         * dynobj.cc: Likewise.
5941         * ehframe.cc: Likewise.
5942         * ehframe.h: Likewise.
5943         * expression.cc: Likewise.
5944         * fileread.cc: Likewise.
5945         * fileread.h: Likewise.
5946         * gc.h: Likewise.
5947         * gold-threads.cc: Likewise.
5948         * gold.cc: Likewise.
5949         * i386.cc: Likewise.
5950         * icf.h: Likewise.
5951         * incremental-dump.cc: Likewise.
5952         * incremental.cc: Likewise.
5953         * layout.cc: Likewise.
5954         * layout.h: Likewise.
5955         * main.cc: Likewise.
5956         * merge.cc: Likewise.
5957         * merge.h: Likewise.
5958         * object.cc: Likewise.
5959         * object.h: Likewise.
5960         * options.cc: Likewise.
5961         * options.h: Likewise.
5962         * output.cc: Likewise.
5963         * output.h: Likewise.
5964         * plugin.cc: Likewise.
5965         * plugin.h: Likewise.
5966         * powerpc.cc: Likewise.
5967         * reloc.cc: Likewise.
5968         * script-c.h: Likewise.
5969         * script-sections.cc: Likewise.
5970         * script.cc: Likewise.
5971         * stringpool.cc: Likewise.
5972         * symtab.cc: Likewise.
5973         * symtab.h: Likewise.
5974         * target.cc: Likewise.
5975         * timer.cc: Likewise.
5976         * timer.h: Likewise.
5977         * version.cc: Likewise.
5978         * x86_64.cc: Likewise.
5979
5980 2010-08-24  Nick Clifton  <nickc@redhat.com>
5981
5982         PR 11899
5983         * layout.cc (segment_precedes): Sort segments by their physical
5984         addresses, if they have been set.
5985
5986 2010-08-23  Cary Coutant  <ccoutant@google.com>
5987
5988         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5989         symbols data.
5990         (Lib_group::include_member): Unlock object after deleting its
5991         symbols data.
5992         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5993         the bug fixed here.
5994
5995 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5996             Cary Coutant  <ccoutant@google.com>
5997
5998         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5999         constructor, and set_blocker.
6000         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6001         readsyms_blocker_.
6002         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6003         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6004         * testsuite/Makefile.am (start_lib_test): New test case.
6005         * testsuite/Makefile.in: Regenerate.
6006         * testsuite/start_lib_test_main.c: New file.
6007         * testsuite/start_lib_test_1.c: New file.
6008         * testsuite/start_lib_test_2.c: New file.
6009         * testsuite/start_lib_test_3.c: New file.
6010
6011 2010-08-19  Ian Lance Taylor  <iant@google.com>
6012
6013         * Makefile.in: Rebuild with automake 1.11.1.
6014         * aclocal.m4: Likewise.
6015         * testsuite/Makefile.in: Likewise.
6016
6017 2010-08-19  Ian Lance Taylor  <iant@google.com>
6018
6019         PR 10893
6020         * i386.cc (class Output_data_plt_i386): Update declarations.
6021         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6022         local_ifuncs_ fields.
6023         (Target_i386::do_plt_section_for_global): New function.
6024         (Target_i386::do_plt_section_for_local): New function.
6025         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6026         parameter; change all callers.  Initialize global_ifuncs_ and
6027         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6028         __rel_iplt_end.
6029         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6030         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6031         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6032         symbols.
6033         (Target_i386::make_plt_section): New function, broken out of
6034         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6035         (Target_i386::make_plt_entry): Call make_plt_section.
6036         (Target_i386::make_local_ifunc_plt_entry): New function.
6037         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6038         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6039         R_386_IRELATIVE to switch.
6040         (Target_i386::Scan::global): Likewise.
6041         (Target_i386::Relocate::relocate): Likewise.
6042         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6043         switch.
6044         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6045         (Target_x86_64::do_plt_section_for_global): New function.
6046         (Target_x86_64::do_plt_section_for_local): New function.
6047         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6048         parameter; change all callers.  If doing a static link define
6049         __rela_iplt_start and __rela_iplt_end.
6050         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6051         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6052         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6053         to point to .plt.
6054         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6055         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6056         switch.
6057         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6058         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6059         R_X86_64_IRELATIVE to switch.
6060         (Target_x86_64::Scan::global): Likewise.
6061         (Target_x86_64::Relocate::relocate): Likewise.
6062         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6063         switch.
6064         * target.h (class Target): Add plt_section_for_global and
6065         plt_section_for_local functions.  Add do_plt_section_for_global
6066         and do_plt_section_for_local virtual functions.
6067         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6068         clarifying comments.
6069         (Symbol::use_plt_offset): Handle IFUNC symbol.
6070         * object.cc (Sized_relobj::Sized_relobj): Initialize
6071         local_plt_offsets_.
6072         (Sized_relobj::local_has_plt_offset): New function.
6073         (Sized_relobj::local_plt_offset): New function.
6074         (Sized_relobj::set_local_plt_offset): New function.
6075         (Sized_relobj::do_count): Handle IFUNC symbol.
6076         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6077         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6078         is_ifunc_symbol functions.
6079         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6080         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6081         local_plt_offsets_ field.
6082         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6083         * output.h (class Output_section_data): Add non-const
6084         output_section function.
6085         (class Output_data_got): Update declarations.
6086         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6087         Add use_plt_offset parameter to global and local constructors.
6088         Change all callers.  Change local_sym_index_ field to 31 bits.
6089         Change GSYM_CODE and CONSTANT_CODE accordingly.
6090         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6091         doing a static link don't set sh_link field.
6092         (Output_data_got::Got_entry::write): Use PLT offset if
6093         appropriate.
6094         (Output_data_got::add_global_plt): New function.
6095         (Output_data_got::add_local_plt): New function.
6096         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6097         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6098         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6099         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6100         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6101         IFUNC conditional.
6102         * testsuite/ifunc-sel.h: New file.
6103         * testsuite/ifuncmain1.c: New file.
6104         * testsuite/ifuncmain1vis.c: New file.
6105         * testsuite/ifuncmod1.c: New file.
6106         * testsuite/ifuncdep2.c: New file.
6107         * testsuite/ifuncmain2.c: New file.
6108         * testsuite/ifuncmain3.c: New file.
6109         * testsuite/ifuncmod3.c: New file.
6110         * testsuite/ifuncmain4.c: New file.
6111         * testsuite/ifuncmain5.c: New file.
6112         * testsuite/ifuncmod5.c: New file.
6113         * testsuite/ifuncmain6pie.c: New file.
6114         * testsuite/ifuncmod6.c: New file.
6115         * testsuite/ifuncmain7.c: New file.
6116         * configure, testsuite/Makefile.in: Rebuild.
6117
6118 2010-08-18  Ian Lance Taylor  <iant@google.com>
6119
6120         * incremental.cc
6121         (Output_section_incremental_inputs::write_input_files): Add cast
6122         to avoid signed/unsigned comparison warning.
6123         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6124
6125 2010-08-12  Cary Coutant  <ccoutant@google.com>
6126
6127         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6128
6129 2010-08-13  Ian Lance Taylor  <iant@google.com>
6130
6131         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6132
6133 2010-08-12  Cary Coutant  <ccoutant@google.com>
6134             Doug Kwan  <dougkwan@google.com>
6135
6136         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6137         defintion overrides non-weak undef, remember that the original undef
6138         is not weak.
6139         * symtab.cc (Symbol_table::sized_write_global): For undef without
6140         an original weak binding, set binding to global in output.
6141         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6142         * testsuite/Makefile.in: Regenerate.
6143         * testsuite/strong_ref_weak_def.sh: New file.
6144         * testsuite/strong_ref_weak_def_1.c: Ditto.
6145         * testsuite/strong_ref_weak_def_2.c: Ditto.
6146
6147 2010-08-12  Cary Coutant  <ccoutant@google.com>
6148
6149         * testsuite/incremental_test.sh: Rewrite.
6150         * testsuite/incremental_test_1.c: Rewrite.
6151         * testsuite/incremental_test_2.c: Rewrite.
6152
6153 2010-08-12  Cary Coutant  <ccoutant@google.com>
6154
6155         * arm.cc (Target_arm::got_size): Add const.
6156         (Target_arm::got_entry_count): New function.
6157         (Target_arm::plt_entry_count): New function.
6158         (Target_arm::first_plt_entry_offset): New function.
6159         (Target_arm::plt_entry_size): New function.
6160         (Output_data_plt_arm::entry_count): New function.
6161         (Output_data_plt_arm::first_plt_entry_offset): New function.
6162         (Output_data_plt_arm::get_plt_entry_size): New function.
6163         * i386.cc (Target_i386::got_size): Add const.
6164         (Target_i386::got_entry_count): New function.
6165         (Target_i386::plt_entry_count): New function.
6166         (Target_i386::first_plt_entry_offset): New function.
6167         (Target_i386::plt_entry_size): New function.
6168         (Output_data_plt_i386::entry_count): New function.
6169         (Output_data_plt_i386::first_plt_entry_offset): New function.
6170         (Output_data_plt_i386::get_plt_entry_size): New function.
6171         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6172         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6173         * incremental.cc: Include target.h.
6174         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6175         parameter.  Adjust all callers.  Find incremental_got_plt section.
6176         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6177         section.
6178         (Output_section_incremental_inputs::set_final_data_size): Calculate
6179         size of incremental_got_plt section.
6180         (Output_section_incremental_inputs::do_write): Write the
6181         incremental_got_plt section.
6182         (Got_plt_view_info): New struct.
6183         (Local_got_offset_visitor): New class.
6184         (Global_got_offset_visitor): New class.
6185         (Global_symbol_visitor_got_plt): New class.
6186         (Output_section_incremental_inputs::write_got_plt): New function.
6187         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6188         Add parameter.  Adjust all callers.
6189         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6190         (Incremental_inputs::got_plt_section): New function.
6191         (Incremental_inputs::got_plt_section_): New data member.
6192         (Incremental_got_plt_reader): New class.
6193         * layout.cc (Layout::create_incremental_info_sections): Add the
6194         incremental_got_plt section.
6195         * object.h (Got_offset_list::get_list): New function.
6196         (Got offset_list::for_all_got_offsets): New function.
6197         (Sized_relobj::local_got_offset_list): New function.
6198         * powerpc.cc (Target_powerpc::got_size): Add const.
6199         (Target_powerpc::got_entry_count): New function.
6200         (Target_powerpc::plt_entry_count): New function.
6201         (Target_powerpc::first_plt_entry_offset): New function.
6202         (Target_powerpc::plt_entry_size): New function.
6203         (Output_data_plt_powerpc::entry_count): New function.
6204         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6205         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6206         * sparc.cc (Target_sparc::got_size): Add const.
6207         (Target_sparc::got_entry_count): New function.
6208         (Target_sparc::plt_entry_count): New function.
6209         (Target_sparc::first_plt_entry_offset): New function.
6210         (Target_sparc::plt_entry_size): New function.
6211         (Output_data_plt_sparc::entry_count): New function.
6212         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6213         (Output_data_plt_sparc::get_plt_entry_size): New function.
6214         * symtab.h (Symbol::got_offset_list): New function.
6215         (Symbol_table::for_all_symbols): New function.
6216         * target.h (Sized_target::got_entry_count): New function.
6217         (Sized_target::plt_entry_count): New function.
6218         (Sized_target::plt_entry_size): New function.
6219         * x86_64.cc (Target_x86_64::got_size): Add const.
6220         (Target_x86_64::got_entry_count): New function.
6221         (Target_x86_64::plt_entry_count): New function.
6222         (Target_x86_64::first_plt_entry_offset): New function.
6223         (Target_x86_64::plt_entry_size): New function.
6224         (Output_data_plt_x86_64::entry_count): New function.
6225         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6226         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6227
6228 2010-08-12  Cary Coutant  <ccoutant@google.com>
6229
6230         * archive.cc: Include incremental.h.
6231         (Archive::Archive): Initialize incremental_info_.
6232         (Archive::include_member): Record archive members in incremental info.
6233         (Add_archive_symbols::run): Record begin and end of an archive in
6234         incremental info.
6235         (Lib_group::include_member): Record objects in incremental info.
6236         * archive.h (Incremental_archive_entry): Forward declaration.
6237         (Archive::set_incremental_info): New member function.
6238         (Archive::incremental_info): New member function.
6239         (Archive::Unused_symbol_iterator): New class.
6240         (Archive::unused_symbols_begin): New member function.
6241         (Archive::unused_symbols_end): New member function.
6242         (Archive::incremental_info_): New data member.
6243         * incremental-dump.cc (find_input_containing_global): New function.
6244         (dump_incremental_inputs): Dump new incremental info sections.
6245         * incremental.cc: Include symtab.h.
6246         (Output_section_incremental_inputs): New class.
6247         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6248         new incremental info sections.
6249         (Sized_incremental_binary::do_check_inputs): Likewise.
6250         (Incremental_inputs::report_archive): Remove.
6251         (Incremental_inputs::report_archive_begin): New function.
6252         (Incremental_inputs::report_archive_end): New function.
6253         (Incremental_inputs::report_object): New function.
6254         (Incremental_inputs::finalize_inputs): Remove.
6255         (Incremental_inputs::report_input_section): New function.
6256         (Incremental_inputs::report_script): Rewrite.
6257         (Incremental_inputs::finalize): Do nothing but finalize string table.
6258         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6259         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6260         (Incremental_inputs::create_data_sections): New function.
6261         (Incremental_inputs::relocs_entsize): New function.
6262         (Output_section_incremental_inputs::set_final_data_size): New function.
6263         (Output_section_incremental_inputs::do_write): New function.
6264         (Output_section_incremental_inputs::write_header): New function.
6265         (Output_section_incremental_inputs::write_input_files): New function.
6266         (Output_section_incremental_inputs::write_info_blocks): New function.
6267         (Output_section_incremental_inputs::write_symtab): New function.
6268         * incremental.h (Incremental_script_entry): Forward declaration.
6269         (Incremental_object_entry): Forward declaration.
6270         (Incremental_archive_entry): Forward declaration.
6271         (Incremental_inputs): Forward declaration.
6272         (Incremental_inputs_header_data): Remove.
6273         (Incremental_inputs_header): Remove.
6274         (Incremental_inputs_header_write): Remove.
6275         (Incremental_inputs_entry_data): Remove.
6276         (Incremental_inputs_entry): Remove.
6277         (Incremental_inputs_entry_write): Remove.
6278         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6279         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6280         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6281         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6282         Likewise.
6283         (Incremental_input_entry): New class.
6284         (Incremental_script_entry): New class.
6285         (Incremental_object_entry): New class.
6286         (Incremental_archive_entry): New class.
6287         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6288         (Incremental_inputs::report_inputs): Remove.
6289         (Incremental_inputs::report_archive): Remove.
6290         (Incremental_inputs::report_archive_begin): New function.
6291         (Incremental_inputs::report_archive_end): New function.
6292         (Incremental_inputs::report_object): Change prototype.
6293         (Incremental_inputs::report_input_section): New function.
6294         (Incremental_inputs::report_script): Change prototype.
6295         (Incremental_inputs::get_reloc_count): New function.
6296         (Incremental_inputs::set_reloc_count): New function.
6297         (Incremental_inputs::create_data_sections): New function.
6298         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6299         (Incremental_inputs::inputs_section): New function.
6300         (Incremental_inputs::symtab_section): New function.
6301         (Incremental_inputs::relocs_section): New function.
6302         (Incremental_inputs::get_stringpool): Add const.
6303         (Incremental_inputs::command_line): Add const.
6304         (Incremental_inputs::inputs): Remove.
6305         (Incremental_inputs::command_line_key): New function.
6306         (Incremental_inputs::input_file_count): New function.
6307         (Incremental_inputs::input_files): New function.
6308         (Incremental_inputs::relocs_entsize): New function.
6309         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6310         (Incremental_inputs::finalize_inputs): Remove.
6311         (Incremental_inputs::Input_info): Remove.
6312         (Incremental_inputs::lock_): Remove.
6313         (Incremental_inputs::inputs_): Change type.
6314         (Incremental_inputs::inputs_map_): Remove.
6315         (Incremental_inputs::current_object_entry_): New data member.
6316         (Incremental_inputs::inputs_section_): New data member.
6317         (Incremental_inputs::symtab_section_): New data member.
6318         (Incremental_inputs::relocs_section_): New data member.
6319         (Incremental_inputs::reloc_count_): New data member.
6320         (Incremental_inputs_reader): New class.
6321         (Incremental_symtab_reader): New class.
6322         (Incremental_relocs_reader): New class.
6323         * layout.cc (Layout::finalize): Move finalization of incremental info
6324         and creation of incremental info sections to follow finalization of
6325         symbol table.  Set offsets for postprocessing sections.
6326         (Layout::create_incremental_info_sections): Call
6327         Incremental_inputs::create_data_sections.  Add incremental symtab
6328         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6329         sections to layout after input sections.
6330         * layout.h (struct Timespec): Forward declaration.
6331         (Layout::incremental_inputs): Add const.
6332         (Layout::create_incremental_info_sections): Add parameter.
6333         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6334         * object.cc: Include incremental.h.
6335         (Relobj::finalize_incremental_relocs): New function.
6336         (Sized_relobj::do_layout): Record input sections in incremental info.
6337         * object.h (Object::output_section): New function.
6338         (Object::output_section_offset): Moved from Relobj.
6339         (Object::get_incremental_reloc_base): New function.
6340         (Object::get_incremental_reloc_count): New function.
6341         (Object::do_output_section): New function.
6342         (Object::do_output_section_offset): Moved from Relobj.
6343         (Object::do_get_incremental_reloc_base): New function.
6344         (Object::do_get_incremental_reloc_count): New function.
6345         (Object::Object): Initialize new data members.
6346         (Relobj::output_section): Renamed do_output_section and moved to
6347         protected.
6348         (Relobj::output_section_offset): Moved to Object.
6349         (Relobj::do_get_incremental_reloc_base): New function.
6350         (Relobj::do_get_incremental_reloc_count): New function.
6351         (Relobj::allocate_incremental_reloc_counts): New function.
6352         (Relobj::count_incremental_reloc): New function.
6353         (Relobj::finalize_incremental_relocs): New function.
6354         (Relobj::next_incremental_reloc_index): New function.
6355         (Relobj::reloc_counts_): New data member.
6356         (Relobj::reloc_bases_): New data member.
6357         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6358         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6359         (Sized_relobj::incremental_relocs_scan): New function.
6360         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6361         (Sized_relobj::incremental_relocs_write): New function.
6362         (Sized_relobj::incremental_relocs_write_reltype): New function.
6363         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6364         incremental link.
6365         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6366         archives and object files elsewhere.
6367         (Add_symbols::run): Report object files here.
6368         (Finish_group::run): Report end of archive at end of group.
6369         * reloc.cc: Include layout.h, incremental.h.
6370         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6371         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6372         (Sized_relobj::incremental_relocs_scan): New function.
6373         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6374         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6375         (Sized_relobj::incremental_relocs_write): New function.
6376         (Sized_relobj::incremental_relocs_write_reltype): New function.
6377         * script.cc (read_input_script): Rewrite test for incremental link.
6378         Change call to Incremental_inputs::report_script.
6379         * symtab.h (Symbol_table::first_global_index): New function.
6380         (Symbol_table::output_count): New function.
6381
6382 2010-08-12  Doug Kwan  <dougkwan@google.com>
6383
6384         * arm.cc (Target_arm::merge_object_attributes): Check command line
6385         options --no-wchar-size-warning and --no-enum-size-warning.
6386         * options.h (General_options): Add ld-compatible options
6387         --no-enum-size-warning and --no-wchar-size-warning.
6388
6389 2010-08-04  Ian Lance Taylor  <iant@google.com>
6390
6391         * x86_64.cc (Target_x86_64::Scan::local): Use
6392         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6393         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6394         (Target_x86_64::Scan::global): Likewise.
6395         (Target_x86_64::Relocate::relocate): Likewise.
6396         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6397         Likewise.
6398
6399 2010-08-03  Cary Coutant  <ccoutant@google.com>
6400
6401         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6402         to reserve space in merged_strings vector. Keep total input size
6403         for stats.
6404         (Output_merge_string::do_print_merge_stats): Print total input size.
6405         * merge.h (Output_merge_string): Add input_size_ field.
6406         * stringpool.cc (Stringpool_template::string_length): Move
6407         implementations out of Stringpool_template class and place in
6408         stringpool.h.
6409         * stringpool.h (string_length): Move out of Stringpool_template.
6410
6411 2010-08-03  Ian Lance Taylor  <iant@google.com>
6412
6413         PR 11712
6414         * layout.cc (relaxation_loop_body): If address of load segment is
6415         set, adjust address to include headers if possible.
6416
6417 2010-08-03  Ian Lance Taylor  <iant@google.com>
6418
6419         * version.cc (version_string): Bump to 1.10.
6420
6421 2010-08-03  Ian Lance Taylor  <iant@google.com>
6422
6423         PR 11805
6424         * layout.h (enum Output_section_order): Define.
6425         (class Layout): Update declarations.
6426         * layout.cc (Layout::get_output_section): Add order parameter.
6427         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6428         is_first_non_relro parameters.  Change all callers.
6429         (Layout::choose_output_section): Likewise.
6430         (Layout::add_output_section_data): Likewise.
6431         (Layout::make_output_section): Likewise.  Set order.
6432         (Layout::default_section_order): New function.
6433         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6434         * output.cc (Output_section::Output_section): Initialize order_.
6435         Don't initialize deleted fields.
6436         (Output_segment::Output_segment): Don't initialize deleted
6437         fields.
6438         (Output_segment::add_output_section_to_load): New function
6439         replacing add_output_section.  Change all callers to call this or
6440         add_output_section_to_nonload.
6441         (Output_segment::add_output_section_to_nonload): New function.
6442         (Output_segment::remove_output_section): Rewrite.
6443         (Output_segment::add_initial_output_data): Likewise.
6444         (Output_segment::has_any_data_sections): Likewise.
6445         (Output_segment::is_first_section_relro): Likewise.
6446         (Output_segment::maximum_alignment): Likewise.
6447         (Output_segment::has_dynamic_reloc): New function replacing
6448         dynamic_reloc_count.  Change all callers.
6449         (Output_segment::has_dynamic_reloc_list): New function replacing
6450         dynamic_reloc_count_list.  Change all callers.
6451         (Output_segment::set_section_addresses): Rewrite.
6452         (Output_segment::set_offset): Rewrite.
6453         (Output_segment::find_first_and_last_list): Remove.
6454         (Output_segment::set_tls_offsets): Rewrite.
6455         (Output_segment::first_section_load_address): Likewise.
6456         (Output_segment::output_section_count): Likewise.
6457         (Output_segment::section_with_lowest_load_address): Likewise.
6458         (Output_segment::write_section_headers): Likewise.
6459         (Output_segment::print_sections_to_map): Likewise.
6460         * output.h (class Output_data): Remove dynamic_reloc_count_
6461         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6462         (Output_data::add_dynamic_reloc): Rewrite.
6463         (Output_data::has_dynamic_reloc): New function.
6464         (Output_data::dynamic_reloc_count): Remove.
6465         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6466         is_last_relro_, is_first_non_relro_, is_interp_,
6467         is_dynamic_linker_section_ fields.  Add order and set_order
6468         functions.  Remove is_relro_local, set_is_relro_local,
6469         is_last_relro, set_is_last_relro, is_first_non_relro,
6470         set_is_first_non_relro functions, is_interp, set_is_interp,
6471         is_dynamic_linker_section, and set_is_dynamic_linker_section
6472         functions.
6473         (class Output_segment): Change Output_data_list from std::list to
6474         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6475         output_bss_ fields.  Update declarations.
6476
6477 2010-08-02  Ian Lance Taylor  <iant@google.com>
6478
6479         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6480         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6481         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6482
6483 2010-08-02  Ian Lance Taylor  <iant@google.com>
6484
6485         PR 11855
6486         * script.cc (Script_options::Script_options): Initialize
6487         symbol_definitions_ and symbol_references_.
6488         (Script_options::add_symbol_assignment): Update
6489         symbol_definitions_ and symbol_references_.
6490         (Script_options::add_symbol_reference): New function.
6491         (script_symbol): New function.
6492         * script.h (class Script_options): Add symbol_definitions_ and
6493         symbol_references_ fields.
6494         (Script_options::referenced_const_iterator): New type.
6495         (Script_options::referenced_begin): New function.
6496         (Script_options::referenced_end): New function.
6497         (Script_options::is_referenced): New function.
6498         (Script_options::any_unreferenced): New function.
6499         * script-c.h (script_symbol): Declare.
6500         * yyscript.y (exp): Call script_symbol.
6501         * symtab.cc: Include "script.h".
6502         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6503         Change all callers.  Check symbols referenced by scripts.
6504         (Symbol_table::add_undefined_symbols_from_command_line): Add
6505         layout parameter.  Change all callers.
6506         (Symbol_table::do_add_undefined_symbols_from_command_line):
6507         Likewise.  Break out loop body.  Check symbols referenced by
6508         scripts.
6509         (Symbol_table::add_undefined_symbol_from_command_line): New
6510         function broken out of
6511         do_add_undefined_symbols_from_command_line.
6512         * symtab.h (class Symbol_table): Update declarations.
6513         * archive.cc: Include "layout.h".
6514         (Archive::should_include_member): Add layout parameter.  Change
6515         all callers.  Check for symbol mentioned in expression.
6516         * archive.h (class Archive): Update declaration.
6517         * object.cc (Sized_relobj::do_should_include_member): Add layout
6518         parameter.
6519         * object.h (Object::should_include_member): Add layout parameter.
6520         Change all callers.
6521         (Object::do_should_include_member): Add layout parameter.
6522         (class Sized_relobj): Update declaration.
6523         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6524         parameter.
6525         * dynobj.h (class Sized_dynobj): Update declaration.
6526         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6527         layout parameter.
6528         * plugin.h (class Sized_pluginobj): Update declaration.
6529
6530 2010-08-02  Ian Lance Taylor  <iant@google.com>
6531
6532         PR 11866
6533         * output.cc (Output_segment::set_offset): Search for the first and
6534         last sections rather than assuming that the list is in order.
6535         (Output_segment::find_first_and_last_list): New function.
6536         * output.h (class Output_segment): Update declarations.
6537         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6538         (relro_strip_test_SOURCES): New variable.
6539         (relro_strip_test_DEPENDENCIES): New variable.
6540         (relro_strip_test_LDFLAGS): New variable.
6541         (relro_strip_test_LDADD): New variable.
6542         (relro_strip_test.so): New target.
6543
6544 2010-08-02  Ian Lance Taylor  <iant@google.com>
6545
6546         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6547         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6548         (Target_i386::got_tlsdesc_section): New function.
6549         (Target_i386::got_section): Create space for GOT entries for
6550         TLSDESC relocations.
6551         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6552         R_386_TLS_GOTDESC.
6553         (Target_i386::Scan::global): Likewise.
6554         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6555         using TLSDESC GOT.
6556         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6557         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6558         (Target_x86_64::got_tlsdesc_section): New function.
6559         (Target_x86_64::got_section): Create space for GOT entries for
6560         TLSDESC relocations.
6561         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6562         R_386_TLS_GOTDESC.
6563         (Target_x86_64::Scan::global): Likewise.
6564         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6565         using TLSDESC GOT.
6566
6567 2010-08-02  Ian Lance Taylor  <iant@google.com>
6568
6569         * testsuite/final_layout.sh: Use dc to convert from hex to
6570         decimal.
6571
6572 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6573
6574         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6575         paramter to the call to gold::gc_process_relocs.
6576         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6577         paramter to the call to gold::gc_process_relocs.
6578         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6579         parameter to the call to gold::gc_process_relocs.
6580         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6581         template parameter to the call to gold::gc_process_relocs.
6582         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6583         paramter to the call to gold::gc_process_relocs.
6584         * gc.h (get_embedded_addend_size): New function.
6585         (gc_process_relocs): Save the size of the reloc for use by ICF.
6586         * icf.cc (get_section_contents): Get the addend from the text section
6587         for SHT_REL relocation sections.
6588         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6589         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6590         * int_encoding.h (read_from_pointer): New overloaded function.
6591         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6592         * testsuite/icf_sht_rel_addend_test.sh: New file.
6593         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6594         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6595
6596 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6597
6598         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6599         * Makefile.in: Regenerate.
6600         * testsuite/Makefile.in: Regenerate.
6601
6602 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6603
6604         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6605         * gold/testsuite/debug_msg.cc: Likewise.
6606         * gold/testsuite/odr_violation1.cc
6607         * gold/testsuite/odr_violation2.cc
6608
6609 2010-07-21  Cary Coutant  <ccoutant@google.com>
6610
6611         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6612         string, and length fields.
6613         (Output_merge_string::Merged_strings_list): New type.
6614         (Output_merge_string::Merged_strings_lists): New typedef.
6615         (Output_merge_string): Replace merged_strings_ with
6616         merged_strings_lists_.
6617         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6618         Merged_strings_list per input object and section.  Don't store pointer
6619         to the string.  Don't store length with each merged string entry.
6620         (Output_merge_string::finalize_merged_data): Loop over list of merged
6621         strings lists.  Recompute length of each merged string.
6622
6623 2010-07-15  Cary Coutant  <ccoutant@google.com>
6624
6625         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6626         here.
6627
6628 2010-07-14  Ian Lance Taylor  <iant@google.com>
6629
6630         * descriptors.cc (Descriptors::open): Report correct name in error
6631         message.
6632
6633 2010-07-13  Doug Kwan  <dougkwan@google.com>
6634
6635         * arm.cc (Arm_input_section::Arm_input_section): For a
6636         SHT_ARM_EXIDX section, always keeps the input sections.
6637         (Arm_input_section::set_exidx_section_link): New method.
6638         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6639         has_errors_ to false.
6640         (Arm_exidx_input_section::has_errors,
6641         Arm_exidx_input_section::set_has_errors): New methods.
6642         (Arm_exidx_input_section::has_errors_): New data member.
6643         (Arm_relobj::get_exidx_shndx_list): New method.
6644         (Arm_output_section::append_text_sections_to_list): Do not skip
6645         section without SHF_EXECINSTR.
6646         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6647         errors.
6648         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6649         section header.  Make error messages more verbose.  Check for
6650         a non-executable section linked to an EXIDX section.
6651         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6652         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6653         check that there is no deferred EXIDX section if we exit early.
6654         Instead of not making an EXIDX section in case of an error, make one
6655         and set the has_errors flag of it.
6656         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6657         in a relocatable link.
6658         (Target_arm::do_relax): Look for the EXIDX output section instead of
6659         assuming that it is called .ARM.exidx.
6660         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6661         section list.  Do not check for SHF_EXECINSTR section flags but
6662         skip any input section with errors.
6663         * output.cc (Output_section::Output_section): Initialize
6664         always_keeps_input_sections_ to false.
6665         (Output_section::add_input_section): Check for
6666         always_keeps_input_sections_.
6667         *  output.h (Output_section::always_keeps_input_sections,
6668         Output_section::set_always_keeps_input_sections): New methods.
6669         (Output_section::always_keeps_input_sections): New data member.
6670
6671 2010-07-13  Rafael Espindola  <espindola@google.com>
6672
6673         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6674         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6675
6676 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6677             Ian Lance Taylor  <iant@google.com>
6678
6679         * output.h (Output_section_lookup_maps::add_merge_section):
6680         Correct check of whether value was inserted.
6681         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6682         (Output_section_lookup_maps::add_relaxed_input_section):
6683         Likewise.
6684         * arm.cc (Target_arm::got_section): Remove used local os.
6685         * i386.cc (Target_i386::got_section): Likewise.
6686         * x86_64.cc (Target_x86_64::got_section): Likewise.
6687         * sparc.cc (Target_sparc::got_section): Likewise.
6688         (Target_sparc::relocate): Remove unused local have_got_offset.
6689         * powerpc.cc (Target_powerpc::relocate): Likewise.
6690
6691 2010-07-13  Ian Lance Taylor  <iant@google.com>
6692
6693         * compressed_output.cc (zlib_decompress): Fix signature in
6694         !HAVE_ZLIB_H case.
6695
6696         * archive.cc (Archive::include_member): Unlock an external member
6697         of a thin archive.  Don't bother to delete an object we know is
6698         NULL.
6699
6700 2010-07-12  Cary Coutant  <ccoutant@google.com>
6701
6702         * compressed_output.cc (zlib_decompress): New function.
6703         (get_uncompressed_size): New function.
6704         (decompress_input_section): New function.
6705         * compressed_output.h (get_uncompressed_size): New function.
6706         (decompress_input_section): New function.
6707         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6708         Handle compressed debug sections.
6709         * layout.cc (is_compressed_debug_section): New function.
6710         (Layout::output_section_name): Map compressed section names to
6711         canonical names.
6712         * layout.h (is_compressed_debug_section): New function.
6713         (is_debug_info_section): Recognize compressed debug sections.
6714         * merge.cc: Include compressed_output.h.
6715         (Output_merge_data::do_add_input_section): Handle compressed
6716         debug sections.
6717         (Output_merge_string::do_add_input_section): Handle compressed
6718         debug sections.
6719         * object.cc: Include compressed_output.h.
6720         (Sized_relobj::Sized_relobj): Initialize new data members.
6721         (build_compressed_section_map): New function.
6722         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6723         * object.h (Object::section_is_compressed): New method.
6724         (Object::do_section_is_compressed): New method.
6725         (Sized_relobj::Compressed_section_map): New type.
6726         (Sized_relobj::do_section_is_compressed): New method.
6727         (Sized_relobj::compressed_sections_): New data member.
6728         * output.cc (Output_section::add_input_section): Handle compressed
6729         debug sections.
6730         * reloc.cc: Include compressed_output.h.
6731         (Sized_relobj::write_sections): Handle compressed debug sections.
6732
6733 2010-07-08  Cary Coutant  <ccoutant@google.com>
6734
6735         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6736         weak when resolving to a dynamic def.
6737         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6738         for weak undef/dynamic def cases. Adjust callers.
6739         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6740         undef_binding_weak_.
6741         (Symbol_table::sized_write_globals): Adjust symbol binding.
6742         (Symbol_table::sized_write_symbol): Add binding parameter.
6743         * symtab.h (Symbol::set_undef_binding): New method.
6744         (Symbol::is_undef_binding_weak): New method.
6745         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6746         (Symbol_table::should_override): Add new parameter.
6747         (Symbol_table::sized_write_symbol): Add new parameter.
6748
6749         * testsuite/weak_undef_file1.cc: Add new test case.
6750         * testsuite/weak_undef_file2.cc: Fix header comment.
6751         * testsuite/weak_undef_test.cc: Add new test case.
6752
6753 2010-06-29  Doug Kwan  <dougkwan@google.com>
6754
6755         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6756         Initialize USE_SYMBOL_.
6757         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6758         definition.
6759         (Arm_reloc_property::uses_symbol_): New data member declaration.
6760         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6761         uses symbol value and symbol is undefined but not weakly undefined.
6762
6763 2010-06-28  Rafael Espindola  <espindola@google.com>
6764
6765         * plugin.cc (Plugin::load): Use dlerror.
6766
6767 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6768
6769         * symtab.cc (detect_odr_violations): When reporting an ODR
6770         violation, report an object where the symbol is defined.
6771
6772 2010-06-25  Doug Kwan  <dougkwan@google.com>
6773
6774         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6775         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6776         definition.
6777         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6778         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6779         target hook to detect function points.
6780         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6781         * icf.h (Icf::check_section_for_function_pointers): Change type of
6782         parameter SECTION_NAME to const reference to std::string.  Use
6783         target hook to determine if section may have unsafe pointers.
6784         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6785         method definition.
6786
6787 2010-06-21  Rafael Espindola  <espindola@google.com>
6788
6789         * fileread.cc (Input_file::find_fie): New
6790         (Input_file::open): Use Input_file::find_fie.
6791         * fileread.h (Input_file::find_fie): New
6792         * plugin.cc (set_extra_library_path): New.
6793         (Plugin::load): Add set_extra_library_path to the transfer vector.
6794         (Plugin_manager::set_extra_library_path): New.
6795         (Plugin_manager::add_input_file): Use the extra search path if set.
6796         (set_extra_library_path(): New.
6797         * plugin.h (Plugin_manager): Add set_extra_library_path and
6798         extra_search_path_.
6799
6800 2010-06-19  Cary Coutant  <ccoutant@google.com>
6801
6802         * layout.cc (gdb_sections): Add .debug_types.
6803         (lines_only_debug_sections): Likewise.
6804
6805 2010-06-18  Rafael Espindola  <espindola@google.com>
6806
6807         * plugin.cc (add_input_file,add_input_library)
6808         (Plugin_manager::add_input_file): Make filename arguments const.
6809         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6810         const.
6811
6812 2010-06-16  Doug Kwan  <dougkwan@google.com>
6813
6814         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6815         .ARM.attributes section if we have not merged any input
6816         attributes sections.
6817
6818 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6819
6820         * arm.cc: Allow combining objects with no EABI version
6821         information.
6822
6823 2010-06-15  Rafael Espindola  <espindola@google.com>
6824
6825         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6826
6827 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6828
6829         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6830         (struct iovec): Correct !HAVE_READV definition.
6831
6832 2010-06-10  Cary Coutant  <ccoutant@google.com>
6833
6834         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6835         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6836         reloc sections.
6837         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6838
6839         PR 11683
6840         * symtab.h (Symbol::is_placeholder): New member function.
6841         * target-reloc.h (relocate_section): Check for placeholder symbols.
6842
6843         * testsuite/Makefile.am (plugin_test_8): New test.
6844         (plugin_test_9): New test.
6845         * testsuite/Makefile.in: Regenerate.
6846
6847 2010-06-09  Nick Clifton  <nickc@redhat.com>
6848
6849         * yyscript.y (input_list_element): Allow strings prefixed with
6850         the '-' character.  Treat these as libraries.
6851         * script.cc (script_add_library): New function.  Adds a library
6852         specified by "-l<name>" found in an input script.
6853         * script-c.h: Add prototype for script_add_library.
6854
6855 2010-06-07  Doug Kwan  <dougkwan@google.com>
6856
6857         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6858         Restrict stub-group size to be within long conditional branch
6859         range when working around cortex-A8 erratum.
6860
6861 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6862
6863         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6864         #ifdef typo.
6865
6866 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6867
6868         PR gold/11658
6869         * output.cc
6870         (Output_section::Input_section_sort_entry::compare_section_ordering):
6871         Change to return non-zero correctly.
6872         (Output_section::Input_section_sort_section_order_index_compare
6873         ::operator()): Change to fix ambiguity in comparisons.
6874
6875 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6876
6877         * gold.h (is_wildcard_string): New function.
6878         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6879         (Layout::layout_eh_frame): Ditto.
6880         (Layout::find_section_order_index): New method.
6881         (Layout::read_layout_from_file): New method.
6882         * layout.h (Layout::find_section_order_index): New method.
6883         (Layout::read_layout_from_file): New method.
6884         (Layout::input_section_position_): New private member.
6885         (Layout::input_section_glob_): New private member.
6886         * main.cc (main): Call read_layout_from_file here.
6887         * options.h (--section-ordering-file): New option.
6888         * output.cc (Output_section::input_section_order_specified_): New
6889         member.
6890         (Output_section::Output_section): Initialize new member.
6891         (Output_section::add_input_section): Add new parameter.
6892         Keep input sections when --section-ordering-file is used.
6893         (Output_section::set_final_data_size): Sort input sections when
6894         section ordering file is specified.
6895         (Output_section::Input_section_sort_entry): Add new parameter.
6896         Check sorting type.
6897         (Output_section::Input_section_sort_entry::compare_section_ordering):
6898         New method.
6899         (Output_section::Input_section_sort_compare::operator()): Change to
6900         consider section_order_index.
6901         (Output_section::Input_section_sort_init_fini_compare::operator()):
6902         Change to consider section_order_index.
6903         (Output_section::Input_section_sort_section_order_index_compare
6904         ::operator()): New method.
6905         (Output_section::sort_attached_input_sections): Change to sort
6906         according to section order when specified.
6907         (Output_section::add_input_section<32, true>): Add new parameter.
6908         (Output_section::add_input_section<64, true>): Add new parameter.
6909         (Output_section::add_input_section<32, false>): Add new parameter.
6910         (Output_section::add_input_section<64, false>): Add new parameter.
6911         * output.h (Output_section::add_input_section): Add new parameter.
6912         (Output_section::input_section_order_specified): New
6913         method.
6914         (Output_section::set_input_section_order_specified): New method.
6915         (Input_section::Input_section): Initialize section_order_index_.
6916         (Input_section::section_order_index): New method.
6917         (Input_section::set_section_order_index): New method.
6918         (Input_section::section_order_index_): New member.
6919         (Input_section::Input_section_sort_section_order_index_compare): New
6920         struct.
6921         (Output_section::input_section_order_specified_): New member.
6922         * script-sections.cc (is_wildcard_string): Delete and move modified
6923         method to gold.h.
6924         (Output_section_element_input::Output_section_element_input): Modify
6925         call to is_wildcard_string.
6926         (Output_section_element_input::Input_section_pattern
6927         ::Input_section_pattern): Ditto.
6928         (Output_section_element_input::Output_section_element_input): Ditto.
6929         * testsuite/Makefile.am (final_layout): New test case.
6930         * testsuite/Makefile.in: Regenerate.
6931         * testsuite/final_layout.cc: New file.
6932         * testsuite/final_layout.sh: New file.
6933
6934 2010-06-01  Rafael Espindola  <espindola@google.com>
6935
6936         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6937
6938 2010-06-01  Rafael Espindola  <espindola@google.com>
6939
6940         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6941         visibility of symbols.
6942
6943 2010-05-27  Doug Kwan  <dougkwan@google.com>
6944
6945         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6946         from start of output section instead of address for a local symbol
6947         in a merged or relaxed section when doing a relocatable link.
6948
6949 2010-05-26  Rafael Espindola  <espindola@google.com>
6950
6951         PR 11604
6952         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6953         adding sections the garbage collector removed.
6954         * gold/testsuite/Makefile.am: Add test.
6955         * gold/testsuite/Makefile.in: Regenerate.
6956         * gold/testsuite/plugin_test_7.sh: New.
6957         * gold/testsuite/plugin_test_7_1.c: New.
6958         * gold/testsuite/plugin_test_7_2.c: New.
6959
6960 2010-05-26  Rafael Espindola  <espindola@google.com>
6961
6962         * script-sections.cc (Output_section_definition::set_section_addresses):
6963         Check for --section-start.
6964
6965 2010-05-26  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Arm_scan_relocatable_relocs): New class.
6968         (Target_arm::relocate_special_relocatable): New method.
6969         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6970         (Arm_relocate_functions::thumb_branch_common): Same.
6971         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6972         instead of Default_scan_relocatable_relocs.
6973         * target-reloc.h (relocate_for_relocatable): Let target handle
6974         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6975         * target.h (Sized_target::relocate_special_relocatable): New method.
6976
6977 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6978
6979         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6980
6981 2010-05-23  Doug Kwan  <dougkwan@google.com>
6982
6983         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6984         instead of a cast.
6985         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6986         with a direct branch, not a conditional branch, to a stub.
6987         * merge.cc (Output_merge_base::record_input_section): New method
6988         defintion.
6989         (Output_merge_data::do_add_input_section): Record input section if
6990         keeps-input-sections flag is set.
6991         (Output_merge_string::do_add_input_section): Ditto.
6992         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6993         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6994         INPUT_SECTIONS_.
6995         (Output_merge_base::keeps_input_sections,
6996         Output_merge_base::set_keeps_input_sections,
6997         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6998         method definitions.
6999         (Output_merge_base::Input_sections): New type declaration.
7000         (Output_merge_base::input_sections_begin,
7001         Output_merge_base::input_sections_end,
7002         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7003         (Output_merge_base::bool keeps_input_sections_,
7004         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7005         Output_merge_base::input_sections_): New data members.
7006         (Output_merge_data::do_set_keeps_input_sections): New method
7007         defintion.
7008         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7009         * output.cc (Output_section::Input_section::relobj): Move method
7010         defintion from class declaration to here and handle merge sections.
7011         (Output_section::Input_section::shndx): Ditto.
7012         (Output_section::Output_section): Remove initializations of removed
7013         data members and initialize new data member LOOKUP_MAPS_.
7014         (Output_section::add_input_section): Set keeps-input-sections flag
7015         for a newly created merge output section as appropriate.  Adjust code
7016         to use Output_section_lookup_maps class.
7017         (Output_section::add_relaxed_input_section): Adjst code for lookup
7018         maps code refactoring.
7019         (Output_section::add_merge_input_section): Add a new parameter
7020         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7021         class.  If adding input section to a newly created merge output
7022         section fails, remove the new merge section.
7023         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7024         Adjust code for use of the Output_section_lookup_maps class.
7025         (Output_section::find_merge_section): Ditto.
7026         (Output_section::build_lookup_maps): New method defintion.
7027         (Output_section::find_relaxed_input_section): Adjust code to use
7028         Output_section_lookup_maps class.
7029         (Output_section::get_input_sections): Export merge sections.  Adjust
7030         code to use Output_section_lookup_maps class.
7031         (Output_section:::add_script_input_section): Adjust code to use
7032         Output_section_lookup_maps class.  Update lookup maps for merge
7033         sections also.
7034         (Output_section::discard_states): Use Output_section_lookup_maps.
7035         (Output_section::restore_states): Same.
7036         * output.h (Merge_section_properties): Move class defintion out of
7037         Output_section.
7038         (Output_section_lookup_maps): New class.
7039         (Output_section::Input_section::is_merge_section): New method
7040         defintion.
7041         (Output_section::Input_section::relobj): Move defintion out of class
7042         defintion.  Declare method only.
7043         (Output_section::Input_section::shndx): Ditto.
7044         (Output_section::Input_section::output_merge_base): New method defintion.
7045         (Output_section::Input_section::u2_.pomb): New union field.
7046         (Output_section::Merge_section_by_properties_map,
7047         Output_section::Output_section_data_by_input_section_map,
7048         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7049         Remove types.
7050         (Output_section::add_merge_input_section): Add new parameter
7051         KEEPS_INPUT_SECTIONS.
7052         (Output_section::build_lookup_maps): New method declaration.
7053         (Output_section::merge_section_map_,
7054         Output_section::merge_section_by_properties_map_,
7055         Output_section::relaxed_input_section_map_,
7056         Output_section::is_relaxed_input_section_map_valid_): Remove data
7057         members.
7058         (Output_section::lookup_maps_): New data member.
7059
7060 2010-05-21  Doug Kwan  <dougkwan@google.com>
7061
7062         PR gold/11619
7063         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7064         avoid a compilation error.
7065
7066 2010-05-19  Rafael Espindola  <espindola@google.com>
7067
7068         * script-sections.cc (Output_section_definition::allocate_to_segment):
7069         Update the phdrs_list even when the output section is NULL.
7070         * testsuite/Makefile.am: Add test.
7071         * testsuite/Makefile.in: Regenerate.
7072         * testsuite/script_test_9.cc: New.
7073         * testsuite/script_test_9.sh: New.
7074         * testsuite/script_test_9.t: New.
7075
7076 2010-05-19  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc (Arm_input_section::original_size): New method.
7079         (Arm_input_section::do_addralign): Add a cast.
7080         (Arm_input_section::do_output_offset): Remove static cast.
7081         (Arm_input_section::original_addralign,
7082          Arm_input_section::original_size_): Change type to uint32_t.
7083         (Arm_input_section::init): Add safe casts for section alignment
7084         and size.
7085         (Arm_input_section::set_final_data_size): Do not set address and
7086         offset of stub table.
7087         (Arm_output_section::fix_exidx_coverage): Change use of of
7088         Output_section::Simple_input_section to that of
7089         Output_section::Input_section.
7090         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7091         except for the first pass.
7092         * output.cc (Output_section::get_input_sections): Change type of
7093         input_sections to std::list<Input_section>.
7094         (Output_section::add_script_input_section): Rename from
7095         Output_section::add_simple_input_section.  Change type of SIS
7096         parameter from Simple_input_section to Input_section.
7097         * output.h (Output_section::Simple_input_section): Remove class.
7098         (Output_section::Input_section): Change class visibility to public.
7099         (Output_section::Input_section::addralign): Use stored alignments
7100         for special input sections if set.
7101         (Output_section::Input_section::set_addralign): New method.
7102         (Output_section::get_input_sections): Change parameter type from
7103         list of Simple_input_section to list of Input_section.
7104         (Output_section::add_script_input_section): Rename from
7105         Output_section::add_simple_input_section. Change first parameter's
7106         type from Simple_input_section to Input_section and remove the
7107         second and third parameters.
7108         * script-sections.cc (Input_section::Input_section_list): Change
7109         type to list of Output_section::Input_section/
7110         (Input_section_info::Input_section_info): Change parameter type of
7111         INPUT_SECTION to Output_section::Input_section.
7112         (Input_section_info::input_section): Change return type.
7113         (Input_section_info::input_section_): Change type to
7114         Output_section::Input_section.
7115         (Output_section_element_input::set_section_addresses): Adjust code
7116         to use Output_section::Input_section instead of
7117         Output_section::Simple_input_section.  Adjust code for renaming
7118         of Output_section::add_simple_input_section.
7119         (Orphan_output_section::set_section_addresses): Ditto.
7120
7121 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7122
7123         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7124         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7125
7126 2010-05-18  Rafael Espindola  <espindola@google.com>
7127
7128         * options.cc (General_options::finalize): Handle -nostdlib.
7129         * options.h (nostdlib): New option.
7130         * script.cc (script_add_search_dir): Handle -nostdlib.
7131
7132 2010-05-12  Doug Kwan  <dougkwan@google.com>
7133
7134         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7135         attributes section only if there no attributes section after merging.
7136         (Target_arm::merge_object_attributes): Move value of
7137         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7138         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7139         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7140         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7141         and arm_attr_merge_7.stdout.
7142         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7143         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7144         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7145         arm_attr_merge_7b.o): New rules.
7146         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7147         arm_attr_merge_7
7148         * testsuite/Makefile.in: Regenerate.
7149         * testsuite/arm_attr_merge.sh: New file.
7150         * testsuite/arm_attr_merge_[67][ab].s: Same.
7151
7152 2010-05-05  Nick Clifton  <nickc@redhat.com>
7153
7154         * po/es.po: Updated Spanish translation.
7155
7156 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7157
7158         * Makefile.am (install-exec-local): Properly install gold as
7159         default cross linker.
7160         * Makefile.in: Regenerated.
7161
7162 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7163             Nick Clifton  <nickc@redhat.com>
7164
7165         * configure.ac (install_as_default): Define and set to false
7166         unless --enable-gold or --enable-gold=both/gold has been
7167         specified.
7168         * configure: Regenerate.
7169
7170         * Makefile.am (install-exec-local): Install the executable as
7171         'ld.gold'.  If install_as_default is true then also install it as
7172         'ld'.
7173         * Makefile.in: Regenerated.
7174
7175 2010-04-24  Ian Lance Taylor  <iant@google.com>
7176
7177         * layout.cc (Layout::layout_reloc): In relocatable link don't
7178         combine reloc sections for grouped sections.
7179
7180 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7181
7182         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7183         sections that are not ordinary to icf.
7184         * icf.cc (get_section_contents): Handle relocation pointing to section
7185         with no object or shndx information.
7186         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7187         * testsuite/Makefile.in: Regenerate.
7188         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7189         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7190
7191 2010-04-22  Ian Lance Taylor  <iant@google.com>
7192
7193         * expression.cc (Expression::Expression_eval_info): Add
7194         result_alignment_pointer field.
7195         (Expression::eval_with_dot): Add result_alignment_pointer
7196         parameter.  Change all callers.
7197         (Expression::eval_maybe_dot): Likewise.
7198         (class Binary_expression): Add alignment_pointer parameter to
7199         left_value and right_value.  Change all callers.
7200         (BINARY_EXPRESSION): Set result alignment.
7201         (class Trinary_expression): Add alignment_pointer parameter to
7202         arg2_value and arg3_value.  Change all callers.
7203         (Trinary_cond::value): Set result alignment.
7204         (Max_expression::value, Min_expression::value): Likewise.
7205         (Align_expression::value): Likewise.
7206         * script-sections.cc (class Sections_element): Add dot_alignment
7207         parameter to set_section_addresses virtual function.  Update
7208         instantiations.
7209         (class Output_section_element): Likewise.
7210         (Script_sections::create_segments): Add dot_alignment parameter.
7211         Change all callers.
7212         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7213         (Script_sections::set_phdrs_clause_addresses): Likewise.
7214         * script-sections.h: Update declarations.
7215         * script.h: Update declarations.
7216         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7217         min_p_align.
7218         * testsuite/script_test_3.t: Set large alignment.
7219         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7220         segment has expected alignment.
7221
7222 2010-04-22  Nick Clifton  <nickc@redhat.com>
7223
7224         * po/gold.pot: Updated by the Translation project.
7225         * po/vi.po: Updated Vietnamese translation.
7226
7227 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7228
7229         * testsuite/Makefile.am (check_PROGRAMS): Add
7230         icf_virtual_function_folding_test.
7231         * testsuite/Makefile.in: Regenerated.
7232
7233 2010-04-15  Andrew Haley  <aph@redhat.com>
7234
7235         * options.h (merge_exidx_entries): New option.
7236         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7237         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7238         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7239         (Target_arm::merge_exidx_entries): New function.
7240         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7241         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7242         to Arm_exidx_fixup constructor.
7243         Add new arg, merge_exidx_entries.
7244         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7245         Arm_output_section::fix_exidx_coverage.
7246
7247 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7248
7249         * icf.cc (get_section_contents): Check for preemptible functions.
7250         Ignore addend when appropriate.
7251         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7252         section folded.
7253         (add_from_relobj): Check for section folded.
7254         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7255         * symtab.h (should_add_dynsym_entry): Add new parameter.
7256         * target-reloc.h (scan_relocs): Check for section folded.
7257         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7258         Check reloc types for function pointers in shared objects.
7259         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7260         case.
7261         (icf_preemptible_functions_test): New test case.
7262         (icf_string_merge_test): New test case.
7263         * testsuite.Makefile.in: Regenerate.
7264         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7265         bar_glob.  Refactor code.
7266         * testsuite/icf_preemptible_functions_test.cc: New file.
7267         * testsuite/icf_preemptible_functions_test.sh: New file.
7268         * testsuite/icf_string_merge_test.cc: New file.
7269         * testsuite/icf_string_merge_test.sh: New file.
7270         * testsuite/icf_virtual_function_folding_test.cc: New file.
7271         * testsuite/icf_virtual_function_folding_test.sh: New file.
7272
7273 2010-04-14  Doug Kwan  <dougkwan@google.com>
7274
7275         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7276         for local symbol recounting if we remove a section due to ICF.
7277         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7278         there are no regular objects in input.
7279
7280 2010-04-13  Doug Kwan  <dougkwan@google.com>
7281
7282         * arm.cc (Arm_input_section::set_final_data_size): Compute
7283         accurate final data size instead of using current data size.
7284
7285 2010-04-09  Doug Kwan  <dougkwan@google.com>
7286
7287         * layout.cc (Layout::choose_output_section): Handle script section
7288         types.
7289         (Layout::make_output_section_for_script): Add section type parameter.
7290         Handle script section types.
7291         * layout.h (Layout::make_output_section_for_script): Add section
7292         type parameter.
7293         * output.cc (Output_section::Output_section): Initialize data member
7294         is_noload_.
7295         (Output_section::do_reset_address_and_file_offset): Do not set address
7296         to 0 if section is a NOLOAD section.
7297         * output.h (Output_section::is_noload): New method.
7298         (Output_section::set_is_noload): Ditto.
7299         (Output_section::is_noload_): New data member.
7300         * script-c.h (Script_section_type): New enum type.
7301         (struct Parser_output_section_header): Add new file section_type.
7302         * script-sections.cc (Sections_element::output_section_name): Add
7303         parameter for returning script section type.
7304         (Output_section_definition::output_section_name): Ditto.
7305         (Output_section_definition::section_type)P; New method.
7306         (Output_section_definiton::script_section_type_name): Ditto.
7307         (Output_section_definition::script_section_type_): New data member.
7308         (Output_section_definition::Output_section_definition): Initialize
7309         data member Output_section_definition::script_section_type_.
7310         (Output_section_definition::create_sections): Pass script section type
7311         to Layout::make_output_section_for_script.
7312         (Output_section_definition::output_section_name): Return script
7313         section type to caller.
7314         (Output_section_definition::set_section_address): Do not advance
7315         dot value and load address if section type is NOLOAD.  Set address
7316         of NOLOAD sections regardless of section flags.
7317         (Output_section_definition::print): Print section type if it is
7318         not SCRIPT_SECTION_TYPE_NONE.
7319         (Output_section_definition::section_type): New method.
7320         (Output_section_definition::script_section_type_name): Ditto.
7321         (Script_sections::output_section_name): Add new parameter
7322         PSECTION_TYPE for returning script section type.  Pass it to
7323         section elements.  Handle discard sections.
7324         (Sort_output_sections::operator()): Handle NOLOAD sections.
7325         * script-sections.h (Script_sections::Section_type): New enum type.
7326         (Script_sections::output_section_name): Add a new parameter for
7327         returning script section type.
7328         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7329         INFO and NOLOAD.
7330         * yyscript.y (union): Add new field SECTION_TYPE.
7331         (COPY, DSECT, INFO, NOLOAD): New tokens.
7332         (opt_address_and_section_type): Change type to output_section_header.
7333         (section_type): New non-terminal
7334         (section_header): Handle section type.
7335         (opt_address_and_section_type): Return section type value.
7336
7337 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7338
7339         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7340         * testsuite/plugin_common_test_2.c (foo): Likewise.
7341
7342 2010-04-08  Doug Kwan  <dougkwan@google.com>
7343
7344         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7345         Output_merge_data.
7346         * output.cc (Output_section::add_merge_input_section): Simplify
7347         code and return status of Output_merge_base::add_input_section.
7348         Update merge section map only if Output_merge_base::add_input_section
7349         returns true.
7350
7351 2010-04-07  Doug Kwan  <dougkwan@google.com>
7352
7353         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7354         if section is marked as containing instructions but has no mapping
7355         symbols.
7356         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7357         correct section index.
7358         (Arm_relobj::find_linked_text_section): Ditto.
7359
7360 2010-04-07  Cary Coutant  <ccoutant@google.com>
7361
7362         * archive.cc (include_member): Destroy Read_symbols_data object before
7363         releasing file.
7364         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7365         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7366         (Read_symbols_data::~Read_symbols_data) New destructor.
7367         (Section_relocs::Section_relocs) New constructor.
7368         (Section_relocs::~Section_relocs) New destructor.
7369         (Read_relocs_data::Read_relocs_data) New constructor.
7370         (Read_relocs_data::~Read_relocs_data) New destructor.
7371         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7372         pointers to NULL after deleting.
7373
7374 2010-04-07  Doug Kwan  <dougkwan@google.com>
7375
7376         * arm.cc: Replace "endianity" with "endianness" in comments.
7377         (Arm_exidx_cantunwind): Ditto.
7378         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7379         (Arm_relobj::merge_flags_and_attributes): New method.
7380         (Arm_relobj::merge_flags_and_attributes_): New data member.
7381         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7382         (Arm_relobj::scan_sections_for_stubs): Ditto.
7383         (Arm_relobj::do_read_symbols): Check to see if we really want to
7384         merge processor-specific flags and attributes.  Exit early if
7385         an object is empty except for section names and the undefined symbol.
7386         (Target_arm::do_finalize_sections): Move check for ELF format to
7387         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7388         attributes from a regular object only when we have determined that
7389         it is aapropriate.  Do not create an .ARM.attributes section in
7390         output if there is no regular input object.
7391         (Target_arm::merge_processor_specific_flags): Check
7392         --warn-mismatch before printing any error.
7393         (Target_arm::merge_object_attributes): Ditto.
7394         * gold.cc (queue_middle_tasks): Handle the case in which there is
7395         no regular object in input.
7396         * options.cc (General_options::parse_EB): New method.
7397         (General_options::parse_EL): Same.
7398         (General_options::General_options): Initialize endianness_.
7399         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7400         New options.
7401         (General_options::Endianness): New enum.
7402         (General_options::endianness): New method.
7403         (General_options::endianness_): New data member.
7404         * parameters.cc (Parameters::set_options): Check target endianness.
7405         (Parameters::set_target_once): Ditto.
7406         (Parameters::check_target_endianness): New method.
7407         (parameters_force_valid_target): If either -EL or -EB is specified,
7408         use it to define endianness of default target.
7409         * parameters.h (Parameters::check_target_endianness): New method
7410         declaration.
7411         * target.h (class Target): Change "endianity" to "endianness"
7412         in comments.
7413
7414 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7415
7416         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7417         * configure: Regenerate.
7418         * Makefile.in: Regenerate.
7419         * testsuite/Makefile.in: Regenerate.
7420
7421 2010-04-06  Cary Coutant  <ccoutant@google.com>
7422
7423         gcc PR lto/42757
7424         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7425         prevailing definitions of common symbols.
7426         * testsuite/plugin_test_6.sh: New test case.
7427         * testsuite/plugin_common_test_1.c: New test case.
7428         * testsuite/plugin_common_test_2.c: New test case.
7429         * testsuite/Makefile.am (plugin_test_6): New test case.
7430         * testsuite/Makefile.in: Regenerate.
7431
7432 2010-04-06  Nick Clifton  <nickc@redhat.com>
7433
7434         * po/vi.po: New Vietnamese translation.
7435
7436 2010-03-30  Doug Kwan  <dougkwan@google.com>
7437
7438         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7439
7440 2010-03-25  Doug Kwan  <dougkwan@google.com>
7441
7442         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7443         to avoid a conversion warning on a 32-bit host.
7444
7445 2010-03-24  Ian Lance Taylor  <iant@google.com>
7446
7447         * testsuite/script_test_3.t: Add a TLS segment.
7448         * testsuite/Makefile.am (check_PROGRAMS): Add
7449         tls_phdrs_script_test.
7450         (tls_phdrs_script_test_SOURCES): Define.
7451         (tls_phdrs_script_test_DEPENDENCIES): Define.
7452         (tls_phdrs_script_test_LDFLAGS): Define.
7453         (tls_phdrs_script_test_LDADD): Define.
7454         * testsuite/Makefile.in: Rebuild.
7455
7456 2010-03-23  Cary Coutant  <ccoutant@google.com>
7457
7458         * fileread.cc (find_or_make_view): Fix comment.
7459
7460 2010-03-23  Ian Lance Taylor  <iant@google.com>
7461
7462         * script-sections.cc (class Orphan_section_placement): Define
7463         PLACE_TLS and PLACE_TLS_BSS.
7464         (Orphan_section_placement::Orphan_section_placement): Initialize
7465         new places.
7466         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7467         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7468         (tls_script_test_SOURCES): Define.
7469         (tls_script_test_DEPENDENCIES): Define.
7470         (tls_script_test_LDFLAGS): Define.
7471         (tls_script_test_LDADD): Define.
7472         * testsuite/Makefile.in: Rebuild.
7473
7474 2010-03-22  Doug Kwan  <dougkwan@google.com>
7475
7476         * arm.cc (Arm_relocate_functions::abs8,
7477         Arm_relocate_functions::abs16): Use correct check for overflow
7478         specified in the ARM ELF specs.
7479         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7480         target of a BLX instruction specially.
7481         (Reloc_stub::stub_type_for_reloc): Ditto.
7482         (Relocate::relocate): Use symbolic names instead of numeric relocation
7483         codes to report error.
7484         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7485         workaround.
7486         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7487         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7488         thumb2_blx_out_of_range.stdout
7489         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7490         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7491         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7492         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7493         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7494         thumb2_blx_in_range, thumb2_blx_in_range.o,
7495         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7496         thumb2_blx_out_of_range.o): New rules.
7497         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7498         thumb2_blx_in_range and thumb2_blx_out_of_range.
7499         * testsuite/Makefile.in: Regenerate.
7500         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7501         * testsuite/thumb_blx_in_range.s: New file.
7502         * testsuite/thumb_blx_out_of_range.s: New file.
7503
7504 2010-03-22  Rafael Espindola  <espindola@google.com>
7505
7506         * archive.cc (Should_include): Move to archive.h.
7507         (should_include_member): Make it a member of Archive.
7508         (Lib_group): New.
7509         (Add_lib_group_symbols): New.
7510         * archive.h: Include options.h.
7511         (Archive_member): Moved from Archive.
7512         (Should_include): Moved from archive.cc.
7513         (Lib_group): New.
7514         (Add_lib_group_symbols): New.
7515         * dynobj.cc (do_should_include_member): New.
7516         * dynobj.h (do_should_include_member): New.
7517         * gold.cc (queue_initial_tasks): Update call to queue.
7518         * main.cc (main): Print lib group stats.
7519         * object.cc (do_should_include_member): New.
7520         * object.h: Include archive.h.
7521         (Object::should_include_member): New.
7522         (Object::do_should_include_member): New.
7523         (Sized_relobj::do_should_include_member): New.
7524         * options.cc (General_options::parse_start_lib): New.
7525         (General_options::parse_end_lib): New.
7526         (Input_arguments::add_file): Handle lib groups.
7527         (Input_arguments::start_group): Check we are not in a lib.
7528         (Input_arguments::start_lib): New.
7529         (Input_arguments::end_lib): New.
7530         * options.h (General_options): Add start_lib and end_lib.
7531         (Input_argument::lib_): New.
7532         (Input_argument::lib): New.
7533         (Input_argument::is_lib): New.
7534         (Input_file_lib): New.
7535         (Input_arguments::in_lib_): New.
7536         (Input_arguments::in_lib): New.
7537         (Input_arguments::start_lib): New.
7538         (Input_arguments::end_lib_): New.
7539         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7540         in unused members as preempted.
7541         (Sized_pluginobj::do_should_include_member): New.
7542         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7543         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7544         return the blocker.
7545         (Read_symbols::do_whole_lib_group): New.
7546         (Read_symbols::do_lib_group): New.
7547         (Read_symbols::do_read_symbols): Handle lib groups.
7548         (Read_symbols::get_name): Handle lib groups.
7549         * readsyms.h (Read_symbols): Add an archive member pointer.
7550         (Read_symbols::do_whole_lib_group): New.
7551         (Read_symbols::do_lib_group): New.
7552         (Read_symbols::member_): New.
7553         * script.cc (read_input_script): Update call to queue_soon.
7554
7555 2010-03-19  Doug Kwan  <dougkwan@google.com>
7556
7557         * arm.cc (Stub_table::Stub_table): Initialize new data members
7558         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7559         (Stub_table::add_reloc_stub): Assign stub offset and update
7560         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7561         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7562         New data members.
7563         (Stub_table::update_data_size_and_addralign): Use
7564         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7565         instead of going over all reloc stubs.
7566         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7567         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7568         Stringpool_template::offset_ to size of Stringpool_char.
7569         (Stringpool_template::new_key_offset): Remove code to initialize
7570         Stringpool_template::offset_.
7571         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7572         Stringpool_template::offset_ to zero.
7573
7574 2010-03-15  Doug Kwan  <dougkwan@google.com>
7575
7576         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7577         offset_.
7578         (Stringpool_template::new_key_offset): New method.
7579         (Stringpool_template::add_string): Assign offsets when adding new
7580         strings.
7581         (Stringpool_template::set_string_offsets): Do not set string offsets
7582         when not optimizing.
7583         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7584         member size_.
7585         (Chunked_vector::clear): Clear size_.
7586         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7587         (Chunked_vector::size): Return size_.
7588         (Chunked_vector::push_back): Use size_ to find insert position.
7589         (Chunked_vector::size_): New data member.
7590         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7591         (Stringpool_template::new_key_offset): New method declaration.
7592         (Stringpool_template::offset_): New data member.
7593
7594 2010-03-15   Rafael Espindola  <espindola@google.com>
7595
7596         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7597         Add_symbols' constructor.
7598         * readsyms.h (Add_symbols): Remove the input_group member.
7599
7600 2010-03-10  Ian Lance Taylor  <iant@google.com>
7601
7602         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7603         target to ask whether a reference to a symbol requires a stack
7604         split.
7605         * target.h (Target::is_call_to_non_split): New function.
7606         (Target::do_is_call_to_non_split): Declare virtual function.
7607         * target.cc: Include "symtab.h".
7608         (Target::do_is_call_to_non_split): New function.
7609         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7610
7611 2010-03-10  Cary Coutant  <ccoutant@google.com>
7612
7613         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7614         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7615         (File_read::open[2]): Add whole_file_view_ to list of views.
7616         (File_read::make_view): Remove test of whole_file_view_.
7617         (File_read::find_or_make_view): Create whole_file_view_ if
7618         necessary.
7619         (File_read::clear_views): Replace bool parameter with enum;
7620         adjust all callers.  Don't delete views with permanent data;
7621         do delete cached views and views from archives if
7622         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7623         if clearing the corresponding view.
7624         * fileread.h (File_read::Clear_views_mode): New enum.
7625         (File_read::View::is_permanent_view): New method.
7626         (File_read::clear_views): Replace bool parameter
7627         with enum; adjust all callers.
7628         * options.h (General_options): Change keep_files_mapped option;
7629         add map_whole_files.
7630         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7631         releasing the file.
7632         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7633         the file.
7634
7635 2010-03-10  David S. Miller  <davem@davemloft.net>
7636
7637         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7638
7639 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7640
7641         * icf.cc (get_section_contents): Add '@' marker after processing the
7642         merge reloc.
7643
7644 2010-03-08  Doug Kwan  <dougkwan@google.com>
7645
7646         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7647         due to a conversion warning.
7648         (Arm_relobj::update_output_local_symbol_count): Check for local
7649         symbol with unset output index.
7650
7651 2010-03-05  Ian Lance Taylor  <iant@google.com>
7652
7653         * options.h (class General_options): Add --spare-dynamic-tags.
7654         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7655         --spare-dynamic-tags.
7656
7657 2010-03-05  Ian Lance Taylor  <iant@google.com>
7658
7659         * incremental.cc: Include "libiberty.h".
7660
7661 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7662
7663         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7664         function, is_info_ member.
7665         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7666         (Versions::Versions): Update caller.
7667         (Versions::define_base_version): Likewise.
7668         (Versions::add_def): Likewise.
7669
7670 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7671
7672         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7673         (Scan::possible_function_pointer_reloc): New function.
7674         (Scan::local_reloc_may_be_function_pointer): Change to call
7675         possible_function_pointer_reloc.
7676         (Scan::global_reloc_may_be_function_pointer): Ditto.
7677         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7678         relocations in ".data.rel.ro._ZTV" section.
7679         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7680         * testsuite/icf_safe_so_test.cc: Ditto.
7681         * testsuite/icf_safe_test.cc: Ditto.
7682         * testsuite/icf_safe_test.sh: Ditto.
7683
7684 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7685             Ian Lance Taylor  <iant@google.com>
7686
7687         * target-reloc.h (relocate_section): Check the symbol table index
7688         for -1U before setting the local symbol index.
7689         (scan_relocatable_relocs): If copying the relocation, record that
7690         the local symbol is required.
7691         * object.h (Symbol_value::is_output_symtab_index_set): New
7692         function.
7693         (Symbol_value::may_be_discarded_from_output_symtab): New
7694         function.
7695         (Symbol_value::has_output_symtab_entry): New function.
7696         (Symbol_value::needs_output_symtab_entry): Remove.
7697         (Symbol_value::output_symtab_index): Make sure the symbol index is
7698         set.
7699         (Symbol_value::set_output_symtab_index): Make sure the symbol
7700         index is not set.  Make sure the new index is valid.
7701         (Symbol_value::set_must_have_output_symtab_entry): New function.
7702         (Symbol_value::has_output_dynsym_entry): New function.
7703         (Symbol_value::set_output_dynsym_index): Make sure the new index
7704         is valid.
7705         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7706         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7707         local symbol if permitted.
7708         (Sized_relobj::do_finalize_local_symbols): Call
7709         is_output_symtab_index_set rather than needs_output_symtab_entry.
7710         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7711         rather than needs_output_symtab_entry.  Call
7712         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7713         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7714         is_output_symtab_index_set rather than needs_output_symtab_entry.
7715         * testsuite/discard_locals_relocatable_test.c: New file.
7716         * testsuite/discard_locals_test.sh: Test -r.
7717         * testsuite/Makefile.am (check_DATA): Add
7718         discard_locals_relocatable_test1.syms,
7719         discard_local_relocatable_test2.syms.
7720         (MOSTLYCLEANFILES): Likewise.  Also add
7721         discard_locals_relocatable_test1.lout and
7722         discard_locals_relocatable_test2.out.
7723         (discard_locals_relocatable_test1.syms): New target.
7724         (discard_locals_relocatable_test.o): New target.
7725         (discard_locals_relocatable_test1.out): New target.
7726         (discard_locals_relocatable_test2.syms): New target.
7727         (discard_locals_relocatable_test2.out): New target.
7728         (various): Add missing ../ld-new dependencies.
7729         * testsuite/Makefile.in: Rebuild.
7730
7731 2010-03-03  Nick Clifton  <nickc@redhat.com>
7732
7733         * po/fi.po: New Finnish translation.
7734
7735 2010-03-01  Doug Kwan  <dougkwan@google.com>
7736
7737         * layout.cc (Layout::Layout): Force section types of .init_array*,
7738         .preinit_array* and .fini_array* sections.
7739         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7740         Fix check of return value of std::string::find.().
7741         (Output_section::Input_section_sort_compare::operator()): Remove
7742         comment about .init_array.
7743         (Output_section::Input_section_sort_init_fini_compare::operator()):
7744         New method.
7745         (Output_section::sort_attached_input_sections): Handle .init_array
7746         and .fini_array specially.
7747         * output.h (Output_section::Inut_section_sort_compare): Update
7748         comment.
7749         (Output_section::Input_section_sort_init_fini_compare): New struct.
7750
7751 2010-02-26  Doug Kwan  <dougkwan@google.com>
7752
7753         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7754         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7755         * testsuite/debug_msg.sh: Avoid matching source line number for
7756         use of global variable undef_int.
7757
7758 2010-02-26  Doug Kwan  <dougkwan@google.com>
7759
7760         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7761         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7762         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7763         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7764         * options.cc (General_options::General_options): Initialize member
7765         fix_v4bx_.
7766         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7767         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7768         and rm_no_fix_v4bx.stdout
7769         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7770         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7771         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7772         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7773         and arm_no_fix_v4bx.
7774         * Makefile.in: Regenerate.
7775         * testsuite/arm_fix_v4bx.s: New file.
7776         * testsuite/arm_fix_v4bx.sh: Ditto.
7777
7778 2010-02-24  Doug Kwan  <dougkwan@google.com>
7779
7780         * arm.cc (Target_arm::got_section): Make the .got section the first
7781         non RELRO section in the data segment.
7782         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7783         suffixes of section names.
7784
7785 2010-02-24  Doug Kwan  <dougkwan@google.com>
7786
7787         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7788         flags and attributes merging if an input file is a binary file.
7789         * fileread.cc (Input_file::open): Record format of original file.
7790         * fileread.h (Input_file::Format): New enum type.
7791         (Input_file::Input_file): Initialize data member format_.
7792         (Input_file::format): New method definition.
7793         (Input_file::format_):: New data member.
7794
7795 2010-02-24  Doug Kwan  <dougkwan@google.com>
7796
7797         * arm.cc (Arm_output_data_got): New class.
7798         (ARM_TCB_SIZE): New constant
7799         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7800         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7801         If user uses a script with a SECTIONS clause, issue only a warning
7802         for a misplaced EXIDX input section.  Otherwise, issue an error.
7803         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7804         garbage collection.
7805         (Target_arm::got_mode_index_entry): Handle static linking.
7806         (Target_arm::Scan::local): Ditto.
7807         (Target_arm::Scan::global): Ditto.
7808         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7809         all incorrectly implemented relocations.
7810         (Target_arm::fix_exidx_coverage): Pass layout to
7811         Arm_output_section::fix_exidx_coverage.
7812         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7813         from ".ARM.exidx." and ".ARM.extab.".
7814
7815 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7816
7817         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7818         section if it does not already exist.
7819         * attributes.cc (Attributes_section_data::Attributes_section_data):
7820         Don't crash if size is zero.
7821
7822 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7823             Ian Lance Taylor  <iant@google.com>
7824
7825         * gold.cc (queue_middle_tasks): If no input files were opened,
7826         exit.
7827         * workqueue.h (Task_function::Task_function): Assert that there is
7828         a blocker.
7829
7830 2010-02-22  Doug Kwan  <dougkwan@google.com>
7831
7832         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7833         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7834         types to avoid warnings due to different uint64_t implementations
7835         on different hosts.
7836
7837 2010-02-21  Doug Kwan  <dougkwan@google.com>
7838
7839         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7840         handling of the maximum backward branch offset.
7841         (Arm_relocate_functions::thumb_branch_common): Ditto.
7842         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7843         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7844         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7845         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7846         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7847         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7848         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7849         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7850         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7851         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7852         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7853         thumb2_bl_out_of_range.o): New rules.
7854         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7855         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7856         thumb2_bl_out_of_range
7857         * testsuite/Makefile.in: Regenerate.
7858         * testsuite/arm_bl_in_range.s: New file.
7859         * testsuite/arm_bl_out_of_range.s: Ditto.
7860         * testsuite/arm_branch_in_range.sh: Ditto.
7861         * testsuite/arm_branch_range.t: Ditto.
7862         * testsuite/thumb2_branch_range.t: Ditto.
7863         * testsuite/thumb_bl_in_range.s: Ditto.
7864         * testsuite/thumb_bl_out_of_range.s: Ditto.
7865         * testsuite/thumb_branch_range.t: Ditto.
7866
7867 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7868
7869         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7870         Add reloc offset information.
7871         * icf.cc (get_section_contents): Change iterators to point to the new
7872         vectors. Add reloc offset information to the contents.
7873         * icf.h (Icf::Sections_reachable_info): New typedef.
7874         (Icf::Sections_reachable_list): New typedef.
7875         (Icf::Offset_info): New typedef.
7876         (Icf::Reloc_info): New struct typedef.
7877         (Icf::Reloc_info_list): New typedef.
7878         (Icf::symbol_reloc_list): Delete method.
7879         (Icf::addend_reloc_list): Delete method.
7880         (Icf::section_reloc_list): Delete method.
7881         (Icf::reloc_info_list): New method.
7882         (Icf::reloc_info_list_): New member.
7883
7884 2010-02-19  Doug Kwan  <dougkwan@google.com>
7885
7886         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7887         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7888         * arm.cc (Arm_relocation_functions): New forward declaration.
7889         (Target_arm::Target_arm): Initialize new data members
7890         got_mod_index_offset_ and tls_base_symbol_defined_.
7891         (Target_arm::Relocate::relocate_tls): New method.
7892         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7893          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7894         New methods.
7895         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7896         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7897         (Target_arm::got_mod_index_offset_,
7898         Target_arm::tls_base_symbol_defined_): New data members.
7899         (Target_arm::Scan::local, Target::Scan::global,
7900         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7901         relocations.
7902
7903 2010-02-18  Doug Kwan  <dougkwan@google.com>
7904
7905         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7906         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7907         text section as a parameter becuase some broken tools may not set
7908         the link in section header.
7909         (Target_arm::has_got_section): New method.
7910         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7911         without any mapping symbol as data only.  Remove warning.
7912         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7913         link in its section header, try to discover the link by inspecting the
7914         REL31 relocation at the beginning of the section.
7915         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7916         in error message.
7917         (Target_arm::Scan::global): Treat any reference to the symbol
7918         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7919
7920 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7921
7922         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7923         (Scan::global_reloc_may_be_function_pointer): New function.
7924         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7925         (Scan::global_reloc_may_be_function_pointer): New function.
7926         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7927         (Scan::global_reloc_may_be_function_pointer): New function.
7928         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7929         (Scan::global_reloc_may_be_function_pointer): New function.
7930         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7931         (Scan::global_reloc_may_be_function_pointer): New function.
7932         (Scan::possible_function_pointer_reloc): New function.
7933         (Target_x86_64::can_check_for_function_pointers): New function.
7934         * gc.h (gc_process_relocs): Scan relocation types to determine if
7935         function pointers were taken for targets that support it.
7936         * icf.cc (Icf::find_identical_sections): Include functions for
7937         folding in safe ICF whose pointer is not taken.
7938         * icf.h (Secn_fptr_taken_set): New typedef.
7939         (fptr_section_id_): New member.
7940         (section_has_function_pointers): New function.
7941         (set_section_has_function_pointers): New function.
7942         (check_section_for_function_pointers): New function.
7943         * options.h: Fix comment for safe ICF option.
7944         * target.h (can_check_for_function_pointers): New function.
7945         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7946         Modify icf_safe_test for X86-64.
7947         * testsuite/Makefile.in: Regenerate.
7948         * testsuite/icf_safe_so_test.cc: New file.
7949         * testsuite/icf_safe_so_test.sh: New file.
7950         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7951         (main): Change to take pointer to function kept_func_3.
7952         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7953         folding is done correctly for X86-64.
7954
7955 2010-02-12  David S. Miller  <davem@davemloft.net>
7956
7957         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7958         is_symbolless parameter.
7959         (Output_reloc<SHT_REL>::is_symbolless): New.
7960         (Output_reloc<SHT_REL>::is_symbolless_): New.
7961         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7962         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7963         (Output_reloc<SHT_RELA>::is_symbolless): New.
7964         (Output_data_reloc::add_global): Handle is_symbolless.
7965         (Output_data_reloc::add_global_relative): Likewise.
7966         (Output_data_reloc::add_local): Likewise.
7967         (Output_data_reloc::add_local_relative): Likewise.
7968         (Output_data_reloc::add_symbolless_global_addend): New.
7969         (Output_data_reloc::add_symbolless_local_addend): New.
7970         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7971         is_symbolless.
7972         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7973         instead of ->is_relative_
7974         (Output_reloc::write): Likewise.
7975         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7976         (Output_reloc::write_rel): Simplify.
7977
7978         * sparc.cc (Target_sparc::Scan::local): Use
7979         ->add_symbolless_local_addend as needed.
7980         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7981         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7982         based upon relocation offset.
7983
7984 2010-02-11  Doug Kwan  <dougkwan@google.com>
7985
7986         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7987         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7988         beginning of function.
7989         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7990         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7991         parameter is_32bit in calls to should_apply_static_reloc.
7992         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7993         (check_DATA): Add arm_abs_global.stdout.
7994         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7995         arm_abs_global.stdout): New rules.
7996         (MOSTLLYCLEANFILES): Add arm_abs_global
7997         * Makefile.in: Regenerate.
7998         * testsuite/arm_abs_global.s: New file.
7999         * testsuite/arm_abs_global.sh: Ditto.
8000         * testsuite/arm_abs_lib.s: Ditto.
8001
8002 2010-02-11  Ian Lance Taylor  <iant@google.com>
8003
8004         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8005         Read_relocs task.
8006         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8007         Allocate_commons_task first.
8008         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8009         task, rather than symtab_lock_.
8010         (Gc_process_relocs::~Gc_process_relocs): New function.
8011         (Gc_process_relocs::is_runnable): Check this_blocker_.
8012         (Gc_process_relocs::locks): Use next_blocker_ rather than
8013         blocker_.
8014         (Scan_relocs::~Scan_relocs): New function.
8015         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8016         symtab_lock_.
8017         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8018         next_blocker_.
8019         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8020         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8021         constructor accordingly.
8022         (class Gc_process_relocs): Likewise.
8023         (class Scan_relocs): Likewise.
8024         * common.h (class Allocate_commons_task): Remove symtab_lock_
8025         field, and corresponding constructor parameter.
8026         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8027         symtab_lock_.
8028         (Allocate_commons_task::locks): Likewise.
8029
8030 2010-02-11  Ian Lance Taylor  <iant@google.com>
8031
8032         * gold-threads.h (class Once): Define.
8033         (class Initialize_lock): Rewrite as child of Once.
8034         * gold-threads.cc (class Once_initialize): Define.
8035         (once_pointer_control): New static variable.
8036         (once_pointer, once_arg): New static variables.
8037         (c_run_once): New static function.
8038         (Once::Once, Once::run_once, Once::internal_run): New functions.
8039         (class Initialize_lock_once): Remove.
8040         (initialize_lock_control): Remove.
8041         (initialize_lock_pointer): Remove.
8042         (initialize_lock_once): Remove.
8043         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8044         (Initialize_lock::initialize): Rewrite.
8045         (Initialize_lock::do_run_once): New function.
8046         * archive.cc (Archive::interpret_header): Only clear name if it is
8047         not already empty.
8048         * fileread.cc: Include "gold-threads.h"
8049         (file_counts_lock): New static variable.
8050         (file_counts_initialize_lock): Likewise.
8051         (File_read::release): Only increment counts when using --stats.
8052         Use a lock around the increment.
8053         * parameters.cc (class Set_parameters_target_once): Define.
8054         (set_parameters_target_once): New static variable.
8055         (Parameters::Parameters): Move here from parameters.h.
8056         (Parameters::set_target): Rewrite.
8057         (Parameters::set_target_once): New function.
8058         (Parameters::clear_target): Move here and rewrite.
8059         * parameters.h (class Parameters): Update declarations.  Add
8060         set_parameters_target_once_ field.
8061         (Parameters::Parameters): Move to parameters.cc.
8062         (Parameters::clear_target): Likewise.
8063         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8064         task.
8065         (Start_group::~Start_group): New function.
8066         (Start_group::is_runnable): New function.
8067         (Start_group::locks, Start_group::run): New functions.
8068         (Finish_group::run): Change saw_undefined to size_t.
8069         * readsyms.h (class Start_group): Define.
8070         (class Finish_group): Change saw_undefined_ field to size_t.
8071         (Finish_group::Finish_group): Remove saw_undefined and
8072         this_blocker parameters.  Change all callers.
8073         (Finish_group::set_saw_undefined): New function.
8074         (Finish_group::set_blocker): New function.
8075         * symtab.h (class Symbol_table): Change saw_undefined to return
8076         size_t.  Change saw_undefined_ field to size_t.
8077         * target-select.cc (Set_target_once::do_run_once): New function.
8078         (Target_selector::Target_selector): Initialize set_target_once_
8079         field.  Don't initialize lock_ and initialize_lock_ fields.
8080         (Target_selector::instantiate_target): Rewrite.
8081         (Target_selector::set_target): New function.
8082         * target-select.h (class Set_target_once): Define.
8083         (class Target_selector): Update declarations.  Make
8084         Set_target_once a friend.  Remove lock_ and initialize_lock_
8085         fields.  Add set_target_once_ field.
8086
8087 2010-02-10  Ian Lance Taylor  <iant@google.com>
8088
8089         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8090         queueing any tasks.
8091         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8092         (queue_middle_tasks): Add all blockers before queueing any tasks.
8093         (queue_final_tasks): Likewise.
8094         * token.h (Task_token::add_blockers): New function.
8095         * object.h (Input_objects::number_of_relobjs): New function.
8096
8097 2010-02-10  Ian Lance Taylor  <iant@google.com>
8098
8099         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8100         shared, not if not position independent.
8101         * x86_64.cc (Relocate::relocate_tls): Likewise.
8102         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8103         (tls_pie_pic_test): New target.
8104         * testsuite/Makefile.in: Rebuild.
8105
8106         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8107         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8108         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8109         * testsuite/Makefile.in: Rebuild.
8110
8111 2010-02-09  David S. Miller  <davem@davemloft.net>
8112
8113         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8114         R_SPARC_RELATIVE using ->add_local_relative().
8115         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8116
8117         * output.h (Output_data_dynamic::add_section_size): New method
8118         that takes two Output_data objects.
8119         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8120         entry param.  Handle it in initializers.
8121         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8122         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8123         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8124         arg.
8125         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8126         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8127         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8128         for dynrel_includes_plt.
8129         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8130         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8131         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8132         before .rela.plt
8133         (Target_sparc::do_finalize_sections): Update to pass true for
8134         dynrel_includes_plt.
8135         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8136         output before .rela.plt
8137         (Target_powerpc::do_finalize_sections): Update to pass true for
8138         dynrel_includes_plt when 32-bit.
8139
8140 2010-02-08  Doug Kwan  <dougkwan@google.com>
8141
8142         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8143         method.
8144         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8145         Arm_relobj::scan_section_for_cortex_a8_stubs,
8146         Arm_relobj::do_relocation_section): Instead of calling
8147         Output_section::output_address, use faster
8148         Arm_relobj::simple_input_section_output_address.
8149
8150 2010-02-08  David S. Miller  <davem@davemloft.net>
8151
8152         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8153         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8154         relocation helper function.
8155
8156         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8157         just like R_SPARC_GOT{10,13,22}.
8158         (Target_sparc::Scan::local): Likewise.
8159         (Target_sparc::Relocate:relocate): Likewise.
8160
8161 2010-02-06  Ian Lance Taylor  <iant@google.com>
8162
8163         * configure.ac: Rewrite targetobjs duplicate removal code to use
8164         only shell constructs.
8165         * configure: Rebuild.
8166
8167 2010-02-05  Doug Kwan  <dougkwan@google.com>
8168
8169         PR 11247
8170         * arm.cc (Arm_relobj::section_is_scannable): New method.
8171         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8172         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8173
8174 2010-02-04  Doug Kwan  <dougkwan@google.com>
8175
8176         PR 11247
8177         * arm-reloc-property.cc (cstdio): Include.
8178         * configure.ac (targetobjs): Remove duplicates.
8179         * configure: Regenerate.
8180         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8181         big and little endian version for a given address size.
8182
8183 2010-02-03  Doug Kwan  <dougkwan@google.com>
8184
8185         * arm-reloc-property.cc
8186         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8187         definition.
8188         * arm-reloc-property.h
8189         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8190         New method definition.
8191         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8192         declaration.
8193         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8194         overflow to N.
8195         (GOT_PREL): Change implemented to Y.
8196         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8197         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8198         (Arm_relocate_functions::movw_abs_nc): Remove method.
8199         (Arm_relocate_functions::movt_abs): Ditto.
8200         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8201         (Arm_relocate_functions::thm_movt_abs): Ditto.
8202         (Arm_relocate_functions::movw_rel_nc): Ditto.
8203         (Arm_relocate_functions::movw_rel): Ditto.
8204         (Arm_relocate_functions::movt_rel): Ditto.
8205         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8206         (Arm_relocate_functions:thm_movw_rel): Ditto.
8207         (Arm_relocate_functions:thm_movt_rel): Ditto.
8208         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8209         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8210         New method definitions.
8211         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8212         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8213         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8214         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8215         (Target_arm::Relocate::relocate): Check for non-static or
8216         unimplemented relocation code and exit early.  Change calls to
8217         Target_arm::reloc_uses_thumb_bit and
8218         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8219         instead.  Refactor code to handle similar relocations to increase
8220         code sharing.  Remove check for unsupported relocation code in switch
8221         statement.
8222         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8223         relocation property table to find out size.  Change error message to
8224         print out the name of a relocation code instead of the numeric value.
8225         (Target_arm::scan_reloc_for_stub): Use relocation property table
8226         instead of calling Target_arm::reloc_uses_thumb_bit().
8227
8228 2010-02-02  Doug Kwan  <dougkwan@google.com>
8229
8230         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8231         types of relaxed input section.
8232
8233 2010-02-02  Doug Kwan  <dougkwan@google.com>
8234
8235         * Makefile.am (HFILES): Add arm-reloc-property.h.
8236         (DEFFILES): New.
8237         (TARGETSOURCES): Add arm-reloc-property.cc
8238         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8239         (libgold_a_SOURCES): $(DEFFILES)
8240         * Makefile.in: Regenerate.
8241         * arm-reloc-property.cc: New file.
8242         * arm-reloc-property.h: New file.
8243         * arm-reloc.def: New file.
8244         * arm.cc: Update comments.
8245         (arm-reloc-property.h): New included header.
8246         (arm_reloc_property_table): New global variable.
8247         (Target_arm::do_select_as_default_target): New method definition.
8248         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8249         arm-reloc-property to targ_extra_obj.
8250         * parameters.cc (set_parameters_target): Call
8251         Target::select_as_default_target().
8252         * target.h (Target::select_as_default_target): New method definition.
8253         (Target::do_select_as_default_target): Same.
8254
8255 2010-02-01  Doug Kwan  <dougkwan@google.com>
8256
8257         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8258         first_output_text_section_.
8259         (Arm_exidx_fixup::first_output_text_section): New method definition.
8260         (Arm_exidx_fixup::first_output_text_section_): New data member.
8261         (Arm_exidx_fixup::process_exidx_section): Record the first text
8262         output section seen.
8263         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8264         and entsize in output section header.
8265
8266 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8267
8268         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8269         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8270         (Arm_relocate_functions::thm_alu11): New Method.
8271         (Arm_relocate_functions::thm_pc8): New Method.
8272         (Arm_relocate_functions::thm_pc12): New Method.
8273         (Target_arm::Scan::local): Handle the relocations.
8274         (Target_arm::Scan::global): Likewise.
8275         (Target_arm::Relocate::relocate): Likewise.
8276         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8277
8278 2010-01-29  Doug Kwan  <dougkwan@google.com>
8279
8280         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8281         of relocation types as ld.
8282
8283 2010-01-29  Doug Kwan  <dougkwan@google.com>
8284
8285         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8286         to public.
8287         (Arm_relocate_functions::thumb_branch_common): Ditto.
8288         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8289         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8290         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8291         Arm_relocate_functions::jump24): Remove.
8292         (Target_arm::Relocate::relocate): Adjust code to call
8293         Arm_relocation_functions::arm_branch_common and
8294         Arm_relocation_functions::thumb_branch_common instead of their removed
8295         wrappers.  Merge switch-cases together to reduce source code size.
8296
8297 2010-01-29  Doug Kwan  <dougkwan@google.com>
8298
8299         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8300         output_local_symbol_count_needs_update_.
8301         (Arm_relobj::output_local_symbol_count_needs_update,
8302          Arm_relobj::set_output_local_symbol_count_needs_update,
8303          Arm_relobj::update_output_local_symbol_count): New methods.
8304         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8305         member.
8306         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8307         of pointed function as in a R_ARM_PREL31 relocation.
8308         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8309         for output local symbol count updating.
8310         (Target_arm::do_relax): Update output local symbol counts in objects
8311         if necessary.
8312         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8313
8314 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8315
8316         * arm.cc: Added support for the ARM relocations:
8317         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8318         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8319         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8320         movw_prel_nc).
8321         (Arm_relocate_functions::movw_rel): New method.
8322         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8323         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8324         thm_movw_prel_nc).
8325         (Arm_relocate_functions::thm_movw_rel): New method.
8326         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8327         thm_movt_prel).
8328         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8329         relocations.
8330         (Target_arm::Scan::global): Likewise.
8331         (Target_arm::Relocate::relocate): Likewise.
8332         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8333         Likewise.
8334
8335 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8336
8337         * arm.cc: Added support for ARM group relocations.
8338         (Target_arm::reloc_needs_sym_origin): New method.
8339         (Arm_relocate_functions::calc_grp_kn): New method.
8340         (Arm_relocate_functions::calc_grp_residual): New method.
8341         (Arm_relocate_functions::calc_grp_gn): New method.
8342         (Arm_relocate_functions::arm_grp_alu): New Method.
8343         (Arm_relocate_functions::arm_grp_ldr): New Method.
8344         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8345         (Arm_relocate_functions::arm_grp_ldc): New Method.
8346         (Target_arm::Scan::local): Handle the ARM group relocations.
8347         (Target_arm::Scan::global): Likewise.
8348         (Target_arm::Relocate::relocate): Likewise.
8349         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8350         Likewise.
8351
8352 2010-01-26  Doug Kwan  <dougkwan@google.com>
8353
8354         * arm.cc (set): Include.
8355         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8356         pointer type.
8357         (Arm_output_section::Text_section_list): New type.
8358         (Arm_output_section::append_text_sections_to_list): New method.
8359         (Arm_output_section::fix_exidx_coverage): Ditto.
8360         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8361         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8362         Relobj::set_section_offset() instead of
8363         Sized_relobj::invalidate_section_offset().
8364         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8365         parameter for section headers. Ignore relocation sections for
8366         unallocated sections and EXIDX sections.
8367         (Target_arm::fix_exidx_coverage): New method.
8368         (Target_arm::output_section_address_less_than): New type.
8369         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8370         linked text section instead of the EXIDX section.
8371         (Arm_output_section::create_stub_group): Add an assertion to check
8372         that this is not an EXIDX output section.
8373         (Arm_output_section::append_text_sections_to_list): New method.
8374         (Arm_output_section::fix_exidx_coverage): Ditto.
8375         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8376         Arm_relobj::section_needs_reloc_stub_scanning.
8377         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8378         first pass.
8379         (Target_arm::fix_exidx_coverage): New method.
8380         * object.h (Relobj::set_output_section): New method.
8381         (Sized_relobj::invalidate_section_offset): Remove method.
8382         (Sized_relobj::do_invalidate_section_offset): Remove method.
8383         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8384
8385 2010-01-25  Doug Kwan  <dougkwan@google.com>
8386
8387         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8388         Fix warning due to signed and unsigned comparison on a 32-bit host.
8389
8390 2010-01-22  Doug Kwan  <dougkwan@google.com>
8391
8392         * arm.cc (Target_arm::do_relax): Record an output section for section
8393         offset adjustment it contains any stub table that has changed.
8394         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8395         offsets in an output section if necessary.
8396         * output.cc (Output_section::Output_section): Initialize
8397         section_offsets_need_adjustments_.
8398         (Output_section::add_input_section_for_script): Renamed to
8399         Output_section::add_simple_input_section.
8400         (Output_section::save_states): Add a comment.
8401         (Output_section::discard_states): New method defintion.
8402         (Output_section::adjust_section_offsets): Same.
8403         * output.h (Output_section::add_input_section_for_script): Renamed to
8404         Output_section::add_simple_input_section.
8405         (Output_section::discard_states): New method declaration.
8406         (Output_section::adjust_section_offsets): Same.
8407         (Output_section::section_offsets_need_adjustment,
8408         Output_section::set_section_offsets_need_adjustment): New method
8409         definitions.
8410         (Output_section::section_offsets_need_adjustment_): New data member.
8411         * script-sections.cc
8412         (Output_section_element_input::set_section_address): Adjust code for
8413         renaming of Output_section::add_input_section_for_script.
8414         (Orphan_output_section::set_section_address): Same.
8415
8416 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8417
8418         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8419         Fix_v4bx enum values .
8420         * gold/options.h (General_options): New option definitions.
8421         (General_options::fix_v4bx): New method.
8422         (General_options::Fix_v4bx): New enum.
8423         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8424         (General_options::parse_fix_v4bx_interworking): New method.
8425
8426 2010-01-22  Doug Kwan  <dougkwan@google.com>
8427
8428         * arm.cc (Arm_exidx_fixup): New class.
8429
8430 2010-01-21  Doug Kwan  <dougkwan@google.com>
8431
8432         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8433         classes.
8434         (Arm_exidx_section_offset_map): New type.
8435
8436 2010-01-21  Doug Kwan  <dougkwan@google.com>
8437
8438         * arm.cc (Arm_exidx_input_section): New class.
8439         (Arm_relobj::exidx_input_section_by_link,
8440         Arm_relobj::exidx_input_section_by_shndx,
8441         Arm_relobj::make_exidx_input_section): New methods.
8442         (read_arm_attributes_section): Remove.
8443         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8444         information about them.
8445         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8446         to here.
8447
8448 2010-01-20  Doug Kwan  <dougkwan@google.com>
8449
8450         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8451         Input_section_specifier to Section_id.
8452         (Target_arm::new_arm_input_section: Adjust code for change of key
8453         type.
8454         (Target_arm::find_arm_input_section): Ditto.
8455         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8456         (Section_id): Remove.
8457         (Garbage_collection::Section_id_hash): Remove.
8458         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8459         (Section_id): Remove.
8460         (Icf::Section_id_hash): Remove.
8461         * object.h (Section_id, Const_section_id, Section_id_hash,
8462         Const_section_id_hash): New type definitions.
8463         * output.cc (Output_section::add_relaxed_input_section): Change to
8464         use Const_section_id instead of Input_section_specifier as key type.
8465         (Output_section::add_merge_input_section): Ditto.
8466         (Output_section::build_relaxation_map): Change to use Section_id
8467         instead of Input_section_specifier as key type.
8468         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8469         Ditto.
8470         (Output_section::convert_input_sections_to_relaxed_sections): Change
8471         to use Const_section_id instead of Input_section_specifier as key type.
8472         (Output_section::find_merge_section): Ditto.
8473         (Output_section::find_relaxed_input_section): Ditto.
8474         * output.h (Input_section_specifier): Remove class.
8475         (Output_section::Output_section_data_by_input_section_map): Change
8476         key type to Const_section_id.
8477         (Output_section::Output_relaxed_input_section_by_input_section_map):
8478         Ditto.
8479         (Output_section::Relaxation_map): Change key type to Section_id.
8480
8481 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8482
8483         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8484         (class Arm_v4bx_stub): New class.
8485         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8486         (Stub_factory::make_arm_v4bx_stub): New method.
8487         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8488         (Stub_table::empty): Handle v4bx stubs.
8489         (Stub_table::add_arm_v4bx_stub): New method.
8490         (Stub_table::find_arm_v4bx_stub): New method.
8491         (Arm_relocate_functions::v4bx): New method.
8492         (Target_arm::fix_v4bx): New method.
8493         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8494         (Stub_table::relocate_stubs): Likewise.
8495         (Stub_table::do_write): Likewise.
8496         (Stub_table::update_data_size_and_addralign): Likewise.
8497         (Stub_table::finalize_stubs):  Likewise.
8498         (Target_arm::Scan::local): Likewise.
8499         (Target_arm::Scan::global): Likewise.
8500         (Target_arm::do_finalize_sections): Likewise.
8501         (Target_arm::Relocate::relocate): Likewise.
8502         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8503         Likewise.
8504         (Target_arm::scan_reloc_for_stub): Likewise.
8505         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8506
8507 2010-01-19  Ian Lance Taylor  <iant@google.com>
8508
8509         * output.cc (Output_section_headers::do_sized_write): Write large
8510         segment count to sh_info field.
8511         (Output_file_header::do_sized_write): For large segment count,
8512         write PN_XNUM to e_phnum field.
8513
8514 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8515
8516         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8517         (Arm_relocate_functions::thm_jump8): New function.
8518         (Arm_relocate_functions::thm_jump11): New function.
8519         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8520         R_ARM_THM_JUMP11.
8521         (Target_arm::Scan::global): Likewise.
8522         (Target_arm::Relocate::relocate): Likewise.
8523         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8524         Likewise.
8525
8526 2010-01-14  Doug Kwan  <dougkwan@google.com>
8527
8528         * arm.cc (map, utility): Include headers.
8529         (Target_arm::apply_cortex_a8_workaround): New method.
8530         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8531         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8532         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8533         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8534         the --[no-]fix-cortex-a8 command line options.
8535         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8536         (Target_arm::relocate_stub): Use addend in instruction template.
8537         * options.h (DEFINE_bool): Set the user-set flag.
8538         (General_options): Add --[no-]-fix-cortex options.
8539         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8540         : Update fast look-up map after conversion.
8541
8542 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8543
8544         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8545         in the first pass of do_layout.
8546
8547 2010-01-13  Doug Kwan  <dougkwan@google.com>
8548
8549         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8550         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8551         apparent compiler problem of not folding static constant integral
8552         data members of elfcpp::Elf_sizes<32>.
8553
8554 2010-01-13  Doug Kwan  <dougkwan@google.com>
8555
8556         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8557         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8558         Arm_relobj::scan_section_for_cortex_a8_erratum,
8559         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8560         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8561         sections to scan for relocation stubs into a new method
8562         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8563         relocation and Cortex-A8 stub scanning.
8564         (Target_arm::do_relax): Force stubs to be after stubbed sections
8565         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8566         the beginning of a new relaxation pass.  Update a comment.
8567         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8568
8569 2010-01-12  Ian Lance Taylor  <iant@google.com>
8570
8571         * target-reloc.h (visibility_error): New inline function.
8572         (relocate_section): Call visibility_error.
8573         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8574         (MOSTLYCLEANFILES): Likewise.
8575         (protected_4_pic.o, protected_3.err): New targets.
8576         * testsuite/protected_4.cc: New file.
8577
8578 2010-01-12  Doug Kwan  <dougkwan@google.com>
8579
8580         * arm.cc (Cortex_a8_reloc): New class.
8581         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8582         and cortex_a8_relocs_info_.
8583         (Target_arm::fix_cortex_a8): New method definition.
8584         (Target_arm::Cortex_a8_relocs_info): New type.
8585         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8586         New data member declarations.
8587         (Target_arm::scan_reloc_for_stub): Record information about
8588         relocations for THUMB branches that might be exempted from the
8589         Cortex-A8 workaround.
8590         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8591         at the beginning of a relaxation pass.
8592
8593 2010-01-12  Doug Kwan  <dougkwan@google.com>
8594
8595         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8596         (Arm_relobj::Mapping_symbol_position,
8597          Arm_reloj::Mapping_symbol_position_less,
8598          Arm_relobj::Mapping_symbols_info): New types.
8599         (Target_arm::is_mapping_symbol_name): New method definition.
8600         (Arm_relobj::do_count_local_symbols): Save information about mapping
8601         symbols.
8602
8603 2010-01-11  Doug Kwan  <dougkwan@google.com>
8604
8605         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8606         Arm_relocate_functions::thumb32_branch_upper,
8607         Arm_relocate_functions::thumb32_branch_lower,
8608         Arm_relocate_functions::thumb32_cond_branch_offset,
8609         Arm_relocate_functions::thumb32_cond_branch_upper,
8610         Arm_relocate_functions::thumb32_cond_branch_lower,
8611         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8612         branch offset encoding.
8613         (Arm_relocate_functions::thumb_branch_common): Use new branch
8614         offset encoding methods to avoid code duplication.
8615         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8616         (Stub_addend_reader::operator()): Use new branch encoding method
8617         to avoid code duplication.
8618
8619 2010-01-11  Doug Kwan  <dougkwan@google.com>
8620
8621         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8622         (Target_arm::do_finalize_sections): Define special EXIDX section
8623         symbols only if referenced.
8624         * gc.h (Garbage_collection::add_reference): New method.
8625         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8626         code duplication.
8627
8628 2010-01-11  Ian Lance Taylor  <iant@google.com>
8629
8630         * script.cc (Version_script_info::build_expression_list_lookup):
8631         Change complaing about duplicate wildcard match from error to
8632         warning.
8633
8634         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8635         of 2009-12-30.
8636         (Version_script_info::Version_script_info): Initialize globs_,
8637         default_version_, default_is_global_, and exact_.  Don't
8638         initialize globals_ or locals_.
8639         (Version_script_info::build_lookup_tables): Build local symbols
8640         first.
8641         (Version_script_info::unquote): New function.
8642         (Version_script_info::add_exact_match): New function.
8643         (Version_script_info::build_expression_list_lookup): Remove lookup
8644         parameter.  Add is_global parameter.  Change all callers.  Handle
8645         wildcard pattern specially.  Unquote pattern.  Call
8646         add_exact_match.
8647         (Version_script_info::get_name_to_match): New function.
8648         (Version_script_info::get_symbol_version): New function.
8649         (Version_script_info::get_symbol_version_helper): Remove.
8650         (Version_script_info::check_unmatched_names): Call unquote.
8651         * script.h (class Version_script_info): Change get_symbol_version
8652         to be non-inline and add is_global parameter; change all callers.
8653         Rewrite symbol_is_local.  Update declarations.  Define struct
8654         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8655         Remove globals_ and locals_ members.  Add exact_, globs_,
8656         default_version_, is_global_.
8657         (Version_script_info::Glob): Remove pattern, add expression and
8658         is_global.  Update constructor.  Change all callers.
8659         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8660         default version.
8661         (Versions::symbol_section_contents): If a symbol is undefined, or
8662         defined in a dynamic object, set the version index to
8663         VER_NDX_LOCAL.
8664         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8665         symbol_is_local.
8666         (Symbol_table::add_from_pluginobj): Likewise.
8667         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8668
8669 2010-01-11  Doug Kwan  <dougkwan@google.com>
8670
8671         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8672         (incremental_dump_LDADD): Add linking option for libintl.
8673         * Makefile.in: Regenerate.
8674
8675 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8676
8677         PR gold/11144
8678         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8679         instead of -Ds.
8680         * testsuite/Makefile.in: Regenerated.
8681
8682 2010-01-10  Doug Kwan  <dougkwan@google.com>
8683
8684         * options.h (DEFINE_var): Use parentheses around argument varname__
8685         in macro body to avoid any unintended subsequent substitutions.
8686
8687 2010-01-10  Ian Lance Taylor  <iant@google.com>
8688
8689         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8690         candidates before doing symbol resolution.
8691
8692         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8693         ODR candidates if only one is weak.
8694
8695 2010-01-08  Ian Lance Taylor  <iant@google.com>
8696
8697         * script.cc (Version_script_info::build_expression_list_lookup):
8698         Don't warn about ambiguous version, just record the ambiguity.
8699         (Version_script_info::get_symbol_version_helper): Give error if
8700         version is ambiguous.
8701
8702 2010-01-08  Doug Kwan  <dougkwan@google.com>
8703
8704         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8705         prev_data_size_ and prev_addralign_.  Remove initializer for
8706         deleted data member has_been_changed_.
8707         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8708         to determine if the table is empty.
8709         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8710         Remove.
8711         (Stub_table::add_reloc_stub): Define method in class definition
8712         instead of just declaring it there.
8713         (Stub_table::add_cortex_a8_stub): New method definition.
8714         (Stub_table::update_data_size_and_addralign): Ditto.
8715         (Stub_table::finalize_stubs): Ditto.
8716         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8717         (Stub_table::do_addralign_): Return address alignment in the
8718         (Stub_table::do_reset_address_and_file_offset): Define method in
8719         class definition instead of declaring it there.  Set current data
8720         size to be the data size of the previous pass.
8721         (Stub_table::set_final_data_size): Use current data size as the
8722         final data size.
8723         (Stub_table::relocate_stub): Change parameter type of stub from
8724         Reloc_stub pointer to Stub pointer.
8725         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8726         (Stub_table::Cortex_a8_stub_list): New typedef.
8727         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8728          Stub_table::prev_addralign_): New data member.
8729         (Arm_relobj::Arm_relobj): Initialize data member
8730         section_has_cortex_a8_workaround_.
8731         (Arm_relobj::section_has_cortex_a8_workaround,
8732          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8733          definitions.
8734         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8735         declarations.
8736         (Target_arm::relocate_stub): Change parameter type of stub from
8737         Reloc_stub pointer to Stub pointer.
8738         (Insn_template::size, Insn_template::alignment): Handle
8739         THUMB16_SPECIAL_TYPE.
8740         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8741          Stub_table::update_data_size_and_addralign,
8742          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8743         definitions.
8744         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8745         (Stub_table::do_write): Ditto.
8746         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8747
8748 2010-01-08  Ian Lance Taylor  <iant@google.com>
8749
8750         PR 11108
8751         * symtab.h (class Symbol): Remove fields is_target_special_ and
8752         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8753         (Symbol::is_defined_in_discarded_section): New function.
8754         (Symbol::set_is_defined_in_discarded_section): New function.
8755         (Symbol::has_plt_offset): Rewrite.
8756         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8757         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8758         Don't initialize is_target_special_ or has_plt_offset_.
8759         Initialize is_defined_in_discarded_section_.
8760         (Symbol_table::add_from_relobj): If appropriate, set
8761         is_defined_in_discarded_section.
8762         * resolve.cc (Symbol::override_base_with_special): Don't test
8763         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8764         * target-reloc.h (relocate_section): Do special handling for
8765         symbols defined in discarded sections for global symbols as well
8766         as local symbols.
8767
8768 2010-01-08  Ian Lance Taylor  <iant@google.com>
8769
8770         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8771         the SHT_SYMTAB case.
8772
8773 2010-01-08  Ian Lance Taylor  <iant@google.com>
8774
8775         * object.cc (Sized_relobj::do_layout): Don't get confused if
8776         layout_eh_frame returns NULL.
8777
8778 2010-01-08  Ian Lance Taylor  <iant@google.com>
8779
8780         PR 11084
8781         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8782         dynamic symbol table, use the normal symbol table.
8783         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8784         symbol table.
8785
8786 2010-01-08  Ian Lance Taylor  <iant@google.com>
8787
8788         PR 11072
8789         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8790         sections.
8791
8792 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8793
8794         * version.cc (print_version): Change to "Copyright 2010".
8795
8796 2010-01-08  Ian Lance Taylor  <iant@google.com>
8797
8798         PR 10287
8799         PR 11063
8800         * i386.cc (class Target_i386): Change return type of plt_section
8801         to be non-const.
8802         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8803         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8804         tls_desc_rel_ field.
8805         (Output_data_plt_i386::rel_tls_desc): New function.
8806         (Target_i386::rel_tls_desc_section): New function.
8807         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8808         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8809         R_386_TLS_DESC reloc in rel_tls_desc_section.
8810         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8811         Define struct Tlsdesc_info.
8812         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8813         (Target_x86_64::do_reloc_symbol_index): New function.
8814         (Target_x86_64::add_tlsdesc_info): New function.
8815         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8816         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8817         tlsdesc_rel_ field.
8818         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8819         all callers.
8820         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8821         (Target_x86_64::rela_tlsdesc_section): New function.
8822         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8823         handling.
8824         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8825         (Target_x86_64::do_reloc_addend): New function.
8826         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8827         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8828         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8829         (Output_reloc::type): New function.
8830         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8831         (Output_reloc::is_target_specific): New function.
8832         (Output_reloc::target_arg): New function.
8833         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8834         absolute relocs and target specific relocs.
8835         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8836         add_target_specific.
8837         (class Output_data_reloc) [SHT_RELA]: Likewise.
8838         * output.cc (Output_reloc::Output_reloc): Add four new versions
8839         for absolute relocs and target specific relocs.
8840         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8841         (Output_reloc::get_symbol_index): Likewise.
8842         (Output_reloc::local_section_offset): Check that local_sym_index_
8843         is not TARGET_CODE or 0.
8844         (Output_reloc::symbol_value): Likewise.
8845         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8846         reloc.
8847         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8848         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8849         functions.
8850         * layout.cc (add_target_dynamic_tags): Use output section for
8851         DT_PLTRELSZ and DT_JMPREL.
8852
8853 2010-01-07  Ian Lance Taylor  <iant@google.com>
8854
8855         PR 11061
8856         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8857         function.
8858         (class Output_data_reloc_generic): Define.
8859         (class Output_data_reloc_base): Change base class to
8860         Output_data_reloc_generic.  Change add() method to call
8861         bump_relative_reloc_count for a relative reloc.  Remove
8862         sort_relocs_ field.
8863         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8864         to sort_relocs().
8865         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8866         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8867         appropriate.
8868         * layout.h (class Layout): Update declaration.
8869
8870 2010-01-07  Ian Lance Taylor  <iant@google.com>
8871
8872         * output.h (class Output_data): Add const version of
8873         output_section and do_output_section.
8874         (class Output_section_data): Add const version of
8875         do_output_section.
8876         (class Output_section): Likewise.
8877         * layout.cc (Layout::add_target_dynamic_tags): New function.
8878         * layout.h (class Layout): Update declarations.
8879         * arm.cc (Target_arm::do_finalize_sections): Use
8880         add_target_dynamic_tags.
8881         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8882         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8883         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8884         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8885
8886 2010-01-07  Ian Lance Taylor  <iant@google.com>
8887
8888         PR 11042
8889         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8890         object as needed.
8891
8892 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8893             Ian Lance Taylor  <iant@google.com>
8894
8895         PR 11019
8896         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8897         Xindex::read_symtab_xindex.
8898
8899 2010-01-07  Doug Kwan  <dougkwan@google.com>
8900
8901         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8902         (Insn_template::thumb16_bcond_insn): New method declaration.
8903         (Insn_template): Fix spelling.
8904         (Stub::thumb16_special): New method declaration.
8905         (Stub::do_write): Define virtual method which was previously pure
8906         virtual.
8907         (Stub::do_thumb16_special): New method declaration.
8908         (Stub::do_fixed_endian_write): New template member.
8909         (Reloc_stub::do_write): Remove.
8910         (Reloc_stub::do_fixed_endian_write): Remove.
8911         (Cortex_a8_stub): New class definition.
8912         (Stub_factory::make_cortex_a8_stub): New method definition.
8913         (Stub_factory::Stub_factory): Add missing static storage class
8914         qualifier for elf32_arm_stub_a8_veneer_blx.
8915
8916 2010-01-07  Ian Lance Taylor  <iant@google.com>
8917
8918         PR 10980
8919         * options.h (class General_options): Add --warn-unresolved-symbols
8920         and --error-unresolved-symbols.
8921         * errors.cc (Errors::undefined_symbol): Implement
8922         --warn-unresolved-symbols.
8923
8924         * options.h (class General_options): Add -z text and -z textoff.
8925         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8926
8927 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8928
8929         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8930         (Garbage_collection::cident_sections): New function.
8931         (Garbage_collection::add_cident_section): New function.
8932         (Garbage_collection::cident_sections_): New member.
8933         (gc_process_relocs): Add references to sections whose names are C
8934         identifiers.
8935         * gold.h (cident_section_start_prefix): New constant.
8936         (cident_section_stop_prefix): New constant.
8937         (is_cident): New function.
8938         * layout.cc (Layout::define_section_symbols): Replace string constants
8939         with the newly defined constants.
8940         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8941         C identifiers.
8942         * testsuite/Makefile.am: Add gc_orphan_section_test.
8943         * testsuite/Makefile.in: Regenerate.
8944         * testsuite/gc_orphan_section_test.cc: New file.
8945         * testsuite/gc_orphan_section_test.sh: New file.
8946
8947 2010-01-06  Ian Lance Taylor  <iant@google.com>
8948
8949         PR 10980
8950         * options.h (class General_options): Add --warn-shared-textrel.
8951         * layout.cc (Layout::finish_dynamic_section): Implement
8952         --warn-shared-textrel.
8953
8954         PR 10980
8955         * options.h (class General_options): Add --warn-multiple-gp.
8956
8957 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8958
8959         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8960         $(THREADSLIB) and $(LIBDL).
8961         * Makefile.in: Rebuild.
8962
8963 2010-01-06  Ian Lance Taylor  <iant@google.com>
8964
8965         PR 10980
8966         * options.cc (General_options::parse_section_start): New function.
8967         (General_options::section_start): New function.
8968         (General_options::General_options): Initialize all members.
8969         * options.h: Include <map>
8970         (class General_options): Add --section-start.  Add section_starts_
8971         member.
8972         * layout.cc (Layout::attach_allocated_section_to_segment): If
8973         --section-start was used, set the address of the segment.  Remove
8974         local sort_sections.
8975         (Layout::relaxation_loop_body): If the address of the load segment
8976         has been set by --section-start, don't use it.
8977         * output.h (Output_segment::update_flags_for_output_section): New
8978         function.
8979         * output.cc (Output_segment::add_output_section): Call
8980         update_flags_for_output_section.
8981
8982 2010-01-05  Ian Lance Taylor  <iant@google.com>
8983
8984         PR 10980
8985         * options.h (class General_options): Add --undefined-version.
8986         * script.cc (struct Version_expression): Add was_matched_by_symbol
8987         field.
8988         (Version_script_info::matched_symbol): New function.
8989         (Version_script_info::get_symbol_version_helper): Call
8990         matched_symbol.
8991         (Version_script_info::check_unmatched_names): New function.
8992         * script.h (class Version_script_info): Update declarations.
8993         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8994
8995         * options.h (class General_options): Use DEFINE_bool_alias for
8996         allow_multiple_definition.
8997         * resolve.cc (Symbol_table::should_override): Don't test
8998         allow_multiple_definition.
8999
9000         PR 10980
9001         * options.h (class General_options): Add --cref.
9002         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9003         until after printing cref table.
9004         * cref.cc: Include "symtab.h".
9005         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9006         (Cref_table_compare::operator()): New function.
9007         (Cref_inputs::gather_cref): New function.
9008         (filecol): New static const.
9009         (Cref_inputs::print_cref): New function.
9010         (Cref::print_cref): New function.
9011         * cref.h: Include <cstdio>.
9012         (class Cref): Update declarations.
9013         * mapfile.h (Mapfile::file): New function.
9014         * object.h (class Object): Define Symbols.  Declare virtual
9015         do_get_global_symbols.
9016         (Object::get_global_symbols): New function.
9017         * object.cc (Input_objects::add_object): Pass object to cref_ if
9018         --cref.
9019         (Input_objects::archive_start): Likewise.
9020         (Input_objects::archive_stop): Likewise.
9021         (Input_objects::print_cref): New function.
9022         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9023         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9024         --cref.
9025         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9026         function.
9027         * plugin.h (class Sized_pluginobj): Update declarations.
9028
9029 2010-01-05  Ian Lance Taylor  <iant@google.com>
9030
9031         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9032         to is_default_version.  Rename insdef to insdefault.
9033         (Symbol_table::add_from_relobj): Rename def to is_default_version
9034         and local to is_forced_local.
9035         (Symbol_table::add_from_pluginobj): Likewise.
9036         (Symbol_table::add_from_dynobj): Likewise.
9037         (Symbol_table::define_special_symbol): Rename insdef to
9038         insdefault.
9039
9040 2010-01-04  Ian Lance Taylor  <iant@google.com>
9041
9042         PR 10980
9043         * options.h (class General_options): Add
9044         --allow-multiple-definition and -z muldefs.
9045         * resolve.cc (Symbol_table::should_override): Don't warn about a
9046         multiple symbol definition if --allow-multiple-definition or -z
9047         muldefs.
9048
9049         PR 10980
9050         * options.h (class General_options): Add --add-needed and
9051         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9052         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9053         error if --copy-dt-needed-entries aka --add-needed is used and
9054         would cause a change in behaviour.
9055
9056         PR 10980
9057         * options.h (class General_options): Add -G as a short version of
9058         --shared.  Add no-op options -assert, -g, and -i.
9059
9060 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9061
9062         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9063         check for .text or .gnu.linkonce.t sections.
9064         * icf.cc (Icf::find_identical_sections): Ditto.
9065         Change the detection for mangled function name within the section
9066         name.
9067         * icf.h (is_section_foldable_candidate): New function.
9068
9069 2009-12-30  Ian Lance Taylor  <iant@google.com>
9070
9071         PR 10980
9072         * options.h (class General_options): Permit two dashes with
9073         --retain-symbols-file.
9074
9075 2009-12-30  Ian Lance Taylor  <iant@google.com>
9076
9077         PR 10979
9078         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9079         don't put the file header and segment headers in the text
9080         segment.
9081
9082         PR 10979
9083         * common.cc (Sort_commons::operator()): Stabilize sort when both
9084         entries are NULL.
9085         (Symbol_table::do_allocate_commons_list): When allocating common
9086         symbols, skip a symbol which is no longer common.
9087         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9088         an object before checking its type.
9089         * testsuite/common_test_2.c: New file.
9090         * testsuite/common_test_3.c: New file.
9091         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9092         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9093         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9094         (common_test_2_pic.o, common_test_2.so): New targets.
9095         (common_test_3_pic.o, common_test_3.so): New targets.
9096         * testsuite/Makefile.in: Rebuild.
9097
9098         PR 10979
9099         * script.cc (read_input_script): If we see a new SECTIONS clause,
9100         and we have added an input section, give an error.
9101         * layout.h (class Layout): Add have_added_input_section function.
9102         Add have_added_input_section_ field.
9103         * layout.cc (Layout::Layout): Initialize
9104         have_added_input_section_.
9105         (Layout::layout): Set have_added_input_section_.
9106         (Layout::layout_eh_frame): Likewise.
9107
9108 2009-12-30  Ian Lance Taylor  <iant@google.com>
9109
9110         PR 10931
9111         * options.h (class General_options): Add --sort-common option.
9112         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9113         * common.cc (Sort_common): Add sort_order parameter to
9114         constructor.  Add sort_order_ field.
9115         (Sort_commons::operator): Check sort_order_.
9116         (Symbol_table::allocate_commons): Determine the sort order.
9117         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9118         Change all callers.
9119         (Symbol_table::do_allocate_commons_list): Likewise.
9120
9121 2009-12-30  Ian Lance Taylor  <iant@google.com>
9122
9123         PR 10916
9124         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9125         symbols from this object, don't change the visibility of an
9126         undefined symbol.
9127         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9128
9129 2009-12-30  Ian Lance Taylor  <iant@google.com>
9130
9131         PR 10861
9132         * script.h (class Version_script_info): Define Language enum.
9133         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9134         new fields globals_, locals_, and is_finalized_.
9135         * script.cc: Various formatting fixes.
9136         (class Parser_closure): Change language_stack_ from a vector of
9137         std::string to one of Version_script_info::Language.  Adjust all
9138         uses accordingly.
9139         (class Lazy_demangler): Remove.
9140         (struct Version_expression): Change language from std::string to
9141         Version_script_info::Language.
9142         (Version_script_info::Version_script_info): New function.
9143         (Version_script_info::~Version_script_info): Don't call clear.
9144         (Version_script_info::finalize): New function.
9145         (Version_script_info::build_lookup_tables): New function.
9146         (Version_script_info::build_expression_list_lookup): New
9147         function.
9148         (Version_script_info::get_symbol_version_helper): Rewrite to use
9149         lookup tables.
9150         (Version_script_info::print_expression_list): Adjust to use
9151         Version_script_info::Language.
9152         (script_push_lex_into_version_mode): Check that the version script
9153         has not been finalized.
9154         (version_script_push_lang): Change language string to
9155         Version_script_info::Language.
9156         * options.cc (Command_line::version_script): New function.
9157         * options.h (class General_options): Add finalize_dynamic_list
9158         function.  Change version_script from declaration to definition.
9159         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9160         * testsuite/version_script.map: Remove duplicate def of foo.
9161         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9162         version_script.map.
9163         * testsuite/Makefile.in: Rebuild.
9164
9165 2009-12-30  Ian Lance Taylor  <iant@google.com>
9166
9167         PR 10843
9168         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9169         if the input symbol index is 0, make the output symbol index 0.
9170
9171 2009-12-30  Ian Lance Taylor  <iant@google.com>
9172
9173         PR 10670
9174         * options.h (class General_options): Add -x/--discard-all.
9175         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9176         --discard-all.  If the local symbol needs a dynamic entry, check
9177         that before handling --discard-locals.
9178
9179 2009-12-30  Ian Lance Taylor  <iant@google.com>
9180
9181         PR 10450
9182         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9183         flags to PF_R.
9184         (Output_segment::add_output_section): Don't change the flags if
9185         the type is PT_TLS.
9186
9187         PR 10450
9188         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9189         GNU hash table if they need a dynamic value.  Otherwise, don't add
9190         them if they are defined in a dynamic object or are forced local.
9191
9192 2009-12-29  Ian Lance Taylor  <iant@google.com>
9193
9194         PR 10450
9195         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9196         .gnu.hash table for a 32-bit target.
9197
9198         PR 10450
9199         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9200         regular and a dynamic object only needs a dynamic symbol table
9201         entry if it is externally visible.
9202
9203         PR 10450
9204         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9205         constructor.  Add global_offset_table_ field.
9206         (Target_i386::got_section): Set global_offset_table_.
9207         (Target_i386::do_finalize_sections): Set global_offset_table_
9208         size.
9209         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9210         in constructor.  Add global_offset_table_ field.
9211         (Target_x86_64::got_section): Set global_offset_table_.
9212         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9213         size.
9214
9215         * layout.cc (Layout::Layout): Initialize increase_relro_.
9216         (Layout::get_output_section): Add is_relro, is_last_relro, and
9217         is_first_non_relro parameters.  Change all callers.
9218         (Layout::choose_output_section): Likewise.
9219         (Layout::add_output_section_data): Likewise.
9220         (Layout::make_output_section): Likewise.
9221         (Layout::set_segment_offsets): Clear increase_relro when using a
9222         linker script.
9223         * layout.h (class Layout): Add increase_relro method.  Add
9224         increase_relro_ field.  Update declarations.
9225         * output.cc (Output_section::Output_section): Initialize
9226         is_last_relro_ and is_first_non_relro_.
9227         (Output_segment::add_output_section): Group relro sections is
9228         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9229         (Output_segment::maximum_alignment): Remove relro handling.
9230         (Output_segment::set_section_addresses): Add increase_relro
9231         parameter.  Change all callers.  Add initial alignment to align
9232         relro sections on separate page.  Remove old relro handling.
9233         (Output_segment::set_section_list_addresses): Remove in_relro
9234         parameter.  Change all callers.
9235         (Output_segment::set_offset): Add increase parameter.  Change all
9236         callers.  Remove old relro handling.
9237         * output.h (class Output_section): Add new methods: is_last_relro,
9238         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9239         Add is_last_relro_ and is_first_non_relro_ fields.
9240         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9241         Create separate .got.plt section.  Call increase_relro.
9242         * x86_64.cc (Target_x86_64::got_section): Likewise.
9243         * testsuite/relro_script_test.t: Add .got.plt.
9244
9245         PR 10450
9246         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9247         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9248         (Layout::finalize): Call set_dynamic_symbol_size.
9249         (Layout::set_dynamic_symbol_size): New function.
9250         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9251         set_dynamic_symbol_size.
9252
9253         PR 10450
9254         * output.h (class Output_section): Add is_entsize_zero_ field.
9255         * output.cc (Output_section::Output_section): Initialize
9256         is_entsize_zero_.
9257         (Output_section::set_entsize): If two different entsizes are
9258         requested, force it to zero.
9259         (Output_section::add_input_section): Set flags for .debug_str
9260         before updating section flags.  Set entsize.
9261         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9262         and SHF_STRING if all input sections have those flags.
9263
9264 2009-12-29   Rafael Espindola  <espindola@google.com>
9265
9266         * main.cc (main): Fix the sys time reporting.
9267         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9268         reporting.
9269
9270 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9271
9272         * options.cc (General_options::parse_version): Allow -v to exit
9273         without an error if there is nothing to link.
9274
9275 2009-12-29  Ian Lance Taylor  <iant@google.com>
9276
9277         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9278         using a version of gcc before 4.1.
9279         * configure: Rebuild.
9280
9281 2009-12-28  Chris Demetriou  <cgd@google.com>
9282
9283         * attributes.cc (Output_attributes_section_data::do_write): Use
9284         std::vector::front rather than std::vector::data.
9285
9286 2009-12-28  Ian Lance Taylor  <iant@google.com>
9287
9288         * symtab.h (class Symbol_table): Add enum Defined.
9289         * resolve.cc (Symbol_table::should_override): Add defined
9290         parameter.  Change all callers.  Test whether object is NULL
9291         before calling a method on it.
9292         (Symbol_table::report_resolve_problem): Add defined parameter.
9293         Change all callers.
9294         (Symbol_table::should_override_with_special): Likewise.
9295         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9296         parameter.  Change all callers.
9297         (Symbol_table::do_define_in_output_data): Likewise.
9298         (Symbol_table::define_in_output_segment): Likewise.
9299         (Symbol_table::do_define_in_output_segment): Likewise.
9300         (Symbol_table::define_as_constant): Likewise.
9301         (Symbol_table::do_define_as_constant): Likewise.
9302         * script.h (class Symbol_assignment): Add is_defsym parameter to
9303         constructor; change all callers.
9304         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9305         parameter.  Change all callers.  Add is_defsym_ field.
9306         (class Parser_closure): Add parsing_defsym parameter to
9307         constructor; change all callers.  Add parsing_defsym accessor
9308         function.  Add parsing_defsym_ field.
9309
9310 2009-12-28  Ian Lance Taylor  <iant@google.com>
9311
9312         * gold.cc (queue_middle_tasks): Fix formatting.
9313         * object.cc (Relobj::is_section_name_included): Likewise.
9314
9315 2009-12-23  Ian Lance Taylor  <iant@google.com>
9316
9317         * i386.cc (Target_i386::do_calls_non_split): Recognize
9318         -fsplit-stack prologue for a function with a static chain.
9319         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9320         -fsplit-stack prologue when using %r11.
9321
9322 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9323
9324         * options.cc (General_options::parse_version): Make -v continue and do
9325         the link like GNU ld does.
9326
9327 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9328
9329         * Makefile.am (CCFILES): Add timer.cc.
9330         (HFILES): Add timer.h.
9331         * configure.ac: Check for sysconf and times.
9332         * main.cc: include timer.h.
9333         (main): Use Timer instead of get_run_time.
9334         * timer.cc: New.
9335         * timer.h: New.
9336         * workqueue.cc: include timer.h.
9337         (Workqueue::find_and_run_task):
9338         Report user, sys and wall time.
9339         * Makefile.in: Regenerate.
9340         * config.in: Regenerate.
9341         * configure: Regenerate.
9342
9343 2009-12-16  Doug Kwan  <dougkwan@google.com>
9344
9345         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9346         sections.
9347         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9348         relaxed input sections.
9349         * output.cc (Output_section::find_relaxed_input_section): Change
9350         return type to Output_relaxed_input_section pointer.  Adjust code
9351         for new type of relaxed_input_section_map_.
9352         * output.h (Output_section::find_relaxed_input_section): Change
9353         return type to Output_relaxed_input_section pointer.
9354         (Output_section::Output_relaxed_input_section_by_input_section_map):
9355         New type.
9356         (Output_section::relaxed_input_section_map_): Change type to
9357         Output_section::Output_relaxed_input_section_by_input_section_map.
9358         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9359         input section.
9360
9361 2009-12-15  Ian Lance Taylor  <iant@google.com>
9362
9363         * layout.cc (Layout::create_shstrtab): Only write out after input
9364         sections if we are compressing debug sections.
9365
9366 2009-12-15  Ian Lance Taylor  <iant@google.com>
9367
9368         * archive.cc (Archive::add_symbols): Only look up a symbol without
9369         a version if there is, in fact, a version.
9370
9371 2009-12-14  Ian Lance Taylor  <iant@google.com>
9372
9373         Revert -Wshadow changes, all changes from:
9374         2009-12-11  Doug Kwan  <dougkwan@google.com>
9375         2009-12-11  Nick Clifton  <nickc@redhat.com>
9376         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9377
9378 2009-12-11  Doug Kwan  <dougkwan@google.com>
9379
9380         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9381         due to -Wshadow.
9382         * attributes.cc (Object_attribute::size): Ditto.
9383         (Attributes_section_data::size): Ditto.
9384         (Attributes_section_data::Attributes_section_data): Ditto.
9385         (Output_attributes_section_data::do_write): Ditto.
9386         * attributes.h (Object_attribute::set_type): Ditto.
9387         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9388
9389 2009-12-11  Nick Clifton  <nickc@redhat.com>
9390
9391         * archive.cc: Fix shadowed variable warnings.
9392         * arm.cc: Likewise.
9393         * compressed_output.cc: Likewise.
9394         * compressed_output.h: Likewise.
9395         * configure: Likewise.
9396         * dwarf_reader.cc: Likewise.
9397         * dynobj.cc: Likewise.
9398         * dynobj.h: Likewise.
9399         * ehframe.cc: Likewise.
9400         * ehframe.h: Likewise.
9401         * errors.cc: Likewise.
9402         * expression.cc: Likewise.
9403         * fileread.cc: Likewise.
9404         * fileread.h: Likewise.
9405         * freebsd.h: Likewise.
9406         * i386.cc: Likewise.
9407         * icf.cc: Likewise.
9408         * incremental.h: Likewise.
9409         * layout.cc: Likewise.
9410         * layout.h: Likewise.
9411         * mapfile.cc: Likewise.
9412         * merge.cc: Likewise.
9413         * merge.h: Likewise.
9414         * object.cc: Likewise.
9415         * object.h: Likewise.
9416         * options.h: Likewise.
9417         * output.cc: Likewise.
9418         * output.h: Likewise.
9419         * parameters.cc: Likewise.
9420         * plugin.cc: Likewise.
9421         * powerpc.cc: Likewise.
9422         * reduced_debug_output.cc: Likewise.
9423         * reduced_debug_output.h: Likewise.
9424         * reloc.cc: Likewise.
9425         * reloc.h: Likewise.
9426         * resolve.cc: Likewise.
9427         * script-sections.cc: Likewise.
9428         * script.cc: Likewise.
9429         * script.h: Likewise.
9430         * sparc.cc: Likewise.
9431         * symtab.cc: Likewise.
9432         * symtab.h: Likewise.
9433         * target-select.cc: Likewise.
9434         * target-select.h: Likewise.
9435         * token.h: Likewise.
9436         * workqueue.cc: Likewise.
9437         * workqueue.h: Likewise.
9438         * x86_64.cc: Likewise.
9439
9440 2009-12-10  Doug Kwan  <dougkwan@google.com>
9441
9442         * arm.cc (attributes.h): New include.
9443         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9444         (Arm_relobj::~Arm_relobj): Delete object pointed by
9445         attributes_section_data_.
9446         (Arm_relobj::attributes_section_data): New method definition.
9447         (Arm_relobj::attributes_section_data_): New data member declaration.
9448         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9449         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9450         attributes_section_data_.
9451         (Arm_dynobj::attributes_section_data): New method definition.
9452         (Arm_dynobj::attributes_section_data_): New data member declaration.
9453         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9454         initialization value of may_use_blx_ to false.
9455         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9456         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9457         object attributes to compute results instead of hard-coding.
9458         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9459         Target_arm::get_secondary_compatible_arch,
9460         Target_arm::set_secondary_compatible_arch
9461         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9462         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9463         New method declarations.
9464         (Target_arm::get_aeabi_object_attribute): New method definition.
9465         (Target_arm::attributes_section_data_): New data member declaration.
9466         (read_arm_attributes_section): New template definition.
9467         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9468         (Arm_dynobj::do_read_symbols): Ditto.
9469         (Target_arm::do_finalize_sections): Merge attributes sections from
9470         input.  Check for BLX use after attributes section merging.
9471         Fix __exidx_start and __exidx_end visibility.  Create an
9472         .ARM.attributes section if necessary.
9473         (Target_arm::get_secondary_compatible_arch,
9474         Target_arm::set_secondary_compatible_arch,
9475         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9476         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9477         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9478         New method definitions.
9479
9480 2009-12-09  Ian Lance Taylor  <iant@google.com>
9481
9482         * plugin.cc (Plugin::load): Don't cast from void* to a function
9483         pointer.
9484
9485 2009-12-09  Ian Lance Taylor  <iant@google.com>
9486
9487         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9488         information fields.
9489
9490 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9491
9492         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9493         Replace two_file_shared_1.so with two_file_shared_2.so.
9494         * testsuite/Makefile.in: Regenerated.
9495
9496 2009-12-08  Doug Kwan  <dougkwan@google.com>
9497
9498         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9499         (HFILES): Add attributes.h and int_encoding.h.
9500         * Makefile.in: Regenerate.
9501         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9502         function definitions to int_encoding.cc
9503         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9504         prototypes to int_encoding.h
9505         * reduced_debug_output.cc (int_encoding.h): New include.
9506         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9507         function definitions to int_encoding.cc
9508         (insert_into_vector, read_from_pointer): Move template definitions to
9509         int_encoding.h
9510         * attributes.cc: New file.
9511         * attributes.h: New file.
9512         * int_encoding.cc: New file.
9513         * int_encoding.h: New file.
9514
9515 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9516
9517         PR gold/11055
9518         * incremental-dump.cc (dump_incremental_inputs): New.
9519         (main): Use dump_incremental_inputs.
9520
9521 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9522
9523         PR gold/10893
9524         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9525         checking elfcpp::STT_FUNC.
9526         (Target_i386::Relocate::relocate): Likewise.
9527         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9528
9529         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9530         symbols from shared libraries into normal FUNC symbols.
9531
9532         * symtab.h (Symbol): Add is_func and use it.
9533
9534 2009-12-05  Doug Kwan  <dougkwan@google.com>
9535
9536         * arm.cc (Target_arm::arm_info): Initialize new fields
9537         attributes_section and attributes_vendor.
9538         * i386.cc (Target_i386::i386_info): Same.
9539         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9540         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9541         fields attributes_section and attributes_vendor.
9542         * sparc.cc (Target_sparc::sparc_info): Same.
9543         * target.h (Target::attributes_section, Target::attributes_vendor,
9544         Target::is_attributes_section, Target::attribute_arg_type,
9545         Target::attributes_order): New method definitions.
9546         (Target::Target_info::attributes_section,
9547         Target::Target_info::attributes_vendor): New fields.
9548         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9549         virtual method definitions.
9550         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9551         attributes_section and attributes_vendor.
9552         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9553
9554 2009-12-05  Doug Kwan  <dougkwan@google.com>
9555
9556         * arm.cc: Update comments about interworking and stub generation.
9557         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9558         considered as non-PIC.
9559         (Arm_relocate_functions::base_abs): Fix formatting.
9560         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9561         of function to use GOT entry address instead of offset.
9562         (Target_arm::Scan::global): Issue an error if a symbol would need a
9563         PLT does not get one because it is untyped.  Remove code to create
9564         dynamic symbols for relative branches.
9565         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9566         takes unsigned integer instead of boolean.
9567
9568 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9569
9570         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9571         (two_file_test_LDADD): Likewise.
9572         (common_test_1_LDADD): Likewise.
9573         (exception_test_LDADD) Likewise.
9574         (weak_test_LDADD): Likewise.
9575         (many_sections_test_LDADD): Likewise.
9576         (initpri1_LDADD): Likewise.
9577         (script_test_1_LDADD): Likewise.
9578         (script_test_2_LDADD): Likewise.
9579         (justsyms_LDADD): Likewise.
9580         (binary_test_LDADD): Likewise.
9581         (large_LDADD): Likewise.
9582         * testsuite/Makefile.in: Regenerated.
9583
9584 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9585
9586         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9587         (Symbol_table::override_with_special): Likewise.
9588         (Symbol_table::add_from_object): Likewise.
9589
9590 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9591
9592         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9593         Don't set the data_offset twice.
9594
9595 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9596
9597         * testsuite/Makefile.in: Regenerate.
9598
9599 2009-12-03  Doug Kwan  <dougkwan@google.com>
9600
9601         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9602         (Target_arm::do_finalize_sections): Add parameter for symbol table
9603         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9604         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9605         parameter for symbol table pointer.
9606         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9607         an additional parameter for a pointer to symbol table.
9608         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9609         parameter for a symbol table pointer.
9610         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9611         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9612         Ditto.
9613         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9614         parameter for a symbol table pointer.
9615
9616 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9617
9618         * incremental.cc (Incremental_inputs_header)
9619         (Incremental_inputs_header_write, Incremental_inputs_entry)
9620         (Incremental_inputs_entry_write): Move ...
9621         * incremental.h (Incremental_inputs_header)
9622         (Incremental_inputs_header_write, Incremental_inputs_entry)
9623         (Incremental_inputs_entry_write): here.
9624
9625 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9626
9627         * incremental.cc (make_sized_incremental_binary): Set the target.
9628         Error if it is incompatible.
9629         * output.h (Output_file): Add filename method.
9630
9631 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9632
9633         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9634         from the get_* methods.
9635
9636 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9637
9638         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9639         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9640         Write 0 for the data_offset of scripts.
9641
9642 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9643
9644         * testsuite/Makefile.am: Add the incremental_test.sh test.
9645         * testsuite/incremental_test.sh: New.
9646         * testsuite/incremental_test_1.c: New.
9647         * testsuite/incremental_test_2.c: New.
9648
9649 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9650
9651         * incremental-dump.cc (main): Fix typos.
9652
9653 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9654
9655         PR gold/11025
9656         * incremental-dump.cc (main): Use llu to print 64 bit values.
9657
9658 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9659             H.J. Lu  <hongjiu.lu@intel.com>
9660
9661         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9662         $(LIBDL).
9663         (incremental_dump_LDADD): Likewise.
9664         * Makefile.in: Regenerated.
9665
9666 2009-11-25  Doug Kwan  <dougkwan@google.com>
9667
9668         Revert:
9669
9670         2009-11-25  Doug Kwan  <dougkwan@google.com>
9671
9672                 * arm.cc (Target_arm::Target_arm): Move method definition
9673                 outside of class definition.  Add code to handle
9674                 --target1-rel, --target1-abs and --target2= options.
9675                 (Target_arm::get_reloc_reloc_type): Change method to be
9676                 non-static and const.
9677                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9678                 New data member declaration.
9679                 (Target_arm::Scan::local, Target_arm::Scan::global,
9680                 Target_arm::Relocate::relocate,
9681                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9682                 Adjust call to Target_arm::get_real_reloc_type.
9683                 (Target_arm::get_real_reloc_type): Use command line options
9684                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9685                 * options.h (--target1-rel, --target1-abs, --target2): New
9686                 ARM-only options.
9687
9688 2009-11-25  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9691         class definition.  Add code to handle --target1-rel, --target1-abs
9692         and --target2= options.
9693         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9694         and const.
9695         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9696         member declaration.
9697         (Target_arm::Scan::local, Target_arm::Scan::global,
9698         Target_arm::Relocate::relocate,
9699         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9700         call to Target_arm::get_real_reloc_type.
9701         (Target_arm::get_real_reloc_type): Use command line options to
9702         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9703         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9704         options.
9705
9706 2009-11-25  Doug Kwan  <dougkwan@google.com>
9707
9708         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9709         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9710         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9711         formatting.
9712         (Arm_relocate_functions::thm_call): Replace body with a call to
9713         Arm_relocate_functions::thumb_branch_common.
9714         (Arm_relocate_functions::thm_jump24,
9715         Arm_relocate_functions::thm_xpc22): New method definitions.
9716         (Arm_relocate_functions::thumb_branch_common): New method definition.
9717         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9718         operator.
9719         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9720         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9721
9722 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9723
9724         * Makefile.am: Build incremental-dump
9725         * Makefile.in: Regenerate.
9726         * incremental-dump.cc: New.
9727         * incremental.cc (Incremental_inputs_header_data,
9728         Incremental_inputs_entry_data): Move to incremental.h
9729         * incremental.h: (Incremental_inputs_header_data,
9730         Incremental_inputs_entry_data): Move from incremental.cc
9731
9732 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9733
9734         * incremental.cc (Incremental_inputs_header,
9735         Incremental_inputs_header_write, Incremental_inputs_entry,
9736         Incremental_inputs_entry_write): Add a typedef with the data type.
9737
9738 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9739
9740         * incremental.cc (Incremental_inputs_header,
9741         Incremental_inputs_header_write, Incremental_inputs_entry,
9742         Incremental_inputs_entry_write): Update comment about which
9743         type has the filed descriptions.
9744
9745 2009-11-15  Doug Kwan  <dougkwan@google.com>
9746
9747         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9748         (Arm_relocate_functions::arm_branch_common): Change method defintion
9749         in class definition to a method declaration and update list of formal
9750         parameters.
9751         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9752         Arm_relocation_functions::jump24): Adjust call to
9753         Arm_relocate_functions::arm_branch_common.  Update list of formal
9754         parameters.
9755         (Arm_relocate_functions::xpc25): New method definition.
9756         (Arm_relocate_functions::arm_branch_common): Move method defintion
9757         out from class definition.  Use stubs for mode-switching and extending
9758         branch ranges.
9759         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9760         specially.  Change code to enable use of stubs in ARM branches.
9761
9762 2009-11-10  Doug Kwan  <dougkwan@google.com>
9763
9764         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9765         in method declaration.
9766         (Target_arm::relocate_stub): New method declaration.
9767         (Target_arm::default_target): Change to return a pointer instead of
9768         a const reference.
9769         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9770         Target_arm::default_target.
9771         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9772         method definition.
9773         (Target_arm::relocate_section): Adjust view.
9774         (Target_arm::relocate_stub): New method definition.
9775
9776 2009-11-10  Doug Kwan  <dougkwan@google.com>
9777
9778         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9779         a format warning.
9780         * incremental.cc (open_incremental_binary): Initialized local
9781         variables to avoid warnings.
9782         * object.cc (make_elf_object): Ditto.
9783         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9784         a format warning.
9785
9786 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9787
9788         PR gold/10930
9789         * testsuite/plugin_test.c: Include "config.h".
9790
9791 2009-11-09  Doug Kwan  <dougkwan@google.com>
9792
9793         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9794         (arm_symbol_value): Remove.
9795         (Arm_relocate_functions::arm_branch_common,
9796         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9797         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9798         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9799         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9800         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9801         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9802         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9803         Arm_relocate_functions::thm_mobw_abs_nc,
9804         Arm_relocate_functions::thm_mov_abs,
9805         Arm_relocate_functions::movw_prel_nc,
9806         Arm_relocate_functions::thm_movt_abs,
9807         Arm_relocate_functions::movt_prel,
9808         Arm_relocate_functions::thm_movw_prel_nc,
9809         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9810         (Target_arm::Relocate::relocate): Only decompose address into two
9811         parts if relocation type uses the thumb-bit and pass the actual
9812         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9813         calls to methods in Arm_relocate_functions for this change.
9814
9815 2009-11-08  Ian Lance Taylor  <iant@google.com>
9816
9817         PR 10925
9818         * reloc.cc: Instantiate
9819         Sized_relobj::initialize_input_to_output_maps and
9820         Sized_relobj:free_input_to_output_maps.
9821
9822 2009-11-06  Ian Lance Taylor  <iant@google.com>
9823
9824         PR 10876
9825         * defstd.cc (in_segment): Set only_if_ref true for "end".
9826
9827 2009-11-06  Doug Kwan  <dougkwan@google.com>
9828
9829         * arm.cc (class Reloc_stub): Correct a comment.
9830         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9831         (Target_arm::scan_section_for_stubs): New method declaration.
9832         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9833         Change methods from private to protected.
9834         (Target_arm::do_may_relax): New method definition.
9835         (Target_arm::do_relax, Target_arm::group_sections,
9836         Target_arm::scan_reloc_for_stub,
9837         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9838         (Target_arm::arm_input_section_map_): New data member declaration.
9839         (Target_arm::scan_reloc_for_stub,
9840         Target_arm::scan_reloc_section_for_stubs,
9841         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9842         Target_arm::do_relax): New method definitions.
9843
9844 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9845
9846         * configure.ac: Check for (struct stat)::st_mtim
9847         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9848         * config.in: Regenerate.
9849         * configure: Regenerate.
9850
9851 2009-11-05  Ian Lance Taylor  <iant@google.com>
9852
9853         PR 10910
9854         * output.cc (Output_segment::add_output_section): Add missing
9855         return statement.
9856
9857 2009-11-04  Ian Lance Taylor  <iant@google.com>
9858
9859         PR 10880
9860         * object.h (class Object): Add is_needed and set_is_needed
9861         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9862         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9863         defined in a dynamic object and referenced by a regular object,
9864         set is_needed for the dynamic object.
9865         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9866         if the file is marked with as_needed and it is not needed.
9867
9868 2009-11-04  Ian Lance Taylor  <iant@google.com>
9869
9870         PR 10887
9871         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9872         tags if data is discarded by linker script.
9873         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9874         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9875         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9876         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9877
9878 2009-11-04  Ian Lance Taylor  <iant@google.com>
9879
9880         * layout.cc (Layout::get_output_section): Add is_interp and
9881         is_dynamic_linker_section parameters.  Change all callers.
9882         (Layout::choose_output_section): Likewise.
9883         (Layout::make_output_section): Likewise.
9884         (Layout::add_output_section_data): Add is_dynamic_linker_section
9885         parameter.  Change all callers.
9886         * layout.h (class Layout): Update declarations.
9887         * output.h (class Output_section): Add is_interp, set_is_interp,
9888         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9889         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9890         generate_code_fills_at_write_ to a bitfield.
9891         * output.cc (Output_section::Output_sections): Initialize new
9892         fields.
9893         (Output_segment::add_output_section): Add do_sort parameter.
9894         Change all callers.
9895
9896 2009-11-03  Ian Lance Taylor  <iant@google.com>
9897
9898         PR 10860
9899         * options.h (class General_options): Add --warn-common.
9900         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9901         merging two common symbols.
9902         (Symbol_table::should_override): Handle --warn-common when merging
9903         a common symbol with a defined symbol.  Use report_resolve_problem
9904         for multiple definitions.
9905         (Symbol_table::report_resolve_problem): New function.
9906         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9907
9908 2009-11-03  Doug Kwan  <dougkwan@google.com>
9909
9910         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9911         stub_factory_.
9912         (Target_arm::stub_factory): New method definition.
9913         (Target_arm::new_arm_input_section,
9914         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9915         Target_arm::reloc_uses_thumb_bit): New method declarations.
9916         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9917         New type definitions.
9918         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9919         member declarations.
9920         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9921         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9922         New method definitions.
9923
9924 2009-11-03  Ian Lance Taylor  <iant@google.com>
9925
9926         * options.h (class General_options): Add --warn_constructors.
9927
9928 2009-11-03  Ian Lance Taylor  <iant@google.com>
9929
9930         PR 10893
9931         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9932         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9933
9934 2009-11-03  Ian Lance Taylor  <iant@google.com>
9935
9936         PR 10895
9937         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9938         --msgid-bugs-address.
9939         (install-pdf): New target.
9940         (install-data_yes): Look up one directory to find mkinstalldirs.
9941
9942 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9943
9944         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9945         tree.
9946
9947 2009-10-30  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9950
9951 2009-10-30  Doug Kwan  <dougkwan@google.com>
9952
9953         * arm.cc (Stub_addend_reader): New struct template definition
9954         and partial specializations.
9955         (Stub_addend_reader::operator()): New method definition for a
9956         partially specialized template.
9957
9958 2009-10-30  Doug Kwan  <dougkwan@google.com>
9959
9960         * arm.cc (Arm_relobj::processor_specific_flags): New method
9961         definition.
9962         (Arm_relobj::do_read_symbols): New method declaration.
9963         (Arm_relobj::processor_specific_flags_): New data member declaration.
9964         (Arm_dynobj): New class definition.
9965         (Target_arm::do_finalize_sections): Add input_objects parameter.
9966         (Target_arm::do_adjust_elf_header): New method declaration.
9967         (Target_arm::are_eabi_versions_compatible,
9968         (Target_arm::merge_processor_specific_flags): New method declaration.
9969         (Target_arm::do_make_elf_object): New overloaded method definitions
9970         and declaration.
9971         (Arm_relobj::do_read_symbols): New method definition.
9972         (Arm_dynobj::do_read_symbols): Ditto.
9973         (Target_arm::do_finalize_sections): Add input_objects parameters.
9974         Merge processor-specific flags from all input objects.
9975         (Target_arm::are_eabi_versions_compatible,
9976         Target_arm::merge_processor_specific_flags,
9977         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9978         New method definitions.
9979         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9980         Input_objects pointer type parameter.
9981         * layout.cc (Layout::finalize): Pass input objects to target's.
9982         finalize_sections function.
9983         * output.cc (Output_file_header::do_sized_write): Set ELF file
9984         header's processor-specific flags.
9985         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9986         Input_objects pointer type parameter.
9987         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9988         * target.h (Input_objects): New forward class declaration.
9989         (Target::processor_specific_flags,
9990         Target::are_processor_specific_flags_sect): New method definitions.
9991         (Target::finalize_sections): Add input_objects parameter.
9992         (Target::Target): Initialize processor_specific_flags_ and
9993         are_processor_specific_flags_set_.
9994         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9995         parameter.
9996         (Target::set_processor_specific_flags): New method definition.
9997         (Target::processor_specific_flags_,
9998         Target::are_processor_specific_flags_set_): New data member
9999         declarations.
10000         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10001         Input_objects pointer type parameter.
10002
10003 2009-10-30  Doug Kwan  <dougkwan@google.com>
10004
10005         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10006
10007 2009-10-28  Ian Lance Taylor  <iant@google.com>
10008
10009         * object.h (class Relobj): Drop options parameter from
10010         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10011         do_scan_relocs, do_relocate.  Change all callers.
10012         (class Sized_relobj): Drop options parameters from
10013         do_gc_process_relocs, do_scan_relocs, do_relocate,
10014         do_relocate_sections, relocate_sections, emit_relocs_scan,
10015         emit_relocs_scan_reltype.  Change all callers.
10016         (struct Relocate_info): Remove options field and all references to
10017         it.
10018         * reloc.h (class Read_relocs): Remove options constructor
10019         parameter and options_ field.  Change all callers.
10020         (class Gc_process_relocs, class Scan_relocs): Likewise.
10021         (class Relocate_task): Likewise.
10022         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10023         all callers.
10024         (scan_relocatable_relocs): Likewise.
10025         * target.h (class Sized_target): Remove options parameter from
10026         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10027         all callers.
10028         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10029         callers.
10030         * arm.cc: Update functions to remove options parameters.
10031         * i386.cc: Likewise.
10032         * powerpc.cc: Likewise.
10033         * sparc.cc: Likewise.
10034         * x86_64.cc: Likewise.
10035         * testsuite/testfile.cc: Likewise.
10036
10037 2009-10-28  Doug Kwan  <dougkwan@google.com>
10038
10039         * arm.cc (Arm_relobj): New class definition.
10040         (Arm_relobj::scan_sections_for_stubs,
10041         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10042         New method definitions.
10043
10044 2009-10-28  Cary Coutant  <ccoutant@google.com>
10045
10046         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10047         (Plugin::cleanup_done_): New member.
10048         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10049         (Plugin_manager::cleanup_done_): Remove.
10050         (Plugin_manager::add_input_file): Edit error message.
10051         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10052         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10053
10054 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10055
10056         * fileread.cc: (File_read::View::~View): Use the new
10057         data_ownership_ filed.
10058         (File_read::~File_read): Dispose the new whole_file_view_.
10059         (File_read::open): Mmap the whole file if needed.
10060         (File_read::open): Use whole_file_view_ instead of contents_.
10061         (File_read::find_view): Use whole_file_view_ if applicable.
10062         (File_read::do_read): Use whole_file_view_ instead of contents_.
10063         (File_read::make_view): Use whole_file_view_ instead of contents_,
10064         update File_read::View::View call.
10065         (File_read::find_or_make_view): Update File_read::View::View
10066         call.
10067         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10068         remove contents_
10069         (File_read::View::Data_ownership): New enum.
10070         (File_read::View::View): Replace bool mapped_ with Data_ownership
10071         argument.
10072         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10073         (File_read::View::data_ownership_): New field.
10074         (File_read::contents_): Remove (replaced by whole_file_view_).
10075         (File_read::whole_file_view_): New field.
10076         * options.h (class General_options): Add --keep-files-mapped.
10077
10078 2009-10-27  Cary Coutant  <ccoutant@google.com>
10079
10080         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10081         * testsuite/Makefile.am (plugin_test_5): New test case.
10082         * testsuite/Makefile.in: Regenerate.
10083
10084 2009-10-25  Doug Kwan  <dougkwan@google.com>
10085
10086         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10087         from private to protected to allow access by child class.
10088         (Sized_relobj::do_relocate_sections): New method declaration.
10089         (Sized_relobj::relocate_sections): Virtualize.
10090         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10091         Sized_relobj::relocate_sections.  Instantiate template explicitly
10092         for different target sizes and endianity.
10093
10094 2009-10-24  Doug Kwan  <dougkwan@google.com>
10095
10096         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10097         (Arm_input_section::as_arm_input_section): New method.
10098         (Arm_output_section): New class definition.
10099         (Arm_output_section::create_stub_group,
10100         Arm_output_section::group_sections): New method definitions.
10101
10102 2009-10-22  Doug Kwan  <dougkwan@google.com>
10103
10104         * arm.cc (Arm_input_section): New class definition.
10105         (Arm_input_section::init, Arm_input_section:do_write,
10106         Arm_input_section::set_final_data_size,
10107         Arm_input_section::do_reset_address_and_file_offset): New method
10108         definitions.
10109
10110 2009-10-21  Doug Kwan  <dougkwan@google.com>
10111
10112         * arm.cc (Stub_table, Arm_input_section): New forward class
10113         declarations.
10114         (Stub_table): New class defintion.
10115         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10116         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10117         New method definition.
10118
10119 2009-10-21  Doug Kwan  <dougkwan@google.com>
10120
10121         * arm.cc: Update copyright comments.
10122         (Target_arm): New forward class template declaration.
10123         (Arm_address): New type.
10124         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10125         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10126         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10127         constants.
10128         (Insn_template): Same.
10129         (DEF_STUBS): New macro.
10130         (Stub_type): New enum type.
10131         (Stub_template): New class definition.
10132         (Stub): Same.
10133         (Reloc_stub): Same.
10134         (Stub_factory): Same.
10135         (Target_arm::Target_arm): Initialize may_use_blx_ and
10136         should_force_pic_veneer_.
10137         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10138         Target_arm::should_force_pic_veneer,
10139         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10140         Target_arm::using_thumb_only, Target_arm:;default_target): New
10141         method defintions.
10142         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10143         New data member declarations.
10144         (Insn_template::size, Insn_template::alignment): New method defintions.
10145         (Stub_template::Stub_template): New method definition.
10146         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10147         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10148         (Stub_factory::Stub_factory): New method definition.
10149         * gold.h (string_hash): New template.
10150         * output.h (Input_section_specifier::hash_value): Use
10151         gold::string_hash.
10152         (Input_section_specifier::string_hash): Remove.
10153         * stringpool.cc (Stringpool_template::string_hash): Use
10154         gold::string_hash.
10155
10156 2009-10-20  Doug Kwan  <dougkwan@google.com>
10157
10158         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10159         symbols of relaxed input sections.
10160         * output.h (Output_section::find_relaxed_input_section): Make
10161         method public.
10162
10163 2009-10-16  Doug Kwan  <dougkwan@google.com>
10164
10165         * dynobj.cc (Versions::Versions): Initialize version_script_.
10166         Only insert base version symbol definition for a shared object
10167         if version script defines any version versions.
10168         (Versions::define_base_version): New method definition.
10169         (Versions::add_def): Check that base version is not needed.
10170         (Versions::add_need): Define base version lazily.
10171         * dynobj.h (Versions::define_base_version): New method declaration.
10172         (Versions::needs_base_version_): New data member declaration.
10173         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10174         (check_DATA): Add no_version_test.stdout.
10175         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10176         New make rules.
10177         * testsuite/Makefile.in: Regenerate.
10178         * testsuite/no_version_test.c: New file.
10179         * testsuite/no_version_test.sh: Ditto.
10180
10181 2009-10-16  Doug Kwan  <dougkwan@google.com>
10182
10183         * expression.cc (class Segment_start_expression): New class definition.
10184         (Segment_start_expression::value): New method definition.
10185         (script_exp_function_segment_start): Return a new
10186         Segment_start_expression.
10187         * gold/script-c.h (script_saw_segment_start_expression): New function
10188         prototype.
10189         * script-sections.cc (Script_sections::Script_sections): Initialize
10190         SAW_SEGMENT_START_EXPRESSION_ to false.
10191         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10192         and -Tbbs options to specify section addresses if given in
10193         command line and no SEGMENT_START expression is seen in a script.
10194         * script-sections.h (Script_sections::saw_segment_start_expression,
10195         Script_sections::set_saw_segment_start_expression): New method
10196         definition.
10197         (Script_sections::saw_segment_start_expression_): New data member
10198         declaration.
10199         * script.cc (script_saw_segment_start_expression): New function.
10200         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10201         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10202         script_test_7.sh and script_test_8.sh.
10203         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10204         script_test_8.stdout.
10205         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10206         (script_test_6, script_test_6.stdout, script_test_7,
10207         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10208         * Makefile.in: Regenerate.
10209         * testsuite/script_test_6.sh: New file.
10210         * testsuite/script_test_6.t: Same.
10211         * testsuite/script_test_7.sh: Same.
10212         * testsuite/script_test_7.t: Same.
10213         * testsuite/script_test_8.sh: Same.
10214
10215 2009-10-16  Doug Kwan  <dougkwan@google.com>
10216
10217         * output.cc (Output_segment::set_section_list_address): Cast
10218         expressions to unsigned long long type to avoid format warnings.
10219
10220 2009-10-15  Ian Lance Taylor  <iant@google.com>
10221
10222         * script.cc (Script_options::add_symbol_assignment): Always add a
10223         dot assignment to script_sections_.
10224         * script-sections.cc (Script_sections::add_dot_assignment):
10225         Initialize if necessary.
10226
10227         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10228         program headers with no load segment if there is a linker script.
10229
10230         * layout.cc (Layout::set_segment_offsets): Align the file offset
10231         to the segment aligment for -N or -n with no load segment.
10232         * output.cc (Output_segment::add_output_section): Don't crash if
10233         the first section is a TLS section.
10234         (Output_segment::set_section_list_addresses): Print an error
10235         message if the address moves backward in a linker script.
10236         * script-sections.cc
10237         (Output_section_element_input::set_section_addresses): Don't
10238         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10239         (Orphan_output_section::set_section_addresses): Likewise.
10240
10241 2009-10-15  Doug Kwan  <dougkwan@google.com>
10242
10243         * layout.cc (Layout::finish_dynamic_section): Generate tags
10244         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10245         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10246         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10247
10248 2009-10-14  Ian Lance Taylor  <iant@google.com>
10249
10250         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10251         fields.
10252         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10253         data_shdr fields of relinfo.
10254         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10255         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10256         R_386_TLS_LDO_32, adjust based on section flags.
10257         (Target_i386::Relocate::fix_up_ldo): Remove.
10258
10259 2009-10-13  Ian Lance Taylor  <iant@google.com>
10260
10261         Add support for -pie.
10262         * options.h (class General_options): Add -pie and
10263         --pic-executable.
10264         (General_options::output_is_position_independent): Test -pie.
10265         (General_options::output_is_executable): Return true if not shared
10266         and not relocatable.
10267         (General_options::output_is_pie): Remove.
10268         * options.cc (General_options::finalize): Reject incompatible uses
10269         of -pie.
10270         * gold.cc (queue_middle_tasks): A -pie link is not static.
10271         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10272         * symtab.cc (Symbol::final_value_is_known): Return false if
10273         output_is_position_independent.
10274         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10275         output_is_position_independent.
10276         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10277         output_is_position_independent.
10278         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10279         output_is_position_independent.
10280         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10281         two_file_pie_test.
10282         (basic_pie_test.o, basic_pie_test): New targets.
10283         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10284         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10285         (two_file_pie_test): New target.
10286         * testsuite/Makefile.in: Rebuild.
10287         * README: Remove note saying that -pie is not supported.
10288
10289 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10290
10291         * options.h (class General_options): Add -init and -fini.
10292         * layout.cc (Layout::finish_dynamic_section): Emit
10293         given init and fini functions.
10294
10295 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10296
10297         * gc.h (gc_process_relocs): Check if icf is enabled using new
10298         function.
10299         * gold.cc (queue_initial_tasks): Likewise.
10300         (queue_middle_tasks): Likewise.
10301         * object.cc (do_layout): Likewise.
10302         * symtab.cc (is_section_folded): Likewise.
10303         * main.cc (main): Likewise.
10304         * reloc.cc (Read_relocs::run): Likewise.
10305         (Sized_relobj::do_scan_relocs): Likewise.
10306         * icf.cc (is_function_ctor_or_dtor): New function.
10307         (Icf::find_identical_sections): Check if function is ctor or dtor when
10308         safe icf is chosen.
10309         * options.h (General_options::icf): Change option to be an enum.
10310         (Icf_status): New enum.
10311         (icf_enabled): New method.
10312         (icf_safe_folding): New method.
10313         (set_icf_status): New method.
10314         (icf_status_): New variable.
10315         * (options.cc) (General_options::finalize): Set icf_status_.
10316         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10317         icf_test and icf_keep_unique_test to use the --icf enum flag.
10318         * testsuite/icf_safe_test.sh: New file.
10319         * testsuite/icf_safe_test.cc: New file.
10320
10321 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10322
10323         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10324         includes to gc.h and icf.h.
10325         * arm.cc: Include gc.h.
10326         * gold.cc: Likewise.
10327         * i386.cc: Likewise.
10328         * powerpc.cc: Likewise.
10329         * sparc.cc: Likewise.
10330         * x86_64.cc: Likewise.
10331         * gc.h: Include icf.h.
10332
10333 2009-10-11  Ian Lance Taylor  <iant@google.com>
10334
10335         * plugin.cc: Include "gold.h" before other header files.
10336
10337 2009-10-10  Chris Demetriou  <cgd@google.com>
10338
10339         * options.h (Input_file_argument::Input_file_type): New enum.
10340         (Input_file_argument::is_lib_): Replace with...
10341         (Input_file_argument::type_): New member.
10342         (Input_file_argument::Input_file_argument): Take Input_file_type
10343         'type' rather than boolean 'is_lib' as second argument.
10344         (Input_file_argument::is_lib): Use type_.
10345         (Input_file_argument::is_searched_file): New function.
10346         (Input_file_argument::may_need_search): Handle is_searched_file.
10347         * options.cc (General_options::parse_library): Support -l:filename.
10348         (General_options::parse_just_symbols): Update for Input_file_argument
10349         changes.
10350         (Command_line::process): Likewise.
10351         * archive.cc (Archive::get_file_and_offset): Likewise.
10352         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10353         * script.cc (read_script_file, script_add_file): Likewise.
10354         * fileread.cc (Input_file::Input_file): Likewise.
10355         (Input_file::will_search_for): Handle is_searched_file.
10356         (Input_file::open): Likewise.
10357         * readsyms.cc (Read_symbols::get_name): Likewise.
10358         * testsuite/Makefile.am (searched_file_test): New test.
10359         * testsuite/Makefile.in: Regenerate.
10360         * testsuite/searched_file_test.cc: New file.
10361         * testsuite/searched_file_test_lib.cc: New file.
10362
10363 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10364             Ian Lance Taylor  <iant@google.com>
10365
10366         * descriptor.cc: Include <cstdio> and "binary-io.h".
10367         (Descriptors::open): Open the files in binary mode always.
10368         * script.cc (Lex::get_token): Treat \r as whitespace.
10369
10370 2009-10-09  Ian Lance Taylor  <iant@google.com>
10371
10372         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10373
10374 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10375             Ian Lance Taylor  <iant@google.com>
10376
10377         * configure.ac: Check for readv function also.
10378         * fileread.cc (readv): Define if not HAVE_READV.
10379         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10380         does not exist.
10381         * config.in: Regenerate.
10382         * configure: Regenerate.
10383
10384 2009-10-09  Doug Kwan  <dougkwan@google.com>
10385
10386         * layout.cc (Layout::make_output_section): Call target hook to make
10387         ordinary output section.
10388         (Layout::finalize): Adjust parameter list of call the
10389         Target::may_relax().
10390         * layout.h (class Layout::section_list): New method.
10391         * merge.h (Output_merge_base::entsize): Change visibility to public.
10392         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10393         New methods.
10394         (Output_merge_string::do_is_string): New method.
10395         * object.cc (Sized_relobj::do_setup): renamed from
10396         Sized_relobj::set_up.
10397         * object.h (Sized_relobj::adjust_shndx,
10398         Sized_relobj::initializ_input_to_output_maps,
10399         Sized_relobj::free_input_to_output_maps): Change visibilities to
10400         protected.
10401         (Sized_relobj::setup): Virtualize.
10402         (Sized_relobj::do_setup): New method declaration.
10403         (Sized_relobj::invalidate_section_offset,
10404         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10405         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10406         * options.cc (parse_int): New function.
10407         * options.h (parse_int): New declaration.
10408         (DEFINE_int): New macro.
10409         (stub_group_size): New option.
10410         * output.cc (Output_section::Output_section): Initialize memebers
10411         merge_section_map_, merge_section_by_properties_map_,
10412         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10413         (Output_section::add_input_section): Handled deferred code-fill
10414         generation and remove an old comment.
10415         (Output_section::add_relaxed_input_section): New method definition.
10416         (Output_section::add_merge_input_section): Use merge section by
10417         properties map to speed to search.  Update merge section maps
10418         as appropriate.
10419         (Output_section::build_relaxation_map): New method definition.
10420         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10421         Same.
10422         (Output_section::relax_input_section): Renamed to
10423         Output_section::convert_input_sections_to_relaxed_sections and change
10424         interface to take a vector of pointers to relaxed sections.
10425         (Output_section::find_merge_section,
10426         Output_section::find_relaxed_input_section): New method definitions.
10427         (Output_section::is_input_address_mapped,
10428         Output_section::output_offset, Output_section::output_address):
10429         Use output section data maps to speed up searching.
10430         (Output_section::find_starting_output_address): Add comments.
10431         (Output_section::do_write,
10432         Output_section::write_to_postprocessing_buffer): Do code-fill
10433         generation as appropriate.
10434         (Output_section::get_input_sections): Invalidate relaxed input section
10435         map.
10436         (Output_section::restore_states): Adjust type of checkpoint .
10437         Invalidate relaxed input section map.
10438         * output.h (Output_merge_base): New class declaration.
10439         (Input_section_specifier): New class defintion.
10440         (class Output_relaxed_input_section) Change base class to
10441         Output_section_data_build.
10442         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10443         base class initializer.
10444         (Output_section::add_relaxed_input_section): New method declaration.
10445         (Output_section::Input_section): Change visibility to protected.
10446         (Output_section::Input_section::relobj,
10447         Output_section::Input_section::shndx): Handle relaxed input sections.
10448         Output_section::input_sections) Change visibility to protected.  Also
10449         define overload to return a non-const pointer.
10450         (Output_section::Merge_section_properties): New class defintion.
10451         (Output_section::Merge_section_by_properties_map,
10452         Output_section::Output_section_data_by_input_section_map,
10453         Output_section::Relaxation_map): New types.
10454         (Output_section::relax_input_section): Rename method to
10455         Output_section::convert_input_sections_to_relaxed_sections and change
10456         interface to take a vector of relaxed section pointers.
10457         (Output_section::find_merge_section,
10458         Output_section::find_relaxed_input_section,
10459         Output_section::build_relaxation_map,
10460         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10461         New method declarations.
10462         (Output_section::merge_section_map_
10463         Output_section::merge_section_by_properties_map_,
10464         Output_section::relaxed_input_section_map_,
10465         Output_section::is_relaxed_input_section_map_valid_,
10466         Output_section::generate_code_fills_at_write_): New data members.
10467         * script-sections.cc
10468         (Output_section_element_input::set_section_addresses): Call
10469         current_data_size and addralign methods of relaxed input sections.
10470         (Orphan_output_section::set_section_addresses): Call current_data_size
10471         and addralign methods of relaxed input sections.
10472         * symtab.cc (Symbol_table::compute_final_value): Extract template
10473         from the body of Symbol_table::sized_finalize_symbol.
10474         (Symbol_table::sized_finalized_symbol): Call
10475         Symbol_table::compute_final_value.
10476         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10477         (Symbol_table::compute_final_value): New templated method declaration.
10478         * target.cc (Target::do_make_output_section): New method defintion.
10479         * target.h (Target::make_output_section): New method declaration.
10480         (Target::relax): Add more parameters for input objects, symbol table
10481         and layout.  Adjust call to do_relax.
10482         (Target::do_make_output_section): New method declaration.
10483         (Target::do_relax): Add parameters for input objects, symbol table
10484         and layout.
10485
10486 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10487
10488         * pread.c: Include stdio.h.
10489
10490 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10491
10492         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10493         defined.
10494
10495 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10496
10497         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10498         Change read_shndx type to unsigned int.
10499         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10500         int.
10501         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10502         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10503         Change read_shndx type to unsigned int.
10504         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10505         int.
10506         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10507         * layout.cc (Layout::create_symtab_sections): Cast the result of
10508         local_symcount * symsize to off_t in the gold_assert.
10509
10510 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10511
10512         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10513         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10514         R_ARM_BASE_ABS.
10515         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10516         (Arm_relocate_functions::thm_abs5): New function.
10517         (Arm_relocate_functions::abs12): New function.
10518         (Arm_relocate_functions::abs16): New function.
10519         (Arm_relocate_functions::base_abs): New function.
10520         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10521         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10522         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10523         R_ARM_BASE_ABS.
10524         (Scan::global): Likewise.
10525         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10526         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10527         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10528         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10529         R_ARM_BASE_ABS.
10530
10531 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10532
10533         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10534         (Arm_relocate_functions::movt_prel): New function.
10535         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10536         (Arm_relocate_functions::thm_movt_prel): New function.
10537         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10538         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10539         (Scan::global, Relocate::relocate): Likewise.
10540         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10541
10542 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10543
10544         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10545         Incremental_checker.
10546         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10547         unsigned int.
10548         (class Incremental_inputs_header): New class.
10549         (Incremental_inputs_header_writer): Edit comment.
10550         (Incremental_inputs_entry): New class.
10551         (Incremental_inputs_entry_writer): Edit comment.
10552         (Sized_incremental_binary::do_find_incremental_inputs_section):
10553         Add *strtab_shndx parameter, fill it.
10554         (Sized_incremental_binary::do_check_inputs): New method.
10555         (Incremental_checker::can_incrementally_link_output_file): Use
10556         Sized_incremental_binary::check_inputs.
10557         (Incremental_inputs::report_command_line): Save command line in
10558         command_line_.
10559         * incremental.h:
10560         (Incremental_binary::find_incremental_inputs_section): New
10561         method.
10562         (Incremental_binary::do_find_incremental_inputs_section): Add
10563         strtab_shndx parameter.
10564         (Incremental_binary::do_check_inputs): New pure virtual method.
10565         (Sized_incremental_binary::do_check_inputs): Declare.
10566         (Incremental_checker::Incremental_checker): Add incremental_inputs
10567         parameter, use it to initialize incremental_inputs_.
10568         (Incremental_checker::incremental_inputs_): New field.
10569         (Incremental_checker::command_line): New method.
10570         (Incremental_checker::inputs): New method.
10571         (Incremental_checker::command_line_): New field.
10572
10573 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10574
10575         * incremental.cc: Include <cstdarg> and "target-select.h".
10576         (vexplain_no_incremental): New function.
10577         (explain_no_incremental): New function.
10578         (Incremental_binary::error): New method.
10579         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10580         method.
10581         (make_sized_incremental_binary): New function.
10582         (open_incremental_binary): New function.
10583         (can_incrementally_link_file): Add checks if output is ELF and has
10584         inputs section.
10585         * incremental.h: Include "elfcpp_file.h" and "output.h".
10586         (Incremental_binary): New class.
10587         (Sized_incremental_binary): New class.
10588         (open_incremental_binary): Declare.
10589         * object.cc (is_elf_object): Use
10590         elfcpp::Elf_recognizer::is_elf_file.
10591         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10592         * output.h (Output_file::filesize): New method.
10593
10594 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10595
10596         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10597         New function.
10598         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10599         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10600         function.
10601         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10602         function.
10603         (Arm_relocate_functions::movw_abs_nc): New function.
10604         (Arm_relocate_functions::movt_abs): New function.
10605         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10606         (Arm_relocate_functions::thm_movt_abs): New function.
10607         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10608         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10609         (Scan::global): Likewise.
10610         (Relocate::relocate): Likewise.
10611         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10612
10613 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10614
10615         * arm.cc (Arm_relocate_functions::got_prel) New function.
10616         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10617         (Relocate::relocate): Likewise.
10618         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10619
10620 2009-10-06  Ian Lance Taylor  <iant@google.com>
10621
10622         * options.h (class General_options): Define
10623         split_stack_adjust_size parameter.
10624         * object.h (class Object): Add uses_split_stack_ and
10625         has_no_split_stack_ fields.  Add uses_split_stack and
10626         has_no_split_stack accessor functions.  Declare
10627         handle_split_stack_section.
10628         (class Reloc_symbol_changes): Define.
10629         (class Sized_relobj): Define Function_offsets.  Declare
10630         split_stack_adjust, split_stack_adjust_reltype, and
10631         find_functions.
10632         * object.cc (Object::handle_split_stack_section): New function.
10633         (Sized_relobj::do_layout): Call handle_split_stack_section.
10634         * dynobj.cc (Sized_dynobj::do_layout): Call
10635         handle_split_stack_section.
10636         * reloc.cc (Sized_relobj::relocate_sections): Call
10637         split_stack_adjust for executable sections in split_stack
10638         objects.  Pass reloc_map to relocate_section.
10639         (Sized_relobj::split_stack_adjust): New function.
10640         (Sized_relobj::split_stack_adjust_reltype): New function.
10641         (Sized_relobj::find_functions): New function.
10642         * target-reloc.h: Include "object.h".
10643         (relocate_section): Add reloc_symbol_changes parameter.  Change
10644         all callers.
10645         * target.h (class Target): Add calls_non_split method.  Declare
10646         do_calls_non_split virtual method.  Declare match_view and
10647         set_view_to_nop.
10648         * target.cc: Include "elfcpp.h".
10649         (Target::do_calls_non_split): New function.
10650         (Target::match_view): New function.
10651         (Target::set_view_to_nop): New function.
10652         * gold.cc (queue_middle_tasks): Give an error if mixing
10653         split-stack and non-split-stack objects with -r.
10654         * i386.cc (Target_i386::relocate_section): Add
10655         reloc_symbol_changes parameter.
10656         (Target_i386::do_calls_non_split): New function.
10657         * x86_64.cc (Target_x86_64::relocate_section): Add
10658         reloc_symbol_changes parameter.
10659         (Target_x86_64::do_calls_non_split): New function.
10660         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10661         parameter.
10662         * powerpc.cc (Target_powerpc::relocate_section): Add
10663         reloc_symbol_changes parameter.
10664         * sparc.cc (Target_sparc::relocate_section): Add
10665         reloc_symbol_changes parameter.
10666         * configure.ac: Call AM_CONDITIONAL for the default target.
10667         * configure: Rebuild.
10668         * testsuite/Makefile.am (TEST_AS): New variable.
10669         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10670         (check_DATA): Add split_i386 and split_x86_64 files.
10671         (SPLIT_DEFSYMS): Define.
10672         (split_i386_[1234n].o): New targets.
10673         (split_i386_[124]): New targets.
10674         (split_i386_[1234r].stdout): New targets.
10675         (split_x86_64_[1234n].o): New targets.
10676         (split_x86_64_[124]): New targets.
10677         (split_x86_64_[1234r].stdout): New targets.
10678         (MOSTLYCLEANFILES): Add new executables.
10679         * testsuite/split_i386.sh: New file.
10680         * testsuite/split_x86_64.sh: New file.
10681         * testsuite/split_i386_1.s: New file.
10682         * testsuite/split_i386_2.s: New file.
10683         * testsuite/split_i386_3.s: New file.
10684         * testsuite/split_i386_4.s: New file.
10685         * testsuite/split_i386_n.s: New file.
10686         * testsuite/split_x86_64_1.s: New file.
10687         * testsuite/split_x86_64_2.s: New file.
10688         * testsuite/split_x86_64_3.s: New file.
10689         * testsuite/split_x86_64_4.s: New file.
10690         * testsuite/split_x86_64_n.s: New file.
10691         * testsuite/testfile.cc (Target_test): Update relocation_section
10692         function.
10693         * testsuite/Makefile.in: Rebuild.
10694
10695 2009-10-06  Ian Lance Taylor  <iant@google.com>
10696
10697         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10698         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10699         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10700         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10701         the address on ldo_addrs_.
10702         (Target_i386::Relocate::fix_up_ldo): New function.
10703
10704 2009-10-06   Rafael Espindola  <espindola@google.com>
10705
10706         * plugin.cc (add_input_library): New.
10707         (Plugin::load): Add add_input_library to tv.
10708         (Plugin_manager::add_input_file): Add the is_lib argument.
10709         (add_input_file): Update call to Plugin_manager::add_input_file.
10710         (add_input_library): New.
10711         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10712
10713 2009-09-30  Doug Kwan  <dougkwan@google.com>
10714
10715         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10716         symbol and call Symbol::may_need_copy_reloc to determine if
10717         a copy reloc is needed.
10718         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10719         nocopyreloc is given in command line.
10720         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10721         given in command line.
10722         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10723         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10724         of the removed Target_i386::may_need_copy_reloc.
10725         * options.h (copyreloc): New option with default value false.
10726         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10727         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10728         instead of the removed Target_powerpc::may_need_copy_reloc.
10729         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10730         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10731         instead of the removed Target_sparc::may_need_copy_reloc.
10732         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10733         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10734         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10735         instead of the removed Target_x86_64::may_need_copy_reloc.
10736
10737 2009-09-30  Ian Lance Taylor  <iant@google.com>
10738
10739         * object.h (class Object): Remove target_ field, and target,
10740         sized_target, and set_target methods.
10741         (Object::sized_target): Remove.
10742         (class Sized_relobj): Update declarations.  Remove sized_target.
10743         * object.cc (Sized_relobj::setup): Remove target parameter.
10744         Change all callers.
10745         (Input_objects::add_object): Don't do anything with the target.
10746         (make_elf_sized_object): Add punconfigured parameter.  Change all
10747         callers.  Set or test parameter target.
10748         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10749         Change all callers.
10750         * parameters.cc (Parameters::set_target): Change parameter type to
10751         be non-const.
10752         (Parameters::default_target): Remove.
10753         (set_parameters_target): Change parameter type to be non-const.
10754         (parameters_force_valid_target): New function.
10755         (parameters_clear_target): New function.
10756         * parameters.h (class Parameters): Update declarations.  Remove
10757         default_target method.  Add sized_target and clear_target
10758         methods.  Change target_ to be non-const.
10759         (set_parameters_target): Update declaration.
10760         (parameters_force_valid_target): Declare.
10761         (parameters_clear_target): Declare.
10762         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10763         as NULL if we aren't searching.
10764         (Add_symbols::run): Don't check for compatible target.
10765         * fileread.cc (Input_file::open_binary): Call
10766         parameters_force_valid_target.
10767         * gold.cc (queue_middle_tasks): Likewise.
10768         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10769         set_target on object.
10770         * dynobj.h (class Sized_dynobj): Update declarations.
10771         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10772         make_elf_object returns NULL.
10773         (Archive::include_member): Don't check whether object target is
10774         compatible.
10775         * output.cc (Output_section::add_input_section): Get target from
10776         parameters.
10777         (Output_section::relax_input_section): Likewise.
10778         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10779         parameters.
10780         (Sized_relobj::do_scan_relocs): Likewise.
10781         (Sized_relobj::relocate_sections): Likewise.
10782         * resolve.cc (Symbol_table::resolve): Likewise.
10783         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10784         parameter.  Change all callers.
10785         (Symbol_table::add_from_object): Get target from parameters.
10786         (Symbol_table::add_from_relobj): Don't check object target.
10787         (Symbol_table::add_from_dynobj): Likewise.
10788         (Symbol_table::define_special_symbol): Get target from
10789         parameters.
10790         * symtab.h (class Symbol_table): Update declaration.
10791         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10792         parameter.  Change all callers.  Clear parameter target.
10793         (Binary_test): Test target here.
10794         * testsuite/object_unittest.cc (gold_testsuite): Remove
10795         target_test_pointer parameter.  Change all callers.
10796         (Object_test): Test target here.
10797
10798 2009-09-26  Ian Lance Taylor  <iant@google.com>
10799
10800         * testsuite/initpri1.c: Don't try to use constructor priorities if
10801         compiling with gcc before 4.3.
10802
10803 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10804
10805         * testsuite/retain_symbols_file_test.sh (check_present): Change
10806         output file name to retain_symbols_file_test.stdout.
10807         (check_absent): Likewise.
10808
10809 2009-09-18  Craig Silverstein  <csilvers@google.com>
10810
10811         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10812         * options.cc: Include <cerrno> and <fstream>.
10813         (General_options::finalize): Parse -retain-symbols-file tag.
10814         * options.h: New flag.
10815         (General_options): New method should_retain_symbol, new
10816         variable symbols_to_retain.
10817         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10818         should_retain_symbol map.
10819         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10820         * testsuite/Makefile.in: Regenerate.
10821         * testsuite/retain_symbols_file_test.sh: New file.
10822
10823 2009-09-18  Nick Clifton  <nickc@redhat.com>
10824
10825         * po/es.po: Updated Spanish translation.
10826
10827 2009-09-17  Doug Kwan  <dougkwan@google.com>
10828
10829         * debug.h (DEBUG_RELAXATION): New constant.
10830         (DEBUG_ALL): Add DEBUG_RELAXATION.
10831         (debug_string_to_enum): Add relaxation debug option.
10832         * layout.cc
10833         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10834         Layout::Relaxation_debug_check::read_sections,
10835         Layout::Relaxation_debug_check::read_sections): New method definitions.
10836         (Layout::Layout): Initialize data members
10837         record_output_section_data_from_scrips_,
10838         script_output_section_data_list_ and relaxation_debug_check_.
10839         (Layout::save_segments, Layout::restore_segments,
10840         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10841         Layout::relaxation_loop_body): New method definitions.
10842         (Layout::finalize): Support relaxation.  Move section layout code to
10843         Layout::relaxation_loop_body.
10844         (Layout::set_asection_address_from_script): Move code for orphan
10845         section placement out.
10846         (Layout::place_orphan_sections_in_script): New method definition.
10847         * layout.h (Output_segment_headers, Output_file_header):
10848         New forward class declarations.
10849         (Layout::~Layout): Define.
10850         (Layout::new_output_section_data_from_script): New method definition.
10851         (Layout::place_orphan_sections_in_script): New method declaration.
10852         (Layout::Segment_states): New type declaration.
10853         (Layout::save_segments, Layout::restore_segments,
10854         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10855         Layout::relaxation_loop_body): New method declarations.
10856         (Layout::Output_section_data_list): New type declaration.
10857         (Layout::Relaxation_debug_check): New class definition.
10858         (Layout::record_output_section_data_from_script_,
10859         Layout::script_output_section_data_list_, Layout::segment_states_,
10860         Layout::relaxation_debug_check_): New data members.
10861         * output.cc: (Output_section_headers::do_size): New method definition.
10862         (Output_section_headers::Output_section_headers): Move size
10863         computation to Output_section_headers::do_size.
10864         (Output_segment_headers::do_size): New method definition.
10865         (Output_file_header::Output_file_header): Move size computation to
10866         Output_file_header::do_size and call it.
10867         (Output_file_header::do_size): New method definition.
10868         (Output_data_group::Output_data_group): Adjust call to
10869         Output_section_data.
10870         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10871         (Output_symtab_xindex::do_write): Add array bound check.
10872         (Output_section::Input_section::print_to_mapfile): Handle
10873         RELAXED_INPUT_SECTION_CODE.
10874         (Output_section::Output_section): Initialize data member checkpoint_.
10875         (Output_section::~Output_section): Delete checkpoint object pointed
10876         by checkpoint_.
10877         (Output_section::add_input_section): Always add an Input_section if
10878         relaxing.
10879         (Output_section::add_merge_input_section): Add assert.
10880         (Output_section::relax_input_section): New method definition.
10881         (Output_section::set_final_data_size): Set load address to zero for
10882         an unallocated section.
10883         (Output_section::do_address_and_file_offset_have_reset_values):
10884         New method definition.
10885         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10886         Handle relaxed input section.
10887         (Output_section::sort_attached_input_sections): Checkpoint input
10888         section list lazily.
10889         (Output_section::get_input_sections): Change type of input_sections to
10890         list of Simple_input_section pointers.  Checkpoint input section list
10891         lazily.  Also handle relaxed input sections.
10892         (Output_section::add_input_section_for_script): Take a reference to
10893         a Simple_input_section object instead of Relobj pointer and section
10894         index as parameter.  Handle relaxed input sections.
10895         (Output_section::save_states, Output_section::restore_states): New
10896         method definitions.
10897         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10898         (Output_data::is_data_size_fixed): New method definition.
10899         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10900         if it is fixed.
10901         (Output_data::address_and_file_offset_have_reset_values): New method
10902         definition.
10903         (Output_data::do_address_and_file_offset_have_reset_values): New method
10904         definition.
10905         (Output_data::set_data_size): Check that data size is not fixed.
10906         (Output_data::fix_data_size): New method definition.
10907         (Output_data::is_data_size_fixed_): New data member.
10908         (Output_section_headers::set_final_data_size): New method definition.
10909         (Output_section_headers::do_size): New method declaration.
10910         (Output_segment_headers::set_final_data_size): New method definition.
10911         (Output_segment_headers::do_size): New method declaration.
10912         (Output_file_header::set_final_data_size)::New method definition.
10913         (Output_file_header::do_size)::New method declaration.
10914         (Output_section_data::Output_section_data): Add new parameter
10915         is_data_size_fixed and use it to fix data size.
10916         (Output_data_const::Output_data_const): Adjust call to base class
10917         constructor and fix data size.
10918         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10919         base class constructor and fix data size.
10920         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10921         base class constructor and fix data size.
10922         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10923         class constructor and fix data size.
10924         (Output_data_group::set_final_data_size): New method definition.
10925         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10926         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10927         class constructor and fix data size.
10928         (Output_relaxed_input_section): New class definition.
10929         (Output_section::Simple_input_section): New class definition.
10930         (Output_section::get_input_sections): Adjust parameter list.
10931         (Output_section::add_input_section_for_script): Same.
10932         (Output_section::save_states, Output_section::restore_states,
10933         Output_section::do_address_and_file_offset_have_reset_values,
10934         (Output_section::Input_section::Input_section): Handle
10935         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10936         Output_relaxed_input_section.
10937         (Output_section::Input_section::is_input_section,
10938         Output_section::Input_section::set_output_section): Handle relaxed
10939         input section.
10940         (Output_section::Input_section::is_relaxed_input_section,
10941         Output_section::Input_section::output_section_data,
10942         Output_section::Input_section::relaxed_input_section): New method
10943         definitions.
10944         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10945         value.
10946         (Output_section::Input_section::u1_): Update comments.
10947         (Output_section::Input_section::u2_): Add new union member poris.
10948         (Output_section::Checkpoint_output_section): New classs definition.
10949         (Output_section::relax_input_section): New method declaration.
10950         (Output_section::checkpoint_): New data member.
10951         (Output_segment): Update comments.
10952         (Output_segment::Output_segment): Un-privatize copy constructor.
10953         (Output_segment::operator=): Un-privatize.
10954         * script-sections.cc (Output_section_element::Input_section_list):
10955         Change element type to Output_section::Simple_input_section.
10956         (Output_section_element_dot_assignment::set_section_addresses):
10957         Register output section data for relaxation clean up.
10958         (Output_data_exression::Output_data_expression): Adjust call to base
10959         constructor to fix data size.
10960         (Output_section_element_data::set_section_addresses): Register
10961         Output_data_expression object for relaxation clean up.
10962         (struct Input_section_info): Replace Relobj pointer and section index
10963         pair with Output_section::Simple_input_section and Convert struct to a
10964         class.
10965         (Input_section_sorter::operator()): Adjust access to
10966         Input_section_info data member to use accessors.
10967         (Output_section_element_input::set_section_addresses): Use layout
10968         parameter.  Adjust code to use Output_section::Simple_input_section
10969         and Input_secction_info classes.  Register filler for relaxation
10970         clean up.
10971         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10972         and section index pair with Output_section::Simple_input_section
10973         class.  Adjust code accordingly.
10974         (Phdrs_element::release_segment): New method definition.
10975         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10976         segment list.
10977         (Script_sections::release_segments): New method definition.
10978         * gold/script-sections.h (Script_sections::release_segments): New
10979         method declaration.
10980         * gold/target.h (Target::may_relax, Target::relax,
10981         Target::do_may_relax, Target::do_relax): New method definitions.
10982
10983 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10984
10985         * arm.cc (has_signed_unsigned_overflow): New function.
10986         (Arm_relocate_functions::abs8): New function.
10987         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10988         (Target_arm::Scan::global): Likewise.
10989         (Target_arm::relocate::relocate): Likewise.
10990         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10991         Likewise.
10992
10993 2009-09-16  Cary Coutant  <ccoutant@google.com>
10994
10995         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10996         * testsuite/Makefile.in: Regenerate.
10997
10998 2009-09-11  Nick Clifton  <nickc@redhat.com>
10999
11000         * po/gold.pot: Updated by the Translation project.
11001
11002 2009-09-08  Cary Coutant  <ccoutant@google.com>
11003
11004         * output.cc (Output_file::open): Add execute permission to empty file.
11005         * testsuite/Makefile.am (permission_test): New test.
11006         * testsuite/Makefile.in: Regenerate.
11007
11008 2009-09-02  Ian Lance Taylor  <iant@google.com>
11009
11010         * output.cc (Output_file::resize): Call map_no_anonymous rather
11011         than map.
11012
11013 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11014
11015         * gold.cc: Include "incremental.h".
11016         (queue_initial_tasks): Call Incremental_checker methods.
11017         * incremental.cc: Include "output.h".
11018         (Incremental_checker::can_incrementally_link_output_file): New
11019         method.
11020         * incremental.h (Incremental_checker): New class.
11021
11022         * output.cc (Output_file::open_for_modification): New method.
11023         (Output_file::map_anonymous): Changed return type to bool.  Record
11024         map in base_ field.
11025         (Output_file::map_no_anonymous): New method, broken out of map.
11026         (Output_file::map): Use map_no_anonymous and map_anonymous.
11027         * output.h (class Output_file): Update declarations.
11028
11029 2009-08-24  Cary Coutant  <ccoutant@google.com>
11030
11031         * options.h (Command_line::Pre_options): New class.
11032         (Command_line::pre_options): New member.
11033         * options.cc (gold::options::ready_to_register): New variable.
11034         (One_option::register_option): Do nothing if not registering options.
11035         Assert if same short option registered twice.
11036         (General_options::General_options): Turn off option registration when
11037         done constructing.
11038         (Command_line::Pre_options::Pre_options): New constructor.
11039
11040 2009-08-24  Cary Coutant  <ccoutant@google.com>
11041
11042         * options.h (General_options::no_keep_memory): Remove incorrect
11043         short option.
11044
11045 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11046
11047         * Makefile.am (am__skiplex, am__skipyacc): New.
11048         * Makefile.in: Regenerate.
11049
11050 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11051
11052         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11053         (INCLUDES): ... this.
11054         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11055         (AM_CPPFLAGS): Renamed from ...
11056         (INCLUDE): ... this.
11057         * Makefile.in, testsuite/Makefile.in: Regenerate.
11058
11059         * Makefile.in: Regenerate.
11060         * aclocal.m4: Likewise.
11061         * config.in: Likewise.
11062         * configure: Likewise.
11063         * testsuite/Makefile.in: Likewise.
11064
11065         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11066         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11067         * Makefile.in: Regenerate.
11068         * testsuite/Makefile.in: Regenerate.
11069
11070 2009-08-19  Cary Coutant  <ccoutant@google.com>
11071
11072         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11073         symbols in shared libraries overridden by hidden or internal symbols
11074         in the main program.
11075
11076 2009-08-19  Chris Demetriou  <cgd@google.com>
11077
11078         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11079         checking source file names in error messages.
11080
11081 2009-08-18  Doug Kwan  <dougkwan@google.com>
11082
11083         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11084         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11085         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11086         an elfcpp::Ehdr as parameter.
11087         * object.cc (Object::set_target): Remove the version that looks up
11088         a target and sets it.
11089         (Sized_relobj::setup): Take a Target object instead of
11090         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11091         (make_elf_sized_object): Find target and ask target to
11092         make an ELF object.
11093         * object.h: (Object::set_target): Remove the version that looks up
11094         a target and sets it.
11095         (Sized_relobj::setup): Take a Target object instead of
11096         an elfcpp:Ehdr as parameter.
11097         * target.cc: Include dynobj.h.
11098         (Target::do_make_elf_object_implementation): New.
11099         (Target::do_make_elf_object): New.
11100         * target.h (Target::make_elf_object): New template declaration.
11101         (Target::do_make_elf_object): New method declarations.
11102         (Target::do_make_elf_object_implementation): New template declaration.
11103
11104 2009-08-14  Ian Lance Taylor  <iant@google.com>
11105
11106         * gold.h (FUNCTION_NAME): Define.
11107         (gold_unreachable): Use FUNCTION_NAME.
11108
11109 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11110
11111         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11112         symbol in the --keep-unique list is not found.
11113
11114 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11115
11116         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11117         been maked as --keep-unique.
11118         (Icf::unfold_section): New function.
11119         * icf.h (Icf::unfold_section): New function.
11120         * options.h (General_options::keep_unique): New option.
11121         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11122         * testsuite/Makefile.in: Regenerate.
11123         * testsuite/icf_keep_unique_test.sh: New file.
11124         * testsuite/icf_keep_unique_test.cc: New file.
11125
11126 2009-08-12  Cary Coutant  <ccoutant@google.com>
11127
11128         PR 10471
11129         * resolve.cc (Symbol_table::resolve): Check for references from
11130         dynamic objects to hidden and internal symbols.
11131         * testsuite/Makefile.am (hidden_test.sh): New test.
11132         * testsuite/Makefile.in: Regenerate.
11133         * testsuite/hidden_test.sh: New script.
11134         * testsuite/hidden_test_1.c: New test source.
11135         * testsuite/hidden_test_main.c: New test source.
11136
11137 2009-08-11  Doug Kwan  <dougkwan@google.com>
11138
11139         * arm.cc: Update comments.
11140         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11141         segment to locate the .ARM.exidx section if present.
11142
11143 2009-08-09  Doug Kwan  <dougkwan@google.com>
11144
11145         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11146         patch.
11147
11148 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11149         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11150         compiler warnings.
11151
11152 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11153
11154         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11155         valid tls_segment only for non-debug-section relocations.
11156         * testsuite/Makefile.am: Add gc_tls_test.
11157         * testsuite/Makefile.in: Regenerate.
11158         * testsuite/gc_tls_test.cc: New file.
11159         * testsuite/gc_tls_test.sh: New file.
11160
11161 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11162
11163         * icf.cc: New file.
11164         * icf.h: New file.
11165         * Makefile.am (CCFILES): Add icf.cc.
11166         (HFILES): Add icf.h
11167         * Makefile.in: Regenerate.
11168         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11169         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11170         section, symbol and addend information for the relocs.
11171         * gold.cc (queue_middle_tasks): Call identical code folding.
11172         * gold.h: Add defines for multimap.
11173         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11174         to the call of finalize_local_symbols.
11175         * main.cc (main): Create object of class Icf.
11176         * object.cc (Sized_relobj::do_layout): Allow this function to be
11177         called twice during icf.
11178         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11179         to sections marked as identical by icf.
11180         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11181         when available.
11182         (Sized_relobj::do_section_entsize): New function.
11183         * object.h (Object::section_entsize): New function.
11184         (Object::do_section_entsize): New pure virtual function.
11185         (Relobj::finalize_local_symbols): Add new parameter.
11186         (Relobj::do_section_entsize): New function.
11187         * options.h (General_options::icf): New option.
11188         (General_options::icf_iterations): New option.
11189         (General_options::print_icf_sections): New option.
11190         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11191         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11192         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11193         icf.
11194         * symtab.cc (Symbol_table::is_section_folded): New function.
11195         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11196         to sections marked as identical by icf.
11197         * symtab.h (Symbol_table::set_icf): New function.
11198         (Symbol_table::icf): New function.
11199         (Symbol_table::is_section_folded): New function.
11200         (Symbol_table::icf_): New data member.
11201         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11202         * testsuite/Makefile.am: Add commands to build icf_test.
11203         * testsuite/Makefile.in: Regenerate.
11204         * testsuite/icf_test.sh: New file.
11205         * testsuite/icf_test.cc: New file.
11206
11207 2009-07-24  Chris Demetriou  <cgd@google.com>
11208
11209         * layout.cc (is_compressible_debug_section): Fix incorrect
11210         comment about compressed section names.
11211
11212 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11213
11214         PR 10419
11215         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11216
11217 2009-07-16  Ian Lance Taylor  <iant@google.com>
11218
11219         PR 10400
11220         * layout.h: #include <map>.
11221         (class Kept_section): Change from struct to class.  Add accessors
11222         and setters.  Add section size to Comdat_group mapping.  Change
11223         Comdat_group to std::map.  Add is_comdat_ field.  Add
11224         linkonce_size field in union.
11225         (class Layout): Update declaration of find_or_add_kept_section.
11226         Don't declare find_kept_object.
11227         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11228         parameter.  Add object, shndx, is_comdat, and is_group_name
11229         parameters.  Change all callers.  Adjust for new Kept_section.
11230         (Layout::find_kept_object): Remove.
11231         * object.cc (Sized_relobj::include_section_group): Update use of
11232         Kept_section.  Rename secnum to shndx.  Only record
11233         Kept_comdat_section if sections are the same size.
11234         (Sized_relobj::include_linkonce_section): Update use of
11235         Kept_section.  Only record Kept_comdat_section if sections are the
11236         same size.  Set size of linkonce section.
11237         (Sized_relobj::map_to_kept_section): Update call to
11238         get_kept_comdat_section.
11239         * object.h (class Sized_relobj): Rename fields in
11240         Kept_comdat_section to drop trailing underscores; change object
11241         field to Relobj*.  Change Kept_comdat_section_table to store
11242         struct rather than pointer.
11243         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11244         Add kept_object and kept_shndx parameters.  Change all callers.
11245         (Sized_relobj::get_kept_comdat_section): Change return type to
11246         bool.  Add kept_object and kept_shndx parameters.  Change all
11247         callers.
11248         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11249         Layout::find_or_add_kept_section.
11250
11251 2009-07-09  Ian Lance Taylor  <iant@google.com>
11252
11253         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11254         Reserve space in the hash table.
11255
11256 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11257
11258         * fileread.cc (File_read::get_mtime): New method.
11259         * fileread.h (Timespec): New structure.
11260         (File_read::get_mtime): New method.
11261         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11262         Renamed from timestamp_nsec.
11263         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11264         Elf_Xword.
11265         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11266         timestamp_nsec.
11267         (Incremental_inputs::report_archive): Save mtime; style fix.
11268         (Incremental_inputs::report_obejct): Save mtime; style fix.
11269         (Incremental_inputs::report_script): Save mtime; style fix.
11270         (Incremental_inputs::finalize_inputs): Style fix.
11271         (Incremental_inputs::finalize): Style fix.
11272         (Incremental_inputs::create_input_section_data): Store inputs
11273         mtime.
11274         * incremental.h (Incremental_inputs::report_script): Add mtime
11275         argument.
11276         (Incremental_inputs::Input_info::Input_info): Intialize only one
11277         union member.
11278         (Incremental_inputs::Input_info::archive): Move to nameless
11279         union.
11280         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11281         (Incremental_inputs::Input_info::script): Move to nameless union.
11282         (Incremental_inputs::mtime): New field.
11283         * script.cc (read_input_script): Pass file mtime to
11284         Incremental_input.
11285         * script.h (Script_info::inputs): Style fix.
11286
11287 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11288
11289         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11290         instead of 32.
11291
11292 2009-06-24  Ian Lance Taylor  <iant@google.com>
11293
11294         PR 10156
11295         * layout.cc (Layout::choose_output_section): If we find an
11296         existing section, update the flags.
11297         (Layout::create_notes): New function, broken out of
11298         Layout::finalize.
11299         (Layout::finalize): Don't create note sections.
11300         (Layout::create_note): Don't crash if linker script discards
11301         section.
11302         (Layout::create_gold_note): Likewise.
11303         (Layout::create_build_id): Likewise.  Don't set
11304         after_input_sections on the section.
11305         (Layout::create_executable_stack_info): Remove target parameter.
11306         Change caller.
11307         * layout.h (class Layout): Declare create_notes.  Update
11308         declaration of create_executable_stack_info.
11309         * gold.cc (queue_middle_tasks): Call create_notes.
11310         * output.cc (Output_section::update_flags_for_input_section): Move
11311         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11312         invalid.
11313         * output.h (Output_data::mark_address_invalid): New function.
11314         (class Output_section): Only declare, not define,
11315         update_flags_for_input_section.  Remove set_flags.
11316
11317 2009-06-24  Ian Lance Taylor  <iant@google.com>
11318
11319         * script-sections.cc (Output_section_definition::
11320         set_section_addresses): Rename shadowing local load_address to
11321         laddr.
11322
11323 2009-06-24  Ian Lance Taylor  <iant@google.com>
11324
11325         PR 10244
11326         * reloc.cc (relocate_sections): Skip empty relocation sections.
11327
11328 2009-06-23  Ian Lance Taylor  <iant@google.com>
11329
11330         PR 10156
11331         * layout.cc (Layout::create_note): Use choose_output_section
11332         rather than make_output_section.
11333
11334 2009-06-23  Ian Lance Taylor  <iant@google.com>
11335
11336         PR 10237
11337         * options.cc (General_options::parse_V): Set printed_version_.
11338         (General_options::General_options): Initialize printed_version_.
11339         * options.h (class General_options): Add printed_version_ field.
11340         * gold.cc (queue_initial_tasks): If there are no input files,
11341         don't give a fatal error if we printed the version information.
11342         (queue_middle_tasks): If using -r with a shared object, give a
11343         fatal error rather than an ordinary error.
11344
11345 2009-06-23  Ian Lance Taylor  <iant@google.com>
11346
11347         PR 10219
11348         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11349         (Layout::make_output_section): Set have_stabstr_section_ if we see
11350         a .stab*str section.
11351         (Layout::finalize): Call link_stabs_sections.
11352         (Layout::link_stabs_sections): New file.
11353         * layout.h (class Layout): Add have_stabstr_section_ field.
11354         Declare link_stabs_sections.
11355
11356 2009-06-23  Doug Kwan  <dougkwan@google.com>
11357
11358         * Makefile.am (libgold_a_LIBADD): New.
11359         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11360         * Makefile.in: Regenerate.
11361         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11362         * configure: Regenerate.
11363         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11364         * fileread.cc: Include sys/state.h
11365         * gold.h: Declare memmem and strndup if found missing.
11366         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11367
11368 2009-06-23  Ian Lance Taylor  <iant@google.com>
11369
11370         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11371         * configure: Rebuild.
11372
11373 2009-06-23  Ian Lance Taylor  <iant@google.com>
11374
11375         PR 10147
11376         * object.cc (Object::section_contents): Don't try to get a view if
11377         the section has length zero.
11378         (Object::handle_gnu_warning_section): If the section is empty, use
11379         the name of the section as the warning.
11380
11381 2009-06-23  Ian Lance Taylor  <iant@google.com>
11382
11383         PR 10133
11384         * stringpool.h (class Stringpool_template): Add optimize_ field.
11385         (Stringpool_template::set_optimize): New function.
11386         * stringpool.cc (Stringpool_template::Stringpool_template):
11387         Initialize optimize_ field.
11388         (Stringpool_template::set_string_offsets): Test local optimize
11389         fild rather than parameter.
11390         * layout.cc (Layout::Layout): Call set_optimize on the section
11391         name stringpool.
11392
11393 2009-06-22  Ian Lance Taylor  <iant@google.com>
11394
11395         PR 10030
11396         * yyscript.y: Parse TARGET.
11397         * script.cc (script_set_target): New function.
11398         * script-c.h (script_set_target): Declare.
11399         * options.cc (General_options::string_to_object_format): Rename
11400         from string_to_object_format in anonymous namespace.  Change
11401         callers.
11402         * options.h (class General_options): Declare
11403         string_to_object_format.
11404
11405 2009-06-22  Ian Lance Taylor  <iant@google.com>
11406
11407         * script-sections.cc (Script_sections::create_segments): Don't put
11408         program headers in a PT_LOAD segment if -n or -N.
11409
11410 2009-06-22  Ian Lance Taylor  <iant@google.com>
11411
11412         PR 10141
11413         * options.h (class General_options): Add -z lazy and -z now.  Sort
11414         -z options into alphabetical order.
11415         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11416
11417 2009-06-21  Ian Lance Taylor  <iant@google.com>
11418
11419         * layout.cc (Layout::make_output_section): Call
11420         Target::new_output_section.
11421         (Layout::attach_allocated_section_to_segment): Put large section
11422         sections in a separate load segment with the large segment flag
11423         set.
11424         (Layout::segment_precedes): Sort large data segments after other
11425         load segments.
11426         (align_file_offset): New static function.
11427         (Layout::set_segment_offsets): Use align_file_offset.
11428         * output.h (class Output_section): Add is_small_section_ and
11429         is_large_section_ fields.
11430         (Output_section::is_small_section): New function.
11431         (Output_section::set_is_small_section):  New function.
11432         (Output_section::is_large_section): New function.
11433         (Output_section::set_is_large_section): New function.
11434         (Output_section::is_large_data_section): New function.
11435         (class Output_segment): Add is_large_data_segment_ field.
11436         (Output_segment::is_large_data_segment): New function.
11437         (Output_segment::set_is_large_data_segment): New function.
11438         * output.cc (Output_section::Output_section): Initialize new
11439         fields.
11440         (Output_segment::Output_segment): Likewise.
11441         (Output_segment::add_output_section): Add assertion that large
11442         data sections always go in large data segments.  Force small data
11443         sections to the end of the list of data sections.  Force small BSS
11444         sections to the start of the list of BSS sections.  For large BSS
11445         sections to the end of the list of BSS sections.
11446         * symtab.h (class Symbol): Declare is_common_shndx.
11447         (Symbol::is_defined): Check Symbol::is_common_shndx.
11448         (Symbol::is_common): Likewise.
11449         (class Symbol_table): Define enum Commons_section_type.  Update
11450         declarations.  Add small_commons_ and large_commons_ fields.
11451         * symtab.cc (Symbol::is_common_shndx): New function.
11452         (Symbol_table::Symbol_table): Initialize new fields.
11453         (Symbol_table::add_from_object): Put small and large common
11454         symbols in the right list.
11455         (Symbol_table::sized_finalized_symbol): Check
11456         Symbol::is_common_shndx.
11457         (Symbol_table::sized_write_globals): Likewise.
11458         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11459         common symbol lists.  Don't call do_allocate_commons_list if the
11460         list is empty.
11461         (Symbol_table::do_allocate_commons_list): Remove is_tls
11462         parameter.  Add comons_section_type parameter.  Change all
11463         callers.  Handle small and large common symbols.
11464         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11465         Symbol::is_common_shndx.
11466         * resolve.cc (symbol_to_bits): Likewise.
11467         * target.h (Target::small_common_shndx): New function.
11468         (Target::small_common_section_flags): New function.
11469         (Target::large_common_shndx): New function.
11470         (Target::large_common_section_flags): New function.
11471         (Target::new_output_section): New function.
11472         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11473         small_common_section_flags, and large_common_section_flags
11474         fields.
11475         (Target::do_new_output_section): New virtual function.
11476         * arm.cc (Target_arm::arm_info): Initialize new fields.
11477         * i386.cc (Target_i386::i386_info): Likewise.
11478         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11479         Likewise.
11480         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11481         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11482         (Target_x86_64::do_new_output_section): New function.
11483         * configure.ac: Define conditional MCMODEL_MEDIUM.
11484         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11485         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11486         (large_LDFLAGS): Define.
11487         * testsuite/large.c: New file.
11488         * testsuite/testfile.cc (Target_test::test_target_info):
11489         Initialize new fields.
11490         * configure, testsuite/Makefile.in: Rebuild.
11491
11492 2009-06-05  Doug Kwan  <dougkwan@google.com>
11493
11494         * Makefile.am (CCFILES): Add target.cc.
11495         * Makefile.in: Regenerate.
11496         * i386.cc (class Target_i386): Define new virtual method to
11497         override do_is_local_label_name in parent.
11498         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11499         local symbols if --discard-locals or -X is given.
11500         * options.h (class General_options): Declare new options
11501         '--discard-locals' and '-X' for discarding locals.
11502         * target.h (class Target): Define new methods is_local_label_name.
11503         Declare new virtual method do_is_local_label_name.
11504         * target.cc: New file.
11505         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11506         (check_SCRIPTS): Add discard_locals_test.sh.
11507         (check_DATA): Add discard_local_tests.syms.
11508         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11509         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11510         * testsuite/Makefile.in: Regenerate.
11511         * testsuite/discard_locals_test.c: New file.
11512         * testsuite/discard_locals_test.sh: Same.
11513
11514 2009-06-05  Doug Kwan  <dougkwan@google.com>
11515
11516         * object.cc (Sized_relobj::Sized_relobj): Initialize
11517         discarded_eh_frame_shndx_ to -1U.
11518         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11519         section.
11520         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11521         a discarded .eh_frame section.
11522         (Sized_relobj::do_finalize_local_symbols): Ditto.
11523         * object.h (class Sized_relobj): Declare new member
11524         discarded_eh_frame_shndx_.
11525         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11526         (local_labels_test.o, local_labels_test): New rules.
11527         * testsuite/Makefile.in: Regenerate.
11528
11529 2009-06-04  Doug Kwan  <dougkwan@google.com>
11530
11531         * layout.cc (Layout::section_name_mapping): Add mapping for
11532         special ARM sections.
11533
11534 2009-06-03  Doug Kwan  <dougkwan@google.com>
11535
11536         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11537         (utils::has_overflow): Same.
11538
11539 2009-06-03  Ian Lance Taylor  <iant@google.com>
11540
11541         * layout.cc (Layout::section_name_mapping): New array, replacing
11542         Layout::linkonce_mapping.
11543         (Layout::section_name_mapping_count): New variable, replacing
11544         Layout::linkonce_mapping_count.
11545         (Layout::linkonce_output_name): Remove.
11546         (Layout::output_section_name): Rewrite.
11547         * layout.h (class Layout): Rename Linkonce_mapping to
11548         Section_name_mapping, linkonce_mapping to section_name_mapping,
11549         linkonce_mapping_count to section_name_mapping_count.  Don't
11550         declare linkonce_output_name.
11551
11552 2009-06-03  Doug Kwan  <dougkwan@google.com>
11553
11554         * gold/arm.cc (namespace utils): New.
11555         (Target_arm::reloc_is_non_pic): Define new method.
11556         (class Arm_relocate_functions): New.
11557         (Target_arm::Relocate::relocate): Handle relocation types used by
11558         Android.
11559
11560 2009-06-03  Ian Lance Taylor  <iant@google.com>
11561
11562         * arm.cc (Target_arm::scan::global): Use || instead of |.
11563
11564 2009-06-02  Doug Kwan  <dougkwan@google.com>
11565
11566         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11567         issued_non_pic_error_.
11568         (class Target_arm::Scan): Declare new method check_non_pic.
11569         Define new method symbol_needs_plt_entry.
11570         Declare new data member issued_non_pic_error_.
11571         (class Target_arm::Relocate): Declare new method
11572         should_apply_static_reloc.
11573         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11574         (Target_arm::Scan::check_non_pic): Define new method.
11575         (Target_arm::Scan::local): Handle a small subset of reloc types used
11576         by Android.
11577         (Target_arm::Scan::local): Same.
11578         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11579
11580 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11581
11582         * incremental.cc (Incremental_inputs::report_command_line): Filter
11583         out --incremental-* options.
11584
11585 2009-05-29  Doug Kwan  <dougkwan@google.com>
11586
11587         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11588         template class.
11589         (class Target_arm): Update comment.
11590         (Target_arm::Target_arm): Initialize new data members GOT_,
11591         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11592         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11593         and Target_arm::rel_dyn_section.
11594         Declare new_enum Target_arm::Got_type.
11595         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11596         and DYNBSS_.
11597         Update commments for member do_dynsym_value.
11598         (Target_arm::got_size, Target_arm::plt_section,
11599         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11600         new methods inside class defintion.
11601         (Target_arm::got_section): Define new method.
11602         (Target_arm::rel_dyn_section): Same.
11603         (Output_data_plt_arm): New template class.
11604         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11605         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11606         (Output_data_plt_arm::add_entry): Same.
11607         (Output_data_plt_arm::first_plt_entry): Define new
11608         static data member for PLT instruction template.
11609         (Output_data_plt_arm::plt_entry): Same.
11610         (Output_data_plt_arm::do_write): Define new method.
11611         (Target_arm::make_plt_entry): Same.
11612         (Target_arm::do_finalize_sections): Same.
11613         (Target_arm::do_dynsym_value): Same.
11614
11615 2009-05-28  Doug Kwan  <dougkwan@google.com>
11616
11617         * Makefile.am (TARGETSOURCES): Add arm.cc.
11618         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11619         * Makefile.in: Regenerate.
11620         * arm.cc: New file.
11621         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11622
11623 2009-05-26  Doug Kwan  <dougkwan@google.com>
11624
11625         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11626         (General_options::check_excluded_libs): Strip off directories in
11627         archive name before matching like GNU ld does.
11628         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11629         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11630         (exclude_libs_test_LDFLAGS): Add linker option
11631         -Wl,--exclude-libs,libexclude_libs_test_3
11632         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11633         an explicit archive without using -l.
11634         (alt/libexclude_libs_test_3.a): New make rule.
11635         * testsuite/Makefile.in: Regenerate.
11636         * testsuite/exclude_libs_test.c : Declare lib3_default().
11637         (main): Call it.
11638         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11639         * exclude_libs_test_3.c: New file.
11640
11641 2009-05-26  Nick Clifton  <nickc@redhat.com>
11642
11643         * po/id.po: New Indonesian translation.
11644         * po/gold.pot: Updated template file.
11645
11646 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11647
11648         * testsuite/Makefile.am: Add -ffunction-sections to compile
11649         gc_comdat_test files.  Add -Wl,--gc-sections to build
11650         gc_comdat_test.
11651         * testsuite/Makefile.in: Regenerate.
11652         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11653
11654 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11655
11656         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11657         kept comdat section was garbage collected.
11658         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11659         * testsuite/Makefile.in: Regenerate.
11660         * testsuite/gc_comdat_test.sh: New file.
11661         * testsuite/gc_comdat_test_1.cc: New file.
11662         * testsuite/gc_comdat_test_2.cc: New file.
11663
11664 2009-05-19  Doug Kwan  <dougkwan@google.com>
11665
11666         * archive.cc (Archive::Archive): Move constructor from archive.h
11667         to here.  Initialize no_export_.
11668         (Archive::get_elf_object_for_member): Set no_export flag of object.
11669         * archive.h (Archive::Archive): Move constructor body to
11670         archive.cc.
11671         (Archive::no_export): New method.
11672         (Archive::no_export_): New field.
11673         * object.h (Object::Object): Initialize no_export_ to false.
11674         (Object::no_export, Object::set_no_export): New methods.
11675         (Object::no_export_): New field.
11676         * options.cc (General_options::parse_exclude_libs): New method.
11677         (General_options::check_excluded_libs) Same.
11678         * options.h (exclude_libs): New option.
11679         (General_options::check_excluded_libs): New method declaration.
11680         (General_options::excluded_libs_): New field.
11681         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11682         default or protected visibility if an object has no-export flag set.
11683         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11684         (check_SCRIPTS): Add exclude_libs_test.sh.
11685         (check_DATA): Add exclude_libs_test.syms.
11686         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11687         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11688         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11689         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11690         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11691         libexclude_libs_test_2.a): New rules.
11692         * testsuite/Makefile.in: Regenerate.
11693         * testsuite/exclude_libs_test.c: New file.
11694         * testsuite/exclude_libs_test.sh: Ditto.
11695         * testsuite/exclude_libs_test_1.c: Ditto.
11696         * testsuite/exclude_libs_test_2.c: Ditto.
11697
11698 2009-05-15  Ian Lance Taylor  <iant@google.com>
11699
11700         * configure.ac: Check for declarations for cases where libiberty.h
11701         checks HAVE_DECL_xxx.
11702         * configure, config.in: Rebuild.
11703
11704 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11705
11706         * gold.h (Incremental_argument_list): Remove (invalid) forward
11707         declaration.
11708         * incremental.cc (Incremental_inputs::report_achive): New method.
11709         (Incremental_inputs::report_object): New method.
11710         (Incremental_inputs::report_script): New method.
11711         (Incremental_inputs::finalize_inputs): New method.
11712         (Incremental_inputs::finalize): Call finalize_inputs().
11713         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11714         Create inputs entries.
11715         * incremental.h (Incremental_input_type): New enum.
11716         (Incremental_inputs::Incremental_input): Initialize new fields.
11717         (Incremental_inputs::report_inputs): New method.
11718         (Incremental_inputs::report_achive): New method.
11719         (Incremental_inputs::report_object): New method.
11720         (Incremental_inputs::report_script): New method.
11721         (Incremental_inputs::finalize_inputs): New method.
11722         (Incremental_inputs::Input_info): New struct.
11723         (Incremental_inputs::Input_info_map): New typedef.
11724         (Incremental_inputs::lock_): New field.
11725         (Incremental_inputs::Inputs_): New field.
11726         (Incremental_inputs::Inputs_map): New field.
11727         * main.cc (main): Call Incremental_input::report_inputs.
11728         * options.h (Input_argument_list): Typedef moved from
11729         Input_arguments.
11730         (Input_file_group::Files): Remove, use ::Input_argument_list.
11731         (Input_file_group::Input_argument_list): Remove, use
11732         ::Input_argument_list.
11733         * plugin.cc (Plugin_manager::add_input_file): Add error in
11734         incremental build.
11735         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11736         functions.
11737         * script.cc (read_input_script): Call
11738         Incremental_input::report_script.
11739         * script.h (Script_info): New class.
11740
11741 2009-04-27  Ian Lance Taylor  <iant@google.com>
11742
11743         * x86_64.cc (do_adjust_output_section): Set entsize to
11744         plt_entry_size.
11745
11746 2009-04-23  Elliott Hughes  <enh@google.com>
11747
11748         * output.cc (Output_file::close): After short writes, continue
11749         writing from the correct offset in the buffer being written.
11750
11751 2009-04-23  Chris Demetriou  <cgd@google.com>
11752
11753         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11754         * configure: Regenerate.
11755         * config.in: Regenerate.
11756         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11757         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11758
11759 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11760
11761         * incremental.cc (Incremental_inputs_header_data): Renamed from
11762         Incremental_input_header_data.
11763         (Incremental_inputs_header_data::data_size): New field.
11764         (Incremental_inputs_header_data::put_input_file_count): Renamed
11765         from input_file_count.
11766         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11767         from command_line_offset.
11768         (Incremental_inputs_header_data::put_reserved): Renamed from
11769         put_reserved.
11770         (Incremental_inputs_entry_data): Renamed from
11771         Incremental_input_entry_data.
11772         (Incremental_inputs_entry_data::data_size): New field.
11773         (Incremental_inputs::report_command_line): New method.
11774         (Incremental_inputs::finalize): New method.
11775         (Incremental_inputs::create_incremental_inputs_data): New method.
11776         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11777         * incremental.h: New file.
11778         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11779         (Layout::finalize): Create incremental inputs section in
11780         incremental builds.
11781         (Layout::create_incremental_info_sections): New method.
11782         * layout.h (Layout::incremental_inputs): New method.
11783         (Layout::create_incremental_info_sections): New method.
11784         (Layout::incremental_inputs_): New field.
11785         * main.cc (main): Notify Incremental_input of the command line.
11786
11787 2009-04-01  Ian Lance Taylor  <iant@google.com>
11788             Mikolaj Zalewski  <mikolajz@google.com>
11789
11790         * gold.h (reserve_unordered_map): Define, three versions, one for
11791         each version of Unordered_map.
11792         * layout.cc (Layout::Layout): Remove options parameter.  Add
11793         number_of_input_files parameter.  Don't initialize options_.
11794         Initialize number_of_input_files_ and resized_signatures_.  Move
11795         sections_are_attached_.
11796         (Layout::layout_group): Reserve space for group_signatures_.
11797         (Layout::find_or_add_kept_section): Change name parameter to be a
11798         reference.  Resize signatures_ map when it gets large enough.
11799         (Layout::layout_eh_frame): Use parameters->options() instead of
11800         this->options_.
11801         (Layout::make_output_section): Likewise.
11802         (Layout::attach_allocated_section_to_segment): Likewise.
11803         (Layout::finalize, Layout::create_executable_stack): Likewise.
11804         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11805         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11806         * layout.h (class Layout): Update declarations.  Remove options_
11807         field.  Add number_of_input_files_ and resized_signatures_
11808         fields.  Move sections_are_attached_ field.
11809         * main.cc (main): Pass number of input files to Layout
11810         constructor.  Don't pass options.
11811
11812 2009-03-30  Ian Lance Taylor  <iant@google.com>
11813
11814         * ffsll.c (ffsll): Correct implementation.
11815
11816 2009-03-27  Ian Lance Taylor  <iant@google.com>
11817
11818         * ffsll.c: New file.
11819         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11820         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11821         * ftruncate.c (ftruncate): Declare before definition.
11822         * mremap.c (mremap): Likewise.
11823         * pread.c (pread): Likewise.
11824         * configure, Makefile.in, config.in: Rebuild.
11825
11826         * mremap.c: New file.
11827         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11828         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11829         (mremap): Declare if HAVE_MREMAP is not defined.
11830         * configure, Makefile.in, config.in: Rebuild.
11831
11832 2009-03-27  Cary Coutant  <ccoutant@google.com>
11833
11834         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11835         position independent.
11836         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11837         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11838
11839 2009-03-24  Cary Coutant  <ccoutant@google.com>
11840
11841         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11842         an executable.
11843         (needs_dynamic_reloc): Likewise.
11844
11845 2009-03-24  Ian Lance Taylor  <iant@google.com>
11846
11847         * yyscript.y (file_cmd): Recognize EXTERN.
11848         (extern_name_list, extern_name_list_body): New nonterminals.
11849         * script.cc (script_add_extern): Define.
11850         * script-c.h (script_add_extern): Declare.
11851
11852 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11853
11854         * object.cc (is_elf_object): Define.
11855         * object.h (is_elf_object): Declare.
11856         * archive.cc (Archive::get_elf_object_for_member): Call
11857         is_elf_object.
11858         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11859
11860 2009-03-24  Elliott Hughes  <enh@google.com>
11861
11862         * output.cc (Output_file::map_anonymous): Define.
11863         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11864         try an anonymous one.  Report the size if the mmap fails.
11865         * output.h (class Output_file): Declare map_anonymous.
11866
11867 2009-03-24  Ian Lance Taylor  <iant@google.com>
11868
11869         * target-select.cc (instantiate_target): Don't acquire the lock if
11870         the instantiated_target_ field has already been set.
11871
11872 2009-03-23  Ian Lance Taylor  <iant@google.com>
11873
11874         * gold-threads.h (class Initialize_lock): Define.
11875         * gold-threads.cc (class Initialize_lock_once): Define.
11876         (initialize_lock_control): New static variable.
11877         (initialize_lock_pointer): New static variable.
11878         (initialize_lock_once): New static function.
11879         (Initialize_lock::Initialize_lock): Define.
11880         (Initialize_lock::initialize): Define.
11881         * target-select.h: Include "gold-threads.h".
11882         (class Target_selector): Add lock_ and initialize_lock_ fields.
11883         Don't define instantiate_target, just declare it.
11884         * target-select.cc (Target_selector::Target_selector): Initialize
11885         new fields.
11886         (Target_selector::instantiate_target): Define.
11887         * descriptors.h: Include "gold-threads.h".
11888         (class Descriptors): Add initialize_lock_ field.
11889         * descriptors.cc (Descriptors::Descriptors): Initialize new
11890         field.
11891         (Descriptors::open): Use initialize_lock_ field
11892         * errors.h (class Errors): Add initialize_lock_ field.
11893         * errors.cc (Errors::Errors): Initialize new field.
11894         (Errors::initialize_lock): Use initialize_lock_ field.
11895         * powerpc.cc (class Target_selector_powerpc): Remove
11896         instantiated_target_ field.  In do_recognize call
11897         instantiate_target rather than do_instantiate_target.  In
11898         do_instantiate_target just allocate a new target.
11899         * sparc.cc (class Target_selector_sparc): Likewise.
11900
11901         * freebsd.h: New file.
11902         * i386.cc: Include "freebsd.h".
11903         (Target_i386): Derive from Target_freebsd rather than
11904         Sized_target.
11905         (Target_selector_i386): Derive from Target_selector_freebsd rather
11906         than Target_selector.
11907         * x86_64.cc: Include "freebsd.h".
11908         (Target_x86_64): Derive from Target_freebsd rather than
11909         Sized_target.
11910         (Target_selector_x86_64): Derive from Target_selector_freebsd
11911         rather than Target_selector.
11912         * target.h (class Target): Add adjust_elf_header and
11913         do_adjust_elf_header.
11914         * output.cc (Output_file_header:: do_sized_write): Call target
11915         adjust_elf_header routine.
11916         * configure.tgt: Set targ_osabi.
11917         * configure.ac: Define GOLD_DEFAULT_OSABI.
11918         * parameters.cc (Parameters::default_target): Pass
11919         GOLD_DEFAULT_OSABI to select_target.
11920         * target-select.h (class Target_selector): Make instantiate_target
11921         protected rather than private.
11922         * Makefile.am (HFILES): Add freebsd.h.
11923         * configure, Makefile.in, config.in: Rebuild.
11924
11925         * merge.cc (do_add_input_section): Correct pend value.  Change
11926         message about last entry not being null terminated from error to
11927         warning.
11928
11929 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11930
11931         * incremental.cc: New file.
11932         * Makefile.am (CCFILES): Add incremental.cc.
11933         * Makefile.in: Rebuild.
11934
11935 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11936
11937         * layout.cc (Layout::output_section_name): Preserve names
11938         of '.note.' sections.
11939
11940 2009-03-19  Ian Lance Taylor  <iant@google.com>
11941
11942         * descriptors.cc (Descriptors::open): Check that the options are
11943         valid before using them.
11944
11945 2009-03-18  Ian Lance Taylor  <iant@google.com>
11946
11947         * script-sections.h: Include <list>.
11948         (class Script_sections): Change Sections_elements from std::vector
11949         to std::list.  Typedef public Elements_iterator.  Add
11950         orphan_section_placement_, data_segment_align_start_, and
11951         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11952         field.
11953         * script-sections.cc (class Orphan_section_placement): New class.
11954         (class Sections_element): Add virtual functions is_relro and
11955         orphan_section_init.  Remove virtual function place_orphan_here.
11956         (class Output_section_definition): Add is_relro and
11957         orphan_section_init.  Remove place_orphan_here.
11958         (class Orphan_output_section): Likewise.
11959         (Script_sections::Script_sections): Update for field changes.
11960         (Script_sections::data_segment_align): Set saw_data_segment_align_
11961         and data_segment_align_start_, not data_segment_align_index.
11962         (Script_sections::data_segment_relro_end): Check
11963         saw_data_segment_align_.  Use data_segment_align_start_ rather
11964         than data_segment_align_index_.
11965         (Script_sections::place_orphan): Rewrite to use
11966         Orphan_section_placement.
11967
11968 2009-03-17  Ian Lance Taylor  <iant@google.com>
11969
11970         * archive.cc (Archive::add_symbols): Check for a version attached
11971         to the symbol name in the archive map.
11972         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11973         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11974         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11975         (ver_test_11.a): New target.
11976         * testsuite/Makefile.in: Rebuild.
11977
11978         * configure.ac: Check for chsize and posix_fallocate.  Replace
11979         ftruncate.
11980         * ftruncate.c: New file, from gnulib.
11981         * output.cc (posix_fallocate): Define dummy version if not
11982         HAVE_POSIX_FALLOCATE.
11983         (Output_file::map): Call posix_fallocate rather than lseek and
11984         write.
11985         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11986         * configure, Makefile.in, config.in: Rebuild.
11987
11988 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11989
11990         * layout.h (Layout::create_note): Add section_name parameter.
11991         * layout.cc (Layout::create_note): Likewise.
11992         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11993
11994 2009-03-17  Ian Lance Taylor  <iant@google.com>
11995
11996         * descriptors.cc: Include "options.h".
11997         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11998         (Descriptors::open): Always use O_CLOEXEC when opening a new
11999         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12000         then set FD_CLOEXEC.
12001
12002         * sparc.cc (class Target_sparc): Add has_got_section.
12003         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12004         make sure we have a GOT section.
12005
12006         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12007         (Target_sparc::Scan::local): Likewise.
12008         (Target_sparc::Scan::global): Likewise.
12009         (Target_sparc::Relocate::relocate): Likewise.
12010         (Target_sparc::Relocate::relocate_tls): Likewise.
12011
12012         * symtab.cc (Symbol_table::define_default_version): New function,
12013         broken out of add_from_object.
12014         (Symbol_table::add_from_object): Call define_default_version.
12015         (Symbol_table::define_special_symbol): Add resolve_oldsym
12016         parameter.  Change all callers.  If the version for a symbol comes
12017         from a version script, resolve it with the symbol with the same
12018         name with no version.  Also add the symbol without a version if
12019         appropriate.
12020         (do_define_in_output_data): If resolving with oldsym, don't delete
12021         sym.
12022         (do_define_in_output_segment): Likewise.
12023         (do_define_as_constant): Likewise.
12024         * symtab.h (class Symbol_table): Update declarations.
12025
12026 2009-03-13  Ian Lance Taylor  <iant@google.com>
12027
12028         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12029         (Read_symbols::requeue): New function.
12030         (Read_symbols::do_read_symbols): If make_elf_object fails because
12031         the target type is not configured, and the file was searched for,
12032         issue a warning and retry with the next directory.
12033         (Add_symbols::run): If the file has an incompatible format, and
12034         it was searched for, requeue the Read_symbols task.  On error,
12035         release the object.
12036         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12037         dirindex parameter to constructor.  Change all callers.  Declare
12038         incompatible_warning and requeue.
12039         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12040         input_argument_ and input_group_ fields.  Add them to
12041         constructor.  Change all callers.
12042         (class Read_script): Add dirindex_ field.  Add it to constructor.
12043         Change all callers.
12044         * archive.cc (Archive::setup): Remove input_objects parameter.
12045         Change all callers.
12046         (Archive::get_file_and_offset): Likewise.
12047         (Archive::read_all_symbols): Likewise.
12048         (Archive::read_symbols): Likewise.
12049         (Archive::get_elf_object_for_member): Remove input_objects
12050         parameter.  Add punconfigured parameter.  Change all callers.
12051         (Archive::add_symbols): Change return type to bool.  Check return
12052         value of include_member.
12053         (Archive::include_all_members): Likewise.
12054         (Archive::include_member): Change return type to bool.  Return
12055         false if first included object has incompatible target.  Set
12056         included_member_ field.
12057         (Add_archive_symbols::run): If add_symbols returns false, requeue
12058         Read_symbols task.
12059         * archive.h (class Archive): Add included_member_ field.
12060         Initialize it in constructor.  Add input_file and searched_for
12061         methods.  Update declarations.
12062         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12063         input_argument_ fields.  Add them to constructor.  Change all
12064         callers.
12065         * script.cc: Include "target-select.h".
12066         (class Parser_closure): Add skip_on_incompatible_target_ and
12067         found_incompatible_target_ fields.  Add
12068         skip_on_incompatible_target parameter to constructor.  Change all
12069         callers.  Add methods skip_on_incompatible_target,
12070         clear_skip_on_incompatible_target, found_incompatible_target, and
12071         set_found_incompatible_target.
12072         (read_input_script): Add dirindex parameter.  Change all callers.
12073         If parser finds an incompatible target, requeue Read_symbols
12074         task.
12075         (script_set_symbol): Clear skip_on_incompatible_target in
12076         closure.
12077         (script_add_assertion, script_parse_option): Likewise.
12078         (script_start_sections, script_add_phdr): Likewise.
12079         (script_check_output_format): New function.
12080         * script.h (read_input_script): Update declaration.
12081         * script-c.h (script_check_output_format): Declare.
12082         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12083         (ignore_cmd): Remove OUTPUT_FORMAT.
12084         * fileread.cc (Input_file::Input_file): Add explicit this.
12085         (Input_file::will_search_for): New function.
12086         (Input_file::open): Add pindex parameter.  Change all callers.
12087         * fileread.h (class Input_file): Add input_file_argument method.
12088         Declare will_search_for.  Update declarations.
12089         * object.cc (make_elf_object): Add punconfigured parameter.
12090         Change all callers.
12091         * object.h (class Object): Make input_file public.  Add
12092         searched_for method.
12093         (make_elf_object): Update declaration.
12094         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12095         restart search.
12096         * dirsearch.h (class Dirsearch): Update declaration.
12097         * options.h (class General_options): Add --warn-search-mismatch.
12098         * parameters.cc (Parameters::is_compatible_target): New function.
12099         * parameters.h (class Parameters): Declare is_compatible_target.
12100         * workqueue.cc (Workqueue::add_blocker): New function.
12101         * workqueue.h (class Workqueue): Declare add_blocker.
12102
12103         * fileread.cc (Input_file::open): Remove options parameter.
12104         Change all callers.
12105         (Input_file::open_binary): Likewise.
12106         * script.cc (read_input_script): Likewise.
12107         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12108         options parameter from constructor.  Change all callers.
12109         (class Read_script): Likewise.
12110         * fileread.h (class Input_file): Update declarations.
12111         * script.h (read_input_script): Update declaration.
12112
12113 2009-03-10  Nick Clifton  <nickc@redhat.com>
12114
12115         * po/es.po: New Spanish translation.
12116
12117 2009-03-06  Cary Coutant  <ccoutant@google.com>
12118
12119         * options.cc (parse_short_option): Keep dash_z from registering itself.
12120
12121 2009-03-03  Ian Lance Taylor  <iant@google.com>
12122
12123         PR 9918
12124         * target-reloc.h (relocate_section): Pass output_section to
12125         relocate.
12126         * i386.cc (Target_i386::should_apply_static_reloc): Add
12127         output_section parameter.  Change all callers.
12128         (Target_i386::Relocate::relocate): Add output_section parameter.
12129         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12130         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12131         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12132         * testsuite/two_file_shared.sh: New script.
12133         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12134         (check_DATA): Add two_file_shared.dbg.
12135         (two_file_shared.dbg): New target.
12136         * testsuite/Makefile.in: Rebuild.
12137
12138 2009-03-01  Ian Lance Taylor  <iant@google.com>
12139
12140         * configure.ac: Check for byteswap.h.
12141         * configure: Rebuild.
12142         * config.in: Rebuild.
12143
12144 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12145
12146         * layout.cc (Layout::find_or_add_kept_section): New function.
12147         (Layout::add_comdat): Removed.
12148         * layout.h (struct Kept_section): Move out of class Layout.
12149         Remove trailing underscores from field names.  Add group_sections
12150         field.  Rename group_ field to is_group.  Change all uses.
12151         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12152         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12153         comdat_groups_ field.
12154         (Sized_relobj::include_section_group): Use
12155         find_or_add_kept_section and Kept_section::group_sections.
12156         (Sized_relobj::include_linkonce_section): Likewise.
12157         * object.cc (class Sized_relobj): Don't define Comdat_group or
12158         Comdat_group_table.  Remove find_comdat_group and
12159         add_comdat_group.  Remove comdat_groups_ field.
12160         * plugin.cc (include_comdat_group): Use
12161         Layout::find_or_add_kept_section.
12162
12163 2009-02-28  Ian Lance Taylor  <iant@google.com>
12164
12165         * README: --gc-sections and map files are now supported.  Document
12166         some build requirements.
12167
12168         PR 6992
12169         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12170         relocatable link set the value of the section symbol to zero.
12171         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12172         relocatable link don't include the section address in the local
12173         symbol value.
12174
12175 2009-02-27  Ian Lance Taylor  <iant@google.com>
12176
12177         PR 6811
12178         * options.h (class Search_directory): Add is_system_directory.
12179         (class General_options): Declare is_in_system_directory.
12180         * options.cc (get_relative_sysroot): Make static.
12181         (get_default_sysroot): Make static.
12182         (General_optoins::is_in_system_directory): New function.
12183         * fileread.cc (Input_file::is_in_system_directory): New function.
12184         * fileread.h (class Input_file): Declare is_in_system_directory.
12185         * object.h (class Object): Add is_in_system_directory.
12186         (class Input_objects): Remove system_library_directory_ field.
12187         * object.cc (Input_objects::add_object): Don't set
12188         system_library_directory_.
12189         (input_objects::found_in_system_library_directory): Remove.
12190         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12191         parameter.  Change all callers.
12192         (Symbol_table::sized_write_globals): Likewise.
12193         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12194         Call Object::is_in_system_directory.
12195         * symtab.h (class Symbol_table): Update declarations.
12196
12197         PR 5990
12198         * descriptors.h (Open_descriptor): Add is_on_stack field.
12199         * descriptors.cc (Descriptors::open): If the descriptor is on the
12200         top of the stack, remove it.  Initialize is_on_stack field.
12201         (Descriptors::release): Only add pod to stack if it is not on the
12202         stack already.
12203         (Descriptors::close_some_descriptor): Clear stack_next and
12204         is_on_stack fields.
12205
12206         PR 7091
12207         * output.cc (Output_section::find_starting_output_address): Rename
12208         from starting_output_address; add PADDR parameter; change return
12209         type.
12210         * output.h (class Output_section): Declare
12211         find_starting_output_address instead of starting_output_address.
12212         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12213         section symbol for which we can't find a merge section.
12214
12215         PR 9836
12216         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12217         hidden or internal, force the symbol to be local.
12218         * resolve.cc (Symbol::override_visibility): Define.
12219         (Symbol::override_base): Use override_visibility.
12220         (Symbol_table::resolve): Likewise.
12221         (Symbol::override_base_with_special): Likewise.
12222         (Symbol_table::override_with_special): If the visibility is hidden
12223         or internal, force the symbol to be local.
12224         * symtab.h (class Symbol): Add set_visibility and
12225         override_visibility.
12226         * testsuite/ver_test_1.sh: New file.
12227         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12228         (check_DATA): Add ver_test_1.syms.
12229         (ver_test_1.syms): New target.
12230         * testsuite/Makefile.in: Rebuild.
12231
12232 2009-02-25  Cary Coutant  <ccoutant@google.com>
12233
12234         * layout.cc (Layout::choose_output_section): Don't rename sections
12235         when using a linker script that has a SECTIONS clause.
12236         * Makefile.in: Regenerate.
12237
12238         * testsuite/Makefile.am (script_test_5.sh): New test case.
12239         * testsuite/Makefile.in: Regenerate.
12240         * testsuite/script_test_5.cc: New file.
12241         * testsuite/script_test_5.sh: New file.
12242         * testsuite/script_test_5.t: New file.
12243
12244 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12245
12246         * archive.cc (Archive::include_member): Update calls to add_symbols.
12247         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12248         the Layout argument.
12249         * dynobj.h (do_add_symbols): Add the Layout argument.
12250         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12251         Layout argument.
12252         * object.h (Object::add_symbols): Add the Layout argument.
12253         (Object::do_add_symbols): Add the Layout argument.
12254         (Sized_relobj::do_add_symbols): Add the Layout argument.
12255         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12256         Unify the two versions.
12257         (Add_plugin_symbols): Remove.
12258         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12259         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12260         (Add_plugin_symbols): Remove.
12261         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12262         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12263         (Add_symbols::run): Make it work with Pulginobj.
12264
12265 2009-02-06  Ian Lance Taylor  <iant@google.com>
12266
12267         * object.cc (Sized_relobj::do_layout): Make info message start
12268         with lower case letter.
12269
12270 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12271
12272         * binary.cc: Fix file comment.
12273
12274         * options.h (enum Incremental_disposition): Define.
12275         (class General_options): Add new options: --incremental,
12276         --incremental_changed, --incremental_unchanged,
12277         --incremental_unknown.  Add incremental_disposition_ and
12278         implicit_incremental_ fields.
12279         (General_options::incremental_disposition): New function.
12280         (class Position_dependent_options): Add incremental_disposition
12281         option.
12282         (Position_dependent_options::copy_from_options): Set incremental
12283         dispositions.
12284         * options.cc (General_options::parse_incremental_changed): New
12285         function.
12286         (General_options::parse_incremental_unchanged): New function.
12287         (General_options::parse_incremental_unknown): New function.
12288         (General_options::General_options): Initialize new fields
12289         incremental_disposition_ and implicit_incremental_.
12290         (General_options::finalize): Check for uasge of --incremental-*
12291         without --incremental.
12292
12293 2009-02-06  Chris Demetriou  <cgd@google.com>
12294
12295         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12296         pointer and to report location as the file name associated with
12297         the symbol.
12298         (gold_undefined_symbol_at_location): New function to replace the
12299         old gold_undefined_symbol functionality.
12300         * target-reloc.h (relocate_section): Update to use
12301         gold_undefined_symbol_at_location.
12302         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12303         Call gold_undefined_symbol function rather than gold_error.
12304         * errors.h (Errors::undefined_symbol): Take location as a
12305         string, rather than calculating it from a relocation.
12306         * errors.cc (Errors::fatal): Print "fatal error:" before the
12307         formatted message.
12308         (Errors::error, Errors::error_at_location): Print "error: "
12309         before the formatted message.
12310         (Errors::undefined_symbol): Take location as a string, rather
12311         than calculating it from a relocation.
12312         (gold_undefined_symbol_at_location): New function akin to
12313         old gold_undefined_symbol, calculates location from relocation.
12314         (gold_undefined_symbol): Change to take only a Symbol pointer
12315         and to report location as the file name associated with the symbol.
12316         * testsuite/debug_msg.sh: Update for changed error messages.
12317         * testsuite/undef_symbol.sh: Likewise.
12318
12319 2009-02-04  Duncan Sands  <baldrick@free.fr>
12320
12321         PR 9812
12322         * reduced_debug_output.h
12323         (Output_reduced_debug_abbrev_section::failed): Use format for
12324         gold_warning.
12325         (Output_reduced_debug_info_section::faild): Likewise.
12326
12327 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12328
12329         * script.cc (Lazy_demangler): New class.
12330         (Version_script_info::get_symbol_version_helper): Demangle a
12331         symbol only once.
12332
12333 2009-01-29  Cary Coutant  <ccoutant@google.com>
12334
12335         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12336         to __tls_get_addr.
12337         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12338
12339 2009-01-28  Ian Lance Taylor  <iant@google.com>
12340
12341         * version.cc (version_string): Bump to 1.9.
12342
12343         * gold.h: Include <cstring> and <stdint.h>.
12344         * version.cc: Include <cstdio>.
12345         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12346         warning.
12347         * reduced_debug_output.cc (insert_into_vector): Rename from
12348         Insert_into_vector; change all callers.  Use Swap_unaligned to
12349         avoid aliasing issue; remove union since it is unnecessary.
12350
12351 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12352
12353         * Makefile.am (CCFILES): Add gc.cc.
12354         (HFILES): Add gc.h.
12355         * Makefile.in: Regenerate.
12356         * gold.cc (Gc_runner): New class.
12357         (queue_initial_tasks): Call garbage collection related tasks
12358         when corresponding options are invoked.
12359         (queue_middle_gc_tasks): New function.
12360         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12361         processed early before laying out sections during garbage collection.
12362         * gold.h (queue_middle_gc_tasks): New function.
12363         (is_prefix_of): Move from "layout.cc".
12364         * i386.cc (Target_i386::gc_process_relocs): New function.
12365         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12366         * main.cc (main): Create object of class "Garbage_collection".
12367         * object.cc (Relobj::copy_symbols_data): New function.
12368         (Relobj::is_section_name_included): New function.
12369         (Sized_relobj::do_layout): Allow this function to be called twice
12370         during garbage collection and defer layout of section during the
12371         first call.
12372         * object.h (Relobj::get_symbols_data): New function.
12373         (Relobj::is_section_name_included): New function.
12374         (Relobj::copy_symbols_data): New function.
12375         (Relobj::set_symbols_data): New function.
12376         (Relobj::get_relocs_data): New function.
12377         (Relobj::set_relocs_data): New function.
12378         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12379         (Relobj::gc_process_relocs): New function.
12380         (Relobj::do_gc_process_relocs): New pure virtual function.
12381         (Relobj::sd_): New data member.
12382         (Sized_relobj::is_output_section_offset_invalid): New function.
12383         (Sized_relobj::do_gc_process_relocs): New function.
12384         * options.h (General_options::gc_sections): Modify to not be a no-op.
12385         (General_options::print_gc_sections): New option.
12386         * plugin.cc (Plugin_finish::run): Remove function call to
12387         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12388         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12389         * reloc.cc (Read_relocs::run): Add task to process relocs and
12390         determine unreferenced sections when doing garbage collection.
12391         (Gc_process_relocs): New class.
12392         (Sized_relobj::do_gc_process_relocs): New function.
12393         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12394         sections that are garbage collected.
12395         * reloc.h (Gc_process_relocs): New class.
12396         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12397         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12398         symbols whose corresponding sections are garbage collected.
12399         (Symbol_table::Symbol_table): Add new parameter for the garbage
12400         collection object.
12401         (Symbol_table::gc_mark_undef_symbols): New function.
12402         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12403         (Symbol_table::gc_mark_dyn_syms): New function.
12404         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12405         as garbage.
12406         (Symbol_table::add_from_object): Likewise.
12407         (Symbol_table::add_from_relobj): When building shared objects, do not
12408         treat externally visible symbols as garbage.
12409         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12410         table information for static and relocatable links.
12411         * symtab.h (Symbol_table::set_gc): New function.
12412         (Symbol_table::gc): New function.
12413         (Symbol_table::gc_mark_undef_symbols): New function.
12414         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12415         (Symbol_table::gc_mark_dyn_syms): New function.
12416         (Symbol_table::gc_): New data member.
12417         * target.h (Sized_target::gc_process_relocs): New pure virtual
12418         function.
12419         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12420         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12421
12422 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12423
12424         * options.h (General_options::gc_sections): Define as a no-op for now.
12425         (General_options::no_keep_memory): Ditto.
12426         (General_options::Bshareable): Define.
12427         * options.cc (General_options::finalize): Honor -Bshareable.
12428
12429 2009-01-20  Andreas Schwab  <schwab@suse.de>
12430
12431         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12432         read the value in the contents, since we don't use it.  Use the
12433         template endianness when writing.
12434         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12435
12436 2009-01-19  Andreas Schwab  <schwab@suse.de>
12437
12438         * configure.tgt (powerpc64-*): Fix targ_obj.
12439
12440 2009-01-15  Ian Lance Taylor  <iant@google.com>
12441
12442         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12443         local symbols when stripping all symbols.
12444
12445 2009-01-14  Cary Coutant  <ccoutant@google.com>
12446
12447         * output.cc (Output_reloc): Add explicit instantiations.
12448
12449 2009-01-14  Cary Coutant  <ccoutant@google.com>
12450
12451         * archive.cc (Archive::get_elf_object_for_member): Remove call
12452         to File_read::claim_for_plugin.
12453         * descriptors.cc (Descriptors::open): Remove reference to
12454         is_claimed.
12455         (Descriptors::claim_for_plugin): Remove.
12456         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12457         (Descriptors::is_claimed): Remove.
12458         (claim_descriptor_for_plugin): Remove.
12459         * fileread.cc (File_read::claim_for_plugin): Remove.
12460         * fileread.h (File_read::claim_for_plugin): Remove.
12461         (File_read::descriptor): Reopen descriptor if necessary.
12462         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12463         (Plugin_manager::all_symbols_read): Add task parameter. Change
12464         all callers.
12465         (Plugin_manager::get_input_file): New function.
12466         (Plugin_manager::release_input_file): New function.
12467         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12468         corresponding data member.
12469         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12470         and pass to base constructor. Change all callers.
12471         (get_input_file, release_input_file): New functions.
12472         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12473         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12474         (Plugin_manager::all_symbols_read): Add task parameter.
12475         (Plugin_manager::get_input_file): New function.
12476         (Plugin_manager::release_input_file): New function.
12477         (Plugin_manager::task_): New data member.
12478         (Pluginobj::Pluginobj): Add filesize parameter.
12479         (Pluginobj::filename): New function.
12480         (Pluginobj::descriptor): New function.
12481         (Pluginobj::filesize): New function.
12482         (Pluginobj::filesize_): New data member.
12483         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12484         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12485         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12486
12487         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12488         with archive libraries.
12489         * testsuite/Makefile.in: Regenerate.
12490         * testsuite/plugin_test.c (struct sym_info): New type.
12491         (get_input_file, release_input_file): New static variables.
12492         (onload): Capture new transfer vector entries.
12493         (claim_file_hook): Stop reading at end of file according to filesize.
12494         Factor out parsing of readelf output into separate function.
12495         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12496         APIs and get the source file name from the symbol table.  Convert
12497         source file name to corresponding object file name.  Print info
12498         message when adding new input files.
12499         (parse_readelf_line): New function.
12500         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12501         * testsuite/plugin_test_2.sh: Likewise.
12502         * testsuite/plugin_test_3.sh: Likewise.
12503         * testsuite/plugin_test_4.sh: New test case.
12504
12505 2009-01-07  Ian Lance Taylor  <iant@google.com>
12506
12507         * version.cc (version_string): Bump to 1.8.
12508
12509 2008-12-23  Cary Coutant  <ccoutant@google.com>
12510
12511         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12512         * plugin.cc (Plugin_manager::finish): Rename as
12513         layout_deferred_objects.  Move cleanup to separate function.
12514         (Plugin_manager::cleanup): New function.
12515         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12516         separately.
12517         * plugin.h (Plugin_manager::finish): Rename as
12518         layout_deferred_objects.
12519         (Plugin_manager::cleanup): New function.
12520         (Plugin_manager::cleanup_done): New field.
12521
12522 2008-12-23  Cary Coutant  <ccoutant@google.com>
12523
12524         * plugin.cc (is_visible_from_outside): New function.
12525         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12526         so we don't return "IR only" status for exported symbols or -r links.
12527
12528         * testsuite/Makefile.am (plugin_test_3): New test case.
12529         * testsuite/Makefile.in: Regenerate.
12530         * testsuite/plugin_test_3.sh: New file.
12531
12532 2008-12-22  Cary Coutant  <ccoutant@google.com>
12533
12534         * object.cc (Sized_relobj::layout_section): New function.
12535         (Sized_relobj::do_layout): Defer layout of input sections until after
12536         plugin has provided replacement files.
12537         (Sized_relobj::do_layout_deferred_sections): New function.
12538         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12539         (Relobj::layout_deferred_sections): New function.
12540         (Relobj::do_layout_deferred_sections): New function.
12541         (Sized_relobj::do_layout_deferred_sections): New function.
12542         (Sized_relobj::layout_section): New function.
12543         (Sized_relobj::Deferred_layout): New structure.
12544         (Sized_relobj::deferred_layout_): New field.
12545         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12546         Change all callers.  Layout deferred sections.
12547         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12548         references.
12549         (Plugin_hook::run): Move code from do_plugin_hook inline.
12550         (Plugin_hook::do_plugin_hook): Remove.
12551         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12552         (Plugin_manager::finish): Renamed, was cleanup.
12553         (Plugin_manager::should_defer_layout): New function.
12554         (Plugin_manager::add_deferred_layout_object): New function.
12555         (Plugin_manager::Deferred_layout_list): New type.
12556         (Plugin_manager::deferred_layout_objects_): New field.
12557         (Plugin_hook::do_plugin_hook): Remove.
12558
12559 2008-12-17  Ian Lance Taylor  <iant@google.com>
12560
12561         * options.h (class General_options): Add --no case for
12562         --export-dynamic.
12563
12564 2008-12-16  Cary Coutant  <ccoutant@google.com>
12565
12566         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12567         vector.
12568         (Plugin_manager::claim_file): Create plugin object even if
12569         plugin did not call the add_symbols callback.
12570         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12571         asking for more symbols than were added.
12572         * testsuite/Makefile.am (plugin_test_1): Add test case with
12573         no global symbols.
12574         (empty.syms): New target.
12575         * testsuite/Makefile.in: Regenerate.
12576         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12577         message. Don't call add_symbols if no globals.
12578         (all_symbols_read_hook): Don't provide replacement for empty
12579         claimed file.
12580
12581 2008-12-12  Ian Lance Taylor  <iant@google.com>
12582
12583         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12584         r_type == 0 for a local symbol with r_sym == 0.
12585         (scan_relocatable_relocs): Pass r_sym to
12586         local_non_section_strategy.
12587         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12588         r_sym parameter.
12589
12590         * configure.ac: Update test for TLS descriptors: they are
12591         supported as of glibc 2.9.
12592         * configure: Rebuild.
12593
12594 2008-12-11  Ian Lance Taylor  <iant@google.com>
12595
12596         PR 7091
12597         * target-reloc.h (Default_scan_relocatable_relocs): For each
12598         function, map r_type == 0 to RELOC_DISCARD.
12599
12600 2008-12-10  Cary Coutant  <ccoutant@google.com>
12601
12602         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12603         object to override a kept COMDAT group from a plugin object.
12604
12605 2008-12-09  Ian Lance Taylor  <iant@google.com>
12606
12607         PR 7088
12608         * yyscript.y (file_cmd): Handle INPUT.
12609
12610         * testsuite/initpri1.c: Change all declarations to be full
12611         prototypes by adding void, to avoid compiler warnings.
12612
12613 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12614
12615         * options.cc (General_options::parse_plugin_opt): New.
12616         (General_options::add_plugin): The argument now is just the filename.
12617         (General_options::add_plugin_option): New.
12618         * options.h (plugin_opt): New.
12619         (add_plugin): Change argument name.
12620         (add_plugin_option): New.
12621         * plugin.cc (Plugin::load): Don't parse the plugin option.
12622         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12623         (Plugin::add_option): New.
12624         (Plugin::args_): Change type.
12625         (Plugin::filename_): New.
12626         (Plugin_manager::add_plugin_option): New.
12627         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12628         * testsuite/Makefile.in: Regenerate.
12629
12630 2008-12-05  Cary Coutant  <ccoutant@google.com>
12631
12632         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12633         Handle --strip-lto-sections option.
12634         * options.h (strip_lto_sections): New option.
12635
12636 2008-12-01  Cary Coutant  <ccoutant@google.com>
12637
12638         * plugin.cc (ld_plugin_message): Change format parameter to const.
12639         Fix mismatch between new[] and delete.
12640
12641 2008-11-14  Cary Coutant  <ccoutant@google.com>
12642
12643         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12644         instead of -1U.
12645
12646 2008-11-05  Craig Silverstein  <csilvers@google.com>
12647
12648         * options.cc (General_options::parse_dynamic_list): New function.
12649         * options.h (General_options): New flags dynamic_list,
12650         dynamic_list_data, dynamic_list_cpp_new, and
12651         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12652         (General_options::in_dynamic_list): New function.
12653         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12654         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12655         (Lex::can_continue_name): Likewise.
12656         (yylex): Likewise.
12657         (read_script_file): New parameter script_options.
12658         (read_dynamic_list): New function.
12659         (Script_options::define_dynamic_list): New function.
12660         (dynamic_list_keyword_parsecodes): New variable.
12661         (dynamic_list_keywords): New variable.
12662         * script.h (Script_options::define_dynamic_list): New function
12663         prototype.
12664         (read_dynamic_list): New function prototype.
12665         * symtab.cc (strprefix): New macro.
12666         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12667         dynamic_list_data, dynamic_list_cpp_new, and
12668         dynamic_list_cpp_typeinfo.
12669         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12670         (dynamic_list_expr): New rule.
12671         (dynamic_list_nodes): Likewise.
12672         (dynamic_list_node): Likewise.
12673         * testsuite/Makefile.am (dynamic_list): New test.
12674         * testsuite/Makefile.in: Regenerated.
12675         * testsuite/dynamic_list.t: New file.
12676         * testsuite/dynamic_list.sh: New file.
12677
12678 2008-11-05  Craig Silverstein  <csilvers@google.com>
12679
12680         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12681         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12682         (t11_last): Likewise.
12683         * testsuite/ver_test_6.c (main): Likewise.
12684
12685 2008-10-07  Cary Coutant  <ccoutant@google.com>
12686
12687         * options.c (General_options::finalize): Add check for -static and
12688         -shared.
12689         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12690         is not empty.
12691
12692 2008-10-02  Cary Coutant  <ccoutant@google.com>
12693
12694         * plugin.cc (make_sized_plugin_object): Fix conditional
12695         compilation to work when not all targets are enabled.
12696
12697 2008-09-29  Cary Coutant  <ccoutant@google.com>
12698
12699         * archive.cc (Archive::get_file_and_offset): Use filename instead
12700         of name to get library path.
12701         (Archive::include_member): Unlock external member of a thin archive.
12702
12703         * testsuite/Makefile.am (TEST_AR): New variable.
12704         (thin_archive_test_1): New test.
12705         (thin_archive_test_2): New test.
12706         * testsuite/Makefile.in: Regenerate.
12707         * testsuite/thin_archive_main.cc: New file.
12708         * testsuite/thin_archive_test_1.cc: New file.
12709         * testsuite/thin_archive_test_2.cc: New file.
12710         * testsuite/thin_archive_test_3.cc: New file.
12711         * testsuite/thin_archive_test_4.cc: New file.
12712
12713 2008-09-29  Cary Coutant  <ccoutant@google.com>
12714
12715         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12716         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12717         instead of -1U.
12718         (Sized_relobj::do_finalize_local_symbols): Likewise.
12719         (Sized_relobj::map_to_kept_section): Likewise.
12720         * object.h (Sized_relobj::invalid_address): New constant.
12721         (Sized_relobj::do_output_section_offset): Check for invalid_address
12722         and return -1ULL.
12723         * output.cc (Output_reloc::local_section_offset): Use constant
12724         invalid_address instead of -1U.
12725         (Output_reloc::get_address): Likewise.
12726         (Output_section::output_address): Change -1U to -1ULL.
12727         * output.h (Output_reloc::invalid_address): New constant.
12728         * reloc.cc (Sized_relobj::write_sections): Use constant
12729         invalid_address instead of -1U.
12730         (Sized_relobj::relocate_sections): Likewise.
12731         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12732         values for merge sections.
12733         * target-reloc.h (relocate_for_relocatable): Use constant
12734         invalid_address instead of -1U.
12735
12736 2008-09-19  Cary Coutant  <ccoutant@google.com>
12737
12738         Add plugin functionality for link-time optimization (LTO).
12739         * configure.ac (plugins): Add --enable-plugins option.
12740         * configure: Regenerate.
12741         * config.in: Regenerate.
12742         * Makefile.am (LIBDL): New variable.
12743         (CCFILES): Add plugin.cc.
12744         (HFILES): Add plugin.h.
12745         (ldadd_var): Add LIBDL.
12746         * Makefile.in: Regenerate.
12747
12748         * archive.cc: Include "plugin.h".
12749         (Archive::setup): Don't preread archive symbols when using a plugin.
12750         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12751         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12752         files.
12753         (Archive::include_member): Add symbols from plugin objects.
12754         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12755         * descriptors.cc (Descriptors::open): Check for file descriptors
12756         abandoned by plugins.
12757         (Descriptors::claim_for_plugin): New function.
12758         * descriptors.h (Descriptors::claim_for_plugin): New function.
12759         (Open_descriptor::is_claimed): New field.
12760         (claim_descriptor_for_plugin): New function.
12761         * fileread.cc (File_read::claim_for_plugin): New function.
12762         * fileread.h (File_read::claim_for_plugin): New function.
12763         (File_read::descriptor): New function.
12764         * gold.cc: Include "plugin.h".
12765         (queue_initial_tasks): Add task to call plugin hooks for generating
12766         new object files.
12767         * main.cc: Include "plugin.h".
12768         (main): Load plugin libraries.
12769         * object.h (Pluginobj): Declare.
12770         (Object::pluginobj): New function.
12771         (Object::do_pluginobj): New function.
12772         (Object::set_target): New function.
12773         * options.cc: Include "plugin.h".
12774         (General_options::parse_plugin): New function.
12775         (General_options::General_options): Initialize plugins_ field.
12776         (General_options::add_plugin): New function.
12777         * options.h (Plugin_manager): Declare.
12778         (General_options): Add --plugin option.
12779         (General_options::has_plugins): New function.
12780         (General_options::plugins): New function.
12781         (General_options::add_plugin): New function.
12782         (General_options::plugins_): New field.
12783         * plugin.cc: New file.
12784         * plugin.h: New file.
12785         * readsyms.cc: Include "plugin.h".
12786         (Read_symbols::do_read_symbols): Check for archive before checking
12787         for ELF file.  Call plugin hooks to claim files.
12788         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12789         from a real object file; force override when processing replacement
12790         files.
12791         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12792         (Symbol::init_base_object): Likewise.
12793         (Symbol::init_base_output_data): Likewise.
12794         (Symbol::init_base_output_segment): Likewise.
12795         (Symbol::init_base_constant): Likewise.
12796         (Symbol::init_base_undefined): Likewise.
12797         (Symbol::output_section): Assert that object is not a plugin.
12798         (Symbol_table::add_from_pluginobj): New function.
12799         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12800         undefined.
12801         (Symbol_table::sized_write_globals): Likewise.
12802         (Symbol_table::add_from_pluginobj): Instantiate template.
12803         * symtab.h (Sized_pluginobj): Declare.
12804         (Symbol::in_real_elf): New function.
12805         (Symbol::set_in_real_elf): New function.
12806         (Symbol::in_real_elf_): New field.
12807         (Symbol_table::add_from_pluginobj): New function.
12808
12809         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12810         (LIBDL): New variable.
12811         (LDADD): Add LIBDL.
12812         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12813         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12814         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12815         (MOSTLYCLEANFILES): Likewise.
12816         * testsuite/Makefile.in: Regenerate.
12817         * testsuite/plugin_test.c: New file.
12818         * testsuite/plugin_test_1.sh: New file.
12819         * testsuite/plugin_test_2.sh: New file.
12820
12821 2008-09-16  Ian Lance Taylor  <iant@google.com>
12822
12823         * target-reloc.h (relocate_section): Check whether a symbol is
12824         defined by the ABI before reporting an undefined symbol error.
12825         * target.h (Target::is_defined_by_abi): Make parameter const.
12826         (Target::do_is_defined_by_abi): Likewise.
12827         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12828         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12829         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12830         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12831         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12832         * testsuite/Makefile.in: Rebuild.
12833
12834         * fileread.cc (make_view): Add casts to avoid warning.
12835
12836 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12837
12838         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12839         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12840
12841 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12842
12843         * options.h (General_options::output_is_executable): New.
12844         (General_options::output_is_pie): New.
12845         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12846         for shared libraries.
12847         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12848
12849 2008-09-11  Chris Demetriou  <cgd@google.com>
12850
12851         * options.h (origin): New -z option.
12852         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12853         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12854         in DT_FLAGS_1.
12855
12856 2008-09-05  Cary Coutant  <ccoutant@google.com>
12857
12858         * fileread.cc (File_read::make_view): Add check for attempt to map
12859         beyond end of file.
12860
12861 2008-09-05  Cary Coutant  <ccoutant@google.com>
12862
12863         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12864         explicit instantiations.
12865
12866 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12867
12868         PR gold/6858
12869         * options.cc (General_options::finalize): Allow undefined symbols
12870         in shlibs if linking -shared.
12871
12872         PR gold/6859
12873         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12874         symbols as not needing a dynsym entry.
12875
12876 2008-08-20  Craig Silverstein  <csilvers@google.com>
12877
12878         * fileread.cc (File_read::open): Do not lock the file unless it
12879         was successfully opened.
12880
12881 2008-08-14  Cary Coutant  <ccoutant@google.com>
12882
12883         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12884         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12885         * testsuite/tls_test.cc (struct int128): 128-bit struct
12886         for testing TLS relocs with non-zero addend.
12887         (v12): New TLS variable.
12888         (t12): New test.
12889         (t_last): Add check for v12.
12890         * testsuite/tls_test.h (t12): New function.
12891         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12892
12893 2008-08-13  Ian Lance Taylor  <iant@google.com>
12894
12895         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12896         set tls_segment_ or relro_segment_.
12897         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12898         when appropriate.
12899         * output.h (Output_section::clear_is_relro): New function.
12900         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12901         sections specially even when output_data_ is empty.
12902         (Output_segment::maximum_alignment): When first section is relro,
12903         only force alignment for PT_LOAD segments.
12904         * script.cc (script_data_segment_align): New function.
12905         (script_data_segment_relro_end): New function.
12906         * script-c.h (script_data_segment_align): Declare.
12907         (script_data_segment_relro_end): Declare.
12908         * script-sections.h (class Script_sections): Declare
12909         data_segment_align and data_segment_relro_end.  Add fields
12910         segment_align_index_ and saw_relro_end_.
12911         * script-sections.cc (class Sections_element): Add set_is_relro
12912         virtual function.  Add new bool* parameter to place_orphan_here.
12913         Add get_output_section virtual function.
12914         (class Output_section_definition): Add set_is_relro.  Add new
12915         bool* parameter to place_orphan_here.  Add get_output_section.
12916         Add is_relro_ field.
12917         (Output_section_definition::Output_section_definition): Initialize
12918         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12919         and is_relro_ fields.
12920         (Output_section_definition::place_orphan_here): Add is_relro
12921         parameter.
12922         (Output_section_definition::set_section_addresses): Set relro for
12923         output section.
12924         (Output_section_definition::alternate_constraint): Likewise.
12925         (class Orphan_output_section): Add new bool* parameter to
12926         place_orphan_here.  Add get_output_section.
12927         (Orphan_output_section::place_orphan_here): Add is_relro
12928         parameter.
12929         (Script_sections::Script_sections): Initialize
12930         data_segment_align_index_ and saw_relro_end_.
12931         (Script_sections::data_segment_align): New function.
12932         (Script_sections::data_segment_relro_end): New function.
12933         (Script_sections::place_orphan): Set or clear is_relro.
12934         (Script_sections::set_section_addresses): Force alignment of first
12935         TLS section.
12936         * yyscript.y (exp): Call script_data_segment_align and
12937         script_data_segment_relro_end.
12938         * testsuite/relro_script_test.t: New file.
12939         * testsuite/relro_test.cc (using_script): Declare.
12940         (t1, t2): Test using_script.
12941         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12942         (relro_script_test_SOURCES): Define.
12943         (relro_script_test_DEPENDENCIES): Define.
12944         (relro_script_test_LDFLAGS): Define.
12945         (relro_script_test_LDADD): Define.
12946         (relro_script_test.so): New target.
12947         * testsuite/Makefile.in: Rebuild.
12948
12949 2008-08-06  Cary Coutant <ccoutant@google.com>
12950
12951         * archive.cc (Archive::total_archives, Archive::total_members)
12952         (Archive::total_members_loaded): New variables.
12953         (Archive::setup): Add parameter.  Add option to preread
12954         archive symbols.
12955         (Archive::read_armap): Add counter.
12956         (Archive::get_file_and_offset): New function.
12957         (Archive::get_elf_object_for_member): New function.
12958         (Archive::read_all_symbols): New function.
12959         (Archive::read_symbols): New function.
12960         (Archive::add_symbols): Add counters.
12961         (Archive::include_all_members): Use armap to find members if it's
12962         already built.
12963         (Archive::include_member): Skip reading symbols if already read.
12964         Factored code into Archive::get_file_and_offset and
12965         Archive::get_elf_object_for_member.  Changed call to
12966         Mapfile::report_include_archive_member.
12967         (Archive::print_stats): New function.
12968         * archive.h: Declare Object and Read_symbols_data classes.
12969         (Archive::Archive): Add initializers for new members.
12970         (Archive::setup): Add parameter.
12971         (Archive::print_stats): New function.
12972         (Archive::total_archives, Archive::total_members)
12973         (Archive::total_members_loaded): New variables.
12974         (Archive::get_file_and_offset): New function.
12975         (Archive::get_elf_object_for_member): New function.
12976         (Archive::read_all_symbols): New function.
12977         (Archive::read_symbols): New function.
12978         (Archive::Archive_member): New class.
12979         (Archive::members_): New member.
12980         (Archive::num_members_): New member.
12981         * main.cc: Include archive.h.
12982         (main): Call Archive::print_stats.
12983         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12984         archive parameter; member_name is now the fully-decorated name.
12985         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12986         * options.h: (General_options): Add --preread-archive-symbols option.
12987         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12988         Archive::setup.
12989
12990 2008-08-04  Ian Lance Taylor  <iant@google.com>
12991
12992         * symtab.h (Symbol::use_plt_offset): New function.
12993         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12994         * powerpc.cc (Relocate::relocate): Likewise.
12995         * sparc.cc (Relocate::relocate): Likewise.
12996         * x86_64.cc (Relocate::relocate): Likewise.
12997         * testsuite/weak_plt.sh: New test.
12998         * testsuite/weak_plt_main.cc: New test.
12999         * testsuite/weak_plt_shared.cc: New test.
13000         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13001         (check_PROGRAMS): Add weak_plt.
13002         (check_DATA): Add weak_plt_shared.so.
13003         (weak_plt_main_pic.o, weak_plt): New targets.
13004         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13005         * testsuite/Makefile.in: Rebuild.
13006
13007         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13008         gcctestdir/ld.
13009         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13010         * testsuite/Makefile.in: Rebuild.
13011
13012 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13013
13014         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13015         * Makefile.in: Regenerate.
13016         * po/POTFILES.in: Regenerate.
13017
13018 2008-07-29  Ian Lance Taylor  <iant@google.com>
13019
13020         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13021         symbols before other symbols.
13022         * testsuite/script_test_2.cc (test_addr): Declare.
13023         (test_addr_alias): Declare.
13024         (main): Check that test_addr and test_addr_alias have the right
13025         values.
13026         * testsuite/script_test_2.t: Define test_addr_alias and
13027         test_addr.
13028
13029 2008-07-24  Ian Lance Taylor  <iant@google.com>
13030
13031         PR 5990
13032         * descriptors.cc: New file.
13033         * descriptors.h: New file.
13034         * gold-threads.h (class Hold_optional_lock): New class.
13035         * fileread.cc: Include "descriptors.h".
13036         (File_read::~File_read): Release descriptor rather than closing
13037         it.
13038         (File_read::open) [file]: Call open_descriptor rather than open.
13039         Set is_descriptor_opened_.
13040         (File_read::open) [memory]: Assert that descriptor is not open.
13041         (File_read::reopen_descriptor): New function.
13042         (File_read::release): Release descriptor.
13043         (File_read::do_read): Make non-const.  Reopen descriptor.
13044         (File_read::read): Make non-const.
13045         (File_read::make_view): Reopen descriptor.
13046         (File_read::do_readv): Likewise.
13047         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13048         Update declarations.
13049         * layout.cc: Include "descriptors.h".
13050         (Layout::create_build_id): Use open_descriptor rather than open.
13051         * output.cc: Include "descriptors.h".
13052         (Output_file::open): Use open_descriptor rather than open.
13053         * archive.cc (Archive::const_iterator): Change Archive to be
13054         non-const.
13055         (Archive::begin, Archive::end): Make non-const.
13056         (Archive::count_members): Likewise.
13057         * archive.h (class Archive): Update declarations.
13058         * object.h (Object::read): Make non-const.
13059         * Makefile.am (CCFILES): Add descriptors.cc.
13060         (HFILES): Add descriptors.h.
13061         * Makefile.in: Rebuild.
13062
13063         PR 6716
13064         * gold.h: Always include <clocale>.  Add Solaris workarounds
13065         following code in binutils/sysdep.h.
13066
13067         PR 6048
13068         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13069         this->eh_frame_hdr_ is NULL before using it.
13070
13071         * dynobj.cc (Versions::Versions): Update comment.
13072
13073         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13074         the base version name.
13075
13076         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13077         array size plus one.
13078         (Stringpool_template::set_string_offsets): Subtract one from key
13079         before using it as an array index.
13080         (Stringpool_template::get_offset_with_length): Likewise.
13081         (Stringpool_template::write_to_buffer): Likewise.
13082         * stringpool.h (Stringpool_template::get_offset_from_key):
13083         Likewise.
13084
13085 2008-07-23  Ian Lance Taylor  <iant@google.com>
13086
13087         PR 6658
13088         * object.h (Merged_symbol_value::value): Do our best to handle a
13089         negative addend.
13090
13091         PR 6647
13092         * script.cc (Version_script_info::get_versions): Don't add empty
13093         version tag to return value.
13094         (Version_script_info::get_symbol_version_helper): Change return
13095         type to bool.  Add pversion parameter.  Change all callers.
13096         (script_register_vers_node): Don't require a non-NULL tag.
13097         * script.h (class Version_script_info): Update declarations.
13098         (Version_script_info::get_symbol_version): Change return type to
13099         bool.  Add version parameter.  Change all callers.
13100         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13101         handling.  Handle an empty version from a version script.
13102         (Symbol_table::define_special_symbol): Likewise.
13103         * testsuite/ver_test_10.script: New file.
13104         * testsuite/ver_test_10.sh: New file.
13105         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13106         (check_DATA): Add ver_test_10.syms.
13107         (ver_test_10.syms, ver_test_10.so): New target.
13108         * testsuite/Makefile.in: Rebuild.
13109
13110 2008-07-23  Simon Baldwin  <simonb@google.com>
13111
13112         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13113         to zero for undefined symbols from dynamic libraries.
13114
13115 2008-07-23  Ian Lance Taylor  <iant@google.com>
13116
13117         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13118         Change all callers.
13119         * symtab.h (class Symbol_table): Update declaration.
13120         * testsuite/ver_test_9.cc: New file.
13121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13122         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13123         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13124         (ver_test_9.so, ver_test_9.o): New targets.
13125         * testsuite/Makefile.in: Rebuild.
13126
13127 2008-07-22  Ian Lance Taylor  <iant@google.com>
13128
13129         * options.h (class General_options): Define --check-sections.
13130         * layout.cc (Layout::set_segment_offsets): Handle
13131         --check-sections.
13132
13133         * options.h (class General_options): Define -n/--nmagic and
13134         -N/--omagic.
13135         * options.cc (General_options::finalize): For -n/--nmagic or
13136         -N/--omagic, set -static.
13137         * layout.cc (Layout::attach_allocated_section_to_segment): If
13138         -N/--omagic, don't put read-only and read-write sections in
13139         different segments.
13140         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13141         finding a read-only segment.
13142         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13143         don't set the minimum segment alignment to the common page size,
13144         and don't set the file offset to the address modulo the page size.
13145         * script-sections.cc (Script_sections::create_segments): If
13146         -n/--omagic, don't put read-only and read-write sections in
13147         different segments.
13148
13149         * cref.cc: New file.
13150         * cref.h: New file.
13151         * options.h (class General_options): Add --print-symbol-counts.
13152         * main.cc (main): Issue defined symbol report if requested.
13153         * archive.cc (Archive::interpret_header): Make into a const member
13154         function.
13155         (Archive::add_symbols): Call Input_objects::archive_start and
13156         archive_stop.
13157         (Archive::const_iterator): Define new class.
13158         (Archive::begin, Archive::end): New functions.
13159         (Archive::include_all_members): Rewrite to use iterator.
13160         (Archive::count_members): New function.
13161         * archive.h (class Archive): Update declarations.
13162         (Archive::filename): New function.
13163         * object.cc: Include "cref.h".
13164         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13165         (Sized_relobj::do_get_global_symbol_counts): New function.
13166         (Input_objects::add_object): Add object to cross-referencer.
13167         (Input_objects::archive_start): New function.
13168         (Input_objects::archive_stop): New function.
13169         (Input_objects::print_symbol_counts): New function.
13170         * object.h: Declare Cref and Archive.
13171         (Object::get_global_symbol_counts): New function.
13172         (Object::do_get_global_symbol_counts): New pure virtual function.
13173         (class Sized_relobj): Add defined_count_ field.  Update
13174         declarations.
13175         (class Input_objects): Add cref_ field.  Update constructor.
13176         Update declarations.
13177         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13178         defined_count_.
13179         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13180         symbol counts.
13181         (Sized_dynobj::do_get_global_symbol_counts): New function.
13182         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13183         defined_count_.  Update declarations.  Define Symbols typedef.
13184         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13185         parameter.  Change all callers.
13186         (Symbol_table::add_from_dynobj): Add sympointers and defined
13187         parameters.  Change all callers.
13188         * symtab.h (class Symbol_table): Update declarations.
13189         * Makefile.am (CCFILES): Add cref.cc.
13190         (HFILES): Add cref.h.
13191         * Makefile.in: Rebuild.
13192
13193 2008-07-22  Simon Baldwin  <simonb@google.com>
13194
13195         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13196         to zero when writing undefined symbols.
13197
13198 2008-07-22  Ian Lance Taylor  <iant@google.com>
13199
13200         * output.cc (Output_section::add_input_section): Don't try to
13201         merge empty merge sections.
13202
13203 2008-07-21  Craig Silverstein  <csilvers@google.com>
13204
13205         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13206         Include symbol version in error message.
13207
13208 2008-07-20  Chris Demetriou  <cgd@google.com>
13209
13210         * configure.ac (gold_cv_c_random_seed): New configured variable.
13211         (RANDOM_SEED_CFLAGS): New substituted variable.
13212         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13213         * configure: Rebuild.
13214         * Makefile.in: Likewise.
13215         * testsuite/Makefile.in: Likewise.
13216
13217 2008-07-18  Ian Lance Taylor  <iant@google.com>
13218
13219         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13220         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13221         * testsuite/ver_test_main.cc (main): Call t4.
13222         (t4, t4_2a): Define.
13223         * testsuite/ver_test_2.cc (t4_2): Define.
13224         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13225         * testsuite/ver_test_4.cc (t4_2a): Define.
13226         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13227         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13228
13229 2008-07-17  Ian Lance Taylor  <iant@google.com>
13230
13231         * dynobj.cc (Versions::add_def): If we give an error about a
13232         missing version, go ahead and create the version anyhow.
13233
13234 2008-07-10  Ian Lance Taylor  <iant@google.com>
13235
13236         Handle output sections with more than 0x7fffffff bytes.
13237         * object.h (class Relobj): Change map_to_output_ to
13238         output_sections_, and just keep a section pointer.  Change all
13239         uses.  Move comdat group support to Sized_relobj.
13240         (Relobj::is_section_specially_mapped): Remove.
13241         (Relobj::output_section): Remove poff parameter.  Change all
13242         callers.
13243         (Relobj::output_section_offset): New function.
13244         (Relobj::set_section_offset): Rewrite.
13245         (Relobj::map_to_output): Remove.
13246         (Relobj::output_sections): New function.
13247         (Relobj::do_output_section_offset): New pure virtual function.
13248         (Relobj::do_set_section_offset): Likewise.
13249         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13250         group support from Relobj.  Update declarations.
13251         (Sized_relobj::get_output_section_offset): New function.
13252         (Sized_relobj::do_output_section_offset): New function.
13253         (Sized_relobj::do_set_section_offset): New function.
13254         * object.cc (Relobj::output_section_address): Remove.
13255         (Sized_relobj::Sized_relobj): Initialize new fields.
13256         (Sized_relobj::include_section_group): Cast find_kept_object to
13257         Sized_relobj.
13258         (Sized_relobj::include_linkonce_section): Likewise.
13259         (Sized_relobj::do_layout): Use separate arrays for output section
13260         and output offset.
13261         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13262         output_sections.
13263         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13264         output_sections and section_offsets.
13265         (Sized_relobj::write_local_symbols): Likewise.
13266         (map_to_kept_section): Compute output address directly.
13267         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13268         output_sections and section_offsets.
13269         (Sized_relobj::write_sections): Likewise.
13270         (Sized_relobj::relocate_sections): Likewise.
13271         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13272         * output.h (class Output_reloc): Update declarations.  Change
13273         u2_.relobj to Sized_relobj*.
13274         (class Output_data_reloc): Change add functions to use
13275         Sized_relobj*.
13276         * output.cc (Output_reloc::Output_reloc): Change relobj to
13277         Sized_relobj*.
13278         (Output_reloc::local_section_offset): Change return type to
13279         Elf_Addr.  Use get_output_section_offset.
13280         (Output_reloc::get_address): Likewise.
13281         (Output_section::is_input_address_mapped): Don't call
13282         is_section_specially_mapped.
13283         (Output_section::output_offset): Likewise.
13284         (Output_section::output_address): Likewise.
13285         (Output_section::starting_output_address): Likewise.
13286         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13287         parameter to Sized_relobj*.
13288         (Copy_relocs::need_copy_reloc): Likewise.
13289         (Copy_relocs::save): Likewise.
13290         * copy-relocs.h (class Copy_relocs): Update declarations.
13291         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13292         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13293         * target-reloc.h (relocate_for_relocatable): Change
13294         offset_in_output_section type to Elf_Addr.  Change code that uses
13295         it as well.
13296         * layout.cc (Layout::layout): Always set *off.
13297         * mapfile.cc (Mapfile::print_input_section): Use
13298         output_section_offset.
13299         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13300         Sized_relobj*.
13301         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13302         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13303         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13304
13305 2008-07-03  Ian Lance Taylor  <iant@google.com>
13306
13307         * layout.cc (Layout::include_section): Do not discard unrecognized
13308         SHT_STRTAB sections.
13309
13310 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13311
13312         * script.cc (Lex::can_continue_name): Make '?' allowable in
13313         version-script names.
13314         * testsuite/version_script.map: Change glob pattern to use '?'
13315
13316 2008-06-30  Manish Singh  <yosh@gimp.org>
13317
13318         PR 6585
13319         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13320         Correct typo.
13321
13322 2008-06-30  Ian Lance Taylor  <iant@google.com>
13323
13324         PR 6660
13325         PR 6682
13326         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13327         versions]: Don't try to read the value in the contents, since we
13328         don't use it.  Use the template endianness when writing.
13329
13330 2008-06-25  Cary Coutant  <ccoutant@google.com>
13331
13332         * fileread.cc (File_read::make_view): Assert on zero-length view.
13333         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13334         symbol table when there are no symbols to read.
13335
13336 2008-06-23  Craig Silverstein  <csilvers@google.com>
13337
13338         * version.cc (version_string): Bump to 1.7
13339
13340 2008-06-18  Craig Silverstein  <csilvers@google.com>
13341
13342         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13343         constant 0xFFFF to type Valtype.
13344         (Powerpc_relocate_functions::rel16_ha): Likewise.
13345
13346 2008-06-17  Ian Lance Taylor  <iant@google.com>
13347
13348         * output.h (Output_section::Input_section): Initialize p2align_ to
13349         zero for Output_section_data constructors.
13350         (Output_section::Input_section::addralign): If not an input
13351         section, return the alignment of the Output_section_data.
13352         * testsuite/copy_test.cc: New file.
13353         * testsuite/copy_test_1.cc: New file.
13354         * testsuite/copy_test_2.cc: New file.
13355         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13356         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13357         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13358         (copy_test_1_pic.o, copy_test_1.so): New targets.
13359         (copy_test_2_pic.o, copy_test_2.so): New targets.
13360         * testsuite/Makefile.in: Rebuild.
13361
13362         * script-sections.cc (Script_sections::place_orphan): Initialize
13363         local variable exact.
13364
13365 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13366
13367         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13368
13369 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13370             David S. Miller  <davem@davemloft.net>
13371
13372         * powerpc.cc: New file.
13373         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13374         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13375         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13376         * Makefile.in: Rebuild.
13377
13378 2008-06-09  Ian Lance Taylor  <iant@google.com>
13379
13380         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13381         <exception>.
13382         (throwing, orig_terminate): New static variables.
13383         (terminate_handler): New static function.
13384         (t2): Set terminate handler.
13385
13386 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13387
13388         PR 6584
13389         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13390         alignment.
13391
13392 2008-05-30  Cary Coutant  <ccoutant@google.com>
13393
13394         * archive.cc (Archive::include_all_members) Correct to step
13395         over symbol table and extended name table in thin archives.
13396
13397 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13398
13399         PR 6407
13400         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13401         calculation.
13402
13403 2008-05-28  Caleb Howe  <cshowe@google.com>
13404
13405         * reduced_debug_output.cc: New file.
13406         * reduced_debug_output.h: New file.
13407         * options.h (class General_options): Add --strip-debug-non-line.
13408         * options.cc (General_options::finalize): Add strip_debug_non_line
13409         to the strip heirarchy.
13410         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13411         fields.
13412         * layout.cc: Include "reduced_debug_output.h".
13413         (Layout::Layout): Initialize new fields.
13414         (line_only_debug_sections): New static array.
13415         (is_lines_only_debug_sections): New static inline function.
13416         (Layout::include_section): Handle --strip-debug-non-line.
13417         (Layout::make_output_section): If --strip-debug-non-line, build
13418         new output sections for .debug_abbrev and .debug_info.
13419         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13420         gold.  Warn about possible overflow.
13421         (read_signed_LEB_128): Likewise.
13422         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13423         (read_signed_LEB_128): Declare.
13424         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13425         (HFILES): Add reduced_debug_output.h.
13426         * Makefile.in: Rebuild.
13427
13428 2008-05-21  Ian Lance Taylor  <iant@google.com>
13429
13430         * mapfile.cc: New file.
13431         * mapfile.h: New file.
13432         * options.h (class General_options): Add -M/--print-map and -Map.
13433         * options.cc (General_options::finalize): Make -M equivalent to
13434         -Map -.
13435         * main.cc: Include <cstdio> and "mapfile.h".
13436         (main): Open mapfile if requested.
13437         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13438         constructor.  Change caller.
13439         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13440         (queue_middle_tasks): Likewise.
13441         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13442         declarations.
13443         * archive.cc: Include "mapfile.h".
13444         (Archive::add_symbols): Add mapfile parameter.  Change all
13445         callers.  Pass mapfile, symbol, and reason to include_member.
13446         (Archive::include_all_members): Add mapfile parameter.  Change all
13447         callers.
13448         (Archive::include_member): Add mapfile, sym, and why parameters.
13449         Change all callers.  Report inclusion to map file.
13450         * archive.h: Include "fileread.h".
13451         (class Archive): Update declarations.
13452         (Archive::file): New const method.
13453         (class Add_archive_symbols): Add mapfile_ field.  Update
13454         constructor.  Change all callers.
13455         * readsyms.h (class Read_symbols): Likewise.
13456         (class Finish_group): Likewise.
13457         (class Read_script): Likewise.
13458         * common.cc: Include "mapfile.h".
13459         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13460         all callers.
13461         (Symbol_table::do_allocate_commons): Likewise.
13462         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13463         symbol allocation to mapfile.
13464         * common.h (class Allocate_commons_task): Add mapfile_ field.
13465         Update constructor.  Change all callers.
13466         * symtab.h (class Symbol_table): Update declarations.
13467         * layout.cc: Include "mapfile.h".
13468         (Layout_task_runner::run): Print information to mapfile.
13469         (Layout::create_gold_note): Change Output_data_fixed_space to
13470         Output_data_zero_fill.
13471         (Layout::create_build_id): Likewise.
13472         (Layout::print_to_mapfile): New function.
13473         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13474         constructor.  Change caller.
13475         (class Layout): Declare print_to_mapfile.
13476         * output.cc (Output_section::Input_section::print_to_mapfile): New
13477         function.
13478         (Output_section::add_input_section): If producing a map, always
13479         add to input_sections_ list.
13480         (Output_section::do_print_to_mapfile): New function.
13481         (Output_segment::print_sections_to_mapfile): New function.
13482         (Output_segment::print_section_list_to_mapfile): New function.
13483         * output.h: Include "mapfile.h".
13484         (Output_data::print_to_mapfile): New function.
13485         (Output_data::do_print_to_mapfile): New virtual function.
13486         (Output_segment_headers::do_print_to_mapfile): New function.
13487         (Output_file_header::do_print_to_mapfile): New function.
13488         (Output_data_const::do_print_to_mapfile): New function.
13489         (class Output_data_const_buffer): Add map_name_ field.  Update
13490         constructor.  Change all callers.  Add do_print_to_mapfile
13491         function.
13492         (class Output_data_fixed_space): Likewise.
13493         (class Output_data_space): Likewise.
13494         (class Output_data_zero_fill): New class.
13495         (Output_data_strtab::do_print_to_mapfile): New function.
13496         (Output_data_reloc_base::do_print_to_mapfile): New function.
13497         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13498         (Output_data_group::do_print_to_mapfile): New function.
13499         (Output_data_got::do_print_to_mapfile): New function.
13500         (Output_data_dynamic::do_print_to_mapfile): New function.
13501         (Output_symtab_xindex::do_print_to_mapfile): New function.
13502         (class Output_section): Declare do_print_to_mapflie.  Declare
13503         print_to_mapfile in Input_section.
13504         (class Output_segment): Declare new functions.
13505         * object.h (Sized_relobj::symbol_count): New function.
13506         * script-sections.cc
13507         (Output_section_element_dot_assignment::set_section_addresses):
13508         Change Output_data_fixed_space to Output_data_zero_fill.
13509         (Output_data_expression::do_print_to_mapfile): New function.
13510         * script.cc (read_input_script): Add mapfile parameter.  Change
13511         all callers.
13512         * script.h (read_input_script): Update declaration.
13513         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13514         (Eh_frame::do_print_to_mapfile): New function.
13515         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13516         (Output_merge_string::do_print_to_mapfile): New function.
13517         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13518         function.
13519         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13520         function.
13521         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13522         function.
13523         * Makefile.am (CCFILES): Add mapfile.cc.
13524         (HFILES): Add mapfile.h.
13525         * Makefile.in: Rebuild.
13526
13527 2008-05-19  Ian Lance Taylor  <iant@google.com>
13528
13529         * options.h (class General_options): Add -z relro.
13530         * layout.cc (Layout::Layout): Initialize relro_segment_.
13531         (Layout::add_output_section_data): Return the output section.
13532         (Layout::make_output_section): Rcognize relro sections and mark
13533         them appropriately.
13534         (Layout::attach_allocated_section_to_segment): Put relro sections
13535         in a PT_GNU_RELRO segment.
13536         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13537         section as relro.
13538         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13539         PT_TLS segments.
13540         (Layout::linkonce_mapping): Map d.rel.ro.local to
13541         .data.rel.ro.local.
13542         (Layout::output_section_name): Us .data.rel.ro.local for any
13543         section which begins with that.
13544         * layout.h (class Layout): Update add_output_section_data
13545         declaration.  Add relro_segment_ field.
13546         * output.cc (Output_section::Output_section): Initialize is_relro_
13547         and is_relro_local_ fields.
13548         (Output_segment::add_output_section): Group relro sections.
13549         (Output_segment::is_first_section_relro): New function.
13550         (Output_segment::maximum_alignment): If there is a relro section,
13551         align the segment to the common page size.
13552         (Output_segment::set_section_addresses): Track whether we are
13553         looking at relro sections.  If the last section is a relro
13554         section, align to the common page size.
13555         (Output_segment::set_section_list_addresses): Add in_relro
13556         parameter.  Change all callers.  Align to the page size when
13557         moving from relro to non-relro section.
13558         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13559         segment.
13560         * output.h (class Output_section): Add is_relro_ and
13561         is_relro_local_ fields.
13562         (Output_section::is_relro): New function.
13563         (Output_section::set_is_relro): New function.
13564         (Output_section::is_relro_local): New function.
13565         (Output_section::set_is_relro_local): New function.
13566         (class Output_segment): Update declarations.
13567         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13568         * sparc.cc (Target_sparc::got_section): Likewise.
13569         * x86_64.cc (Target_x86_64::got_section): Likewise.
13570         * testsuite/relro_test_main.cc: New file.
13571         * testsuite/relro_test.cc: New file.
13572         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13573         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13574         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13575         (relro_test.so, relro_test_pic.o): New targets.
13576         * testsuite/Makefile.in: Rebuild.
13577
13578 2008-05-16  Ian Lance Taylor  <iant@google.com>
13579
13580         * output.cc (Output_segment::add_output_section): Remove front
13581         parameter.
13582         * output.h (class Output_segment): Remove
13583         add_initial_output_section and overloaded add_output_section.
13584         Update declaration of remaining add_output_section.
13585         * layout.cc (Layout::create_interp): Call add_output_section
13586         rather than add_initial_output_section.
13587         (Layout::finish_dynamic_section): Likewise.
13588
13589         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13590         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13591         know the dynamic type.
13592         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13593         field.  Initialize it in constructor.
13594         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13595         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13596         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13597         reloc.
13598
13599         * output.cc (Output_reloc::get_address): Change return type to
13600         Elf_Addr.
13601         * output.h (class Output_reloc): Update get_address declaration.
13602         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13603         for section addresses.
13604
13605 2008-05-09  Ian Lance Taylor  <iant@google.com>
13606
13607         PR 6493
13608         * gold.cc (gold_nomem): Use return value of write.
13609
13610 2008-05-08  Ian Lance Taylor  <iant@google.com>
13611
13612         * symtab.c (Symbol::init_base_output_data): Add version
13613         parameter.  Change all callers.
13614         (Symbol::init_base_output_segment): Likewise.
13615         (Symbol::init_base_constant): Likewise.
13616         (Symbol::init_base_undefined): Likewise.
13617         (Sized_symbol::init_output_data): Likewise.
13618         (Sized_symbol::init_output_segment): Likewise.
13619         (Sized_symbol::init_constant): Likewise.
13620         (Sized_symbol::init_undefined): Likewise.
13621         (Symbol_table::do_define_in_output_data): If the new symbol has a
13622         version, mark it as the default.
13623         (Symbol_table::do_define_in_output_segment): Likewise.
13624         (Symbol_table::do_define_as_constant): Likewise.
13625         * symtab.h (class Symbol): Update declarations.
13626         (class Sized_symbol): Likewise.
13627         * resolve.cc (Symbol::override_version): New function.
13628         (Symbol::override_base): Call override_version.
13629         (Symbol::override_base_with_special): Likewise.
13630         * testsuite/ver_script_8.script: New file.
13631         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13632         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13633         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13634         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13635
13636 2008-05-06  Ian Lance Taylor  <iant@google.com>
13637
13638         PR 6049
13639         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13640         functions.
13641         (class General_options): Remove existing --undefined, and add
13642         --no-undefined instead.  Add new --undefined as synonym for -u.
13643         * archive.cc (Archive::add_symbols): Check whether symbol was
13644         named with -u.
13645         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13646         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13647         all uses.  Add IS_UNDEFINED.  Update declarations to split
13648         different versions of init_base.  Declare init_base_undefined.
13649         (Symbol::is_defined): Handle IS_UNDEFINED.
13650         (Symbol::is_undefined): Likewise.
13651         (Symbol::is_weak_undefined): Call is_undefined.
13652         (Symbol::is_absolute): Handle IS_CONSTANT.
13653         (class Sized_symbol): Update declarations to split different
13654         versions of init.  Declare init_undefined.
13655         (class Symbol_table): Declare new functions.
13656         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13657         Change all callers.
13658         (Symbol::init_base_output_data): Likewise.
13659         (Symbol::init_base_output_segment): Likewise.
13660         (Symbol::init_base_constant): Likewise.
13661         (Symbol::init_base_undefined): New function.
13662         (Sized_symbol::init_object): Rename from init.  Change all
13663         callers.
13664         (Sized_symbol::init_output_data): Likewise.
13665         (Sized_symbol::init_output_segment): Likewise.
13666         (Sized_symbol::init_constant): Likewise.
13667         (Sized_symbol::init_undefined): New function.
13668         (Symbol_table::add_undefined_symbols_from_command_line): New
13669         function.
13670         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13671         function.
13672         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13673         (Symbol::output_section): Likewise.
13674         (Symbol::set_output_section): Likewise.
13675         (Symbol_table::sized_finalize_symbol): Likewise.
13676         (Symbol_table::sized_write_globals): Likewise.
13677         * resolve.cc (Symbol_table::should_override): Likewise.
13678         (Symbol::override_base_with_special): Likewise.
13679
13680         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13681         symbol, change it to have default visibility.
13682         * testsuite/protected_1.cc: New file.
13683         * testsuite/protected_2.cc: New file.
13684         * testsuite/protected_3.cc: New file.
13685         * testsuite/protected_main_1.cc: New file.
13686         * testsuite/protected_main_2.cc: New file.
13687         * testsuite/protected_main_3.cc: New file.
13688         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13689         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13690         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13691         (protected_1.so): New target.
13692         (protected_1_pic.o, protected_2_pic.o): New targets.
13693         (protected_3_pic.o): New target.
13694         (check_PROGRAMS): Add protected_2.
13695         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13696         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13697         * testsuite/Makefile.in: Rebuild.
13698
13699         * options.h (DEFINE_var): Add set_user_set_##varname__.
13700         (DEFINE_bool_alias): New macro.
13701         (class General_options): Define -Bstatic using DEFINE_bool_alias
13702         rather than DEFINE_special.  Add --undefined as an alias for -z
13703         defs.
13704         * options.cc (General_options::parse_Bstatic): Remove.
13705
13706         * options.h (class General_options): Add --fatal-warnings.
13707         * main.cc (main): Implement --fatal-warnings.
13708         * errors.h (Errors::warning_count): New function.
13709
13710         * options.h (class General_options): Add -Bsymbolic-functions.
13711         * symtab.h (Symbol::is_preemptible): Check for
13712         -Bsymbolic-functions.
13713
13714 2008-05-05  Ian Lance Taylor  <iant@google.com>
13715
13716         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13717         as noVARNAME rather than no-VARNAME.
13718         (class General_options): Add option -z combreloc.
13719         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13720         get_address.
13721         (Output_reloc::sort_before) [SHT_REL]: New function.
13722         (Output_reloc::sort_before) [SHT_RELA]: New function.
13723         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13724         Sort_relocs_comparison.
13725         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13726         parameter.  Change all callers.
13727         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13728         sort_relocs parameter.  Change all callers.
13729         * output.cc (Output_reloc::get_address): New function, broken out
13730         of write_rel.
13731         (Output_reloc::write_rel): Call it.
13732         (Output_reloc::compare): New function.
13733         (Output_data_reloc_base::do_write): Optionally sort relocs.
13734
13735         * configure.ac: If targ_extra_obj is set, link it in.
13736         * configure.tgt: Initialize all variables.
13737         (x86_64*): Set targ_extra_obj and targ_extra_size.
13738         * configure: Rebuild.
13739
13740         * object.cc (Sized_relobj::include_section_group): Adjust section
13741         indexes read from group data.  Build vector to pass to
13742         layout_group.
13743         * layout.cc (Layout::layout_group): Add flags and shndxes
13744         parameters.  Remove contents parameter.  Change caller.  Update
13745         explicit instantiations.
13746         * layout.h (class Layout): Update layout_group declaration.
13747         * output.cc (Output_data_group::Output_data_group): Add flags and
13748         input_shndxes parameters.  Remove contents parameter.  Change
13749         caller.
13750         (Output_data_group::do_write): Change input_sections_ to
13751         input_shndxes_.
13752         * output.h (class Output_data_group): Update constructor
13753         declaration.  Rename input_sections_ to input_shndxes_.
13754         * testsuite/many_sections_test.cc: Add template.
13755
13756 2008-04-30  Cary Coutant  <ccoutant@google.com>
13757
13758         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13759
13760         * layout.cc (Layout::include_section): Refactored check for debug
13761         info section.
13762         (Layout::add_comdat): Add new parameters.  Change type
13763         of signature parameter.  Add object and shndx to signatures table.
13764         (Layout::find_kept_object): New function.
13765         * layout.h: Include <cstring>.
13766         (Layout::is_debug_info_section): New function.
13767         (Layout::add_comdat): Add new parameters.
13768         (Layout::find_kept_object): New function.
13769         (Layout::Kept_section): New struct.
13770         (Layout::Signatures): Change type of map range.
13771         * object.cc (Relobj::output_section_address): New function.
13772         (Sized_relobj::include_section_group): Add new parameters.  Change
13773         calls to Layout::add_comdat.  Change to build table of kept comdat
13774         groups and table mapping discarded sections to kept sections.
13775         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13776         (Sized_relobj::do_layout): Change calls to include_section_group and
13777         include_linkonce_section.
13778         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13779         value to zero when section is discarded.
13780         (Sized_relobj::map_to_kept_section): New function.
13781         * object.h (Relobj::output_section_address): New function.
13782         (Relobj::Comdat_group): New type.
13783         (Relobj::find_comdat_group): New function.
13784         (Relobj::Comdat_group_table): New type.
13785         (Relobj::Kept_comdat_section): New type.
13786         (Relobj::Kept_comdat_section_table): New type.
13787         (Relobj::add_comdat_group): New function.
13788         (Relobj::set_kept_comdat_section): New function.
13789         (Relobj::get_kept_comdat_section): New function.
13790         (Relobj::comdat_groups_): New field.
13791         (Relobj::kept_comdat_sections_): New field.
13792         (Symbol_value::input_value): Update comment.
13793         (Sized_relobj::map_to_kept_section) New function.
13794         (Sized_relobj::include_linkonce_section): Add new parameter.
13795         * target-reloc.h (Comdat_behavior): New type.
13796         (get_comdat_behavior): New function.
13797         (relocate_section): Add code to map a discarded section to the
13798         corresponding kept section when applying a relocation.
13799
13800 2008-04-30  Craig Silverstein  <csilvers@google.com>
13801
13802         * dwarf_reader.cc (next_generation_count): New static var.
13803         (Addr2line_cache_entry): New struct.
13804         (addr2line_cache): New static var.
13805         (Dwarf_line_info::one_addr2line): Added caching.
13806         (Dwarf_line_info::clear_addr2line_cache): New function.
13807         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13808         cache-size parameter.
13809         (Dwarf_line_info::one_addr2line_cache): New function.
13810         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13811         new cache-size argument to one_addr2line(), and clear cache.
13812
13813 2008-04-28  Cary Coutant  <ccoutant@google.com>
13814
13815         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13816         R_386_PC8 relocations.
13817
13818 2008-04-23  Ian Lance Taylor  <iant@google.com>
13819
13820         * object.cc (Sized_relobj::include_section_group): Check for
13821         invalid section group.
13822
13823         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13824         header size.
13825
13826         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13827         than read for file header.
13828         * archive.cc (Archive::include_member): Likewise.
13829
13830 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13831
13832         * aclocal.m4: Regenerate.
13833         * configure: Regenerate.
13834
13835 2008-04-19  Ian Lance Taylor  <iant@google.com>
13836
13837         * version.cc (version_string): Bump to 1.6.
13838
13839         * testsuite/Makefile.am (many_sections_r_test): New target.
13840         (many_sections_r_test_SOURCES): Remove.
13841         (many_sections_r_test_DEPENDENCIES): Remove.
13842         (many_sections_r_test_LDFLAGS): Remove.
13843         (many_sections_r_test_LDADD): Remove.
13844
13845         * object.cc (Sized_relobj::do_add_symbols): Always pass
13846         local_symbol_count_ to add_from_relobj.
13847
13848         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13849         every thousand variables.
13850         * testsuite/Makefile.in: Rebuild.
13851
13852         * object.cc (Xindex::initialize_symtab_xindex): New function.
13853         (Xindex::read_symtab_xindex): New function.
13854         (Xindex::sym_xindex_to_shndx): New function.
13855         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13856         available.
13857         (Sized_relobj::do_initialize_xindex): New function.
13858         (Sized_relobj::do_read_symbols): Adjust section links.
13859         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13860         parameter.  Change all callers.
13861         (Sized_relobj::include_section_group): Adjust section links and
13862         symbol section indexes.
13863         (Sized_relobj::do_layout): Adjust section links.
13864         (Sized_relobj::do_count_local_symbols): Adjust section links and
13865         symbol section indexes.
13866         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13867         ordinary and special symbols.
13868         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13869         dynsym_xindex parameters.  Change all callers.  Adjust section
13870         links.  Use SHN_XINDEX when needed.
13871         (Sized_relobj::get_symbol_location_info): Adjust section links.
13872         Don't get fooled by special symbols.
13873         * object.h (class Xindex): Define.
13874         (class Object): Add xindex_ parameter.  Declare virtual functoin
13875         do_initialize_xindex.
13876         (Object::adjust_sym_shndx): New function.
13877         (Object::set_xindex): New protected function.
13878         (class Symbol_value): Add is_ordinary_shndx_ field.
13879         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13880         (Symbol_value::value): Assert ordinary section.
13881         (Symbol_value::initialize_input_to_output_map): Likewise.
13882         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13883         Change all callers.
13884         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13885         all callers.
13886         (class Sized_relobj): Update declarations.
13887         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13888         parameter.  Change all callers.
13889         (Sized_relobj::adjust_shndx): New function.
13890         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13891         field.
13892         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13893         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13894         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13895         (Sized_dynobj::read_dynsym_section): Adjust section links.
13896         (Sized_dynobj::read_dynamic): Likewise.
13897         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13898         section links.
13899         (Sized_dynobj::do_initialize_xindex): New function.
13900         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13901         do_initialize_xindex.
13902         (Sized_dynobj::adjust_shndx): New function.
13903         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13904         dynsym_xindex_ fields.
13905         (Layout::finalize): Add a call to set_section_indexes before
13906         creating the symtab sections.
13907         (Layout::set_section_indexes): Don't do anything if the section
13908         already has a section index.
13909         (Layout::create_symtab_sections): Add shnum parameter.  Change
13910         caller.  Create .symtab_shndx section if needed.
13911         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13912         caller.
13913         (Layout::allocated_output_section_count): New function.
13914         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13915         needed.
13916         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13917         fields.  Update declarations.
13918         (Layout::symtab_xindex): New function.
13919         (Layout::dynsym_xindex): New function.
13920         (class Write_symbols_task): Add layout_ field.
13921         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13922         Change caller.
13923         * output.cc (Output_section_headers::Output_section_headers): Add
13924         shstrtab_section parameter.  Change all callers.
13925         (Output_section_headers::do_sized_write): Store overflow values
13926         for section count and section string table section index in
13927         section header zero.
13928         (Output_file_header::do_sized_write): Check for overflow of
13929         section count and section string table section index.
13930         (Output_symtab_xindex::do_write): New function.
13931         (Output_symtab_xindex::endian_do_write): New function.
13932         * output.h (class Output_section_headers): Add shstrtab_section_.
13933         Update declarations.
13934         (class Output_symtab_xindex): Define.
13935         (Output_section::has_out_shndx): New function.
13936         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13937         field.
13938         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13939         Change all callers.
13940         (Sized_symbol::init): Likewise.
13941         (Symbol::output_section): Check for ordinary symbol.
13942         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13943         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13944         callers.
13945         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13946         Change all callers.  Simplify handling of symbols from sections
13947         not included in the link.
13948         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13949         distinction.
13950         (Weak_alias_sorter::operator()): Assert that symbols are
13951         ordinary.
13952         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13953         distinction.
13954         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13955         parameters.  Change all callers.
13956         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13957         symbol distinction.  Use SHN_XINDEX when needed.
13958         (Symbol_table::write_section_symbol): Add symtab_xindex
13959         parameter.  Change all callers.
13960         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13961         SHN_XINDEX when needed.
13962         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13963         declarations.
13964         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13965         (Symbol::is_defined): Check is_ordinary.
13966         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13967         (Symbol::is_absolute, Symbol::is_common): Likewise.
13968         (class Sized_symbol): Update declarations.
13969         (class Symbol_table): Update declarations.
13970         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13971         parameters.  Change all callers.
13972         (Sized_symbol::override): Likewise.
13973         (Symbol_table::override): Likewise.
13974         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13975         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13976         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13977         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13978         to be in an ordinary section.
13979         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13980         object and is_ordinary parameters.  Change all callers.
13981         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13982         Change all callers.  Don't add undefined or non-ordinary symbols
13983         to reloc_map_.
13984         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13985         Change all callers.
13986         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13987         declarations.
13988         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13989         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13990         (Sized_relobj::relocate_sections): Likewise.
13991         * target-reloc.h (scan_relocs): Adjust section symbol index.
13992         (scan_relocatable_relocs): Likewise.
13993         * i386.cc (Scan::local): Check for ordinary symbols.
13994         * sparc.cc (Scan::local): Likewise.
13995         * x86_64.cc (Scan::local): Likewise.
13996         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13997         to symbol_section_and_value.
13998         * testsuite/many_sections_test.cc: New file.
13999         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14000         (check_PROGRAMS): Add many_sections_test.
14001         (many_sections_test_SOURCES): Define.
14002         (many_sections_test_DEPENDENCIES): Define.
14003         (many_sections_test_LDFLAGS): Define.
14004         (BUILT_SOURCES): Add many_sections_define.h.
14005         (many_sections_define.h): New target.
14006         (BUILT_SOURCES): Add many_sections_check.h.
14007         (many_sections_check.h): New target.
14008         (check_PROGRAMS): Add many_sections_r_test.
14009         (many_sections_r_test_SOURCES): Define.
14010         (many_sections_r_test_DEPENDENCIES): Define.
14011         (many_sections_r_test_LDFLAGS): Define.
14012         (many_sections_r_test_LDADD): Define.
14013         (many_sections_r_test.o): New target.
14014         * testsuite/Makefile.in: Rebuild.
14015
14016 2008-04-17  Cary Coutant  <ccoutant@google.com>
14017
14018         * errors.cc (Errors::info): New function.
14019         (gold_info): New function.
14020         * errors.h (Errors::info): New function.
14021         * gold.h (gold_info): New function.
14022         * object.cc (Input_objects::add_object): Print trace output.
14023         * options.cc (options::parse_set): New function.
14024         (General_options::parse_wrap): Deleted.
14025         (General_options::General_options): Deleted initializer.
14026         * options.h (options::String_set): New typedef.
14027         (options::parse_set): New function.
14028         (DEFINE_set): New macro.
14029         (General_options::wrap): Changed to use DEFINE_set. Changed
14030         callers of any_wrap_symbols and is_wrap_symbol.
14031         (General_options::trace, General_options::trace_symbol):
14032         New options.
14033         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14034         (General_options::wrap_symbols_): Deleted.
14035         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14036
14037 2008-04-17  David S. Miller  <davem@davemloft.net>
14038
14039         * options.cc (General_options::parse_V): New function.
14040         * options.h: Add entries for -V and -Qy.
14041
14042 2008-04-17  Ian Lance Taylor  <iant@google.com>
14043
14044         * common.cc (Symbol_table::allocate_commons): Remove options
14045         parameter.  Change caller.
14046         (Symbol_table::do_allocate_commons): Remove options parameter.
14047         Change caller.  Just call do_allocate_commons_list twice.
14048         (Symbol_table::do_allocate_commons_list): New function, broken out
14049         of do_allocate_commons.
14050         * common.h (class Allocate_commons_task): Remove options_ field.
14051         Update constructor.
14052         * symtab.cc (Symbol_table::Symbol_table): Initialize
14053         tls_commons_.
14054         (Symbol_table::add_from_object): Put TLS common symbols on
14055         tls_commons_ list.
14056         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14057         which are IN_OUTPUT_DATA.
14058         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14059         allocate_commons and do_allocate_commons declarations.  Declare
14060         do_allocate_commons_list.
14061         * gold.cc (queue_middle_tasks): Update creation of
14062         Allocate_commons_task to not pass options.
14063         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14064         (TLS_TEST_C_FLAGS): New variable.
14065         (tls_test_c_pic.o): New target.
14066         (tls_test_shared.so): Link in tls_test_c_pic.o.
14067         (tls_test_c_pic_ie.o): New target.
14068         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14069         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14070         (tls_test_c.o): New target.
14071         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14072         (tls_pic_test_LDADD): Likewise.
14073         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14074         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14075         (tls_test_c_gnu2.o): New target.
14076         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14077         tls_test_c_gnu2.o.
14078         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14079         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14080         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14081         * testsuite/tls_test.cc: Include "config.h".
14082         (t_last): Call t11_last.
14083         * testsuite/tls_test.h (t11, t11_last): Declare.
14084         * testsuite/tls_test_c.c: New file.
14085         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14086         * configure.ac: Check for OpenMP support.
14087         * configure, config.in, Makefile.in: Rebuild.
14088         * testsuite/Makefile.in: Rebuild.
14089
14090 2008-04-16  Cary Coutant  <ccoutant@google.com>
14091
14092         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14093         (Target_i386::tls_base_symbol_defined_): New field.
14094         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14095         (Target_i386::Scan::global): Likewise.
14096         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14097         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14098         (Target_x86_64::tls_base_symbol_defined_): New field.
14099         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14100         (Target_x86_64::Scan::global): Likewise.
14101
14102 2008-04-16  Cary Coutant  <ccoutant@google.com>
14103
14104         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14105         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14106         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14107         building shared libraries.
14108         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14109         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14110         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14111         * testsuite/Makefile.in: Rebuild.
14112         * testsuite/weak_undef.h: New file.
14113         * testsuite/weak_undef_file1.cc: Add extra test cases.
14114         * testsuite/weak_undef_file2.cc: Likewise.
14115         * testsuite/weak_undef_test.cc: Likewise.
14116
14117 2008-04-16  David S. Miller  <davem@davemloft.net>
14118
14119         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14120         Add issued_non_pic_error_ field.  Declare check_non_pic.
14121         (Target_sparc::Scan::check_non_pic): New function.
14122         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14123         (Target_sparc::Scan::global): Likewise.
14124
14125         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14126         * configure: Rebuild.
14127
14128         * options.h (DEFINE_enable): New macro.
14129         (new_dtags): New enable option.
14130         (initfirst, interpose, loadfltr, nodefaultlib,
14131         nodelete, nodlopen, nodump): New -z options.
14132         * layout.cc (Layout:finish_dynamic_section): If new
14133         dtags enabled, emit DT_RUNPATH.  Also, emit a
14134         DT_FLAGS_1 containing any specified -z flags.
14135
14136 2008-04-16  Ian Lance Taylor  <iant@google.com>
14137
14138         * copy-relocs.cc: New file.
14139         * copy-relocs.h: New file.
14140         * reloc.cc: Remove Copy_relocs code.
14141         * reloc.h: Likewise.
14142         * reloc-types.h (struct Reloc_types) [both versions]: Add
14143         get_reloc_addend_noerror.
14144         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14145         variants of add_global which take an addend which must be zero.
14146         * i386.cc: Include "copy-relocs.h".
14147         (class Target_i386): Change type of copy_relocs_ to variable,
14148         update initializer.
14149         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14150         Change all callers.
14151         (Target_i386::do_finalize_sections): Change handling of
14152         copy_relocs_.
14153         * sparc.cc: Include "copy-relocs.h".
14154         (class Target_sparc): Change type of copy_relocs_ to variable,
14155         update initializer.
14156         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14157         Change all callers.
14158         (Target_sparc::do_finalize_sections): Change handling of
14159         copy_relocs_.
14160         * x86_64.cc: Include "copy-relocs.h".
14161         (class Target_x86_64): Change type of copy_relocs_ to variable,
14162         update initializer.
14163         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14164         class.  Change all callers.
14165         (Target_x86_64::do_finalize_sections): Change handling of
14166         copy_relocs_.
14167         * Makefile.am (CCFILES): Add copy-relocs.cc.
14168         (HFILES): Add copy-relocs.h.
14169
14170         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14171
14172         * testsuite/script_test_4.sh: Permit leading zeroes.
14173
14174 2008-04-15  Ian Lance Taylor  <iant@google.com>
14175
14176         * script-sections.cc (Script_sections::create_segments): Use
14177         header_size_adjustment even when there is enough room for the
14178         headers.
14179         * testsuite/script_test_4.sh: New file.
14180         * testsuite/script_test_4.t: New file.
14181         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14182         (check_DATA): Add script_test_4.stdout.
14183         (MOSTLYCLEANFILES): Likewise.
14184         (script_test_4): New target.
14185         (script_test_4.stdout): New target.
14186         * testsuite/Makefile.in: Rebuild.
14187
14188         * sparc.cc: Add definitions for Output_data_plt_sparc class
14189         constants.
14190
14191 2008-04-14  David S. Miller  <davem@davemloft.net>
14192
14193         * sparc.cc: New file.
14194         * Makefile.am (TARGETSOURCES): Add sparc.cc
14195         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14196         * configure.tgt: Document targ_extra_size and
14197         targ_extra_big_endian.  Add entries for sparc-* and
14198         sparc64-*.
14199         * configure.ac: Handle targ_extra_size and
14200         targ_extra_big_endian.
14201         * Makefile.in: Rebuild.
14202         * configure: Likewise.
14203         * po/POTFILES.in: Likewise.
14204         * po/gold.pot: Likewise.
14205
14206 2008-04-14  Ian Lance Taylor  <iant@google.com>
14207
14208         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14209         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14210         in the name/type/flags to section mapping.  Don't call
14211         allocate_output_section.
14212         (Layout::choose_output_section): Change parameter from adjust_name
14213         to is_input_section.  Don't permit input sections after sections
14214         are attached to segments.  Don't call allocate_output_section.
14215         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14216         not write_enable_output_section.
14217         (Layout::make_output_section): Don't push to
14218         unattached_section_list_ nor call attach_to_segment.  Call
14219         attach_section_to_segment if sections are attached.
14220         (Layout::attach_sections_to_segments): New function.
14221         (Layout::attach_section_to_segment): New function.
14222         (Layout::attach_allocated_section_to_segment): Rename from
14223         attach_to_segment.  Remove flags parameter.
14224         (Layout::allocate_output_section): Remove function.
14225         (Layout::write_enable_output_section): Remove function.
14226         * layout.h (class Layout): Update for above changes.  Add new
14227         field sections_are_attached_.
14228         * output.h (Output_section::update_flags_for_input_section): New
14229         function.
14230         * output.cc (Output_section::add_input_section): Call
14231         update_flags_for_input_section.
14232         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14233
14234 2008-04-11  Cary Coutant  <ccoutant@google.com>
14235
14236         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14237         thought unnecessary.
14238         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14239
14240 2008-04-11  Ian Lance Taylor  <iant@google.com>
14241
14242         * output.h (class Output_section_data): Remove inline definition
14243         of set_addralign.
14244         * output.cc (Output_section_data::set_addralign): New function.
14245
14246 2008-04-11  Cary Coutant  <ccoutant@google.com>
14247
14248         Add support for TLS descriptors for i386 and x86_64.
14249         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14250         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14251         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14252         GOT_TYPE_TLS_DESC.
14253         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14254         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14255         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14256         relocations.
14257         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14258         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14259         Fix problem with initial-exec relocations.
14260         (Target_i386::Relocate::relocate_tls): Likewise.
14261         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14262         relaxation.
14263         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14264         support for section-plus-offset dynamic table entries.
14265         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14266         (Output_data_dynamic::Dynamic_entry): Add support for
14267         section-plus-offset dynamic table entries.
14268         (Output_data_dynamic::Classification): Likewise.
14269         (Output_data_dynamic::classification_): Renamed offset_.
14270         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14271         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14272         (Target_x86_64::make_plt_section): New function.
14273         (Target_x86_64::reserve_tlsdesc_entries): New function.
14274         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14275         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14276         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14277         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14278         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14279         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14280         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14281         add extra PLT entry for TLS descriptors.
14282         (Output_data_plt_x86_64::got_): New field.
14283         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14284         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14285         fields.
14286         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14287         descriptors.
14288         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14289         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14290         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14291         R_386_TLS_DESC_CALL relocations.
14292         (Target_x86_64::Scan::global): Likewise.
14293         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14294         for TLS descriptors.
14295         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14296         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14297         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14298         GD-to-IE relaxation.
14299         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14300         and TLS_DESCRIPTORS.
14301         * Makefile.in: Rebuild.
14302         * configure: Rebuild.
14303         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14304         (tls_test_shared2.so): New target.
14305         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14306         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14307         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14308         (tls_shared_gd_to_ie_test_LDADD): New variable.
14309         (tls_shared_gnu2_gd_to_ie_test): New target.
14310         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14311         New targets.
14312         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14313         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14314         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14315         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14316         (tls_shared_gnu2_test): New target.
14317         (tls_test_gnu2_shared.so): New target.
14318         (tls_shared_gnu2_test_SOURCES): New variable.
14319         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14320         (tls_shared_gnu2_test_LDFLAGS): New variable.
14321         (tls_shared_gnu2_test_LDADD): New variable.
14322         * testsuite/Makefile.in: Rebuild.
14323         * testsuite/Makefile.
14324
14325 2008-04-11  Ian Lance Taylor  <iant@google.com>
14326
14327         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14328         justsyms.t.
14329         * testsuite/Makefile.in: Rebuild.
14330
14331         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14332         long.
14333         * testsuite/script_test_2.cc (main): Adjust test.
14334
14335 2008-04-11  David S. Miller  <davem@davemloft.net>
14336             Ian Lance Taylor  <iant@google.com>
14337
14338         * options.h (General_options): Add entries for '-Y' and
14339         '-relax'.
14340         * options.cc (General_options:finalize): If -Y was used, add those
14341         entries to the library path instead of the default "/lib" and
14342         "/usr/lib".
14343
14344 2008-04-11  David S. Miller  <davem@davemloft.net>
14345
14346         * testsuite/justsyms.t: Start at 0x100.
14347         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14348         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14349         long.
14350         * testsuite/script_test_2.cc: Adjust string and section length
14351         checks.
14352
14353 2008-04-09  Ian Lance Taylor  <iant@google.com>
14354
14355         PR gold/5996
14356         * script-sections.cc (Sections_element::allocate_to_segment): Add
14357         orphan parameter.
14358         (Output_section_definition::allocate_to_segment): Likewise.
14359         (Orphan_output_section::allocate_to_segment): Likewise.
14360         (Script_sections::attach_sections_using_phdrs_clause): Don't
14361         propagate non-PT_LOAD segments to orphan sections.
14362         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14363         readelf rather than objdump.
14364         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14365         .interp section and PT_INTERP segment are the same size.
14366         * testsuite/Makefile.in: Rebuild.
14367
14368         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14369         aliases for symbols defined in the same object.
14370         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14371         (weak_alias_test_SOURCES): New variable.
14372         (weak_alias_test_DEPENDENCIES): New variable.
14373         (weak_alias_test_LDFLAGS): New variable.
14374         (weak_alias_test_LDADD): New variable.
14375         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14376         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14377         (weak_alias_test_3.o): New target.
14378         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14379         * testsuite/weak_alias_test_main.cc: New file.
14380         * testsuite/weak_alias_test_1.cc: New file.
14381         * testsuite/weak_alias_test_2.cc: New file.
14382         * testsuite/weak_alias_test_3.cc: New file.
14383
14384 2008-04-08  Ian Lance Taylor  <iant@google.com>
14385
14386         * options.h (class General_options): Add --noinhibit-exec option.
14387         * main.cc (main): Check --noinhibit-exec.
14388
14389         * options.h (class General_options): Define --wrap as a special
14390         option.  Add wrap_symbols_ field.
14391         (General_options::any_wrap_symbols): New function.
14392         (General_options::is_wrap_symbol): New function.
14393         * options.cc (General_options::parse_wrap): New function.
14394         (General_options::General_options): Initialize wrap_symbols_.
14395         * symtab.cc (Symbol_table::wrap_symbol): New function.
14396         (Symbol_table::add_from_object): Handle --wrap.
14397         * symtab.h (class Symbol_table): Declare wrap_symbol.
14398         * target.h (Target::wrap_char): New function.
14399         (Target::Target_info): Add wrap_char field.
14400         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14401         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14402         * testsuite/testfile.cc (Target_test::test_target_info):
14403         Likewise.
14404
14405         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14406         there is one.
14407
14408         * layout.h (class Layout): Add added_eh_frame_data_ field.
14409         * layout.cc (Layout::Layout): Initialize new field.
14410         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14411         output section until we find a section we merged successfully.
14412         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14413         that the size be non-zero.
14414
14415         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14416         qualifier.
14417
14418 2008-04-08  Craig Silverstein  <csilvers@google.com>
14419
14420         * configure.ac: Export new conditional variable HAVE_ZLIB.
14421         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14422         on HAVE_ZLIB.
14423         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14424         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14425
14426 2008-04-07  Ian Lance Taylor  <iant@google.com>
14427
14428         * version.cc (version_string): Set to "1.5".
14429
14430         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14431         Add issued_non_pic_error_ field.  Declare check_non_pic.
14432         (Target_x86_64::Scan::check_non_pic): New function.
14433         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14434         (Target_x86_64::Scan::global): Likewise.
14435
14436         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14437         addend parameter.  Change caller.  Handle merge sections.
14438         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14439         Address to Addend.  Don't add in the result of
14440         local_section_offset, pass down the addend and use the returned
14441         value.
14442         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14443         Update declarations of local_section_offset and symbol_value.
14444         * testsuite/two_file_test_1.cc (t18): New function.
14445         * testsuite/two_file_test_2.cc (f18): New function.
14446         * testsuite/two_file_test_main.cc (main): Call t18.
14447         * testsuite/two_file_test.h (t18, f18): Declare.
14448
14449         * configure.ac: Don't test for objdump, c++filt, or readelf.
14450         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14451         conditionals.
14452         (TEST_READELF): New variable.
14453         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14454         (check_PROGRAMS): Add two_file_strip_test.
14455         (two_file_strip_test): New target.
14456         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14457         (two_file_same_shared_strip_test_SOURCES): New variable.
14458         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14459         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14460         (two_file_same_shared_strip_test_LDADD): New variable.
14461         (two_file_shared_strip.so): New target.
14462         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14463         (ver_test_5.syms, ver_test_7.syms): Likewise.
14464         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14465         (strip_test_3.stdout): Use TEST_OBJDUMP.
14466         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14467
14468 2008-04-04  Cary Coutant  <ccoutant@google.com>
14469
14470         * symtab.h (Symbol::is_weak_undefined): New function.
14471         (Symbol::is_strong_undefined): New function.
14472         (Symbol::is_absolute): New function.
14473         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14474         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14475         absolute symbols.
14476         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14477         (weak_undef_test): New target.
14478         * testsuite/Makefile.in: Rebuild.
14479         * testsuite/weak_undef_file1.cc: New file.
14480         * testsuite/weak_undef_file2.cc: New file.
14481         * testsuite/weak_undef_test.cc: New file.
14482
14483 2008-04-03  Craig Silverstein  <csilvers@google.com>
14484
14485         * compressed_output.h (class Output_compressed_section): Use
14486         unsigned buffer.
14487         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14488         add zlib header.
14489         (zlib_compressed_suffix): Removed.
14490         (Output_compressed_section::set_final_data_size): Use unsigned
14491         buffers.
14492         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14493         Fix linker invocation.
14494         (flagstest_o_specialfile_and_compress_debug_sections):
14495         Likewise.
14496         * testsuite/Makefile.in: Regenerated.
14497
14498 2008-04-02  David S. Miller  <davem@davemloft.net>
14499
14500         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14501         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14502
14503 2008-04-02  Craig Silverstein  <csilvers@google.com>
14504
14505         * TODO: New file.
14506
14507 2008-04-02  Ian Lance Taylor  <iant@google.com>
14508
14509         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14510         parameters.  Update for new key type to views_.  Change all
14511         callers.
14512         (File_read::read): Adjust for byteshift in returned view.
14513         (File_read::add_view): New function, broken out of
14514         find_and_make_view.
14515         (File_read::make_view): New function, broken out of
14516         find_and_make_view.
14517         (File_read::find_or_make_view): Add offset and aligned
14518         parameters.  Rewrite accordingly.  Change all callers.
14519         (File_read::get_view): Add offset and aligned parameters.  Adjust
14520         for byteshift in return value.
14521         (File_read::get_lasting_view): Likewise.
14522         * fileread.h (class File_read): Update declarations.
14523         (class File_read::View): Add byteshift_ field.  Add byteshift to
14524         constructor.  Add byteshift method.
14525         * archive.h (Archive::clear_uncached_views): New function.
14526         (Archive::get_view): Add aligned parameter.  Change all callers.
14527         * object.h (Object::get_view): Add aligned parameter.  Change all
14528         callers.
14529         (Object::get_lasting_view): Likewise.
14530
14531         * fileread.cc (File_read::release): Don't call clear_views if
14532         there are multiple objects.
14533         * fileread.h (File_read::clear_uncached_views): New function.
14534         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14535         on the archive.
14536
14537 2008-03-31  Cary Coutant  <ccoutant@google.com>
14538
14539         Add thin archive support.
14540         * archive.cc (Archive::armagt): New const.
14541         (Archive::setup): Remove task parameter and calls to unlock.
14542         (Archive::unlock_nested_archives): New function.
14543         (Archive::read_header): Add nested_off parameter. Change
14544         all callers.
14545         (Archive::interpret_header): Likewise.
14546         (Archive::include_all_members): Change to handle thin
14547         archives.
14548         (Archive::include_member): Likewise.
14549         * archive.h (Archive::Archive): Add new parameters and
14550         initializers.
14551         (Archive::armagt): New const.
14552         (Archive::setup): Remove task parameter.
14553         (Archive::unlock_nested_archives): New function.
14554         (Archive::read_header): Add nested_off parameter.
14555         (Archive::interpret_header): Likewise.
14556         (Archive::Nested_archive_table): New typedef.
14557         (Archive::is_thin_archive_): New field.
14558         (Archive::nested_archives_): New field.
14559         (Archive::options_): New field.
14560         (Archive::dirpath_): New field.
14561         (Archive::task_): New field.
14562         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14563         for thin archives.  Pass additional parameters to
14564         Archive::Archive.  Unlock the archive file after calling
14565         Archive::setup.
14566
14567 2008-03-29  Ian Lance Taylor  <iant@google.com>
14568
14569         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14570         version symbol to be local.
14571         * testsuite/ver_test_4.sh: New file.
14572         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14573         (check_DATA): Add ver_test_4.syms.
14574         (ver_test_4.syms): New target.
14575         * testsuite/Makefile.in: Rebuild.
14576
14577         * output.cc
14578         (Output_section::Input_section_sort_entry::has_priority): New
14579         function.
14580         (Output_section::Input_section_sort_entry::match_file_name): New
14581         function.
14582         (Output_section::Input_section_sort_entry::match_section_name):
14583         Remove.
14584         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14585         Remove.
14586         (Output_section::Input_section_sort_entry::match_section_file):
14587         Remove.
14588         (Output_section::Input_section_sort_compare::operator()): Rewrite
14589         using new Input_section_sort_entry functions.  Sort crtbegin and
14590         crtend first.  Sort sections with no priority before sections with
14591         a priority.
14592         * testsuite/initpri1.c (d3): Check j != 4.
14593         (cd5): New constructor/destructor function.
14594         (main): Check j != 2.
14595
14596         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14597         new symbol when resolving, don't call set_is_default.
14598         * testsuite/ver_test_7.cc: New file.
14599         * testsuite/ver_test_7.sh: New file.
14600         * testsuite/Makefile.am (ver_test_7.so): New target.
14601         (ver_test_7.o): New target.
14602         (check_SCRIPTS): Add ver_test_7.sh.
14603         (check_DATA): Add ver_test_7.syms.
14604         (ver_test_7.syms): New target.
14605
14606 2008-03-28  Ian Lance Taylor  <iant@google.com>
14607
14608         * layout.cc (Layout::layout): If we see an input section with a
14609         name that needs sorting, set the must_sort flag for the output
14610         section.
14611         (Layout::make_output_section): If the name of the output section
14612         indicates that it might require sorting, set the may_sort flag.
14613         * output.h (Output_section::may_sort_attached_input_sections): New
14614         function.
14615         (Output_section::set_may_sort_attached_input_sections): New
14616         function.
14617         (Output_section::must_sort_attached_input_sections): New
14618         function.
14619         (Output_section::set_must_sort_attached_input_sections): New
14620         function.
14621         (class Output_section): Declare Input_section_sort_entry.  Define
14622         Input_section_sort_compare.  Declare
14623         sort_attached_input_sections.  Add new fields:
14624         may_sort_attached_input_sections_,
14625         must_sort_attached_input_sections_,
14626         attached_input_sections_are_sorted_.
14627         * output.cc (Output_section::Output_section): Initialize new
14628         fields.
14629         (Output_section::add_input_section): Add an entry to
14630         input_sections_ if may_sort or must_sort are true.
14631         (Output_section::set_final_data_size): Call
14632         sort_attached_input_sections if necessary.
14633         (Output_section::Input_section_sort_entry): Define new class.
14634         (Output_section::Input_section_sort_compare::operator()): New
14635         function.
14636         (Output_section::sort_attached_input_sections): New function.
14637         * configure.ac: Check whether the compiler supports constructor
14638         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14639         * testsuite/initpri1.c: New file.
14640         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14641         CONSTRUCTOR_PRIORITY.
14642         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14643         (initpri1_LDFLAGS): New variable.
14644         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14645
14646 2008-03-27  Ian Lance Taylor  <iant@google.com>
14647
14648         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14649         * testsuite/common_test_1.c: New file.
14650         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14651         (common_test_1_SOURCES): New variable.
14652         (common_test_1_DEPENDENCIES): New variable.
14653         (common_test_1_LDFLAGS): New variable.
14654
14655         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14656         and commons_ correctly when NAME/VERSION does not override
14657         NAME/NULL.
14658         * testsuite/ver_test_6.c: New file.
14659         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14660         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14661         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14662
14663 2008-03-26  Ian Lance Taylor  <iant@google.com>
14664
14665         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14666         of an undefined symbol from a version script.
14667         * testsuite/Makefile.am (ver_test_5.so): New target.
14668         (ver_test_5.o): New target.
14669         (check_SCRIPTS): Add ver_test_5.sh.
14670         (check_DATA): Add ver_test_5.syms.
14671         (ver_test_5.syms): New target.
14672         * testsuite/ver_test_5.cc: New file.
14673         * testsuite/ver_test_5.script: New file.
14674         * testsuite/ver_test_5.sh: New file.
14675         * Makefile.in, testsuite/Makefile.in: Rebuild.
14676
14677         PR gold/5986
14678         Fix problems building gold with gcc 4.3.0.
14679         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14680         (gold_error_at_location, gold_warning_at_location): Use it.
14681         * configure.ac: Check whether we can compile and use a template
14682         function with a printf attribute.
14683         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14684         when jumping over bytes.
14685         * object.cc: Instantiate Object::read_section_data.
14686         * debug.h: Include <cstring>
14687         * dwarf_reader.cc: Include <algorithm>
14688         * main.cc: Include <cstring>.
14689         * options.cc: Include <cstring>.
14690         * output.cc: Include <cstring>.
14691         * script.cc: Include <cstring>.
14692         * script.h: Include <string>.
14693         * symtab.cc: Include <cstring> and <algorithm>.
14694         * target-select.cc: Include <cstring>.
14695         * version.cc: Include <string>.
14696         * testsuite/testmain.cc: Include <cstdlib>.
14697         * configure, config.in: Rebuild.
14698
14699 2008-03-25  Ian Lance Taylor  <iant@google.com>
14700
14701         * options.cc: Include "../bfd/bfdver.h".
14702         (options::help): Print bug reporting address.
14703
14704         * version.cc (print_version): Adjust output for current value of
14705         BFD_VERSION_STRING.
14706
14707         * NEWS: New file.
14708
14709         * options.cc (options::help): Print list of supported targets.
14710         * target-select.h: Include <vector>.
14711         (class Target_selector): Make machine_, size_, and is_big_endian_
14712         fields const.  Add bfd_name_ and instantiated_target_ fields.
14713         (Target_selector::Target_selector): Add bfd_name parameter.
14714         (Target_selector::recognize): Make non-virtual, call
14715         do_recognize.
14716         (Target_selector::recognize_by_name): Make non-virtual, call
14717         do_recognize_by_name.
14718         (Target_selector::supported_names): New function.
14719         (Target_selector::bfd_name): New function.
14720         (Target_selector::do_instantiate_target): New pure virtual
14721         function.
14722         (Target_selector::do_recognize): New virtual function.
14723         (Target_selector::do_recognize_by_name): New virtual function.
14724         (Target_selector::instantiate_target): New private function.
14725         (supported_target_names): Declare.
14726         * target-select.cc (Target_selector::Target_selector): Update for
14727         new parameter and fields.
14728         (select_target_by_name): Check that the name matches before
14729         calling recognize_by_name.
14730         (supported_target_names): New function.
14731         * i386.cc (class Target_selector_i386): Update Target_selector
14732         constructor call.  Remove recognize and recognize_by_name.  Add
14733         do_instantiate_target.
14734         * x86_64.cc (class Target_selector_x86_64): Likewise.
14735         * testsuite/testfile.cc (class Target_selector_test): Update for
14736         changes to Target_selector.
14737
14738         * README: Rewrite, with some notes on unsupported features.
14739
14740 2008-03-24  Cary Coutant  <ccoutant@google.com>
14741
14742         * i386.cc (Target_i386::Got_type): New enum declaration.
14743         (Target_i386::Scan::local): Updated callers of Output_data_got
14744         member functions.
14745         (Target_i386::Scan::global): Likewise.
14746         (Target_i386::Relocate::relocate): Likewise.
14747         (Target_i386::Relocate::relocate_tls): Likewise.
14748         * object.h (Got_offset_list): New class.
14749         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14750         (Sized_relobj::local_got_offset): Likewise.
14751         (Sized_relobj::set_local_got_offset): Likewise.
14752         (Sized_relobj::local_has_tls_got_offset): Removed.
14753         (Sized_relobj::local_tls_got_offset): Removed.
14754         (Sized_relobj::set_local_tls_got_offset): Removed.
14755         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14756         * output.cc (Output_data_got::add_global): Added got_type parameter.
14757         (Output_data_got::add_global_with_rel): Likewise.
14758         (Output_data_got::add_global_with_rela): Likewise.
14759         (Output_data_got::add_global_pair_with_rel): New function.
14760         (Output_data_got::add_global_pair_with_rela): New function.
14761         (Output_data_got::add_local): Added got_type parameter.
14762         (Output_data_got::add_local_with_rel): Likewise.
14763         (Output_data_got::add_local_with_rela): Likewise.
14764         (Output_data_got::add_local_pair_with_rel): New function.
14765         (Output_data_got::add_local_pair_with_rela): New function.
14766         (Output_data_got::add_global_tls): Removed.
14767         (Output_data_got::add_global_tls_with_rel): Removed.
14768         (Output_data_got::add_global_tls_with_rela): Removed.
14769         (Output_data_got::add_local_tls): Removed.
14770         (Output_data_got::add_local_tls_with_rel): Removed.
14771         (Output_data_got::add_local_tls_with_rela): Removed.
14772         * output.h (Output_data_got::add_global): Added got_type parameter.
14773         (Output_data_got::add_global_with_rel): Likewise.
14774         (Output_data_got::add_global_with_rela): Likewise.
14775         (Output_data_got::add_global_pair_with_rel): New function.
14776         (Output_data_got::add_global_pair_with_rela): New function.
14777         (Output_data_got::add_local): Added got_type parameter.
14778         (Output_data_got::add_local_with_rel): Likewise.
14779         (Output_data_got::add_local_with_rela): Likewise.
14780         (Output_data_got::add_local_pair_with_rel): New function.
14781         (Output_data_got::add_local_pair_with_rela): New function.
14782         (Output_data_got::add_global_tls): Removed.
14783         (Output_data_got::add_global_tls_with_rel): Removed.
14784         (Output_data_got::add_global_tls_with_rela): Removed.
14785         (Output_data_got::add_local_tls): Removed.
14786         (Output_data_got::add_local_tls_with_rel): Removed.
14787         (Output_data_got::add_local_tls_with_rela): Removed.
14788         * resolve.cc (Symbol::override_base_with_special): Removed
14789         reference to has_got_offset_ field.
14790         * symtab.cc (Symbol::init_fields): Replaced initialization
14791         of got_offset_ with got_offsets_.  Removed initialization
14792         of has_got_offset_
14793         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14794         (Symbol::got_offset): Likewise.
14795         (Symbol::set_got_offset): Likewise.
14796         (Symbol::has_tls_got_offset): Removed.
14797         (Symbol::tls_got_offset): Removed.
14798         (Symbol::set_tls_got_offset): Removed.
14799         (Symbol::got_offset_): Removed.
14800         (Symbol::tls_mod_got_offset_): Removed.
14801         (Symbol::tls_pair_got_offset_): Removed.
14802         (Symbol::got_offsets_): New field.
14803         (Symbol::has_got_offset): Removed.
14804         (Symbol::has_tls_mod_got_offset): Removed.
14805         (Symbol::has_tls_pair_got_offset): Removed.
14806         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14807         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14808         member functions.
14809         (Target_x86_64::Scan::global): Likewise.
14810         (Target_x86_64::Relocate::relocate): Likewise.
14811         (Target_x86_64::Relocate::relocate_tls): Likewise.
14812
14813 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14814
14815         * yyscript.y: Fix spelling error in comment.
14816
14817 2008-03-24  Ian Lance Taylor  <iant@google.com>
14818
14819         * options.h (class General_options): Define build_id option.
14820         * layout.h (class Layout): Declare write_build_id, create_note,
14821         create_build_id.  Add build_id_note_ member.
14822         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14823         "libiberty.h", "md5.h", "sha1.h".
14824         (Layout::Layout): Initialize eh_frame_data_,
14825         eh_frame_hdr_section_, and build_id_note_.
14826         (Layout::finalize): Call create_build_id.
14827         (Layout::create_note): New function, broken out of
14828         Layout::create_gold_note.
14829         (Layout::create_gold_note): Call create_note.
14830         (Layout::create_build_id): New function.
14831         (Layout::write_build_id): New function.
14832         (Close_task_runner::run): Call write_build_id.
14833
14834         * x86_64.cc: Correct license to GPLv3.
14835
14836 2008-03-23  Ian Lance Taylor  <iant@google.com>
14837
14838         * options.cc: Include "demangle.h".
14839         (parse_optional_string): New function.
14840         (parse_long_option): Handle takes_optional_argument.
14841         (parse_short_option): Update dash_z initializer.  Handle
14842         takes_optional_argument.
14843         (General_options::General_options): Initialize do_demangle_.
14844         (General_options::finalize): Set do_demangle_.  Handle demangling
14845         style.
14846         * options.h (parse_optional_string): Declare.
14847         (struct One_option): Add optional_arg field.  Update constructor.
14848         Update call constructor calls.  Add takes_optional_argument
14849         function.
14850         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14851         (DEFINE_optional_string): Define.
14852         (General_options::demangle): Change from DEFINE_bool to
14853         DEFINE_optional_string.
14854         (General_options::no_demangle): New function.
14855         (General_options::do_demangle): New function.
14856         (General_options::set_do_demangle): New function.
14857         (General_options::execstack_status_): Move definition to end of
14858         class definition.
14859         (General_options::static_): Likewise.
14860         (General_options::do_demangle_): New field.
14861         * object.cc (big_endian>::get_symbol_location_info): Call
14862         Options::do_demangle, not Options::demangle.
14863         * symtab.cc (demangle): Likewise.
14864
14865 2008-03-22  Ian Lance Taylor  <iant@google.com>
14866
14867         * gold.h: Include <cstddef> and <sys/types.h>
14868         * options.h: Include <cstring>.
14869
14870 2008-03-21  Ian Lance Taylor  <iant@google.com>
14871
14872         * Added source code to GNU binutils.
14873 \f
14874 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14875
14876 Copying and distribution of this file, with or without modification,
14877 are permitted in any medium without royalty provided the copyright
14878 notice and this notice are preserved.
14879
14880 Local Variables:
14881 mode: change-log
14882 left-margin: 8
14883 fill-column: 74
14884 version-control: never
14885 End: