2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
[external/binutils.git] / gold / ChangeLog
1 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2             Sriraman Tallam  <tmsriram@google.com>
3
4         * options.h (sort_section): New option.
5         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
6         Rename from Input_section_sort_section_name_special_ordering_compare.
7         (Input_section_sort_section_name_compare): New struct.
8         * output.cc (Output_section::Input_section_sort_section_name_compare::
9         operator()): New function.
10         (Output_section::sort_attached_input_sections): Use new sort function
11         for .text if --sort-section=name is specified.
12         * layout.cc (Layout::make_output_section):
13         Add sorting by name when --sort-section=name is specified.
14         * testsuite/Makefile.am (text_section_grouping): Test option
15         --sort-section=name.
16         * testsuite/Makefile.in: Regenerate.
17         * testsuite/section_sorting_name.cc: New file.
18         * testsuite/section_sorting_name.sh: New file.
19
20 2013-05-21  Cary Coutant  <ccoutant@google.com>
21
22         * symtab.h (Symbol::is_cxx_vtable): New function.
23         * target-reloc.h (relocate_section): Check for vtable symbol.
24         * testsuite/Makefile.am (missing_key_func.sh): New test case.
25         * testsuite/Makefile.in: Regenerate.
26         * testsuite/missing_key_func.cc: New test source.
27         * testsuite/missing_key_func.sh: New test script.
28
29 2013-05-21  Cary Coutant  <ccoutant@google.com>
30
31         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
32         type of enclosing symbol.
33         (Relocate_info::location): Check symbol type when describing symbol.
34         * object.h (Symbol_location_info): Remove unused line_number;
35         add enclosing_symbol_type.
36         * testsuite/debug_msg.sh: Adjust expected output.
37
38 2013-05-13  Cary Coutant  <ccoutant@google.com>
39
40         * configure.ac: Export DEFAULT_TARGET.
41         * configure: Regenerate.
42         * Makefile.in: Regenerate.
43         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
44         * testsuite/Makefile.in: Regenerate.
45         * testsuite/debug_msg.sh: Delete duplicate tests.
46         Don't check undef_int error message match for powerpc where the
47         source file and line number aren't available.
48
49 2013-05-10  Roland McGrath  <mcgrathr@google.com>
50
51         * options.h (General_options): Add --rosegment-gap option.
52         * options.cc (finalize): --rosegment-gap implies --rosegment.
53         * layout.cc (set_segment_offsets): Let user option override
54         target->rosegment_gap().
55
56 2013-05-10  Roland McGrath  <mcgrathr@google.com>
57
58         * options.h (General_options): Remove leading space from help
59         messages for -nostdlib and --rosegment.
60
61 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
62
63         PR ld/15365
64         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
65
66 2013-05-03  Alan Modra  <amodra@gmail.com>
67
68         * merge.cc (Output_merge_string::do_add_input_section): Correct
69         scan for number of strings.  Rename vars to avoid shadowing.
70         Include missing terminator in input_size_.
71
72 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
73
74         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
75         Restore empty string handling.
76
77 2013-05-01  Cary Coutant  <ccoutant@google.com>
78
79         * stringpool.cc (Stringpool_template::new_key_offset): Fix
80         uninitialized warning.
81
82 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
83
84         * output.cc (Output_section::add_merge_input_section): Allow
85         to merge sections if the alignment is more than character size.
86         * merge.h (Output_merge_string::Output_merge_string): Remove
87         assert.
88         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
89         only not-null strings. Check the alignment of strings.
90         * stringpool.h
91         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
92         alignment as the argument.
93         (Stringpool_template<Stringpool_char>::addralign_): New class member.
94         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
95         Align non-zero length strings according to the addralign_.
96         (Stringpool_template<Stringpool_char>::set_string_offsets):
97         Updating offsets according to the given alignment.
98         * testsuite/Makefile.am (text_section_grouping): Test if string
99         literals are getting merged.
100         * testsuite/Makefile.in: Regenerate.
101         * testsuite/merge_string_literals_1.c: New file.
102         * testsuite/merge_string_literals_2.c: Ditto.
103         * testsuite/merge_string_literals.sh: Ditto.
104
105 2013-04-26  Ian Lance Taylor  <iant@google.com>
106
107         * target-reloc.h (relocate_section): If the reloc offset is out of
108         range, pass VIEW as NULL to relocate.relocate.
109         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
110         * i386.cc (Target_i386::Relocate::relocate): Likewise.
111         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
112         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
113         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
114         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
115
116 2013-04-26  Geoff Pike  <gpike@chromium.org>
117
118         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
119         * layout.cc (Hash_task): New class.
120         (Layout::queue_build_id_tasks): New function.
121         (Layout::write_build_id): Handle single-thread portion of build ID
122         computation.  (In some cases, all of it is single-threaded.)  Replace
123         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
124         functionality in fewer lines of code.
125         * layout.h (Layout::queue_build_id_tasks): New function declaration.
126         * options.h (General_options): make "--build-id" default to tree
127         rather than sha1.  Add two new options related to --build-id=tree:
128         --build-id-chunk-size-for-treehash and
129         --build-id-min-file-size-for-treehash.
130         * Makefile.am: add testing of --build-id=tree and related new options
131         (these tests will be invoked by "make check").
132         * Makefile.in: Regenerate.
133
134 2013-04-25  Alan Modra  <amodra@gmail.com>
135
136         * configure.tgt: Add powerpcle and powerpc64le.
137
138 2013-04-22  Alan Modra  <amodra@gmail.com>
139
140         PR gold/15355
141         * layout.cc (Layout::segment_precedes): Allow more than one
142         segment with the same type and flags.
143
144 2013-04-15  Cary Coutant  <ccoutant@google.com>
145
146         * layout.cc (Layout::set_relocatable_section_offsets): Don't
147         allocate space in file for BSS sections.
148
149 2013-04-15  Cary Coutant  <ccoutant@google.com>
150
151         * script-sections.cc (Orphan_output_section): Reset address
152         to zero after each orphaned section for relocatable links.
153
154 2013-04-15  Cary Coutant  <ccoutant@google.com>
155
156         * symtab.cc (Symbol_table::sized_write_globals): Subtract
157         section starting address for relocatable link.
158         * testsuite/Makefile.am (script_test_11): New test.
159         * testsuite/Makefile.in: Regenerate.
160         * testsuite/script_test_11.c: New source file.
161         * testsuite/script_test_11.t: New linker script.
162
163 2013-04-13  Alan Modra  <amodra@gmail.com>
164
165         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
166         owner when sections are not adjacent and exceed group size.
167         (Target_powerpc::group_sections): Handle corner case.
168         (Target_powerpc::Branch_info::make_stub): Handle case where
169         stub table doesn't exist due to branches in non-exec sections.
170         (Target_powerpc::Relocate::relocate): Likewise.
171
172 2013-04-11  Alan Modra  <amodra@gmail.com>
173
174         PR gold/15354
175         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
176         .branch_lt to match bfd ld.  Adjust comments throughout file.
177
178 2013-04-04  Ian Lance Taylor  <iant@google.com>
179
180         GCC PR c++/56840
181         * object.cc (do_layout_deferred_sections): Handle .eh_frame
182         sections before checking whether they are included in the link.
183
184 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
185
186         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
187         object before calling the plugin claim_file handler.  Pass the elf
188         object of the archive to the plugin. Delete the elf object if the
189         plugin claims the file.
190
191 2013-03-21  Alan Modra  <amodra@gmail.com>
192
193         * layout.cc (Layout::set_segment_offsets): Accept writable .text
194         segment when omagic.
195
196 2013-03-21  Alan Modra  <amodra@gmail.com>
197
198         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
199         comparison warning.
200         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
201         uninitialized" warning.
202
203 2013-03-20  Alan Modra  <amodra@gmail.com>
204
205         * symtab.h (Symbol::clear_version): New function.
206         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
207         is_needed by weak references.  Clear version for symbols defined
208         in as-needed objects that are not needed.
209
210 2013-03-15  Alan Modra  <amodra@gmail.com>
211
212         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
213         static and public.  Add report_err param.  Return false for data refs.
214         (Target_powerpc::rela_dyn_section): New overloaded function.
215         (Target_powerpc::plt_, iplt_): Elucidate.
216         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
217         (Output_data_plt_powerpc::do_write): Don't write .iplt.
218         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
219         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
220         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
221         push_branch and make_plt_entry for ifunc syms when
222         reloc_needs_plt_for_ifunc.
223         (Target_powerpc::Relocate::relocate): Don't use plt entry value
224         for ifunc unless reloc_needs_plt_for_ifunc.
225
226 2013-03-15  Alan Modra  <amodra@gmail.com>
227
228         * gc.h (gc_process_relocs): Don't look through function descriptors.
229         * icf.cc (get_section_contents): Do so here instead.
230
231 2013-03-13  Alan Modra  <amodra@gmail.com>
232
233         * powerpc.cc (is_branch_reloc): Forward declare.
234         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
235         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
236         false for 64-bit, true for 32-bit non-branch relocs.
237         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
238         * testsuite/Makefile.am (icf_test): Use linker map file instead of
239         nm output.
240         (icf_safe_test): Generate linker map file as well as nm output.
241         (icf_safe_so_test): Likewise.
242         * testsuite/Makefile.in: Regenerate.
243         * testsuite/icf_test.sh: Parse linker map file to determine
244         section folding.
245         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
246         * testsuite/icf_safe_so_test.sh: Likewise.
247         (X86_32_or_ARM_specific_safe_fold): Merge into..
248         (arch_specific_safe_fold): ..this.
249         (X86_64_specific_safe_fold): Delete unused function.
250
251 2013-03-12  Alan Modra  <amodra@gmail.com>
252
253         * gc.h (gc_process_relocs): Look through function descriptors
254         to determine shndx, symvalue and addend used by ICF.  Tidy
255         variable duplication.
256
257 2013-03-11  Alan Modra  <amodra@gmail.com>
258
259         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
260         * layout.cc (Layout_task_runner::run): ..to here.
261         * symtab.h (struct Symbol_location): Extract from..
262         (class Symbol_table): ..here.
263         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
264         * target.h (class Target): Add function_location and
265         do_function_location functions.
266         (class Sized_target): Add do_function_location.
267         * object.h (class Sized_relobj_file): Move find_shdr..
268         (class Object): ..to here.
269         * object.cc: Likewise.  Update to suit.  Instantiate.
270         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
271         * powerpc.cc (class Powerpc_dynobj): New.
272         (Target_powerpc::do_function_location): New function.
273         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
274         (Powerpc_dynobj::do_read_symbols): New function.
275         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
276
277 2013-03-08  Ian Lance Taylor  <iant@google.com>
278
279         * options.cc (General_options::string_to_object_format): Accept
280         "default".
281
282 2013-03-08  Alan Modra  <amodra@gmail.com>
283
284         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
285         pointer to Post_fde.
286         (struct Post_fde): Move definition to here..
287         * ehframe.cc (struct Post_fde): ..from here.
288         (Cie::write): Don't alloc Post_fde.
289         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
290
291 2013-03-07  Alan Modra  <amodra@gmail.com>
292
293         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
294         relocation referencing .LC0.
295         * testsuite/discard_locals_test.sh: Remove FIXMEs.
296
297 2013-03-07  Alan Modra  <amodra@gmail.com>
298
299         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
300         always_inline.  Add assembly for powerpc to avoid GOT.
301
302 2013-03-07  Alan Modra  <amodra@gmail.com>
303
304         * testsuite/script_test_10.sh: Don't test .bss section
305         header number.
306
307 2013-03-06  Alan Modra  <amodra@gmail.com>
308
309         * powerpc.cc (class Powerpc_relobj): Move some member functions.
310         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
311         all callers.  Handle folded sections.
312         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
313         to Powerpc_relobj.
314         (Global_symbol_visitor_opd::operator()): Likewise.
315
316 2013-03-04  Alan Modra  <amodra@gmail.com>
317
318         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
319         * testsuite/Makefile.in: Regenerate.
320
321 2013-03-01  Cary Coutant  <ccoutant@google.com>
322
323         Add dwp support for v2 DWARF package file format.
324         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
325         tu_length parameter.  Adjust all callers.
326         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
327         * dwp.cc: Include dwarf.h.
328         (Section_bounds): New struct type.
329         (Unit_set): New struct type.
330         (Dwo_file::Dwo_file): Initialize new data member.
331         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
332         Combine and rename to...
333         (Dwo_file::read_unit_index): ...this.
334         (Dwo_file::sized_read_compunit_index)
335         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
336         (Dwo_file::sized_read_unit_index): ...this.
337         (Dwo_file::copy_section): Remove section_name, is_str_offsets
338         parameters; add section_id parameter.
339         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
340         (Dwo_file::add_unit_set): ...this.
341         (Dwo_file::shndx_map_): Remove.
342         (Dwo_file::sect_offsets_): New data member.
343         (Dwp_output_file::Dwp_output_file): Initialize new data members.
344         (Dwp_output_file::add_section): Rename to...
345         (Dwp_output_file::add_contribution): ...this.
346         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
347         (Dwp_output_file::add_tu_set): Likewise.
348         (Dwp_output_file::Contribution): New type.
349         (Dwp_output_file::Section::contributions): New data member.
350         (Dwp_output_file::Cu_or_tu_set): Remove.
351         (Dwp_output_file::Section::Section): New ctor.
352         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
353         (Dwp_output_file::Dwp_index::Section_table): New type.
354         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
355         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
356         parameter.
357         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
358         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
359         (Dwp_output_file::Dwp_index::section_table): New member function.
360         (Dwp_output_file::Dwp_index::section_table_end): New member function.
361         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
362         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
363         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
364         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
365         (Dwp_output_file::Dwp_index::section_table_): New data member.
366         (Dwp_output_file::Dwp_index::section_mask_): New data member.
367         (Dwp_output_file::add_output_section): New member function.
368         (Dwp_output_file::write_new_section): New member function.
369         (Dwp_output_file::write_contributions): New member function.
370         (Dwp_output_file::section_id_map_): New data member.
371         (class Dwo_id_info_reader): Remove.
372         (class Unit_reader): New class.
373         (get_dwarf_section_name): New function.
374         (Dwo_file::read_executable): Adjust initializations of class data.
375         (Dwo_file::read): Add support for v2 package file format.
376         (Dwo_file::read_unit_index): Likewise.
377         (Dwo_file::sized_read_unit_index): Likewise.
378         (Dwo_file::copy_section): Likewise.
379         (Dwo_file::add_unit_set): Likewise.
380         (Dwp_output_file::add_output_section): Likewise.
381         (Dwp_output_file::add_contribution): Likewise.
382         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
383         for empty slot.
384         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
385         file format.
386         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
387         slot.
388         (Dwp_output_file::initialize): Remove unused function.
389         (Dwp_output_file::finalize): Add support for v2 package file format.
390         (Dwp_output_file::write_index): Likewise.
391         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
392         function prototype.
393
394 2013-03-01  Cary Coutant  <ccoutant@google.com>
395
396         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
397         function into class definition in header file.
398         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
399         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
400         New function.
401         (Dwarf_info_reader::check_buffer): Move here from .cc file.
402
403 2013-02-28  Alan Modra  <amodra@gmail.com>
404
405         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
406         * target.cc (Target::do_plt_fde_location): New function.
407         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
408         accessor function, and constructor param.
409         (struct Post_fde, Post_fdes): Declare.
410         (Cie::write): Add post_fdes param.
411         * ehframe.cc (Fde::write): Use plt_fde_location.
412         (struct Post_fde): Define.
413         (Cie::write): Stash FDEs added post merge mapping.
414         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
415         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
416         (Eh_frame::do_sized_write): Arrange to write post map FDES after
417         other FDEs.
418         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
419         (Target_powerpc::has_glink): New function.
420         (Target_powerpc::do_relax): Add eh_frame info for stubs.
421         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
422         glink_eh_frame_fde_32, default_fde): New data.
423         (Stub_table::eh_frame_added_): New var.
424         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
425         Make const.
426         (Stub_table::add_eh_frame): New function.
427         (Output_data_glink::add_eh_frame): New function.
428         (Target_powerpc::make_glink_section): Call add_eh_frame.
429
430 2013-02-15  Ian Lance Taylor  <iant@google.com>
431
432         * options.h (DEFINE_uint64_alias): Define.
433         (class General_options): Add -Ttext-segment as an alias for
434         -Ttext.
435
436 2013-02-15  Alan Modra  <amodra@gmail.com>
437
438         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
439         (Stub_table::do_write): ..here, two places.
440         (Stub_table::plt_call_size): Use it here too.
441
442 2013-02-11  Ian Lance Taylor  <iant@google.com>
443
444         * descriptors.cc (Descriptors::close_all): New function.
445         * descriptors.h (class Descriptors): Declare close_all.
446         (close_all_descriptors): New inline function.
447         * plugin.cc: Include "descriptors.h".
448         (Plugin_manager::cleanup): Call close_all_descriptors.
449
450 2013-02-06  Alan Modra  <amodra@gmail.com>
451
452         * README: Update coding style link.
453
454 2013-01-28  Cary Coutant  <ccoutant@google.com>
455
456         * dwp.cc (File_list): New typedef.
457         (Dwo_name_info_reader): New class.
458         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
459         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
460         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
461         (Dwo_file::read_executable): New function.
462         (Dwo_file::read): Move common setup code to ...
463         (Dwo_file::make_object): ... here.
464         (dwp_options): Add --exec/-e.
465         (usage): Likewise.
466         (main): Likewise.
467
468 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
469
470         * layout.cc (Layout::layout): Check for option text_reorder.
471         (Layout::make_output_section): Ditto.
472         * options.h (text_reorder): New option.
473         * output.cc (Input_section_sort_compare): Remove special ordering
474         of section names.
475         (Output_section::
476          Input_section_sort_section_name_special_ordering_compare::
477          operator()): New function.
478         (Output_section::sort_attached_input_sections): Use new sort function
479         for .text.
480         * output.h (Input_section_sort_section_name_special_ordering_compare):
481         New struct.
482         * testsuite/Makefile.am (text_section_grouping): Test option
483         --no-text-reorder
484         * testsuite/Makefile.in: Regenerate.
485         * testsuite/text_section_grouping.sh: Check order of functions without
486         default text reordering.
487
488 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
489
490         * options.h (General_options): Change default to true for new_dtags.
491
492 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
493
494         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
495         when enable_new_dtags is false.  Only add DT_RUNPATH when
496         enable_new_dtags is true.
497
498 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
499
500         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
501         used in declaration and definition consistent.
502         (Target_powerpc::symval_for_branch): Ditto.
503
504 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
505
506         * testsuite/plugin_final_layout.cc: Fix comment.
507
508 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
509
510         * layout.cc (Layout::layout): Do not do default sorting for
511         text sections when section ordering is specified.
512         (make_output_section): Ditto.
513         * testsuite/plugin_final_layout.cc: Name the function sections
514         to catch reordering issues.
515
516 2013-01-15  Alan Modra  <amodra@gmail.com>
517
518         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
519         plt-thread-safe.
520
521 2013-01-15  Alan Modra  <amodra@gmail.com>
522
523         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
524         * testsuite/Makefile.in: Regenerate.
525
526 2013-01-14  Alan Modra  <amodra@gmail.com>
527
528         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
529         * testsuite/Makefile.in: Regenerate.
530
531 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
532
533         PR bfd/14430
534         Fix mingw gold build with plugins enabled
535         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
536         * configure.ac: Export DLOPEN_LIBS and add headers check.
537         * plugin.cc: Handle non-dlfcn case.
538         * Makefile.in: Regenerate.
539         * config.in: Regenerate.
540         * configure: Regenerate.
541         * testsuite/Makefile.in: Regenerate.
542
543 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
544
545         * output.h (sort_attached_input_sections): Change to be public.
546         * script-sections.cc
547         (Output_section_definition::set_section_addresses): Sort
548         attached input sections according to section order before linker
549         script assigns section addresses.
550         (Orphan_output_section::set_section_addresses): Sort
551         attached input sections according to section order before linker
552         script assigns section addresses.
553         * Makefile.am (final_layout.sh): Use a simple linker script to
554         check if section ordering still works.
555         * Makefile.in: Regenerate.
556
557 2013-01-09  Ben Cheng  <bccheng@google.com>
558
559         * arm.cc (Target_arm::attributes_accept_div): New function.
560         (Target_arm::attributes_forbid_div): New function.
561         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
562         attribute using the same new functions as what bfd/elf32_arm.c
563         does.
564
565 2013-01-07  Cary Coutant  <ccoutant@google.com>
566
567         PR gold/14993
568         * output.cc (Output_section::add_input_section): For incremental
569         updates, don't track input sections that are allocated from patch
570         space.
571
572 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
573             Ian Lance Taylor  <iant@google.com>
574
575         PR gold/14897
576         * configure.ac (--enable-ld): Removed.
577         (install_as_default): Set to yes only for --enable-gold=default
578         or --disable-ld.
579         * configure: Regenerated.
580
581 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
582
583         * options.h (General_options): Add -fuse-ld= for GCC linker
584         option compatibility.
585
586 2013-01-04  Cary Coutant  <ccoutant@google.com>
587
588         * configure.ac: Fix typo restoring CXXFLAGS.
589         * configure: Regenerate.
590
591 2013-01-04  Cary Coutant  <ccoutant@google.com>
592
593         * testsuite/Makefile.am (CXXLINK_S): New macro.
594         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
595         * testsuite/Makefile.in: Regenerate.
596
597 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
598
599         * version.cc (print_version): Update copyright year to 2013.
600
601 2012-12-20  Ian Lance Taylor  <iant@google.com>
602
603         * layout.cc (Layout::special_ordering_of_input_section): New
604         function.
605         (Layout::layout): If input section requires special ordering, must
606         sort input sections.
607         (Layout::make_output_section): May sort .text input sections.
608         (Layout::is_section_name_prefix_grouped): Remove.
609         * layout.h (class Layout): Declare
610         special_ordering_of_input_section.  Don't declare
611         is_section_name_prefix_grouped.
612         * output.cc (Output_section::add_input_section): Revert last
613         change.
614         (Output_section::Input_section_sort::match_file_name): Don't crash
615         if called on output section data.
616         (Output_section::Input_section_sort_compare): Sort based on
617         special ordering.
618         (Output_section::Input_section_sort_section_order_index_compare):
619         Revert last patch.
620         (Output_section::sort_attached_input_sections): Likewise.
621
622 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
623
624         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
625         * layout.h (Layout::is_section_name_prefix_grouped): New function.
626         * output.cc (Output_section::add_input_section): Check if section
627         name contains special prefix.  Keep input sections to sort such
628         sections.
629         (Output_section::Input_section_sort_section_order_index_compare
630          ::operator()): Group sections according to prefixes.
631         (Output_section::sort_attached_input_sections): Add condition to
632         Input_section_entry constructor call.
633         * testsuite/Makefile.am (text_section_grouping): New test.
634         * testsuite/Makefile.in: Regenerate.
635         * testsuite/text_section_grouping.cc: New file.
636         * testsuite/text_section_grouping.sh: New file.
637
638 2012-12-17  Nick Clifton  <nickc@redhat.com>
639
640         * Makefile.am: Add copyright notice.
641         * NEWS: Likewise.
642         * README: Likewise.
643         * configure.ac: Likewise.
644         * ftruncate.c: Likewise.
645         * Makefile.in: Regenerate.
646
647 2012-12-14  Cary Coutant  <ccoutant@google.com>
648
649         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
650         --no-as-needed flag.
651         (exception_separate_shared_12_test): Likewise.
652         (incremental_copy_test): Likewise.
653         * testsuite/Makefile.in: Regenerate.
654
655 2012-12-14  Cary Coutant  <ccoutant@google.com>
656
657         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
658         (Dwp_output_file::Dwp_index::enter_set): Add assert.
659
660 2012-12-12  Alan Modra  <amodra@gmail.com>
661
662         * powerpc.cc (class Track_tls): New.
663         (class Relocate, class Scan): Inherit Track_tls.
664         (Target_powerpc::Scan::local, global): Track tls optimization
665         and avoid creating plt entry for __tls_get_addr if all uses
666         are optimized away.
667         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
668
669 2012-12-12  Alan Modra  <amodra@gmail.com>
670
671         * options.h (General_options): Add --toc-sort/--no-toc-sort.
672         Replace no_toc_optimize with toc_optimize.
673         * output.h (Output_section::input_sections): Provide non-const variant.
674         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
675         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
676         accessors.
677         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
678         (class Sort_toc_sections): New.
679         (Target_powerpc::do_finalize_sections): Sort toc sections.
680         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
681
682 2012-12-10  Roland McGrath  <mcgrathr@google.com>
683
684         * testsuite/binary_unittest.cc (read_all): New function.
685         (Sized_binary_test): Use it instead of ::read.
686         * fileread.cc (do_read): Don't assume pread always reads the whole
687         amount in a single call.
688
689 2012-12-10  Alan Modra  <amodra@gmail.com>
690
691         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
692         Set EM_PPC64 or EM_PPC here.
693         (Target_selector_powerpc::do_recognize): Delete.
694
695 2012-12-10  Alan Modra  <amodra@gmail.com>
696
697         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
698         stub_table_.
699         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
700
701 2012-12-07  Roland McGrath  <mcgrathr@google.com>
702
703         * testsuite/binary_unittest.cc (Sized_binary_test):
704         Use open_descriptor rather than ::open.
705
706 2012-12-07  Alan Modra  <amodra@gmail.com>
707
708         * powerpc.cc (Stub_table::do_write): Delete redundant Address
709         typedef and invalid_address constant.
710         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
711         instantiate constants.
712
713 2012-12-06  Roland McGrath  <mcgrathr@google.com>
714
715         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
716         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
717         * aclocal.m4: Regenerate.
718         * configure: Regenerate.
719         * Makefile.in: Regenerate.
720         * testsuite/Makefile.in: Regenerate.
721
722 2012-12-07  Alan Modra  <amodra@gmail.com>
723
724         * options.h (General_options): Add no_toc_optimize.
725         * powerpc.cc (ok_lo_toc_insn): New function.
726         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
727
728 2012-12-06  Alan Modra  <amodra@gmail.com>
729
730         * options.h (General_options): Add plt_align, plt_static_chain,
731         plt_thread_safe.  Update stub_group_size help text.
732         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
733         for new plt_thread_safe_ var.
734         (use_plt_offset): Correct comments.
735         (Target_powerpc::do_relax): Look for thread creation symbols to
736         determine default plt_thread_safe value.  Clear plt call stubs
737         as well as branch stubs each iteration.
738         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
739         insn constants.
740         (l, hi, ha, write_insn): Move earlier.
741         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
742         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
743         plt stubs too.
744         (Stub_table::update_size): Adjust.
745         (Stub_table::prev_size, set_prev_size): Delete.
746         (Stub_table::stub_align): Let --plt-align affect result.
747         (Stub_table::plt_call_size): Calculate sizes for various stubs.
748         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
749         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
750         (Stub_table::do_write): Support more stub variants.
751
752 2012-12-04  Alan Modra  <amodra@gmail.com>
753
754         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
755         (Target_powerpc::do_define_standard_symbols): New function.
756
757 2012-12-03  Alan Modra  <amodra@gmail.com>
758
759         * output.h: Formatting, whitespace.
760
761 2012-12-03  Alan Modra  <amodra@gmail.com>
762
763         * layout.h (Layout::get_executable_sections): Declare.
764         * layout.cc (Layout::get_executable_sections): New function.
765         * arm.cc (Target_arm::group_sections): Use it.
766         (Arm_output_section::group_sections): Delete now redundant test.
767         * output.cc (Output_reloc::Output_reloc): Add is_relative.
768         param to handle relative relocs.
769         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
770         (Output_data_reloc::add_absolute): Adjust.
771         (Output_data_reloc::add_relative): New function.
772         (Output_data::reset_data_size): New function.
773         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
774         (Output_section::set_addralign): New function.
775         (Output_section::checkpoint_set_addralign): New function.
776         (Output_section::clear_section_offsets_need_adjustment): New function.
777         (Output_section::input_sections): Make public.
778         * powerpc.cc (class Output_data_brlt_powerpc): New.
779         (class Stub_table, class Stub_control): New.
780         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
781         stub_table_, set_stub_table, stub_table): New vectors and accessor
782         functions.
783         (Target_powerpc::do_may_relax, do_relax, push_branch,
784         new_stub_table, stub_tables, brlt_section, group_sections,
785         add_branch_lookup_table, find_branch_lookup_table,
786         write_branch_lookup_table, make_brlt_section): New functions.
787         (Target_powerpc::struct Sort_sections, class Branch_info): New.
788         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
789         branch_info_): New vars.
790         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
791         make call stubs here.
792         (Output_data_glink): Remove all call stub handling from this class.
793         (Target_powerpc::Scan::local, global): Save interesting branch
794         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
795         (Target_powerpc::do_finalize_sections): Only make reg save/restore
796         functions on final link.
797         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
798         Handle long branch destinations too.
799         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
800         do_plt_address_for_local): Adjust lookup of plt call stubs.
801
802 2012-11-30  Alan Modra  <amodra@gmail.com>
803
804         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
805         relocs against protected symbols when building 32-bit shared libs.
806
807 2012-11-30  Alan Modra  <amodra@gmail.com>
808
809         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
810         param.  Call got_section() to make .got.  Update all callers
811         and their callers and so on.
812
813 2012-11-30  Alan Modra  <amodra@gmail.com>
814
815         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
816         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
817         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
818         value if it already exists.
819
820 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
821
822         PR gold/14858
823         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
824
825 2012-11-14  Roland McGrath  <mcgrathr@google.com>
826
827         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
828         than bfc instruction for data sandboxing.
829
830 2012-11-08  Alan Modra  <amodra@gmail.com>
831
832         * po/POTFILES.in: Regenerate.
833
834 2012-11-05  Alan Modra  <amodra@gmail.com>
835
836         * configure.ac: Apply 2012-09-10 change to config.in here.
837         * configure: Regenerate.
838
839 2012-11-05  Alan Modra  <amodra@gmail.com>
840
841         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
842         (struct Opd_ent): Use "Address" rather than "Offset".
843         (Output_data_got_powerpc::got_base_offset): Return Valtype.
844         (Target_powerpc::got_section): Make public.
845         (Target_powerpc::scan_relocs): Move code setting symbols..
846         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
847         Create _SDA_BASE_ only when referenced.
848
849 2012-11-02  Roland McGrath  <mcgrathr@google.com>
850
851         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
852         from last change.
853
854 2012-11-01  Roland McGrath  <mcgrathr@google.com>
855
856         * target.h (Sized_target::relocate_relocs): Use Elf_Off
857         for offset_in_output_section parameter.
858         (Sized_target::relocate_special_relocatable): Likewise.
859         * arm.cc (Target_arm::relocate_relocs): Likewise.
860         (Target_arm::relocate_special_relocatable): Likewise.
861         * i386.cc (Target_i386::relocate_relocs): Likewise.
862         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
863         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
864         * target-reloc.h (relocate_relocs): Likewise.
865         * testsuite/testfile.cc (Target_test): Likewise.
866         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
867         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
868
869         * system.h: Move inclusion of <clocale> to after <libintl.h> in
870         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
871
872         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
873         parameter, which is unused in the [!F_SETFD] case.
874
875         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
876         SYMNDX to off_t before comparing it to this->data_size().
877         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
878         * incremental.cc (Output_section_incremental_inputs::do_write):
879         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
880
881         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
882
883 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
884
885         * gold.cc (Target_arm::do_adjust_elf_header): Add the
886         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
887         in EABI_VER5.
888
889 2012-10-29  Cary Coutant  <ccoutant@google.com>
890
891         * dwp.cc (usage): Add file and exit status parameters;
892         add --help and --version options.
893         (print_version): New function.
894         (main): Add --help and --version options.
895
896 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
897
898         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
899         final_layout_sequence.txt.
900         * testsuite/Makefile.in: Regenerated.
901
902 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
903
904         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
905         COMPILE generated by automake.
906         (LINK1): Likewise.
907         (CXXCOMPILE1): Likewise.
908         (CXXLINK1): Likewise.
909         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
910         (LINK): Likewise.
911         (CXXCOMPILE): Likewise.
912         (CXXLINK): Likewise.
913         * testsuite/Makefile.in: Regenerated.
914
915 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
916
917         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
918         on bad fwrite return.
919
920 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
921
922         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
923         on val.
924
925 2012-10-23  Cary Coutant  <ccoutant@google.com>
926
927         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
928         * testsuite/Makefile.in: Regenerate.
929         * testsuite/dwp_test.h: New source file.
930         * testsuite/dwp_test_1.cc: New source file.
931         * testsuite/dwp_test_1.s: New source file.
932         * testsuite/dwp_test_1.sh: New source file.
933         * testsuite/dwp_test_1b.cc: New source file.
934         * testsuite/dwp_test_1b.s: New source file.
935         * testsuite/dwp_test_2.cc: New source file.
936         * testsuite/dwp_test_2.s: New source file.
937         * testsuite/dwp_test_2.sh: New source file.
938         * testsuite/dwp_test_main.cc: New source file.
939         * testsuite/dwp_test_main.s: New source file.
940
941 2012-10-23  Cary Coutant  <ccoutant@google.com>
942
943         * dwp.h: New header file.
944         * dwp.cc: New source file.
945         * gold.h: Move shared declarations to system.h.
946         * system.h: New header file.
947         * Makefile.am: Add dwp.
948         * Makefile.in: Regenerate.
949
950 2012-10-23  Cary Coutant  <ccoutant@google.com>
951
952         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
953         Dwarf_info_reader::read_from_pointer.
954         (Dwarf_pubnames_table::read_header): Likewise.
955         (Dwarf_pubnames_table::next_name): Likewise.
956         (Dwarf_die::read_attributes): Likewise.
957         (Dwarf_die::skip_attributes): Likewise.
958         (Dwarf_info_reader::read_from_pointer): New function template.
959         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
960         (Dwarf_pubnames_table): Likewise.
961         (Dwarf_info_reader::read_from_pointer): New function template.
962         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
963         Dwarf_pubnames_table ctor.
964
965 2012-10-23  Cary Coutant  <ccoutant@google.com>
966
967         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
968         abbrev_shndx.
969         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
970         abbrev_shndx_.
971         (Dwarf_info_reader::set_abbrev_shndx): New method.
972         (Dwarf_info_reader::abbrev_shndx_): New data member.
973
974 2012-10-23  Cary Coutant  <ccoutant@google.com>
975
976         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
977         from object, not parameters.
978         (Dwarf_info_reader::parse): Likewise.
979         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
980         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
981         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
982         methods.
983
984 2012-10-23  Cary Coutant  <ccoutant@google.com>
985
986         * fileread.cc (Input_file::Input_file): New constructor.
987         * fileread.h (class Input_file): Add new constructor.
988
989 2012-10-18  Alan Modra  <amodra@gmail.com>
990
991         PR gold/14727
992         * object.cc (Relobj::is_section_name_included): Also match
993         .sdata personality section.
994
995 2012-10-18  Alan Modra  <amodra@gmail.com>
996
997         * target-reloc.h (class Default_comdat_behavior): New, package up..
998         (get_comdat_behaviour): ..this.
999         (relocate_section): Add Relocate_comdat_behavior template arg,
1000         adjust code to suit.
1001         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1002         (Target_arm::scan_reloc_section): Likewise.
1003         * i386.cc (Target_i386::relocate_section): Likewise.
1004         * sparc.cc (Target_sparc::relocate_section): Likewise.
1005         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1006         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1007         * powerpc.cc (class Relocate_comdat_behavior): New.
1008         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1009         gold::relocate_section with new template arg.
1010
1011 2012-10-18  Alan Modra  <amodra@gmail.com>
1012
1013         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1014         dynamic relocs for GOT_TPREL got entries, without symbol if
1015         resolving locally.
1016         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1017         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1018         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1019
1020 2012-10-17  Alan Modra  <amodra@gmail.com>
1021
1022         PR gold/14726
1023         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1024
1025 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1026
1027         * layout.cc (Layout::include_section): Keep sections marked
1028         SHF_EXCLUDE when doing relocatable links.
1029
1030 2012-10-16  Alan Modra  <amodra@gmail.com>
1031
1032         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1033         (Target_powerpc::do_finalize_sections): Call it.
1034         (Output_data_save_res): New class and supporting functions.
1035         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1036         normal symbols defined in object files.
1037
1038 2012-10-12  Alan Modra  <amodra@gmail.com>
1039
1040         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1041         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1042         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1043         section if scan_opd_relocs not yet called.
1044         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1045
1046 2012-10-12  Alan Modra  <amodra@gmail.com>
1047
1048         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1049         add_local_ifunc_entry): Revert last change.
1050         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1051
1052 2012-10-05  Alan Modra  <amodra@gmail.com>
1053
1054         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1055         do_plt_address_for_global): New functions.
1056         (Output_data_got_powerpc::do_write): Don't segfault when linking
1057         statically.
1058         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1059         add_local_ifunc_entry): Return true on adding entry..
1060         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1061         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1062         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1063         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1064         set up symbols here.
1065         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1066         syms here.  Do so even when no .iplt.  Don't segfault when linking
1067         statically.
1068         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1069         new variants without reloc param.
1070         (Glink_sym_ent::Glink_sym_ent): Likewise.
1071         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1072         reloc when refs will resolve to plt call stub.
1073         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1074         R_PPC_PLTREL24 to resolve locally.
1075         (Target_powerpc::Scan::global): Correct ifunc handling.
1076         (Target_powerpc::Relocate::relocate): Correct local sym glink
1077         lookup.  Don't destroy "value" when we have a plt call stub,
1078         and when checking plt call validity.
1079         (Target_powerpc::do_dynsym_value): Simplify.
1080
1081 2012-10-05  Alan Modra  <amodra@gmail.com>
1082
1083         * i386.cc (Output_data_plt_i386::address_for_global,
1084         address_for_local): Add plt offset to returned value.  Adjust uses.
1085         * sparc.cc (Output_data_plt_sparc::address_for_global,
1086         address_for_local): Likewise.
1087         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1088         address_for_local): Likewise.
1089         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1090         address_for_local): Likewise.
1091         * target.h (Target::plt_address_for_global, plt_address_for_local):
1092         Update comment.
1093         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1094         (Output_data_got::Got_entry::write): Nor here.
1095         * output.h: Comment fix.
1096
1097 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1098
1099         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1100         global_offset_table_ value for larget got.
1101         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1102
1103 2012-09-29  Alan Modra  <amodra@gmail.com>
1104
1105         * powerpc.cc (Target_powerpc::iplt_): New output section.
1106         (Target_powerpc::iplt_section, make_iplt_section,
1107         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1108         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1109         Target_powerpc::plt_entry_count): Count iplt entries too.
1110         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1111         reloc section in constructor.  New params.
1112         (Target_powerpc::make_plt_section): Create reloc section here instead.
1113         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1114         functions.
1115         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1116         (Output_data_glink::add_entry, find_entry): New functions to
1117         deal with local syms.
1118         (Glink_sym_ent): Add support for local syms.
1119         (Output_data_glink::do_write): Handle ifunc plt entries.
1120         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1121         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1122         (Target_powerpc::Relocate::relocate): Likewise.
1123         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1124
1125 2012-09-25  Alan Modra  <amodra@gmail.com>
1126
1127         * object.h (Sized_relobj_file::adjust_local_symbol,
1128         do_adjust_local_symbol): New functions.
1129         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1130         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1131         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1132         and irregular opd entry spacing.
1133         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1134         (Global_symbol_visitor_opd): New functor.
1135         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1136         on deleted opd entries.
1137
1138 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1139
1140         * tilegx.cc: New file.
1141         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1142         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1143         * configure.tgt: Add entries for tilegx*.
1144         * configure.ac: Likewise.
1145         * Makefile.in: Rebuild.
1146         * configure: Likewise.
1147         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1148         tilegx.
1149
1150 2012-09-13  Alan Modra  <amodra@gmail.com>
1151
1152         * target-reloc.h (scan_relocs): Call scan.local for relocs
1153         against symbols in discarded sections.  Pass is_discarded
1154         param.
1155         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1156         Add is_discarded param.
1157         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1158         is_discarded to flag opd entry as discarded.  Don't emit dyn
1159         relocs on such entries.
1160         (Target_powerpc::Scan::global): Similarly detect and handle
1161         such opd entries.
1162         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1163         opd_ent_.  Update all uses.
1164         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1165         (Target_powerpc::relocate_section): Zero out discarded opd
1166         entry relocs.
1167
1168 2012-09-12  Ian Lance Taylor  <iant@google.com>
1169
1170         PR gold/14570
1171         * output.cc: Rename Output_data_got template parameter from size
1172         to got_size for all functions.  Compile all variants of
1173         Output_data_got.
1174         (Output_data_got::Got_entry::write): Correct use of size for
1175         symbol value.  Use local_is_tls rather than casting to
1176         Sized_relobj_file.
1177         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1178         (class Sized_relobj_file): Add do_local_is_tls.
1179         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1180
1181 2012-09-11  Alan Modra  <amodra@gmail.com>
1182
1183         PR gold/14566
1184         * layout.cc (Layout::set_segment_offsets): When using
1185         common-page-size alignment, ensure we are on a new max-page-size
1186         page.
1187         * output.cc (Output_segment::set_section_addresses): Use
1188         abi_pagesize, not common_pagesize for relro boundary.
1189         (Output_segment::set_offset): Likewise.
1190
1191 2012-09-11  Alan Modra  <amodra@gmail.com>
1192
1193         * output.h (Output_data_got::add_global_tls, add_local_tls,
1194         add_local_tls_pair): New functions.
1195         (Output_data_got::add_local_pair_with_rel): Remove second
1196         reloc param.  Expand comment.
1197         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1198         use_plt_or_tls_offset_, similarly for constructor param.
1199         (Output_data_got::Got_entry::write): Add got_index param.
1200         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1201         add_local_tls_pair): New functions.
1202         (Output_data_got::Got_entry::write): Handle tls symbols
1203         with use_plt_or_tls_offset_ set specially.
1204         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1205         (Output_data_got::do_write): Replace iterator with index, pass
1206         index to entry write function.
1207         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1208         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1209         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1210         call.
1211         * i386.cc (Target_i386::Scan::local): Likewise.
1212         * sparc.cc (Target_sparc::Scan::local): Likewise.
1213         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1214         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1215         do_tls_offset_for_global): New functions.
1216         (Target_powerpc::Scan::local): Correct TLS relocations and got
1217         entry values.
1218         (Target_powerpc::Scan::global): Don't emit unnecessary
1219         dynamic relocations on TLS GOT entries.
1220
1221 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1222
1223         * config.in: Disable sanity check for kfreebsd.
1224
1225 2012-09-10  Sterling Augustine  <saugustine@google.com>
1226
1227         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1228         (Gdb_index::pubtypes_read): New parameter.
1229         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1230         to calls.
1231         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1232         pubtypes_object_.
1233
1234 2012-09-09  Alan Modra  <amodra@gmail.com>
1235
1236         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1237         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1238         * gc.h (gc_process_relocs): Call target gc_add_reference.
1239         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1240         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1241         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1242         unnecessary cast.
1243         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1244         to cater for when we don't need code offset.  Update use.
1245         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1246         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1247         set_opd_valid): New functions.
1248         (Target_powerpc::do_gc_add_reference): New function.
1249         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1250         stashed refs.
1251         (Target_powerpc::do_gc_mark_symbol): New function.
1252
1253 2012-09-06  Cary Coutant  <ccoutant@google.com>
1254
1255         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1256         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1257         (Dwarf_die::skip_attributes): Likewise.
1258         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1259         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1260         (main): Call it.
1261         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1262
1263 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1264
1265         * testsuite/script_test_3.t: Add .got.plt output section
1266         statement.
1267         * testsuite/script_test_4.t: Likewise.
1268
1269 2012-09-05  Alan Modra  <amodra@gmail.com>
1270
1271         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1272         update all uses and lose "enum" when using type.
1273
1274 2012-09-05  Alan Modra  <amodra@gmail.com>
1275
1276         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1277         * configure: Regenerate.
1278         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1279         (plugin_final_layout.stdout): Likewise.
1280         (memory_test): Set page sizes to 0x1000.
1281         * testsuite/Makefile.in: Regenerate.
1282         * testsuite/discard_locals_test.sh: Add FIXME comment.
1283         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1284         * testsuite/pr14265.t: Add .got output section statement.
1285         * testsuite/script_test_2.t: Likewise.
1286         * testsuite/script_test_3.t: Likewise.
1287         * testsuite/script_test_4.t: Likewise.
1288         * testsuite/script_test_5.t: Likewise.
1289         * testsuite/script_test_6.t: Likewise.
1290         * testsuite/script_test_7.t: Likewise.
1291         * testsuite/script_test_9.t: Likewise.
1292
1293 2012-09-05  Alan Modra  <amodra@gmail.com>
1294
1295         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1296         (Powerpc_relocate_functions::Status): New typedef.
1297         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1298         (Target_powerpc::Scan::local): Handle REL64.
1299         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1300         for REL32 and REL64.
1301         (Target_powerpc::symval_for_branch): New function, extracted from..
1302         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1303         checks.  Report overflow errors.
1304
1305 2012-09-05  Alan Modra  <amodra@gmail.com>
1306
1307         * object.h (Sized_relobj_file::emit_relocs): Delete.
1308         (Sized_relobj_file::emit_relocs_reltype): Delete.
1309         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1310         relocate_relocs for --emit-relocs.
1311         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1312         * output.h: Update comment.
1313         (Output_segment::first_section): New function.
1314         (Output_segment::first_section_load_address): Use first_section.
1315         * output.cc (Output_segment::first_section): New function extracted..
1316         (Output_segment::first_section_load_address): ..from here.  Delete.
1317         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1318         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1319         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1320         adjust call to target.h function.
1321         * i386.cc (Target_i386): Likewise.
1322         * sparc.cc (Target_sparc): Likewise.
1323         * x86_64.cc (Target_x86_64): Likewise.
1324         * powerpc.cc (Target_powerpc): Likewise.
1325         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1326         first tls section has section symbol for optimised local dynamic
1327         output relocs.
1328         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1329         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1330         optimised tls code.
1331         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1332         Rename to relocate_relocs.  Update error message.
1333
1334 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1335
1336         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1337         --just-symbols.
1338
1339 2012-08-31  Alan Modra  <amodra@gmail.com>
1340
1341         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1342         (Powerpc_relobj::toc_base_offset): New stub function.
1343         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1344         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1345         (Target_powerpc::Relocate::enum skip_tls): New.
1346         (Target_powerpc::call_tls_get_addr_): New var.
1347         (Target_powerpc::is_branch_reloc): Move to file scope.
1348         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1349         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1350         New functions.
1351         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1352         (powerpc_info): Correct common_pagesize for ppc64.
1353         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1354         (Powerpc_relocate_functions): Add overflow check enums and functions.
1355         Add non-shift version of rela, rela_ua.  Delete all rel public
1356         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1357         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1358         addr16_ha3, addr14 functions.
1359         (Output_data_got_powerpc::add_constant_pair): New function.
1360         (Output_data_got_powerpc::got_base_offset): Likewise.
1361         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1362         (instruction constants): Sort, add some more.
1363         (Output_data_glink::do_write): Add and use Address typedef.  Use
1364         object->toc_base_offset() stub for 64-bit.
1365         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1366         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1367         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1368         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1369         Always treat .opd relocs as against locally defined symbol.
1370         Correct condition for RELATIVE relocs.
1371         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1372         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1373         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1374         calculations.  Handle TLS relocs, and more.  Add overflow
1375         checking and adjust for Powerpc_relocate_functions changes.
1376         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1377         Reinstate --emit-relocs code with FIXME.
1378
1379 2012-08-30  Alan Modra  <amodra@gmail.com>
1380
1381         * layout.cc (Layout::set_segment_offsets): Set p_align to
1382         abi_pagesize, not common_pagesize.
1383         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1384         to determine whether file header can go in segment.
1385
1386 2012-08-30  Alan Modra  <amodra@gmail.com>
1387
1388         * output.h (Output_reloc::Output_reloc <output section>): Add
1389         is_relative param.  Adjust calls.
1390         (Output_reloc::add_output_section_relative): New functions.
1391         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1392         is_relative.
1393         (Output_reloc::symbol_value): Handle SECTION_CODE.
1394
1395 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1396
1397         * gold.cc (queue_middle_tasks): Call layout again when unique
1398         segments for sections is desired.
1399         * layout.cc (Layout::Layout): Initialize new members.
1400         (Layout::get_output_section_flags): New function.
1401         (Layout::choose_output_section): Call get_output_section_flags.
1402         (Layout::layout): Make output section for mapping to a unique segment.
1403         (Layout::insert_section_segment_map): New function.
1404         (Layout::attach_allocated_section_to_segment): Make unique segment for
1405         output sections marked so.
1406         (Layout::segment_precedes): Check for unique segments when sorting.
1407         * layout.h (Layout::Unique_segment_info): New struct.
1408         (Layout::Section_segment_map): New typedef.
1409         (Layout::insert_section_segment_map): New function.
1410         (Layout::get_output_section_flags): New function.
1411         (Layout::is_unique_segment_for_sections_specified): New function.
1412         (Layout::set_unique_segment_for_sections_specified): New function.
1413         (Layout::unique_segment_for_sections_specified_): New member.
1414         (Layout::section_segment_map_): New member.
1415         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1416         Rename is_gc_pass_one to is_pass_one.
1417         Rename is_gc_pass_two to is_pass_two.
1418         Rename is_gc_or_icf to is_two_pass.
1419         Check for which pass based on whether symbols data is present.
1420         Make it two pass when unique segments for sections is desired.
1421         * output.cc (Output_section::Output_section): Initialize new
1422         members.
1423         * output.h (Output_section::is_unique_segment): New function.
1424         (Output_section::set_is_unique_segment): New function.
1425         (Output_section::is_unique_segment_): New member.
1426         (Output_section::extra_segment_flags): New function.
1427         (Output_section::set_extra_segment_flags): New function.
1428         (Output_section::extra_segment_flags_): New member.
1429         (Output_section::segment_alignment): New function.
1430         (Output_section::set_segment_alignment): New function.
1431         (Output_section::segment_alignment_): New member.
1432         (Output_segment::Output_segment): Initialize is_unique_segment_.
1433         (Output_segment::is_unique_segment): New function.
1434         (Output_segment::set_is_unique_segment): New function.
1435         (Output_segment::is_unique_segment_): New member.
1436         * plugin.cc (allow_unique_segment_for_sections): New function.
1437         (unique_segment_for_sections): New function.
1438         (Plugin::load): Add new functions to transfer vector.
1439         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1440         * Makefile.in: Regenerate.
1441         * testsuite/plugin_final_layout.sh: Check if unique segment
1442         functionality works.
1443         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1444         are available.
1445         (allow_unique_segment_for_sections): New global.
1446         (unique_segment_for_sections): New global.
1447         (claim_file_hook): Call allow_unique_segment_for_sections.
1448         (all_symbols_read_hook): Call unique_segment_for_sections.
1449
1450 2012-08-22  Cary Coutant  <ccoutant@google.com>
1451
1452         * layout.cc (Layout::include_section): Don't assert on GROUP
1453         sections with --emit-relocs.
1454
1455 2012-08-21  Cary Coutant  <ccoutant@google.com>
1456
1457         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1458         if --export-dynamic-symbol names an undef symbol.
1459
1460 2012-08-18  Alan Modra  <amodra@gmail.com>
1461
1462         * powerpc.cc: Formatting and white space.
1463         (Powerpc_relobj): Rename got2_section_ to special_.
1464         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1465         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1466         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1467         (Target_powerpc): Add Address typedef and invalid_address.  Use
1468         throughout.
1469         (Target_powerpc::is_branch_reloc): New function.
1470         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1471         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1472         for dst_mask, value and addend.
1473         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1474         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1475         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1476         uint16_t for 24-bit offset.  Use get_output_section_offset and
1477         check return.
1478         (Target_powerpc::Scan::local): Handle more relocs.
1479         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1480         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1481         Plug in toc restoring insn after plt calls.  Translate branches
1482         to function descriptor symbols to corresponding entry point.
1483         (Target_powerpc::relocate_for_relocatable): Check return from
1484         get_output_section_offset.
1485         * symtab.h: Comment typo.
1486
1487 2012-08-14  Ian Lance Taylor  <iant@google.com>
1488
1489         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1490         unsupported_relocal_local to call unsupported_reloc_global.
1491
1492 2012-08-14  Nick Clifton  <nickc@redhat.com>
1493
1494         PR ld/14265
1495         * script-sections.cc (Sections_element::output_section_name): Add
1496         keep return parameter.
1497         (Output_section_element::match_name): Add keep return parameter.
1498         Return the value of the keep_ member.
1499         * script-sections.h (class Output_section): Update
1500         output_section_name prototype.
1501         * layout.cc (Layout::keep_input_section): New public member
1502         function.
1503         (Layout::choose_output_section): Pass keep parameter to
1504         output_section_name.
1505         * layout.h (class Layout): Add keep_input_section.
1506         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1507         sections.
1508         * testsuite/Makefile.am: Add a test.
1509         * testsuite/Makefile.in: Regenerate.
1510         * testsuite/pr14265.c: Source file for the test.
1511         * testsuite/pr14265.t: Linker script for the test.
1512         * testsuite/pr14265.sh: Shell script for the test.
1513
1514 2012-08-14  Alan Modra  <amodra@gmail.com>
1515
1516         * target.h (Target::output_section_name): New function.
1517         (Target::do_output_section_name): New function.
1518         * layout.cc (Layout::choose_output_section): Call the above.
1519         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1520
1521 2012-08-14  Alan Modra  <amodra@gmail.com>
1522
1523         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1524         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1525         for replace_constant call.
1526         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1527         (Output_data_glink::do_print_to_mapfile): New function.
1528         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1529         (Target_powerpc::Relocate::relocate): Likewise.
1530
1531 2012-08-14  Alan Modra  <amodra@gmail.com>
1532
1533         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1534         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1535         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1536         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1537         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1538         here.
1539         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1540         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1541         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1542         here.
1543         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1544         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1545
1546 2012-08-12  Alan Modra  <amodra@gmail.com>
1547
1548         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1549         (glink insn constants): Use uint32_t.
1550         (Output_data_glink::add_entry): Use insert, not [] operator.
1551
1552 2012-08-11  Alan Modra  <amodra@gmail.com>
1553
1554         * object.h (Sized_relobj_file::find_shdr): New function.
1555         (Sized_relobj_file::find_special_sections): New function.
1556         * object.cc (Sized_relobj_file::find_shdr): New function.
1557         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1558         (Sized_relobj_file::find_special_sections): New function, split out..
1559         (Sized_relobj_file::do_read_symbols): ..from here.
1560         * output.h (Output_data_got::replace_constant): New function.
1561         (Output_data_got::num_entries): New function.
1562         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1563         (Output_data_got::got_offset): Protected rather than private.
1564         (Output_data_got::replace_got_entry): New function.
1565         * output.cc (Output_data_got::replace_got_entry): New function.
1566         * powerpc.cc (class Powerpc_relobj): New.
1567         (class Powerpc_relocate_functions): Delete all psymval variants or
1568         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1569         Implement _ha functions using corresponding _hi function.
1570         (Powerpc_relobj::find_special_sections): New function.
1571         (Target_powerpc::do_make_elf_object): New function.
1572         (class Output_data_got_powerpc): New.
1573         (class Output_data_glink): New.
1574         (class Powerpc_scan_relocatable_reloc): New.
1575         Many more changes througout file.
1576
1577 2012-08-09  Nick Clifton  <nickc@redhat.com>
1578
1579         * po/vi.po: Updated Vietnamese translation.
1580
1581 2012-08-07  Ian Lance Taylor  <iant@google.com>
1582
1583         * layout.cc (Layout::add_target_dynamic_tags): If
1584         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1585         plt_rel.
1586
1587 2012-07-30  Nick Clifton  <nickc@redhat.com>
1588
1589         * po/gold.pot: Updated template.
1590         * po/es.po: Updated Spanish translation.
1591
1592 2012-07-18  Cary Coutant  <ccoutant@google.com>
1593
1594         PR gold/14344
1595         * configure.ac: Add check for -gpubnames support.
1596         * configure: Regenerate.
1597         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1598         support; force -gno-pubnames.
1599         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1600         support.
1601         (gdb_index_test_4): New test.
1602         * testsuite/Makefile.in: Regenerate.
1603         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1604         * testsuite/gdb_index_test_2.sh: Likewise.
1605         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1606         * testsuite/gdb_index_test_4.sh: New script.
1607         * testsuite/gdb_index_test_comm.sh: New script with common code;
1608         don't look for space after colon.
1609
1610 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1611
1612         * gold.cc (queue_middle_tasks): Update function order only after
1613         deferred objects due to plugins are processed.
1614
1615 2012-07-11  Ian Lance Taylor  <iant@google.com>
1616
1617         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1618         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1619         (Target_arm::scan_reloc_for_stub): Likewise.
1620         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1621         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1622         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1623         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1624         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1625
1626 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1627             Ian Lance Taylor  <iant@google.com>
1628
1629         PR gold/14309
1630         * configure.ac: Test whether std::tr1::hash<off_t> works.
1631         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1632         needed.
1633         * output.h (class Output_fill): Add virtual destructor.
1634         * configure, config.in: Rebuild.
1635
1636 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1637
1638         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1639
1640 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1641
1642         * plugin.cc (Plugin::load): Handle position independent executables.
1643
1644 2012-06-06  Cary Coutant  <ccoutant@google.com>
1645
1646         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1647         add .debug_macro.
1648         (lines_only_debug_sections): Likewise.
1649         (gdb_fast_lookup_sections): New static array.
1650         (is_gdb_debug_section): Rename formal parameter.
1651         (is_lines_only_debug_section): Likewise.
1652         (is_gdb_fast_lookup_section): New function.
1653         (Layout::include_section): Check for ".zdebug_" prefix; pass
1654         section name suffix to is_gdb_debug_section, et al.; check for
1655         fast-lookup sections when building .gdb_index.
1656         * options.h (--strip-debug-gdb): Update GDB version number.
1657
1658 2012-06-06  Cary Coutant  <ccoutant@google.com>
1659
1660         * configure.ac: Add check for fallocate.
1661         * configure: Regenerate.
1662         * config.in: Regenerate.
1663
1664         * options.h (class General_options): Add --mmap-output-file and
1665         --posix-fallocate options.
1666         * output.cc: (posix_fallocate): Remove; replace with...
1667         (gold_fallocate): New function.
1668         (Output_file::map_no_anonymous): Call gold_fallocate.
1669         (Output_file::map): Check --mmap-output-file option.
1670
1671 2012-06-05  Jing Yu  <jingyu@google.com>
1672
1673         * gold.h (textdomain): Add do {} to empty while(0).
1674         (bindtextdomain): Likewise.
1675
1676 2012-06-04  Cary Coutant  <ccoutant@google.com>
1677
1678         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1679         has_dynsym_index.
1680
1681 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1682
1683         * symtab.cc (Symbol_table::define_special_symbol):
1684         Initialize *poldsym to prevent uninitialized variable errors.
1685
1686 2012-05-23  Cary Coutant  <ccoutant@google.com>
1687
1688         * layout.cc (Layout::section_name_mapping): Add rules to handle
1689         exact match on .data.rel.ro.local or .data.rel.ro.
1690         (Layout::output_section_name): Check for exact matches.
1691
1692 2012-05-23  Cary Coutant  <ccoutant@google.com>
1693
1694         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1695         more carefully.
1696
1697 2012-05-22  Cary Coutant  <ccoutant@google.com>
1698
1699         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1700         object before exporting symbol.
1701
1702 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1703
1704         * testsuite/tls_test.cc: Include "config.h" first.
1705         * testsuite/tls_test_c.c: Likewise.
1706
1707 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1708             Nick Clifton  <nickc@redhat.com>
1709
1710         PR 14072
1711         * configure.in: Add check that sysdep.h has been included before
1712         any system header files.
1713         * configure: Regenerate.
1714         * config.in: Regenerate.
1715
1716 2012-05-14  Cary Coutant  <ccoutant@google.com>
1717
1718         * layout.cc (Layout::make_output_section): Mark .tdata section
1719         as RELRO.
1720         * testsuite/relro_test.cc: Add a TLS variable.
1721
1722 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1723
1724         PR gold/14091
1725         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1726         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1727         R_X86_64_64.
1728
1729 2012-05-08  Cary Coutant  <ccoutant@google.com>
1730
1731         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1732         (lines_only_debug_sections): Likewise.
1733
1734 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1735
1736         * nacl.cc: New file.
1737         * nacl.h: New file.
1738         * Makefile.am (CCFILES, HFILES): Add them.
1739         * Makefile.in: Regenerate.
1740         * i386.cc (Output_data_plt_i386_nacl): New class.
1741         (Output_data_plt_i386_nacl_exec): New class.
1742         (Output_data_plt_i386_nacl_dyn): New class.
1743         (Target_i386_nacl): New class.
1744         (Target_selector_i386_nacl): New class.
1745         (target_selector_i386): Use it instead of Target_selector_i386.
1746         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1747         (Target_x86_64_nacl): New class.
1748         (Target_selector_x86_64_nacl): New class.
1749         (target_selector_x86_64, target_selector_x32): Use it instead of
1750         Target_selector_x86_64.
1751         * arm.cc (Output_data_plt_arm_nacl): New class.
1752         (Target_arm_nacl): New class.
1753         (Target_selector_arm_nacl): New class.
1754         (target_selector_arm, target_selector_armbe): Use it instead of
1755         Target_selector_arm.
1756
1757         * target-select.cc (select_target): Take new Input_file* and off_t
1758         arguments, pass them on to recognize method of selector.
1759         * object.cc (make_elf_sized_object): Update caller.
1760         * parameters.cc (parameters_force_valid_target): Likewise.
1761         * incremental.cc (make_sized_incremental_binary): Likewise.
1762         * target-select.h: Update decl.
1763         (Target_selector::recognize): Take new Input_file* argument,
1764         pass it on to do_recognize.
1765         (Target_selector::do_recognize): Take new Input_file* argument.
1766         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1767         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1768         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1769         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1770
1771         * target.h (Target::Target_info): New members isolate_execinstr
1772         and rosegment_gap.
1773         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1774         * arm.cc (Target_arm::arm_info): Update initializer.
1775         * i386.cc (Target_i386::i386_info): Likewise.
1776         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1777         * sparc.cc (Target_sparc::sparc_info): Likewise.
1778         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1779         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1780         * layout.cc (Layout::attach_allocated_section_to_segment):
1781         Take new const Target* argument.  If target->isolate_execinstr(), act
1782         like --rosegment.
1783         (Layout::find_first_load_seg): Take new const Target* argument;
1784         if target->isolate_execinstr(), reject PF_X segments.
1785         (Layout::relaxation_loop_body): Update caller.
1786         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1787         reset file offset to zero when we hit LOAD_SEG, and then do a second
1788         loop over the segments before LOAD_SEG to reassign offsets after
1789         addresses have been determined.  Handle target->rosegment_gap().
1790         (Layout::attach_section_to_segment): Take new const Target* argument;
1791         pass it to attach_allocated_section_to_segment.
1792         (Layout::make_output_section): Update caller.
1793         (Layout::attach_sections_to_segments): Take new const Target* argument;
1794         pass it to attach_section_to_segment.
1795         * gold.cc (queue_middle_tasks): Update caller.
1796         * layout.h (Layout): Update method decls with new arguments.
1797
1798         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1799         Target_info pointer to use.
1800         (Target_arm::do_make_data_plt): New virtual method.
1801         (Target_arm::make_data_plt): New method that calls it.
1802         (Target_arm::make_plt_entry): Use it.
1803         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1804         for the section alignment.
1805         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1806         method.
1807         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1808         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1809         method.
1810         (Output_data_plt_arm::get_plt_entry_size): Call it.
1811         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1812         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1813         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1814         method.
1815         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1816         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1817         method instead of sizeof(plt_entry).
1818         (Output_data_plt_arm::add_entry): Likewise.
1819         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1820         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1821         than static method.
1822         (Target_arm::plt_entry_size): Likewise.
1823         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1824         Move to ...
1825         (Output_data_plt_arm_standard): ... here, new class.
1826         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1827         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1828         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1829
1830         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1831         Take additional argument for the PLT entry size.
1832         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1833         Use get_plt_entry_size method rather than plt_entry_size variable.
1834         (Output_data_plt_x86_64::reserve_slot): Likewise.
1835         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1836         (Output_data_plt_x86_64::add_entry): Likewise.
1837         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1838         (Output_data_plt_x86_64::address_for_global): Likewise.
1839         (Output_data_plt_x86_64::address_for_local): Likewise.
1840         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1841         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1842         Make method non-static.
1843         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1844         method.
1845         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1846         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1847         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1848         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1849         virtual method.
1850         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1851         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1852         virtual method.
1853         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1854         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1855         virtual method.
1856         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1857         (Output_data_plt_x86_64::plt_entry_size)
1858         (Output_data_plt_x86_64::first_plt_entry)
1859         (Output_data_plt_x86_64::plt_entry)
1860         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1861         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1862         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1863         (Output_data_plt_x86_64_standard): ... here, new class.
1864         (Target_x86_64::Target_x86_64): Take optional argument for the
1865         Target_info pointer to use.
1866         (Target_x86_64::do_make_data_plt): New virtual method.
1867         (Target_x86_64::make_data_plt): New method to call it.
1868         (Target_x86_64::init_got_plt_for_update): Use that.
1869         Call this->plt_->add_eh_frame method here.
1870         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1871         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1872         rather than static method.
1873         (Target_x86_64::plt_entry_size): Likewise.
1874         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1875         rather than plt_entry_size variable.  Move guts of PLT filling to...
1876         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1877         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1878         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1879
1880         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1881         additional argument for the section alignment.
1882         Don't do add_eh_frame_for_plt here.
1883         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1884         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1885         variable.
1886         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1887         method.
1888         (Output_data_plt_i386::get_plt_entry_size): Call it.
1889         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1890         (Output_data_plt_i386::add_eh_frame): New method to call it.
1891         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1892         method.
1893         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1894         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1895         method.
1896         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1897         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1898         method instead of plt_entry_size.
1899         (Output_data_plt_i386::plt_entry_size)
1900         (Output_data_plt_i386::plt_eh_frame_fde_size)
1901         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1902         (Output_data_plt_i386_standard): ... here, new class.
1903         (Output_data_plt_i386_exec): New class.
1904         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1905         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1906         (Output_data_plt_i386::exec_plt_entry): Move to ...
1907         (Output_data_plt_i386_exec::plt_entry): ... here.
1908         (Output_data_plt_i386_dyn): New class.
1909         (Output_data_plt_i386::first_plt_entry): Move to ...
1910         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1911         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1912         (Output_data_plt_i386_dyn::plt_entry): ... here.
1913         (Target_i386::Target_i386): Take optional argument for the Target_info
1914         pointer to use.
1915         (Target_i386::do_make_data_plt): New virtual method.
1916         (Target_i386::make_data_plt): New method to call it.
1917         (Target_i386::make_plt_section): Use that.
1918         Call this->plt_->add_eh_frame method here.
1919         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1920         rather than plt_entry_size variable.
1921         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1922         (Output_data_plt_i386::address_for_local): Likewise.
1923         (Output_data_plt_i386::do_write): Likewise.
1924         Move guts of PLT filling to...
1925         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1926         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1927         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1928         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1929
1930 2012-05-01  Cary Coutant  <ccoutant@google.com>
1931
1932         * dwarf_reader.cc (Dwarf_die::read_attributes)
1933         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1934         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1935         * reduced_debug_output.cc
1936         (Output_reduced_debug_info_section::get_die_end): Remove
1937         DW_FORM_GNU_ref_index.  Add default case.
1938
1939 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1940
1941         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1942         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1943         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1944         DW_AT_high_pc as offset from DW_AT_low_pc.
1945
1946         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1947         * testsuite/Makefile.in: Regenerate.
1948         * testsuite/gdb_index_test_3.c: New test source file.
1949         * testsuite/gdb_index_test_3.sh: New test source file.
1950
1951 2012-04-25  Ian Lance Taylor  <iant@google.com>
1952
1953         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1954         pointer.
1955         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1956         as a class, not a struct.
1957         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1958         (Target_arm::apply_cortex_a8_workaround): Likewise.
1959         * gc.h: Declare Reloc_types as a struct, not a class.
1960         * object.h: Declare Symbols_data as a struct.
1961         * reloc.h: Declare Read_relocs_data as a struct.
1962         * target.h: Declare Relocate_info as a struct.
1963
1964 2012-04-24  David S. Miller  <davem@davemloft.net>
1965
1966         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1967         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1968         and R_SPARC_WPLT30.
1969
1970 2012-04-24  Cary Coutant  <ccoutant@google.com>
1971
1972         * incremental-dump.cc (find_input_containing_global): Replace
1973         magic number with symbolic constant.
1974         (dump_incremental_inputs): Update version number.
1975         * incremental.cc (Output_section_incremental_inputs): Update version
1976         number; import symbolic constants from Incremental_inputs_reader.
1977         (Incremental_inputs::create_data_sections): Align relocations
1978         section correctly for 64-bit targets.
1979         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1980         constants; add padding.
1981         (Output_section_incremental_inputs::write_header): Add assert for
1982         header_size.
1983         (Output_section_incremental_inputs::write_input_files): Add assert
1984         for input_entry_size.
1985         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1986         add assert for object_info_size, input_section_entry_size,
1987         global_sym_entry_size.
1988         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1989         for data structure sizes; use them.
1990         (Incremental_input_entry_reader): Import symbolic constants from
1991         Incremental_inputs_reader; use them.
1992
1993 2012-04-23  David S. Miller  <davem@davemloft.net>
1994
1995         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1996         and elf_flags_set_.
1997         (Target_sparc::Target_sparc): Initialize new fields.
1998         (Target_sparc::do_make_elf_object): New function.
1999         (Target_sparc::do_adjust_elf_header): New function.
2000
2001 2012-04-23  Cary Coutant  <ccoutant@google.com>
2002
2003         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2004         CU range table of gdb index.
2005
2006 2012-04-20  David S. Miller  <davem@davemloft.net>
2007
2008         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2009         instead of false.
2010
2011 2012-04-16  David S. Miller  <davem@davemloft.net>
2012
2013         * sparc.cc (Target_sparc::got_address): New function.
2014         (Sparc_relocate_functions::gdop_hix22): New function.
2015         (Sparc_relocate_functions::gdop_lox10): New function.
2016         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2017         relocs.
2018         (Target_sparc::Scan::local): Likewise if the global symbol is not
2019         preemptible and is not IFUNC.
2020         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2021         transformations for local and non-preemptible non-IFUNC global
2022         symbols.
2023
2024         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2025         writing out 64-bit part of ranges.
2026
2027         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2028         -fpic and -fpie respectively.
2029         * Makefile.in: Regenerate.
2030
2031         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2032         (Target_sparc::Target_sparc): Initialize new field.
2033         (Target_sparc::do_plt_section_for_global): New function.
2034         (Target_sparc::do_plt_section_for_local): New function.
2035         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2036         (Target_sparc::make_plt_section): New function, broken out of
2037         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2038         (Target_sparc::make_plt_entry): Call make_plt_section.
2039         (Target_sparc::make_local_ifunc_plt_entry): New function.
2040         (Target_sparc::rela_ifunc_section): New function.
2041         (Target_sparc::plt_section): Remove const.
2042         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2043         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2044         and ifunc_count_ fields.
2045         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2046         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2047         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2048         (Output_data_plt_sparc::rela_ifunc): New function.
2049         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2050         (Output_data_plt_sparc::has_ifunc_section): New function.
2051         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2052         (Output_data_plt_sparc::address_for_global): New function.
2053         (Output_data_plt_sparc::address_for_local): New function.
2054         (Output_data_plt_sparc::plt_index_to_offset): New function.
2055         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2056         and entry_count.
2057         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2058         entry_count.
2059         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2060         R_SPARC_JMP_IREL to switch.
2061         (Target_sparc::Scan::check_non_pic): Likewise.
2062         (Target_sparc::Scan::local): Handle IFUNC symbols.
2063         (Target_sparc::Scan::local): Likewise.
2064         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2065         and plt_address_for_local.
2066         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2067         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2068
2069         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2070         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2071         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2072         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2073         global relocs too.
2074         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2075         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2076         calls.
2077         * sparc.cc (Target_sparc::Scan::global): Likewise.
2078         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2079
2080 2012-04-16  Cary Coutant  <ccoutant@google.com>
2081
2082         * archive.cc (Library_base::should_include_member): Check for
2083         --export-dynamic-symbol.
2084         * options.h (class General_options): Add --export-dynamic-symbol.
2085         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2086         --export-dynamic-symbol.
2087         (Symbol_table::gc_mark_undef_symbols): Likewise.
2088         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2089
2090 2012-04-12  David S. Miller  <davem@davemloft.net>
2091
2092         * sparc.cc (Reloc::wdisp10): New relocation method.
2093         (Reloc::h34): Likewise.
2094         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2095         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2096         R_SPARC_WDISP10.
2097         (Target_sparc::Scan::local): Likewise.
2098         (Target_sparc::Scan::global): Likewise.
2099         (Target_sparc::Relocate::relocate): Likewise.
2100
2101 2012-04-09  Cary Coutant  <ccoutant@google.com>
2102
2103         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2104         low_pc == 0.
2105
2106 2012-04-06  Ian Lance Taylor  <iant@google.com>
2107
2108         * timer.cc: #include <unistd.h>.
2109
2110 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2111
2112         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2113         * config.in: Regenerate.
2114         * configure: Regenerate.
2115
2116 2012-04-05  Nick Clifton  <nickc@redhat.com>
2117
2118         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2119         (AM_LC_MESSAGES): Add.
2120         * aclocal.m4: Regenerate.
2121         * config.in: Regenerate.
2122         * configure: Regenerate.
2123
2124 2012-03-21  Cary Coutant  <ccoutant@google.com>
2125
2126         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2127         * Makefile.in: Regenerate.
2128         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2129         (Sized_elf_reloc_mapper::symbol_section): New function.
2130         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2131         (make_elf_reloc_mapper): New function.
2132         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2133         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2134         (Dwarf_abbrev_table::do_get_abbrev): New function.
2135         (Dwarf_ranges_table::read_ranges_table): New function.
2136         (Dwarf_ranges_table::read_range_list): New function.
2137         (Dwarf_pubnames_table::read_section): New function.
2138         (Dwarf_pubnames_table::read_header): New function.
2139         (Dwarf_pubnames_table::next_name): New function.
2140         (Dwarf_die::Dwarf_die): New function.
2141         (Dwarf_die::read_attributes): New function.
2142         (Dwarf_die::skip_attributes): New function.
2143         (Dwarf_die::set_name): New function.
2144         (Dwarf_die::set_linkage_name): New function.
2145         (Dwarf_die::attribute): New function.
2146         (Dwarf_die::string_attribute): New function.
2147         (Dwarf_die::int_attribute): New function.
2148         (Dwarf_die::uint_attribute): New function.
2149         (Dwarf_die::ref_attribute): New function.
2150         (Dwarf_die::child_offset): New function.
2151         (Dwarf_die::sibling_offset): New function.
2152         (Dwarf_info_reader::check_buffer): New function.
2153         (Dwarf_info_reader::parse): New function.
2154         (Dwarf_info_reader::do_parse): New function.
2155         (Dwarf_info_reader::do_read_string_table): New function.
2156         (Dwarf_info_reader::lookup_reloc): New function.
2157         (Dwarf_info_reader::get_string): New function.
2158         (Dwarf_info_reader::visit_compilation_unit): New function.
2159         (Dwarf_info_reader::visit_type_unit): New function.
2160         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2161         Sized_elf_reloc_mapper.
2162         (Sized_dwarf_line_info::symbol_section): Remove function.
2163         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2164         (Sized_dwarf_line_info::read_line_mappings): Remove object
2165         parameter, adjust callers.
2166         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2167         * dwarf_reader.h: Include <sys/types.h>.
2168         (class Track_relocs): Remove forward declaration.
2169         (class Elf_reloc_mapper): New class.
2170         (class Sized_elf_reloc_mapper): New class.
2171         (class Dwarf_abbrev_table): New class.
2172         (class Dwarf_range_list): New class.
2173         (class Dwarf_ranges_table): New class.
2174         (class Dwarf_pubnames_table): New class.
2175         (class Dwarf_die): New class.
2176         (class Dwarf_info_reader): New class.
2177         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2178         (Sized_dwarf_line_info::symbol_section): Remove member function.
2179         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2180         base class.
2181         * gdb-index.cc: New source file.
2182         * gdb-index.h: New source file.
2183         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2184         and .debug_types sections, call Layout::add_to_gdb_index.
2185         (Sized_relobj_incr::do_section_name): Implement.
2186         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2187         return type; Implement.
2188         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2189         return type.
2190         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2191         parameter list and return type.
2192         (Sized_incr_dynobj::do_section_contents): Likewise.
2193         * layout.cc: Include gdb-index.h.
2194         (Layout::Layout): Initialize gdb_index_data_.
2195         (Layout::init_fixed_output_section): Check for .gdb_index section.
2196         (Layout::add_to_gdb_index): New function. Instantiate.
2197         * layout.h: Add forward declaration for class Gdb_index.
2198         (Layout::add_to_gdb_index): New member function.
2199         (Layout::gdb_index_data_): New data member.
2200         * main.cc: Include gdb-index.h.
2201         (main): Print statistics for gdb index.
2202         * object.cc (Object::section_contents): Move code into
2203         do_section_contents.
2204         (need_decompressed_section): Check for sections needed when building
2205         gdb index.
2206         (build_compressed_section_map): Likewise.
2207         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2208         gdb index.
2209         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2210         sections; call Layout::add_to_gdb_index.
2211         (Sized_relobj_file::do_decompressed_section_contents): Call
2212         do_section_contents directly.
2213         * object.h (Object::do_section_contents): Adjust parameter list and
2214         return type.
2215         (Object::do_decompressed_section_contents): Call do_section_contents
2216         directly.
2217         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2218         return type.
2219         * options.h (class General_options): Add --gdb-index option.
2220         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2221         list and return type.
2222         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2223         * reloc.h (Track_relocs::checkpoint): New function.
2224         (Track_relocs::reset): New function.
2225
2226         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2227         New test cases.
2228         * testsuite/Makefile.in: Regenerate.
2229         * testsuite/gdb_index_test.cc: New test source file.
2230         * testsuite/gdb_index_test_1.sh: New test source file.
2231         * testsuite/gdb_index_test_2.sh: New test source file.
2232
2233 2012-03-19  Doug Kwan  <dougkwan@google.com>
2234
2235         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2236         (Target_arm::do_finalize_sections): Remove code which defines
2237         __exidx_start and __exidx_end.  Make symbol table parameter
2238         anonymous as it is not used.
2239         * gold.cc (queue_middle_tasks): Call target hook to define any
2240         target-specific symbols.
2241         * target.h (Target::define_standard_symbols): New method.
2242         (Target::do_define_standard_symbols): Same.
2243         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2244         * testsuite/Makefile.in: Regenerate.
2245         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2246         and __exidx_end.
2247         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2248         relocations are generated for __exidx_start and __exidx_end.
2249
2250 2012-03-16  Doug Kwan  <dougkwan@google.com>
2251
2252         * testsuite/Makefile.am: Disable test initpri3b.
2253         * testsuite/Makefile.in: Regenerate.
2254
2255 2012-03-15  Doug Kwan  <dougkwan@google.com>
2256
2257         * arm.cc (Target_arm::got_section): Make .got section read-only
2258         if -z now is given.
2259
2260 2012-03-15  Ian Lance Taylor  <iant@google.com>
2261
2262         PR gold/13850
2263         * layout.cc (Layout::make_output_section): Correctly mark
2264         SHT_INIT_ARRAY, et. al., as relro.
2265
2266 2012-03-14  Doug Kwan  <dougkwan@google.com>
2267
2268         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2269         dynamic relocations for protected symbols in shared objects.
2270
2271 2012-03-13  Ian Lance Taylor  <iant@google.com>
2272
2273         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2274         keep the larger alignment.
2275
2276 2012-03-12  Cary Coutant  <ccoutant@google.com>
2277
2278         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2279         handling of DW_LNE_define_file.
2280
2281 2012-03-12  Cary Coutant  <ccoutant@google.com>
2282
2283         * reduced_debug_output.cc
2284         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2285         codes to switch.
2286
2287 2012-02-29  Cary Coutant  <ccoutant@google.com>
2288
2289         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2290
2291 2012-02-29  Cary Coutant  <ccoutant@google.com>
2292
2293         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2294         Call Object::decompressed_section_contents.
2295         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2296         New dtor.
2297         (Sized_dwarf_line_info::buffer_start_): New data member.
2298         * merge.cc (Output_merge_data::do_add_input_section): Call
2299         Object::decompressed_section_contents.
2300         (Output_merge_string::do_add_input_section): Likewise.
2301         * object.cc (need_decompressed_section): New function.
2302         (build_compressed_section_map): Decompress sections needed later.
2303         (Sized_relobj_file::do_decompressed_section_contents): New function.
2304         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2305         * object.h (Object::decompressed_section_contents): New function.
2306         (Object::discard_decompressed_sections): New function.
2307         (Object::do_decompressed_section_contents): New function.
2308         (Object::do_discard_decompressed_sections): New function.
2309         (Compressed_section_info): New type.
2310         (Compressed_section_map): Include decompressed section contents.
2311         (Sized_relobj_file::do_decompressed_section_contents): New function.
2312         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2313
2314 2012-02-16  Cary Coutant  <ccoutant@google.com>
2315
2316         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2317         * testsuite/Makefile.in: Regenerate.
2318
2319 2012-02-14  Cary Coutant  <ccoutant@google.com>
2320
2321         * options.cc (General_options::finalize): Disallow -pie and -static.
2322
2323 2012-02-03  Doug Kwan  <dougkwan@google.com>
2324
2325         * arm.cc (Arm_relocate_functions::abs8,
2326         Arm_relocate_functions::abs16): Use
2327         Bits::has_signed_unsigned_overflow32.
2328         (Arm_relocate_functions::thm_abs8): Correct range of
2329         overflow check.
2330         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2331         in assertions.
2332
2333 2012-02-02  Doug Kwan  <dougkwan@google.com>
2334
2335         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2336         position independent outputs, not just shared objects.
2337
2338 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2339
2340         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2341         * configure: Regenerated.
2342
2343 2012-01-27  Ian Lance Taylor  <iant@google.com>
2344
2345         * reloc.h (Bits): New class with static functions, copied from
2346         namespace utils in arm.cc.
2347         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2348         instead.
2349
2350 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2351
2352         * incremental.cc (write_info_blocks): Correct relocation offset.
2353
2354 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2355
2356         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2357         (Relocate::tls_gd_to_le): Likewise.
2358
2359 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2360
2361         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2362
2363 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2364
2365         * configure.ac: Check if -mcmodel=medium works.
2366         * configure: Regenerated.
2367
2368 2012-01-24  Cary Coutant  <ccoutant@google.com>
2369
2370         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2371         definition and ...
2372         (read_unsigned_LEB_128_x): ... this new function.
2373         (read_signed_LEB_128): Replaced with inline definition and ...
2374         (read_signed_LEB_128_x): ... this new function.
2375         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2376         (read_unsigned_LEB_128): Add inline definition.
2377         (read_signed_LEB_128_x): New function.
2378         (read_signed_LEB_128): Add inline definition.
2379         * testsuite/Makefile.am (leb128_unittest): New unit test.
2380         * testsuite/Makefile.in: Regenerate.
2381         * testsuite/leb128_unittest.cc: New unit test.
2382
2383 2012-01-23  Ian Lance Taylor  <iant@google.com>
2384
2385         PR gold/13617
2386         * i386.cc (Target_i386::do_code_fill): When using a jmp
2387         instruction, pad with nop instructions.
2388         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2389
2390 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2391
2392         * x86_64.cc (gc_process_relocs): Add typename on types used in
2393         template.
2394         (scan_relocs): Likewise.
2395         (relocate_section): Likewise.
2396         (apply_relocation): Likewise.
2397
2398 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2399
2400         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2401         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2402         under x32.
2403
2404 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2405
2406         * x86_64.cc: Initial support for x32.
2407
2408 2012-01-03  Cary Coutant  <ccoutant@google.com>
2409
2410         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2411         Use abstract base class for GOT.
2412         * gold/output.h (class Output_data_got_base): New abstract base class.
2413         (class Output_data_got): Derive from new base class, adjust ctors.
2414         (Output_data_got::reserve_slot): Make virtual; rename to
2415         do_reserve_slot; Adjust callers.
2416         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2417         pointer to abstract base class.
2418         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2419
2420 2011-12-18  Ian Lance Taylor  <iant@google.com>
2421
2422         * object.h (Relobj::local_symbol_value): New function.
2423         (Relobj::local_plt_offset): New function.
2424         (Relobj::local_has_got_offset): New function.
2425         (Relobj::local_got_offset): New function.
2426         (Relobj::set_local_got_offset): New function.
2427         (Relobj::do_local_symbol_value): New pure virtual function.
2428         (Relobj::do_local_plt_offset): Likewise.
2429         (Relobj::do_local_has_got_offset): Likewise.
2430         (Relobj::do_local_got_offset): Likewise.
2431         (Relobj::do_set_local_got_offset): Likewise.
2432         (Sized_relobj::do_local_has_got_offset): Rename from
2433         local_has_got_offset.
2434         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2435         (Sized_relobj::do_set_local_got_offset): Rename from
2436         set_local_got_offset.
2437         (Sized_relobj_file::do_local_plt_offset): Rename from
2438         local_plt_offset.
2439         (Sized_relobj_file::do_local_symbol_value): New function.
2440         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2441         local_plt_offset.
2442         * output.cc (Output_data_got::Got_entry::write): Change object to
2443         Relobj.  Use local_symbol_value.
2444         (Output_data_got::add_global_with_rel): Change rel_dyn to
2445         Output_data_reloc_generic*.  Use add_global_generic.
2446         (Output_data_got::add_global_with_rela): Remove.  Change all
2447         callers to use add_global_with_rel.
2448         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2449         Output_data_reloc_generic*.  Use add_global_generic.
2450         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2451         callers to use add_global_pair_with_rel.
2452         (Output_data_got::add_local): Change object to Relobj*.
2453         (Output_data_got::add_local_plt): Likewise.
2454         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2455         change rel_dyn to Output_data_reloc_generic*.  Use
2456         add_local_generic.
2457         (Output_data_got::add_local_with_rela): Remove.  Change all
2458         callers to use all_local_with_rel.
2459         (Output_data_got::add_local_pair_with_rel): Change object to
2460         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2461         add_output_section_generic.
2462         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2463         callers to use add_local_pair_with_rel.
2464         (Output_data_got::reserve_local): Change object to Relobj*.
2465         * output.h: (class Output_data_reloc_generic): Add pure virtual
2466         declarations for add_global_generic, add_local_generic,
2467         add_output_section_generic.
2468         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2469         functions for Output_data_reloc_generic.  Update declarations for
2470         changes listed in output.cc.
2471         (class Output_data_got): Change template parameter to got_size.
2472         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2473         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2474         function.
2475         (Sized_relobj_incr::do_local_plt_offset): New function.
2476         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2477         add_global_generic.
2478
2479 2011-12-17  Cary Coutant  <ccoutant@google.com>
2480
2481         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2482         * resolve.cc (Symbol_table::resolve): Likewise.
2483         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2484         arrays.
2485         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2486
2487 2011-12-16  Ian Lance Taylor  <iant@google.com>
2488
2489         * output.h (Output_data_reloc_generic::add): Only call
2490         add_dynamic_reloc if this is a dynamic reloc section.
2491
2492 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2493
2494         PR gold/13505
2495         * target-reloc.h (apply_relocation): Replace <64, false> with
2496         <size, big_endian>.
2497
2498 2011-11-25  Nick Clifton  <nickc@redhat.com>
2499
2500         * po/it.po: New Italian translation.
2501
2502 2011-11-17  Sterling Augustine  <saugustine@google.com>
2503
2504         * script.cc (script_include_directive): Implement.
2505         (read_script_file): New local variables name and search_path. Update
2506         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2507         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2508         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2509
2510 2011-11-11  Sterling Augustine  <saugustine@google.com>
2511
2512         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2513         (file_or_sections_cmd): Likewise.
2514
2515 2011-11-11  Doug Kwan  <dougkwan@google.com>
2516
2517         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2518         if --just-symbols is given.
2519
2520 2011-11-10  Doug Kwan  <dougkwan@google.com>
2521
2522         PR gold/13362
2523         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2524         when processing data relocs.
2525         * reloc.h (Relocate_functions::rel_unaligned): New method.
2526         (Relocate_functions::pcrel_unaligned): Ditto.
2527         (Relocate_functions::rel32_unaligned): Ditto.
2528         (Relocate_functions::pcrel32_unaligned): Ditto.
2529
2530 2011-11-09  Doug Kwan  <dougkwan@google.com>
2531
2532         PR gold/13362
2533         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2534         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2535         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2536         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2537         (Relocate_functions::rel_unaligned): New.
2538         (Relocate_functions::rel32_unaligned): New.
2539         * target-reloc.h (relocate_for_relocatable): Add code to handle
2540         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2541         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2542         arm_unaligned_reloc_r): New targets.
2543         * testsuite/Makefile.in: Regenerate.
2544         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2545         linking.
2546
2547 2011-11-02  Ian Lance Taylor  <iant@google.com>
2548
2549         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2550         NATIVE_LINKER.
2551         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2552         * options.cc (General_options::finalize): Use library search path
2553         from configure script if specified.  If not native and no sysroot,
2554         only search TOOLLIBDIR.
2555         * options.h (Search_directory::Search_directory): Change name to
2556         const std::string&.
2557         (General_options::add_to_library_path_with_sysroot): Change arg to
2558         const std::string&.
2559         * configure, Makefile.in, config.in: Rebuild.
2560
2561 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2562
2563         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2564         we are working around the ARM1176 Erratum.
2565         * options.h (General_options::fix_arm1176): Add option.
2566         * testsuite/Makefile.am: Add testcases, and keep current ones
2567         working.
2568         * testsuite/Makefile.in: Regenerate.
2569         * testsuite/arm_fix_1176.s: New file.
2570         * testsuite/arm_fix_1176.sh: Likewise.
2571
2572 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2573
2574         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2575         may_use_blx_.
2576         (Target_arm::may_use_blx): Remove method.
2577         (Target_arm::set_may_use_blx): Likewise.
2578         (Target_arm::may_use_v4t_interworking): New method.
2579         (Target_arm::may_use_v5t_interworking): Likewise.
2580         (Target_arm::may_use_blx_): Remove member variable.
2581         (Arm_relocate_functions::arm_branch_common): Check for v5T
2582         interworking.
2583         (Arm_relocate_functions::thumb_branch_common): Likewise.
2584         (Reloc_stub::stub_type_for_reloc): Likewise.
2585         (Target_arm::do_finalize_sections): Correct interworking checks.
2586         * testsuite/Makefile.am: Add new tests.
2587         * testsuite/Makefile.in: Regenerate.
2588         * testsuite/arm_farcall_arm_arm.s: New test.
2589         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2590         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2591         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2592         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2593         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2594         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2595         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2596
2597 2011-10-31  Cary Coutant  <ccoutant@google.com>
2598
2599         PR gold/13023
2600         * expression.cc (Expression::eval_with_dot): Add
2601         is_section_dot_assignment parameter.
2602         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2603         absolute and assigning to dot within a section.
2604         * script-sections.cc
2605         (Output_section_element_assignment::set_section_addresses): Pass
2606         dot_section to set_if_absolute.
2607         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2608         as is_section_dot_assignment flag to eval_with_dot.
2609         (Output_section_element_dot_assignment::set_section_addresses):
2610         Likewise.
2611         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2612         parameter.  Also set value if relative to dot_section; set the
2613         symbol's output_section.
2614         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2615         parameter.  Adjust all callers.
2616         (Expression::eval_maybe_dot): Likewise.
2617         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2618         Adjust all callers.
2619         * testsuite/script_test_2.t: Test assignment of an absolute value
2620         to dot within an output section element.
2621
2622 2011-10-31  Cary Coutant  <ccoutant@google.com>
2623
2624         * options.h (class General_options): Add --[no-]gnu-unique options.
2625         * symtab.cc (Symbol_table::sized_write_globals): Convert
2626         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2627
2628 2011-10-31  Cary Coutant  <ccoutant@google.com>
2629
2630         PR gold/13359
2631         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2632         unnecessary assertion.
2633         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2634
2635 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2636
2637         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2638         gc_mark_symbol.
2639         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2640         gc_mark_symbol.
2641         Change to just keep the section associated with symbol.
2642         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2643         they are externally visible and --export-dynamic is turned on.
2644         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2645
2646 2011-10-19  Ian Lance Taylor  <iant@google.com>
2647
2648         PR gold/13163
2649         * script-sections.cc
2650         (Output_section_element_dot_assignment::needs_output_section): New
2651         function.
2652
2653 2011-10-19  Ian Lance Taylor  <iant@google.com>
2654
2655         PR gold/13204
2656         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2657         --section-start option was seen.
2658         * options.h (General_options::any_section_start): New function.
2659
2660 2011-10-18  David S. Miller  <davem@davemloft.net>
2661
2662         PR binutils/13301
2663         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2664         member to track relocation locations that have moved during TLS
2665         reloc optimizations.
2666         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2667         (Target_sparc::Relocate::relocate): Adjust view down by 4
2668         bytes if it matches reloc_adjust_addr_.
2669         (Target_sparc::Relocate::relocate_tls): Always move the
2670         __tls_get_addr call delay slot instruction forward 4 bytes when
2671         performing relaxation.
2672
2673 2011-10-18  Cary Coutant  <ccoutant@google.com>
2674
2675         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2676         (Output_file::map_no_anonymous): Check for non-zero
2677         return code from posix_fallocate.
2678
2679 2011-10-17  Cary Coutant  <ccoutant@google.com>
2680
2681         PR gold/13245
2682         * plugin.cc (is_visible_from_outside): Check for symbols
2683         referenced from dynamic objects.
2684         * resolve.cc (Symbol_table::resolve): Don't count references
2685         from dynamic objects as references from real ELF files.
2686         * testsuite/plugin_test_2.sh: Adjust expected result.
2687
2688 2011-10-17  Cary Coutant  <ccoutant@google.com>
2689
2690         * gold.cc: Include timer.h.
2691         (queue_middle_tasks): Stamp time.
2692         (queue_final_tasks): Likewise.
2693         * main.cc (main): Store timer in parameters.  Print timers
2694         for each pass.
2695         * parameters.cc (Parameters::Parameters): Initialize timer_.
2696         (Parameters::set_timer): New function.
2697         (set_parameters_timer): New function.
2698         * parameters.h (Parameters::set_timer): New function.
2699         (Parameters::timer): New function.
2700         (Parameters::timer_): New data member.
2701         (set_parameters_timer): New function.
2702         * timer.cc (Timer::stamp): New function.
2703         (Timer::get_pass_time): New function.
2704         * timer.h (Timer::stamp): New function.
2705         (Timer::get_pass_time): New function.
2706         (Timer::pass_times_): New data member.
2707
2708 2011-10-17  Cary Coutant  <ccoutant@google.com>
2709
2710         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2711         task for members of lib groups.
2712
2713 2011-10-17  Cary Coutant  <ccoutant@google.com>
2714
2715         PR gold/13288
2716         * fileread.cc (File_read::find_view): Add assert.
2717         (File_read::make_view): Move bounds check (replace with assert)...
2718         (File_read::find_or_make_view): ... to here.
2719
2720 2011-10-12  Cary Coutant  <ccoutant@google.com>
2721
2722         * output.cc (Output_file::open_base_file): Handle case where
2723         ::read returns less than requested size.
2724
2725 2011-10-10  Cary Coutant  <ccoutant@google.com>
2726
2727         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2728         Initialize defined_count_.
2729         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2730         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2731         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2732         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2733         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2734         * incremental.h (Sized_relobj_incr::defined_count_): New data
2735         member.
2736         (Sized_incr_dynobj::defined_count_): New data member.
2737         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2738         Return zeroes instead of internal error.
2739
2740 2011-10-10  Cary Coutant  <ccoutant@google.com>
2741
2742         PR gold/13249
2743         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2744         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2745         * output.h (class Output_reloc): Add use_plt_offset flag.
2746         (Output_reloc::type_): Adjust size of bit field.
2747         (Output_reloc::use_plt_offset_): New bit field.
2748         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2749         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2750         flag.  Adjust all callers.
2751         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2752         creating RELATIVE relocations.
2753
2754 2011-10-10  Nick Clifton  <nickc@redhat.com>
2755
2756         * po/es.po: Updated Spanish translation.
2757         * po/fi.po: Updated Finnish translation.
2758
2759 2011-10-03   Diego Novillo  <dnovillo@google.com>
2760
2761         * options.cc (parse_uint): Fix dereference of RETVAL.
2762
2763 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2764
2765         * layout.h (section_order_map_): New member.
2766         (get_section_order_map): New member function.
2767         * output.cc (Output_section::add_input_section): Check for patterns
2768         only when --section-ordering-file is specified.
2769         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2770         output_sections have been formed.
2771         * layout.cc (Layout_Layout): Initialize section_order_map_.
2772         * plugin.cc (update_section_order): Store order in order_map. Do not
2773         update the order.
2774         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2775         * testsuite/Makefile.in: Regenerate.
2776         * testsuite/plugin_section_order.c: New file.
2777         * testsuite/plugin_final_layout.cc: New file.
2778         * testsuite/plugin_final_layout.sh: New file.
2779
2780 2011-09-29  Cary Coutant  <ccoutant@google.com>
2781
2782         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2783         Check for NULL.
2784         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2785         symbols during incremental update.
2786         (Symbol_table::add_from_dynobj): Likewise.
2787
2788 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2789             Ian Lance Taylor  <iant@google.com>
2790
2791         * symtab.cc (Symbol_table::define_special_symbol): Always
2792         canonicalize version string.
2793
2794 2011-09-26  Cary Coutant  <ccoutant@google.com>
2795
2796         * gold.cc (queue_initial_tasks): Move option checks ...
2797         * options.cc (General_options::finalize): ... to here. Disable
2798         some options; make others fatal.
2799
2800 2011-09-26  Cary Coutant  <ccoutant@google.com>
2801
2802         gcc PR lto/47247
2803         * plugin.cc (get_symbols_v2): New function.
2804         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2805         (is_referenced_from_outside): New function.
2806         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2807         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2808         (get_symbols): Pass version parameter.
2809         (get_symbols_v2): New function.
2810         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2811         parameter.
2812         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2813         (onload): Add LDPT_GET_SYMBOLS_V2.
2814         (all_symbols_read_hook): Use get_symbols_v2; check for
2815         LDPR_PREVAILING_DEF_IRONLY_EXP.
2816         * testsuite/plugin_test_3.sh: Update expected results.
2817
2818 2011-09-23  Simon Baldwin  <simonb@google.com>
2819
2820         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2821         configuration options.
2822         * configure: Regenerate.
2823         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2824         * Makefile.in: Regenerate.
2825         * testsuite/Makefile.in: Regenerate.
2826
2827 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2828
2829         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2830
2831 2011-09-19  Cary Coutant  <ccoutant@google.com>
2832
2833         * incremental.cc (can_incremental_update): Fix typo in comment.
2834         * incremental.h (can_incremental_update): Likewise.
2835
2836 2011-09-18  Cary Coutant  <ccoutant@google.com>
2837
2838         * incremental.cc (can_incremental_update): New function.
2839         * incremental.h (can_incremental_update): New function.
2840         * layout.cc (Layout::init_fixed_output_section): Call it.
2841         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2842         * object.cc (Sized_relobj_file::do_layout): Call
2843         can_incremental_update.
2844
2845 2011-09-13  Cary Coutant  <ccoutant@google.com>
2846
2847         * configure.ac: Check for glibc support for gnu_indirect_function
2848         support with static linking, setting automake conditional
2849         IFUNC_STATIC.
2850         * Makefile.in: Regenerate.
2851         * configure: Regenerate.
2852
2853         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2854         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2855         for IFUNC_STATIC.
2856         * testsuite/Makefile.in: Regenerate.
2857
2858 2011-09-13  Cary Coutant  <ccoutant@google.com>
2859
2860         * incremental.cc (Sized_relobj_incr::do_layout): Call
2861         report_comdat_group for kept comdat sections.
2862         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2863         * testsuite/Makefile.in: Regenerate.
2864         * testsuite/incr_comdat_test_1.cc: New source file.
2865         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2866         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2867         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2868
2869 2011-09-13  Ian Lance Taylor  <iant@google.com>
2870
2871         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2872         variable external_symbols_offset.
2873
2874 2011-09-12  Ian Lance Taylor  <iant@google.com>
2875
2876         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2877         triggered if object has no symbols.
2878
2879 2011-09-09  David S. Miller  <davem@davemloft.net>
2880
2881         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2882         (Output_fill_debug_line::do_write): Likewise.
2883
2884 2011-08-29  Cary Coutant  <ccoutant@google.com>
2885
2886         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2887         casts to match formatting specs.
2888         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2889
2890 2011-08-26  Cary Coutant  <ccoutant@google.com>
2891
2892         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2893         remaining hole size when allocating.
2894         (Layout::make_output_section): Set fill methods for debug sections.
2895         * layout.h (Free_list::Free_list_node): Move from private to
2896         public.
2897         (Free_list::set_min_hole_size): New function.
2898         (Free_list::begin, Free_list::end): New functions.
2899         (Free_list::min_hole_): New data member.
2900         * output.cc: Include dwarf.h.
2901         (Output_fill_debug_info::do_minimum_hole_size): New function.
2902         (Output_fill_debug_info::do_write): New function.
2903         (Output_fill_debug_line::do_minimum_hole_size): New function.
2904         (Output_fill_debug_line::do_write): New function.
2905         (Output_section::Output_section): Initialize new data member.
2906         (Output_section::set_final_data_size): Ensure patch space is larger
2907         than minimum hole size.
2908         (Output_section::do_write): Fill holes in debug sections.
2909         * output.h (Output_fill): New class.
2910         (Output_fill_debug_info): New class.
2911         (Output_fill_debug_line): New class.
2912         (Output_section::set_free_space_fill): New function.
2913         (Output_section::free_space_fill_): New data member.
2914         * testsuite/Makefile.am (incremental_test_3): Add
2915         --incremental-patch option.
2916         (incremental_test_4): Likewise.
2917         (incremental_test_5): Likewise.
2918         (incremental_test_6): Likewise.
2919         (incremental_copy_test): Likewise.
2920         (incremental_common_test_1): Likewise.
2921         * testsuite/Makefile.in: Regenerate.
2922
2923 2011-08-26  Nick Clifton  <nickc@redhat.com>
2924
2925         * po/es.po: Updated Spanish translation.
2926
2927 2011-08-01  Cary Coutant  <ccoutant@google.com>
2928
2929         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2930         * gold/testsuite/Makefile.in: Regenerate.
2931         * gold/testsuite/justsyms_exec.c: New source file.
2932         * gold/testsuite/justsyms_lib.c: New source file.
2933
2934 2011-08-01  Cary Coutant  <ccoutant@google.com>
2935
2936         * layout.cc (Layout::set_segment_offsets): Don't realign text
2937         segment if -Ttext was specified.
2938         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2939         file type.
2940         * object.h (Sized_relobj_file::e_type): New function.
2941         (Sized_relobj_file::e_type_): New data member.
2942         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2943         base address for ET_EXEC files.
2944         * target.cc (Target::do_make_elf_object_implementation): Allow
2945         ET_EXEC files with --just-symbols option.
2946
2947 2011-07-28  Cary Coutant  <ccoutant@google.com>
2948
2949         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2950         Add thread_number parameter.
2951         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2952         * workqueue-threads.cc
2953         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2954         current thread if its thread number is greater than desired thread
2955         count.
2956         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2957         Add thread_number parameter.
2958         (Workqueue::should_cancel_thread): Likewise.
2959         (Workqueue::find_runnable_or_wait): Pass thread_number to
2960         should_cancel_thread.
2961         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2962         parameter.
2963
2964 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2965
2966         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2967         only after checking if it cannot be forced local.
2968         * symtab.h (is_externally_visible): Check if the symbol is not forced
2969         local.
2970
2971 2011-07-15  Ian Lance Taylor  <iant@google.com>
2972
2973         * options.h (class General_options): Add --print-output-format.
2974         Move -EL next to -EB, for  better --help output.
2975         * target-select.cc: Include <cstdio>, "options.h", and
2976         "parameters.h".
2977         (Target_selector::do_target_bfd_name): New function.
2978         (print_output_format): New function.
2979         * target-select.h (class Target_selector): Update declarations.
2980         (Target_selector::target_bfd_name): New function.
2981         (print_output_format): Declare.
2982         * main.cc: Include "target-select.h".
2983         (main): Handle --print-output-format.
2984         * gold.cc: Include "target-select.h".
2985         (queue_initial_tasks): Handle --print-output-format when there are
2986         no input files.
2987         * parameters.cc (parameters_force_valid_target): Give a better
2988         error message if -EB/-EL does not match target.
2989         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2990         function.
2991
2992 2011-07-15  Ian Lance Taylor  <iant@google.com>
2993
2994         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2995         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2996         (Output_data_plt_i386::do_write): Write address of .dynamic
2997         section to first entry in .got.plt section.
2998         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2999         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3000         Initialize layout_.
3001         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3002         section to first entry in .got.plt section.
3003         * layout.h (Layout::dynamic_section): New function.
3004
3005 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3006
3007         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3008         to claim_file call.
3009         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3010         input_section_position_, and input_section_glob_.
3011         (read_layout_from_file): Call function section_ordering_specified.
3012         * layout.h (is_section_ordering_specified): New function.
3013         (section_ordering_specified): New function.
3014         (section_ordering_specified_): New boolean member.
3015         * main.cc(main): Call load_plugins after layout object is defined.
3016         * output.cc (Output_section::add_input_section): Use
3017         function section_ordering_specified to check if section ordering is
3018         needed.
3019         * output.cc (Output_section::add_relaxed_input_section): Use
3020         function section_ordering_specified to check if section ordering is
3021         needed.
3022         (Output_section::update_section_layout): New function.
3023         (Output_section::sort_attached_input_sections): Check if input section
3024         must be reordered.
3025         * output.h (Output_section::update_section_layout): New function.
3026         * plugin.cc (get_section_count): New function.
3027         (get_section_type): New function.
3028         (get_section_name): New function.
3029         (get_section_contents): New function.
3030         (update_section_order): New function.
3031         (allow_section_ordering): New function.
3032         (Plugin::load): Add the new interfaces to the transfer vector.
3033         (Plugin_manager::load_plugins): New parameter.
3034         (Plugin_manager::all_symbols_read): New parameter.
3035         (Plugin_manager::claim_file): New parameter. Save the elf object for
3036         unclaimed objects.
3037         (Plugin_manager::get_elf_object): New function.
3038         (Plugin_manager::get_view): Change to directly use the bool to check
3039         if get_view is called from claim_file_hook.
3040         * plugin.h (input_objects): New function
3041         (Plugin__manager::load_plugins): New parameter.
3042         (Plugin_manager::claim_file): New parameter.
3043         (Plugin_manager::get_elf_object): New function.
3044         (Plugin_manager::in_claim_file_handler): New function.
3045         (Plugin_manager::in_claim_file_handler_): New member.
3046         (layout): New function.
3047         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3048         handler with an extra parameter. Make the elf object before calling
3049         claim_file handler.
3050         * testsuite/plugin_test.c (get_section_count): New function pointer.
3051         (get_section_type): New function pointer.
3052         (get_section_name): New function pointer.
3053         (get_section_contents): New function pointer.
3054         (update_section_order): New function pointer.
3055         (allow_section_ordering): New function pointer.
3056         (onload): Check if the new interfaces exist.
3057
3058 2011-07-13  Ian Lance Taylor  <iant@google.com>
3059
3060         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3061         relro section.
3062         * x86_64.cc (Target_x86_64::got_section): Likewise.
3063         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3064         (relro_now_test_SOURCES): New variable.
3065         (relro_now_test_DEPENDENCIES): New variable.
3066         (relro_now_test_LDFLAGS): New variable.
3067         (relro_now_test_LDADD): New variable.
3068         (relro_now_test.so): New target.
3069         * testsuite/Makefile.in: Rebuild.
3070
3071 2011-07-12  Ian Lance Taylor  <iant@google.com>
3072
3073         PR gold/12980
3074         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3075         GLOB_DAT relocation rather than a RELATIVE relocation for a
3076         protected symbol when creating a shared library.
3077         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3078         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3079         * testsuite/protected_main_1.cc (main): Test that protected
3080         function has same address.
3081
3082 2011-07-11  Ian Lance Taylor  <iant@google.com>
3083
3084         PR gold/12979
3085         * options.h (class General_options): Add -Bgroup.
3086         * options.cc (General_options::finalize): If -Bgroup is set,
3087         default to --unresolved-symbols=report-all.
3088         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3089         * target-reloc.h (issue_undefined_symbol_error): Handle
3090         --unresolved-symbols=report-all.
3091
3092 2011-07-08  Ian Lance Taylor  <iant@google.com>
3093
3094         PR gold/11985
3095         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3096         if linker script discards key sections.
3097         (Layout::create_dynamic_symtab): Likewise.
3098         (Layout::assign_local_dynsym_offsets): Likewise.
3099         (Layout::sized_create_version_sections): Likewise.
3100         (Layout::create_interp): Likewise.
3101         (Layout::finish_dynamic_section): Likewise.
3102         (Layout::set_dynamic_symbol_size): Likewise.
3103
3104 2011-07-08  Ian Lance Taylor  <iant@google.com>
3105
3106         PR gold/12386
3107         * options.h (class General_options): Add --unresolved-symbols.
3108         * target-reloc.h (issue_undefined_symbol_error): Check
3109         --unresolved-symbols.  Add comments.
3110
3111 2011-07-08  Ian Lance Taylor  <iant@google.com>
3112
3113         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3114         expression more complex.
3115
3116 2011-07-08  Ian Lance Taylor  <iant@google.com>
3117
3118         PR gold/11317
3119         * target-reloc.h (issue_undefined_symbol_error): New inline
3120         function, broken out of relocate_section.
3121         (relocate_section): Call issue_undefined_symbol_error.
3122         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3123         there is no TLS segment if we are about to issue an undefined
3124         symbol error.
3125         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3126
3127 2011-07-08  Ian Lance Taylor  <iant@google.com>
3128
3129         PR gold/12279
3130         * resolve.cc (Symbol_table::should_override): Add fromtype
3131         parameter.  Change all callers.  Give error when linking together
3132         TLS and non-TLS symbol.
3133         (Symbol_table::should_override_with_special): Add fromtype
3134         parameter.  Change all callers.
3135         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3136         there is no TLS segment if we have reported some errors.
3137         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3138
3139 2011-07-08  Ian Lance Taylor  <iant@google.com>
3140
3141         PR gold/12372
3142         * target.h (Target::plt_address_for_global): New function.
3143         (Target::plt_address_for_local): New function.
3144         (Target::plt_section_for_global): Remove.
3145         (Target::plt_section_for_local): Remove.
3146         (Target::do_plt_address_for_global): New virtual function.
3147         (Target::do_plt_address_for_local): New virtual function.
3148         (Target::do_plt_section_for_global): Remove.
3149         (Target::do_plt_section_for_local): Remove.
3150         (Target::register_global_plt_entry): Add Symbol_table and Layout
3151         parameters.
3152         * output.cc (Output_data_got::Got_entry::write): Use
3153         plt_address_for_global and plt_address_for_local.
3154         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3155         address of output section.
3156         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3157         got_irelative_, and irelative_count_ fields.  Update
3158         declarations.
3159         (Output_data_plt_i386::has_irelative_section): New function.
3160         (Output_data_plt_i386::entry_count): Add irelative_count_.
3161         (Output_data_plt_i386::set_final_data_size): Likewise.
3162         (class Target_i386): Add got_irelative_ and rel_irelative_
3163         fields.  Update declarations.
3164         (Target_i386::Target_i386): Initialize new fields.
3165         (Target_i386::do_plt_address_for_global): New function replacing
3166         do_plt_section_for_global.
3167         (Target_i386::do_plt_address_for_local): New function replacing
3168         do_plt_section_for_local.
3169         (Target_i386::got_section): Create got_irelative_.
3170         (Target_i386::rel_irelative_section): New function.
3171         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3172         fields.  Don't define __rel_iplt_{start,end}.
3173         (Output_data_plt_i386::add_entry): Add symtab and layout
3174         parameters.  Change all callers.  Use different PLT and GOT for
3175         IFUNC symbols.
3176         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3177         layout parameters.  Change all callers.  Use different PLT and
3178         GOT.
3179         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3180         (Output_data_plt_i386::rel_irelative): New function.
3181         (Output_data_plt_i386::address_for_global): New function.
3182         (Output_data_plt_i386::address_for_local): New function.
3183         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3184         IRELATIVE GOT when changing IFUNC GOT entries.
3185         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3186         reloc.
3187         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3188         if we didn't create an IRELATIVE GOT.
3189         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3190         plt_address_for_local.
3191         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3192         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3193         got_irelative_, and irelative_count_ fields.  Update
3194         declarations.
3195         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3196         Initialize new fields.  Remove symtab parameter.  Change all
3197         callers.
3198         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3199         irelative_count_.
3200         (Output_data_plt_x86_64::has_irelative_section): New function.
3201         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3202         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3203         fields.  Update declarations.
3204         (Target_x86_64::Target_x86_64): Initialize new fields.
3205         (Target_x86_64::do_plt_address_for_global): New function replacing
3206         do_plt_section_for_global.
3207         (Target_x86_64::do_plt_address_for_local): New function replacing
3208         do_plt_section_for_local.
3209         (Target_x86_64::got_section): Create got_irelative_.
3210         (Target_x86_64::rela_irelative_section): New function.
3211         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3212         all callers.  Don't create __rel_iplt_{start,end}.
3213         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3214         parameters.  Change all callers.  Use different PLT and GOT for
3215         IFUNC symbols.
3216         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3217         layout parameters.  Change all callers.  Use different PLT and
3218         GOT.
3219         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3220         parameters.  Change all callers.  Use different PLT and GOT for
3221         IFUNC symbols.
3222         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3223         (Output_data_plt_x86_64::rela_irelative): New function.
3224         (Output_data_plt_x86_64::address_for_global): New function.
3225         (Output_data_plt_x86_64::address_for_local): New function.
3226         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3227         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3228         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3229         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3230         parameters.
3231         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3232         reloc.
3233         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3234         symbols if we didn't create an IRELATIVE GOT.
3235         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3236         plt_address_for_local.
3237         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3238         * testsuite/ifuncvar1.c: New test file.
3239         * testsuite/ifuncvar2.c: New test file.
3240         * testsuite/ifuncvar3.c: New test file.
3241         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3242         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3243         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3244         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3245         * testsuite/Makefile.in: Rebuild.
3246
3247 2011-07-07  Cary Coutant  <ccoutant@google.com>
3248
3249         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3250         (two_file_test_1_ndebug.o): Likewise.
3251         (two_file_test_1b_ndebug.o): Likewise.
3252         (two_file_test_2_ndebug.o): Likewise.
3253         (two_file_test_main_ndebug.o): Likewise.
3254         (incremental_test_2): Link with no-debug versions.
3255
3256 2011-07-06  Cary Coutant  <ccoutant@google.com>
3257
3258         * gold/incremental.cc
3259         (Output_section_incremental_inputs::write_info_blocks): Check for
3260         hidden and internal symbols.
3261
3262 2011-07-06  Cary Coutant  <ccoutant@google.com>
3263
3264         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3265         Check disposition for startup file.
3266         (Incremental_inputs::report_command_line): Ignore
3267         --incremental-startup-unchanged option.
3268         * options.cc (General_options::parse_incremental_startup_unchanged):
3269         New function.
3270         (General_options::General_options): Initialize new data member.
3271         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3272         (General_options): Add --incremental-startup-unchanged option.
3273         (General_options::incremental_startup_disposition): New function.
3274         (General_options::incremental_startup_disposition_): New data member.
3275
3276 2011-07-06  Cary Coutant  <ccoutant@google.com>
3277
3278         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3279         input file index to Script_info ctor.
3280         (Sized_incremental_binary::do_file_has_changed): Find the
3281         command-line argument for files named in scripts.
3282         * incremental.h (Script_info::Script_info): New ctor
3283         with input file index.
3284         (Script_info::input_file_index): New function.
3285         (Script_info::input_file_index_): New data member.
3286         (Incremental_binary::get_library): Add const.
3287         (Incremental_binary::get_script_info): Add const.
3288         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3289         * testsuite/Makefile.am (incremental_test_5): New test case.
3290         (incremental_test_6): New test case.
3291         * testsuite/Makefile.in: Regenerate.
3292
3293 2011-07-06  Cary Coutant  <ccoutant@google.com>
3294
3295         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3296         debug output when command lines differ.
3297
3298 2011-07-06  Cary Coutant  <ccoutant@google.com>
3299
3300         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3301         --incremental-patch option.
3302         * layout.cc (Free_list::allocate): Extend allocation beyond original
3303         end if enabled.
3304         (Layout::make_output_section): Mark sections that should get
3305         patch space.
3306         * options.cc (parse_percent): New function.
3307         * options.h (parse_percent): New function.
3308         (DEFINE_percent): New macro.
3309         (General_options): Add --incremental-patch option.
3310         * output.cc (Output_section::Output_section): Initialize new data
3311         members.
3312         (Output_section::add_input_section): Print section name when out
3313         of patch space.
3314         (Output_section::add_output_section_data): Likewise.
3315         (Output_section::set_final_data_size): Add patch space when
3316         doing --incremental-full.
3317         (Output_section::do_reset_address_and_file_offset): Remove patch
3318         space.
3319         (Output_segment::set_section_list_addresses): Print debug output
3320         only if --incremental-update.
3321         * output.h (Output_section::set_is_patch_space_allowed): New function.
3322         (Output_section::is_patch_space_allowed_): New data member.
3323         (Output_section::patch_space_): New data member.
3324         * parameters.cc (Parameters::incremental_full): New function.
3325         * parameters.h (Parameters::incremental_full): New function
3326         * testsuite/Makefile.am (incremental_test_2): Add test for
3327         --incremental-patch option.
3328         * testsuite/Makefile.in: Regenerate.
3329         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3330         (t18): Remove function body.
3331
3332 2011-07-05  Doug Kwan  <dougkwan@google.com>
3333
3334         PR gold/12771
3335         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3336         Arm_Address type for relocation result.
3337         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3338         overflow check.
3339         (Arm_relocate_functions::abs32): Use unaligned access.
3340         (Arm_relocate_functions::rel32): Ditto.
3341         (Arm_relocate_functions::prel31): Ditto.
3342         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3343         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3344         static data relocations.
3345         * testsuite/Makefile.in: Regnerate.
3346         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3347
3348 2011-07-05  Ian Lance Taylor  <iant@google.com>
3349
3350         PR gold/12392
3351         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3352         symbols if necessary.
3353         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3354
3355 2011-07-05  Ian Lance Taylor  <iant@google.com>
3356
3357         PR gold/12952
3358         * resolve.cc (Symbol::override_base_with_special): Simply override
3359         version with special symbol version, ignoring previous version.
3360
3361 2011-07-05  Ian Lance Taylor  <iant@google.com>
3362
3363         * object.cc (Sized_relobj_file::include_section_group): Add
3364         information to comment about signature location.
3365
3366 2011-07-02  Ian Lance Taylor  <iant@google.com>
3367
3368         PR gold/12957
3369         * options.h (class General_options): Add -f and -F.
3370         * options.cc (General_options::finalize): Fatal error if -f/-F
3371         are used without -shared.
3372         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3373
3374 2011-07-02  Ian Lance Taylor  <iant@google.com>
3375
3376         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3377
3378 2011-07-01  Ian Lance Taylor  <iant@google.com>
3379
3380         PR gold/12525
3381         PR gold/12952
3382         * resolve.cc (Symbol::override_base_with_special): Don't override
3383         the version if the overriding symbol has a different name.
3384         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3385         all callers.  If we give an error about an undefined version,
3386         define the base version if necessary.
3387         * dynobj.h (class Versions): Update declaration.
3388         * testsuite/weak_alias_test_5.cc: New file.
3389         * testsuite/weak_alias_test.script: New file.
3390         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3391         and versioned_alias have the right value, and call t2.
3392         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3393         weak_alias_test_5.so.
3394         (weak_alias_test_LDADD): Likewise.
3395         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3396         * testsuite/Makefile.in: Rebuild.
3397
3398 2011-07-01  Ian Lance Taylor  <iant@google.com>
3399
3400         PR gold/12525
3401         * options.h (class General_options): Support -z notext.
3402         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3403         -Wl,-z,notext.
3404         (two_file_shared_nonpic.so): Likewise.
3405         (two_file_shared_mixed.so): Likewise.
3406         (two_file_shared_mixed_1.so): Likewise.
3407         (weak_undef_lib_nonpic.so): Likewise.
3408         (alt/weak_undef_lib_nonpic.so): Likewise.
3409         (tls_test_shared_nonpic.so): Likewise.
3410         * testsuite/Makefile.in: Rebuild.
3411
3412 2011-07-01  Ian Lance Taylor  <iant@google.com>
3413
3414         PR gold/12525
3415         * configure.ac: Test whether static linking works, setting
3416         the automake conditional HAVE_STATIC.
3417         * testsuite/Makefile.am: Disable tests using -static if
3418         HAVE_STATIC is not true.
3419         * configure, testsuite/Makefile.in: Rebuild.
3420
3421 2011-07-01  Ian Lance Taylor  <iant@google.com>
3422
3423         PR gold/12525
3424         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3425         Assert if we see DW_EH_PE_indirect.
3426         * target.h (Target::ehframe_datarel_base): New function.
3427         (Target::do_ehframe_datarel_base): New target function.
3428         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3429         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3430         function.
3431
3432 2011-07-01  Ian Lance Taylor  <iant@google.com>
3433
3434         PR gold/12571
3435         * options.h (class General_options): Add
3436         --ld-generated-unwind-info.
3437         * ehframe.cc (Fde::write): Add address parameter.  Change all
3438         callers.  If associated with PLT, fill in address and size.
3439         (Cie::set_output_offset): Only add merge mapping if there is an
3440         object.
3441         (Cie::write): Add address parameter.  Change all callers.
3442         (Eh_frame::add_ehframe_for_plt): New function.
3443         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3444         input_offset_ fields into union u_, with new plt field.
3445         (Fde::Fde): Adjust for new union field.
3446         (Fde::Fde) [Output_data version]: New constructor.
3447         (Fde::add_mapping): Only add merge mapping if there is an object.
3448         (class Cie): Update declarations.
3449         (class Eh_frame): Declare add_ehframe_for_plt.
3450         * layout.cc (Layout::layout_eh_frame): Break out code into
3451         make_eh_frame_section, and call it.
3452         (Layout::make_eh_frame_section): New function.
3453         (Layout::add_eh_frame_for_plt): New function.
3454         * layout.h (class Layout): Update declarations.
3455         * merge.cc (Merge_map::add_mapping): Add assertion.
3456         * i386.cc: Include "dwarf.h".
3457         (class Output_data_plt_i386): Make first_plt_entry,
3458         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3459         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3460         and plt_eh_frame_fde.
3461         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3462         boundary.  Call add_eh_frame_for_plt if appropriate.
3463         * x86_64.cc: Include "dwarf.h".
3464         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3465         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3466         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3467         and plt_eh_frame_fde.
3468         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3469         appropriate.
3470
3471 2011-06-29  Ian Lance Taylor  <iant@google.com>
3472
3473         PR gold/12629
3474         * object.cc (Sized_relobj_file::layout_section): Change shdr
3475         parameter to be const.
3476         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3477         out of do_layout.
3478         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3479         appropriate.  Call layout_eh_frame_section.
3480         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3481         sections.
3482         * object.h (class Sized_relobj_file): Update declarations.
3483
3484 2011-06-29  Ian Lance Taylor  <iant@google.com>
3485
3486         PR gold/12652
3487         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3488         modifier.
3489         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3490
3491 2011-06-29  Ian Lance Taylor  <iant@google.com>
3492
3493         PR gold/12675
3494         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3495         SHT_X86_64_UNWIND.
3496         * layout.cc (Layout::layout_eh_frame): Likewise.
3497
3498 2011-06-29  Ian Lance Taylor  <iant@google.com>
3499
3500         PR gold/12695
3501         * layout.cc (Layout::symtab_section_shndx): New function.
3502         * layout.h (class Layout): Declare symtab_section_shndx.
3503         * output.cc (Output_section::write_header): Call it.
3504
3505 2011-06-29  Ian Lance Taylor  <iant@google.com>
3506
3507         PR gold/12818
3508         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3509         symbols which are not used in a relocation.
3510
3511 2011-06-28  Ian Lance Taylor  <iant@google.com>
3512
3513         PR gold/12898
3514         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3515         script create indistinguishable segments.
3516         (Layout::set_segment_offsets): Use stable_sort when sorting
3517         segments.  Pass this to Compare_segments constructor.
3518         * layout.h (class Layout): Make segment_precedes non-static.
3519         (class Compare_segments): Change from struct to class.  Add
3520         layout_ field.  Add constructor.
3521         * script-sections.cc
3522         (Script_sections::attach_sections_using_phdrs_clause): Rename
3523         local orphan to is_orphan.  Don't report failure to put empty
3524         section in segment.  On attachment failure, report name of
3525         section, and attach to first PT_LOAD segment.
3526
3527 2011-06-28  Ian Lance Taylor  <iant@google.com>
3528
3529         PR gold/12934
3530         * target-select.cc (Target_selector::Target_selector): Add
3531         emulation parameter.  Change all callers.
3532         (select_target_by_bfd_name): Rename from select_target_by_name.
3533         Change all callers.
3534         (select_target_by_emulation): New function.
3535         (supported_emulation_names): New function.
3536         * target-select.h (class Target_selector): Add emulation_ field.
3537         Update declarations.
3538         (Target_selector::recognize_by_bfd_name): Rename from
3539         recognize_by_name.  Change all callers.
3540         (Target_selector::supported_bfd_names): Rename from
3541         supported_names.  Change all callers.
3542         (Target_selector::recognize_by_emulation): New function.
3543         (Target_selector::supported_emulations): New function.
3544         (Target_selector::emulation): New function.
3545         (Target_selector::do_recognize_by_bfd_name): Rename from
3546         do_recognize_by_name.  Change all callers.
3547         (Target_selector::do_supported_bfd_names): Rename from
3548         do_supported_names.  Change all callers.
3549         (Target_selector::do_recognize_by_emulation): New function.
3550         (Target_selector::do_supported_emulations): New function.
3551         (select_target_by_bfd_name): Change name in declaration.
3552         (select_target_by_emulation): Declare.
3553         (supported_emulation_names): Declare.
3554         * parameters.cc (parameters_force_valid_target): Try to find
3555         target based on emulation from -m option.
3556         * options.h (class General_options): Change doc string for -m.
3557         * options.cc (help): Print emulations.
3558         (General_options::parse_V): Likewise.
3559         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3560         Add emulation parameter.  Change all callers.
3561
3562 2011-06-28  Ian Lance Taylor  <iant@google.com>
3563
3564         * target.h (class Target): Add osabi_ field.
3565         (Target::osabi): New function.
3566         (Target::set_osabi): New function.
3567         (Target::Target): Initialize osabi_.
3568         (Target::do_adjust_elf_header): Make pure virtual.
3569         (Sized_target::do_adjust_elf_header): Declare.
3570         * target.cc (Sized_target::do_adjust_elf_header): New function.
3571         (class Sized_target): Instantiate all versions.
3572         * freebsd.h (class Target_freebsd): Remove.
3573         (Target_selector_freebsd::do_recognize): Call set_osabi on
3574         Target.
3575         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3576         (Target_selector_freebsd::set_osabi): Remove.
3577         * i386.cc (class Target_i386): Inherit from Sized_target rather
3578         than Target_freebsd.
3579         * x86_64.cc (class Target_x86_64): Likewise.
3580
3581 2011-06-28  Ian Lance Taylor  <iant@google.com>
3582
3583         * target.h (Target::can_check_for_function_pointers): Rewrite.
3584         Make non-virtual.
3585         (Target::can_icf_inline_merge_sections): Likewise.
3586         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3587         (Target::Target_info): Add can_icf_inline_merge_sections field.
3588         (Target::do_can_check_for_function_pointers): New virtual
3589         function.
3590         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3591         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3592         from can_check_for_function_pointers, move in file.
3593         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3594         section_may_have_icf_unsafe_poineters, move in file.
3595         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3596         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3597         Rename from can_check_for_function_pointers, move in file.
3598         (Target_i386::can_icf_inline_merge_sections): Remove.
3599         (Target_i386::i386_info): Initialize
3600         can_icf_inline_merge_sections.
3601         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3602         Initialize can_icf_inline_merge_sections.
3603         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3604         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3605         Rename from can_check_for_function_pointers, move in file.
3606         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3607         (Target_x86_64::x86_64_info): Initialize
3608         can_icf_inline_merge_sections.
3609         * testsuite/testfile.cc (Target_test::test_target_info):
3610         Likewise.
3611         * icf.cc (get_section_contents): Correct formatting.
3612
3613 2011-06-27  Ian Lance Taylor  <iant@google.com>
3614
3615         * symtab.cc (Symbol::versioned_name): New function.
3616         (Symbol_table::add_to_final_symtab): Use versioned_name when
3617         appropriate.
3618         (Symbol_table::sized_write_symbol): Likewise.
3619         * symtab.h (class Symbol): Declare versioned_name.
3620         * stringpool.h (class Stringpool_template): Add variant of add
3621         which takes a std::basic_string.
3622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3623         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3624         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3625         (ver_test_12.o): New target.
3626         * testsuite/Makefile.in: Rebuild.
3627
3628 2011-06-27  Doug Kwan  <dougkwan@google.com>
3629
3630         * arm.cc (Arm_relocate_functions::thm_jump8,
3631         Arm_relocate_functions::thm_jump11): Use a wider signed
3632         type to compute offset.
3633         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3634         arm_thm_jump8.
3635         * testsuite/Makefile.in: Regenerate.
3636         * testsuite/arm_branch_in_range.sh: Check test results of
3637         arm_thm_jump11 and arm_thm_jump8.
3638         * testsuite/arm_thm_jump11.s: New test source file.
3639         * testsuite/arm_thm_jump11.t: New linker script.
3640         * testsuite/arm_thm_jump8.s: New test source file.
3641         * testsuite/arm_thm_jump8.t: New linker script.
3642
3643 2011-06-24  Ian Lance Taylor  <iant@google.com>
3644
3645         * layout.cc: Include "object.h".
3646         (ctors_sections_in_init_array): New static variable.
3647         (Layout::is_ctors_in_init_array): New function.
3648         (Layout::layout): Add entry to ctors_sections_in_init_array if
3649         appropriate.
3650         * layout.h (class Layout): Declare is_ctors_in_init_array.
3651         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3652         is_ctors_reverse_view is set.
3653         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3654         all callers.  Set is_ctors_reverse_view field of View_size.
3655         (Sized_relobj_file::reverse_words): New function.
3656         * object.h (Sized_relobj_file::View_size): Add
3657         is_ctors_reverse_view field.
3658         (class Sized_relobj_file): Update declarations.
3659         * testsuite/initpri3.c: New test.
3660         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3661         initpri3b.
3662         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3663         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3664         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3665         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3666         * testsuite/Makefile.in: Rebuild.
3667
3668 2011-06-24  Cary Coutant  <ccoutant@google.com>
3669
3670         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3671         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3672         (debug_msg_cdebug.err): New targets.
3673         * testsuite/Makefile.in: Regenerate.
3674         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3675         Fix checks for link with shared library.
3676
3677 2011-06-24  Doug Kwan  <dougkwan@google.com>
3678
3679         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3680         skip empty text sections.
3681         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3682
3683 2011-06-22  Ian Lance Taylor  <iant@google.com>
3684
3685         PR gold/12910
3686         * options.h (class General_options): Add --ctors-in-init-array.
3687         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3688         friends as SHT_PROGBITS for merging sections.
3689         (Layout::layout): Remove special handling of .init_array and
3690         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3691         and .dtors if ctors_in_init_array.
3692         (Layout::make_output_section): Force correct section types for
3693         .init_array and friends.  Don't sort if doing relocatable link,
3694         Don't sort .ctors and .dtors if ctors_in_init_array.
3695         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3696         (Layout::output_section_name): Add relobj parameter.  Change all
3697         callers.  Handle .ctors. and .dtors. in code rather than table.
3698         Handle .ctors and .dtors if ctors_in_init_array.
3699         (Layout::match_file_name): New function, moved from output.cc.
3700         * layout.h (class Layout): Update declarations.
3701         * output.cc: Include "layout.h".
3702         (Input_section_sort_entry::get_priority): New function.
3703         (Input_section_sort_entry::match_file_name): Just call
3704         Layout::match_file_name.
3705         (Output_section::Input_section_sort_init_fini_compare::operator()):
3706         Handle .ctors and .dtors.  Sort by explicit priority rather than
3707         by name.
3708         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3709         * testsuite/initpri2.c: New test.
3710         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3711         (check_PROGRAMS): Add initpri2.
3712         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3713         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3714         * configure, testsuite/Makefile.in: Rebuild.
3715
3716 2011-06-19  Ian Lance Taylor  <iant@google.com>
3717
3718         PR gold/12880
3719         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3720         .interp section to a PT_INTERP segment even if we have seen a
3721         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3722         clause in a linker script.
3723         (Layout::finalize): Don't create a .interp section if we've
3724         already create a PT_INTERP segment.
3725         (Layout::create_interp): Always call choose_output_section (revert
3726         patch of 2011-06-17).  Don't create PT_INTERP segment.
3727         * script-sections.cc
3728         (Script_sections::create_note_and_tls_segments): Add a .interp
3729         section to a PT_INTERP segment even if we have seen a
3730         --dynamic-linker option.
3731
3732 2011-06-18  Ian Lance Taylor  <iant@google.com>
3733
3734         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3735         merely because a non-PT_LOAD segment has a dynamic reloc.
3736
3737 2011-06-18  Ian Lance Taylor  <iant@google.com>
3738
3739         * layout.cc (Layout::finish_dynamic_section): Don't create
3740         DT_FLAGS entry if not needed.
3741
3742 2011-06-18  Ian Lance Taylor  <iant@google.com>
3743
3744         PR gold/12745
3745         * layout.cc (Layout::layout_eh_frame): Correct handling of
3746         writable .eh_frame section.
3747
3748 2011-06-17  Ian Lance Taylor  <iant@google.com>
3749
3750         PR gold/12893
3751         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3752         symbol is redefined with the exact same object and value.
3753
3754 2011-06-17  Ian Lance Taylor  <iant@google.com>
3755
3756         PR gold/12880
3757         * layout.h (class Layout): Add interp_segment_ field.
3758         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3759         (Layout::attach_allocated_section_to_segment): If making shared
3760         library, put .interp section in PT_INTERP segment.
3761         (Layout::finalize): Also call create_interp if -dynamic-linker
3762         option was used.
3763         (Layout::create_interp): Assert that there is no PT_INTERP
3764         segment.  If not using a SECTIONS clause, use make_output_section.
3765         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3766         * script-sections.cc
3767         (Script_sections::create_note_and_tls_segments): If making shared
3768         library, put .interp section in PT_INTERP segment.
3769
3770 2011-06-17  Ian Lance Taylor  <iant@google.com>
3771
3772         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3773         when making a shared library.
3774
3775 2011-06-17  Ian Lance Taylor  <iant@google.com>
3776
3777         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3778         parameter.  Change all callers.  Don't issue warning about PC32
3779         against locally defined symbol.
3780
3781 2011-06-16  Ian Lance Taylor  <iant@google.com>
3782
3783         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3784         occurs in same object.
3785
3786 2011-06-14  Alan Modra  <amodra@gmail.com>
3787
3788         * po/POTFILES.in: Regenerate.
3789
3790 2011-06-09  Ian Lance Taylor  <iant@google.com>
3791
3792         * script-sections.cc
3793         (Orphan_output_section::set_section_addresses): For a relocatable
3794         link set address to 0.
3795
3796 2011-06-09  Cary Coutant  <ccoutant@google.com>
3797
3798         PR gold/12804
3799         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3800         used with --compress-debug-sections.
3801         * gold/object.cc (Sized_relobj_file::do_layout): Report
3802         uncompressed size of compressed input sections.
3803
3804 2011-06-08  Cary Coutant  <ccoutant@google.com>
3805
3806         PR gold/12804
3807         * testsuite/two_file_test_2_v1.cc: Change initialization of
3808         v2 to keep it in .data.
3809
3810 2011-06-07  Cary Coutant  <ccoutant@google.com>
3811
3812         * common.cc (Symbol_table::do_allocate_commons_list): Call
3813         gold_fallback.
3814         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3815         (Errors::fallback): New function.
3816         (gold_fallback): New function.
3817         * errors.h (Errors::fallback): New function.
3818         * gold.cc (gold_exit): Change status parameter to enum; adjust
3819         all callers.
3820         (queue_initial_tasks): Call gold_fallback.
3821         * gold.h: Include cstdlib.
3822         (Exit_status): New enum type.
3823         (gold_exit): Change status parameter to enum.
3824         (gold_fallback): New function.
3825         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3826         (Layout::create_symtab_sections): Likewise.
3827         (Layout::create_shdrs): Likewise.
3828         * main.cc (main): Adjust call to gold_exit.
3829         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3830         (Output_data_got::add_got_entry_pair): Likewise.
3831         (Output_section::add_input_section): Likewise.
3832         (Output_section::add_output_section_data): Likewise.
3833         (Output_segment::set_section_list_addresses): Likewise.
3834         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3835
3836 2011-06-07  Cary Coutant  <ccoutant@google.com>
3837
3838         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3839         for incremental links.
3840         * output.cc (Output_segment::set_section_list_addresses): Remove
3841         FIXME and test for TLS or BSS.
3842
3843 2011-06-07  Cary Coutant  <ccoutant@google.com>
3844
3845         * testsuite/Makefile.am: Add incremental_copy_test,
3846         incremental_common_test_1.
3847         * testsuite/Makefile.in: Regenerate.
3848         * testsuite/common_test_1_v1.c: New source file.
3849         * testsuite/common_test_1_v2.c: New source file.
3850         * testsuite/copy_test_v1.cc: New source file.
3851
3852 2011-06-07  Cary Coutant  <ccoutant@google.com>
3853
3854         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3855         update, allocate common from bss section's free list.
3856         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3857         linker-defined symbols.
3858         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3859         Skip GOT and PLT entries that are no longer referenced.
3860         (Output_section_incremental_inputs::write_info_blocks): Mark
3861         linker-defined symbols.
3862         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3863         * output.cc (Output_section::allocate): New function.
3864         * output.h (Output_section::allocate): New function.
3865         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3866         linker-defined symbols.
3867         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3868         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3869         (Symbol::init_base_output_data): Likewise.
3870         (Symbol::init_base_output_segment): Likewise.
3871         (Symbol::init_base_constant): Likewise.
3872         (Sized_symbol::init_output_data): Likewise.
3873         (Sized_symbol::init_output_segment): Likewise.
3874         (Sized_symbol::init_constant): Likewise.
3875         (Symbol_table::do_define_in_output_data): Likewise.
3876         (Symbol_table::do_define_in_output_segment): Likewise.
3877         (Symbol_table::do_define_as_constant): Likewise.
3878         * symtab.h (Symbol::is_predefined): New function.
3879         (Symbol::init_base_output_data): Add is_predefined parameter.
3880         (Symbol::init_base_output_segment): Likewise.
3881         (Symbol::init_base_constant): Likewise.
3882         (Symbol::is_predefined_): New data member.
3883         (Sized_symbol::init_output_data): Add is_predefined parameter.
3884         (Sized_symbol::init_output_segment): Likewise.
3885         (Sized_symbol::init_constant): Likewise.
3886         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3887
3888 2011-06-07  Cary Coutant  <ccoutant@google.com>
3889
3890         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3891         instead of emit_copy_reloc.
3892         (Copy_relocs::emit_copy_reloc): Refactor.
3893         (Copy_relocs::make_copy_reloc): New function.
3894         (Copy_relocs::add_copy_reloc): Remove.
3895         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3896         section.
3897         (Copy_relocs::make_copy_reloc): New function.
3898         (Copy_relocs::add_copy_reloc): Remove.
3899         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3900         unchanged input files.
3901         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3902         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3903         Reserve BSS space for COPY relocations.
3904         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3905         (Output_section_incremental_inputs::write_info_blocks): Record
3906         whether a symbol is copied from a shared object.
3907         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3908         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3909         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3910         (Incremental_input_entry_reader::get_output_symbol_index): Add
3911         is_copy parameter.
3912         (Incremental_binary::emit_copy_relocs): New function.
3913         (Incremental_binary::do_emit_copy_relocs): New function.
3914         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3915         new data member.
3916         (Sized_incremental_binary::add_copy_reloc): New function.
3917         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3918         (Sized_incremental_binary::Copy_reloc): New struct.
3919         (Sized_incremental_binary::Copy_relocs): New typedef.
3920         (Sized_incremental_binary::copy_relocs_): New data member.
3921         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3922         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3923         * target.h (Sized_target::emit_copy_reloc): New function.
3924         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3925
3926 2011-06-02  Cary Coutant  <ccoutant@google.com>
3927
3928         PR gold/12163
3929         * gold/archive.cc (Archive::Archive): Initialize new data member.
3930         (Archive::include_all_members): Return if archive has already been
3931         included.
3932         * gold/archive.h (Archive::include_all_members_): New data member.
3933
3934 2011-06-02  Nick Clifton  <nickc@redhat.com>
3935
3936         * dynobj.h: Fix spelling mistake in comment.
3937         * output.cc: Likewise.
3938
3939 2011-05-31  Doug Kwan  <dougkwan@google.com>
3940             Asier Llano
3941
3942         PR gold/12826
3943         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3944         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3945         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3946         redundant arm_exidx_test.so.
3947         * testsuite/Makefile.in: Regenerate.
3948         (check_SCRIPTS): Add pr12826.sh
3949         (check_DATA): Add pr12826.stdout
3950         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3951         * testsuite/pr12826.sh: New file.
3952         * testsuite/pr12826_1.s: Ditto.
3953         * testsuite/pr12826_1.s: Ditto.
3954
3955 2011-05-30  Ian Lance Taylor  <iant@google.com>
3956
3957         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3958         sections.
3959
3960 2011-05-29  Ian Lance Taylor  <iant@google.com>
3961
3962         PR gold/12804
3963         * testsuite/Makefile.am: Use different file name for two_file_test
3964         temporary file for each incremental test.
3965         * testsuite/Makefile.in: Rebuild.
3966
3967 2011-05-29  Ian Lance Taylor  <iant@google.com>
3968
3969         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3970         binary input file is empty.
3971
3972 2011-05-27  Ian Lance Taylor  <iant@google.com>
3973
3974         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3975         (ver_test_9.so): Likewise.
3976         * testsuite/Makefile.in: Rebuild.
3977
3978 2011-05-26 Cary Coutant  <ccoutant@google.com>
3979
3980         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3981         * incremental.cc (Incremental_inputs::report_input_section): Fix
3982         comment, indentation.
3983         (Incremental_inputs::report_comdat_group): New function.
3984         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3985         of data for incremental input file entry.
3986         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3987         group count, COMDAT group signatures.
3988         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3989         an unchanged input file.
3990         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3991         Initialize new data member.
3992         (Incremental_object_entry::add_comdat_group): New function.
3993         (Incremental_object_entry::get_comdat_group_count): New function.
3994         (Incremental_object_entry::get_comdat_signature_key): New function.
3995         (Incremental_object_entry::groups_): New data member.
3996         (Incremental_inputs::report_comdat_group): New function.
3997         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3998         data for incremental input file entry.
3999         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4000         (Incremental_input_entry_reader::get_input_section): Adjust size of
4001         data for incremental input file entry.
4002         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4003         (Incremental_input_entry_reader::get_comdat_group_signature): New
4004         function.
4005         * object.cc (Sized_relobj::include_section_group): Report kept
4006         COMDAT groups for incremental links.
4007
4008 2011-05-24  David Meyer  <pdox@google.com>
4009
4010         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4011         with name parameter.  Add found_name parameter.
4012         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4013         * dirsearch.h (class Dirsearch): Update declaration.
4014
4015 2011-05-24  Ian Lance Taylor  <iant@google.com>
4016
4017         * archive.cc (Library_base::should_include_member): Pull in object
4018         from archive if it defines the entry symbol.
4019         * parameters.cc (Parameters::entry): New function.
4020         * parameters.h (class Parameters): Declare entry.
4021         * output.h (class Output_file_header): Remove entry_ field.
4022         * output.cc (Output_file_header::Output_file_header): Remove entry
4023         parameter.  Change all callers.
4024         (Output_file_header::entry): Use parameters->entry.
4025         * gold.cc (queue_middle_tasks): Likewise.
4026         * plugin.cc (Plugin_hook::run): Likewise.
4027
4028 2011-05-24 Cary Coutant  <ccoutant@google.com>
4029
4030         * gold.cc (queue_initial_tasks): Pass incremental base filename
4031         to Output_file::open_base_file; don't print error message.
4032         * incremental-dump.cc (main): Adjust call to
4033         Output_file::open_for_modification.
4034         * incremental-dump.cc (main): Likewise.
4035         * incremental.cc (Incremental_inputs::report_command_line):
4036         Ignore --incremental-base option when comparing command lines.
4037         Ignore parameter when given as separate argument.
4038         * options.h (class General_options): Add --incremental-base.
4039         * output.cc (Output_file::Output_file):
4040         (Output_file::open_base_file): Add base_name and writable parameters;
4041         read base file into new file; print error message here.
4042         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4043         callers.
4044         * output.h (Output_file::open_for_modification): Rename to...
4045         (Output_file::open_base_file): ...this; add base_name and
4046         writable parameters; adjust all callers.
4047         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4048         callers.
4049         * testsuite/Makefile.am (incremental_test_4): Test
4050         --incremental-base.
4051         * testsuite/Makefile.in: Regenerate.
4052
4053 2011-05-24 Cary Coutant  <ccoutant@google.com>
4054
4055         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4056         incremental_test_4.
4057         * testsuite/Makefile.in: Regenerate.
4058         * testsuite/two_file_test_1_v1.cc: New test source file.
4059         * testsuite/two_file_test_1b_v1.cc: New test source file.
4060         * testsuite/two_file_test_2_v1.cc: New test source file.
4061
4062 2011-05-24 Cary Coutant  <ccoutant@google.com>
4063
4064         * dynobj.h (Dynobj::do_dynobj): New function.
4065         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4066         flag and soname for shared objects.
4067         * incremental.cc (Incremental_inputs::report_object): Make
4068         either Incremental_object_entry or Incremental_dynobj_entry; add
4069         soname to string table.
4070         (Incremental_inputs::report_input_section): Add assertion.
4071         (Output_section_incremental_inputs::set_final_data_size): Adjust
4072         type of input file entry for shared libraries; adjust size of
4073         shared library info entry.
4074         (Output_section_incremental_inputs::write_input_files): Write
4075         as_needed flag for shared libraries.
4076         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4077         of input file entry for shared libraries; write soname.
4078         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4079         soname from incremental info.
4080         * incremental.h (enum Incremental_input_flags): Add
4081         INCREMENTAL_INPUT_AS_NEEDED.
4082         (Incremental_input_entry::Incremental_input_entry): Initialize new
4083         data member.
4084         (Incremental_input_entry::set_as_needed): New function.
4085         (Incremental_input_entry::as_needed): New function.
4086         (Incremental_input_entry::do_dynobj_entry): New function.
4087         (Incremental_input_entry::as_needed_): New data member.
4088         (Incremental_object_entry::Incremental_object_entry): Don't check
4089         for shared library.
4090         (Incremental_object_entry::do_type): Likewise.
4091         (class Incremental_dynobj_entry): New class.
4092         (Incremental_input_entry_reader::as_needed): New function.
4093         (Incremental_input_entry_reader::get_soname): New function.
4094         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4095         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4096         size of shared library info entry.
4097         * layout.cc (Layout::finish_dynamic_section): Don't test for
4098         incremental link when adding DT_NEEDED entries.
4099         * object.h (Object::Object): Initialize new data member.
4100         (Object::dynobj): New function.
4101         (Object::set_as_needed): New function.
4102         (Object::as_needed): New function.
4103         (Object::do_dynobj): New function.
4104         (Object::as_needed_): New data member.
4105
4106 2011-05-24 Cary Coutant  <ccoutant@google.com>
4107
4108         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4109         info; adjust display of GOT entries.
4110         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4111         vector of input objects; remove file_status_.
4112         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4113         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4114         got_plt reader; call target hooks to reserve GOT entries.
4115         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4116         of input file info header and GOT info entry.
4117         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4118         relocation info.
4119         (Got_plt_view_info::got_descriptor): Remove.
4120         (Got_plt_view_info::sym_index): New data member.
4121         (Got_plt_view_info::input_index): New data member.
4122         (Local_got_offset_visitor::visit): Write input file index.
4123         (Global_got_offset_visitor::visit): Write 0 for input file index.
4124         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4125         with sym_index and input_index.
4126         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4127         incremental info GOT entry; replace got_descriptor with input_index.
4128         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4129         map from input file index to object.
4130         (Sized_relobj_incr::do_layout): Replace direct data member reference
4131         with accessor function.
4132         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4133         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4134         Adjust size of input file info header.
4135         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4136         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4137         (Incremental_input_entry_reader::get_input_section): Adjust size of
4138         input file info header.
4139         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4140         of incremental info GOT entry.
4141         (Incremental_got_plt_reader::get_got_desc): Remove.
4142         (Incremental_got_plt_reader::get_got_symndx): New function.
4143         (Incremental_got_plt_reader::get_got_input_index): New function.
4144         (Sized_incremental_binary::Sized_incremental_binary): Remove
4145         file_status_; add input_objects_.
4146         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4147         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4148         (Sized_incremental_binary::file_is_unchanged): Remove.
4149         (Sized_incremental_binary::set_input_object): New function.
4150         (Sized_incremental_binary::input_object): New function.
4151         (Sized_incremental_binary::file_status_): Remove.
4152         (Sized_incremental_binary::input_objects_): New data member.
4153         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4154         references.
4155         (Sized_relobj_incr::invalid_address): Move to base class.
4156         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4157         class.
4158         (Sized_relobj_incr::do_output_section_offset): Likewise.
4159         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4160         (Sized_relobj_incr::section_offsets_): Likewise.
4161         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4162         function.
4163         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4164         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4165         with accessor function.
4166         (Sized_relobj_file::do_layout): Likewise.
4167         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4168         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4169         (Sized_relobj_file::compute_final_local_value): Replace refs to
4170         section_offsets_ with accessor function.
4171         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4172         * object.h (Relobj::Relobj): Initialize new data members.
4173         (Relobj::add_dyn_reloc): New function.
4174         (Relobj::first_dyn_reloc): New function.
4175         (Relobj::dyn_reloc_count): New function.
4176         (Relobj::first_dyn_reloc_): New data member.
4177         (Relobj::dyn_reloc_count_): New data member.
4178         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4179         references.
4180         (Sized_relobj::Address): New typedef.
4181         (Sized_relobj::invalid_address): Move here from child class.
4182         (Sized_relobj::Sized_relobj): Initialize new data members.
4183         (Sized_relobj::sized_relobj): New function.
4184         (Sized_relobj::is_output_section_offset_invalid): Move here from
4185         child class.
4186         (Sized_relobj::get_output_section_offset): Likewise.
4187         (Sized_relobj::local_has_got_offset): Likewise.
4188         (Sized_relobj::local_got_offset): Likewise.
4189         (Sized_relobj::set_local_got_offset): Likewise.
4190         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4191         (Sized_relobj::clear_got_offsets): New function.
4192         (Sized_relobj::section_offsets): Move here from child class.
4193         (Sized_relobj::do_output_section_offset): Likewise.
4194         (Sized_relobj::do_set_section_offset): Likewise.
4195         (Sized_relobj::Local_got_offsets): Likewise.
4196         (Sized_relobj::local_got_offsets_): Likewise.
4197         (Sized_relobj::section_offsets_): Likewise.
4198         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4199         references.
4200         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4201         class.
4202         (Sized_relobj_file::sized_relobj): New function
4203         (Sized_relobj_file::local_has_got_offset): Move to base class.
4204         (Sized_relobj_file::local_got_offset): Likewise.
4205         (Sized_relobj_file::set_local_got_offset): Likewise.
4206         (Sized_relobj_file::get_output_section_offset): Likewise.
4207         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4208         (Sized_relobj_file::do_output_section_offset): Likewise.
4209         (Sized_relobj_file::do_set_section_offset): Likewise.
4210         (Sized_relobj_file::Local_got_offsets): Likewise.
4211         (Sized_relobj_file::local_got_offsets_): Likewise.
4212         (Sized_relobj_file::section_offsets_): Likewise.
4213         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4214         (all constructors).
4215         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4216         (Output_reloc::get_symbol_index): Likewise.
4217         (Output_reloc::local_section_offset): Likewise.
4218         (Output_reloc::get_address): Likewise.
4219         (Output_reloc::symbol_value): Likewise.
4220         (Output_data_got::reserve_slot): Move to class definition.
4221         (Output_data_got::reserve_local): New function.
4222         (Output_data_got::reserve_slot_for_global): Remove.
4223         (Output_data_got::reserve_global): New function.
4224         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4225         (all constructors, two instantiations).
4226         (Output_reloc::get_relobj): New function (two instantiations).
4227         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4228         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4229         (Output_data_reloc::add_global): Adjust type of relobj.
4230         (Output_data_reloc::add_global_relative): Likewise.
4231         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4232         (Output_data_reloc::add_local): Likewise.
4233         (Output_data_reloc::add_local_relative): Likewise.
4234         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4235         (Output_data_reloc::add_local_section): Likewise.
4236         (Output_data_reloc::add_output_section): Likewise.
4237         (Output_data_reloc::add_absolute): Likewise.
4238         (Output_data_reloc::add_target_specific): Likewise.
4239         (Output_data_got::reserve_slot): Move definition here.
4240         (Output_data_got::reserve_local): New function.
4241         (Output_data_got::reserve_global): New function.
4242         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4243         section_offsets_ with accessor function.
4244         (Sized_relobj_file::write_sections): Likewise.
4245         (Sized_relobj_file::do_relocate_sections): Likewise.
4246         * target.h (Sized_target::reserve_local_got_entry): New function.
4247         (Sized_target::reserve_global_got_entry): New function.
4248         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4249         (Target_x86_64::reserve_global_got_entry): New function.
4250         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4251
4252 2011-05-23 Cary Coutant  <ccoutant@google.com>
4253
4254         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4255         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4256         bit when checking got_type.
4257         * incremental.cc (Sized_incremental_binary::setup_readers):
4258         Store symbol table and string table locations; initialize bit vector
4259         of file status flags.
4260         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4261         unchanged files.
4262         (Sized_incremental_binary::do_process_got_plt): New function.
4263         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4264         (Output_section_incremental_inputs::set_final_data_size): Record
4265         file index for each input file.
4266         (Output_section_incremental_inputs::write_got_plt): Store file index
4267         instead of input entry offset for each GOT entry.
4268         * incremental.h
4269         (Incremental_input_entry::Incremental_input_entry): Initialize new
4270         data member.
4271         (Incremental_input_entry::set_offset): Store file index.
4272         (Incremental_input_entry::get_file_index): New function.
4273         (Incremental_input_entry::file_index_): New data member.
4274         (Incremental_binary::process_got_plt): New function.
4275         (Incremental_binary::do_process_got_plt): New function.
4276         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4277         data members.
4278         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4279         (Sized_incremental_binary::set_file_is_unchanged): New function.
4280         (Sized_incremental_binary::file_is_unchanged): New function.
4281         (Sized_incremental_binary::do_process_got_plt): New function.
4282         (Sized_incremental_binary::file_status_): New data member.
4283         (Sized_incremental_binary::main_symtab_loc_): New data member.
4284         (Sized_incremental_binary::main_strtab_loc_): New data member.
4285         * output.cc (Output_data_got::Got_entry::write): Add case
4286         RESERVED_CODE.
4287         (Output_data_got::add_global): Call add_got_entry.
4288         (Output_data_got::add_global_plt): Likewise.
4289         (Output_data_got::add_global_with_rel): Likewise.
4290         (Output_data_got::add_global_with_rela): Likewise.
4291         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4292         (Output_data_got::add_global_pair_with_rela): Likewise.
4293         (Output_data_got::add_local): Call add_got_entry.
4294         (Output_data_got::add_local_plt): Likewise.
4295         (Output_data_got::add_local_with_rel): Likewise.
4296         (Output_data_got::add_local_with_rela): Likewise.
4297         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4298         (Output_data_got::add_local_pair_with_rela): Likewise.
4299         (Output_data_got::reserve_slot): New function.
4300         (Output_data_got::reserve_slot_for_global): New function.
4301         (Output_data_got::add_got_entry): New function.
4302         (Output_data_got::add_got_entry_pair): New function.
4303         (Output_section::add_output_section_data): Edit FIXME.
4304         * output.h
4305         (Output_section_data_build::Output_section_data_build): New
4306         constructor with size parameter.
4307         (Output_data_space::Output_data_space): Likewise.
4308         (Output_data_got::Output_data_got): Initialize new data member; new
4309         constructor with size parameter.
4310         (Output_data_got::add_constant): Call add_got_entry.
4311         (Output_data_got::reserve_slot): New function.
4312         (Output_data_got::reserve_slot_for_global): New function.
4313         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4314         (Output_data_got::add_got_entry): New function.
4315         (Output_data_got::add_got_entry_pair): New function.
4316         (Output_data_got::free_list_): New data member.
4317         * target.h (Sized_target::init_got_plt_for_update): New function.
4318         (Sized_target::register_global_plt_entry): New function.
4319         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4320         Initialize new data member; call init; add constructor with PLT count.
4321         (Output_data_plt_x86_64::init): New function.
4322         (Output_data_plt_x86_64::add_relocation): New function.
4323         (Output_data_plt_x86_64::reserve_slot): New function.
4324         (Output_data_plt_x86_64::free_list_): New data member.
4325         (Target_x86_64::init_got_plt_for_update): New function.
4326         (Target_x86_64::register_global_plt_entry): New function.
4327         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4328         incremental updates.
4329         (Output_data_plt_x86_64::add_relocation): New function.
4330         * testsuite/object_unittest.cc (Object_test): Set default options.
4331
4332 2011-05-16  Ian Lance Taylor  <iant@google.com>
4333
4334         * options.h (class General_options): Make -i a synonym for -r.
4335
4336 2011-05-16  Ian Lance Taylor  <iant@google.com>
4337
4338         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4339
4340 2011-05-10 Cary Coutant  <ccoutant@google.com>
4341
4342         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4343         strip_all (-s).
4344
4345 2011-05-06  Ian Lance Taylor  <iant@google.com>
4346
4347         * layout.cc (Layout::layout): If the output section flags change,
4348         update the ordering.
4349
4350 2011-04-25 Cary Coutant  <ccoutant@google.com>
4351
4352         * incremental-dump.cc (dump_incremental_inputs): Print local
4353         symbol info for each input file.
4354         * incremental.cc
4355         (Output_section_incremental_inputs::set_final_data_size): Add local
4356         symbol info to input file entries in incremental info.
4357         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4358         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4359         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4360         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4361         implementation.
4362         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4363         (Sized_incr_relobj::do_relocate): Write the local symbols.
4364         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4365         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4366         Adjust size of input file header.
4367         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4368         (Incremental_inputs_reader::get_local_symbol_count): New function.
4369         (Incremental_inputs_reader::get_input_section): Adjust size of input
4370         file header.
4371         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4372         (Sized_incr_relobj::This): New typedef.
4373         (Sized_incr_relobj::sym_size): New const data member.
4374         (Sized_incr_relobj::Local_symbol): New struct.
4375         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4376         (Sized_incr_relobj::do_local_symbol_offset): New function.
4377         (Sized_incr_relobj::local_symbol_count_): New data member.
4378         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4379         (Sized_incr_relobj::local_symbol_index_): New data member.
4380         (Sized_incr_relobj::local_symbol_offset_): New data member.
4381         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4382         (Sized_incr_relobj::local_symbols_): New data member.
4383         * object.h (Relobj::output_local_symbol_count): New function.
4384         (Relobj::local_symbol_offset): New function.
4385         (Relobj::do_output_local_symbol_count): New function.
4386         (Relobj::do_local_symbol_offset): New function.
4387         (Sized_relobj::do_output_local_symbol_count): New function.
4388         (Sized_relobj::do_local_symbol_offset): New function.
4389
4390 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4391
4392         * descriptors.cc (set_close_on_exec): New function.
4393         (Descriptors::open): Use set_close_on_exec.
4394         * output.cc (S_ISLNK): Define if not defined.
4395
4396 2011-04-22 Cary Coutant  <ccoutant@google.com>
4397
4398         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4399         global symbol map.
4400         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4401         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4402         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4403         relocations.
4404         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4405         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4406         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4407         * incremental.h
4408         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4409         function.
4410         (Incremental_binary::apply_incremental_relocs): New function.
4411         (Incremental_binary::do_apply_incremental_relocs): New function.
4412         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4413         data member.
4414         (Sized_incremental_binary::add_global_symbol): New function.
4415         (Sized_incremental_binary::global_symbol): New function.
4416         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4417         (Sized_incremental_binary::symbol_map_): New data member.
4418         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4419         * target.h (Sized_target::apply_relocation): New function.
4420         * target-reloc.h (apply_relocation): New function.
4421         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4422
4423 2011-04-22  Doug Kwan  <dougkwan@google.com>
4424
4425         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4426         flag of a SHT_ARM_EXIDX section.
4427         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4428         * testsuite/Makefile.in: Regenerate.
4429         * testsuite/arm_exidx_test.s: New file.
4430         * testsuite/arm_exidx_test.sh: Same.
4431
4432 2011-04-20 Cary Coutant  <ccoutant@google.com>
4433
4434         PR gold/12689
4435         * archive.h (Incremental_archive_entry::Archive_member):
4436         Initialize arg_serial_ (second constructor).
4437
4438 2011-04-17  Ian Lance Taylor  <iant@google.com>
4439
4440         * object.cc (Relocate_info::location): Simplify location string.
4441         * errors.cc (Errors::error_at_location): Don't print program
4442         name.
4443         (Errors::warning_at_location): Likewise.
4444         (Errors::undefined_symbol): Likewise.
4445         * testsuite/debug_msg.sh: Update accordingly.
4446
4447 2011-04-14 Cary Coutant  <ccoutant@google.com>
4448
4449         * gold/layout.cc (Layout::symtab_section_offset): New function.
4450         * gold/layout.h (Layout::symtab_section_offset): New function.
4451         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4452
4453 2011-04-12  Ian Lance Taylor  <iant@google.com>
4454
4455         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4456         with MREMAP_MAYMOVE.
4457         * output.h (class Output_file): Add map_is_allocated_ field.
4458         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4459         not available, provide stubs.  If mremap is not available, #define
4460         it to gold_mremap.
4461         (MREMAP_MAYMOVE): Define if not defined.
4462         (Output_file::Output_file): Initialize map_is_allocated_.
4463         (Output_file::resize): Check map_is_allocated_.
4464         (Output_file::map_anonymous): If mmap fails, use malloc.
4465         (Output_file::unmap): Don't do anything for an anonymous map.
4466         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4467         is not available, provide stubs.
4468         (File_read::View::~View): Use free rather than delete[].
4469         (File_read::make_view): Use malloc rather than new[].  If mmap
4470         fails, use malloc.
4471         (File_read::find_or_make_view): Use malloc rather than new[].
4472         * gold.h: Remove HAVE_REMAP code.
4473         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4474         exists.  Rename mremap to gold_mremap.  If mmap is not available
4475         don't do anything.
4476         * configure, config.in: Rebuild.
4477
4478 2011-04-11  Ian Lance Taylor  <iant@google.com>
4479
4480         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4481         initialize local variable v.
4482
4483 2011-04-11  Cary Coutant  <ccoutant@google.com>
4484
4485         * archive.cc (Archive::include_member): Adjust call to
4486         report_object.
4487         (Add_archive_symbols::run): Track argument serial numbers.
4488         (Lib_group::include_member): Likewise.
4489         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4490         * archive.h (Incremental_archive_entry::Archive_member):
4491         Initialize arg_serial_.
4492         (Archive_member::arg_serial_): New data member.
4493         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4494         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4495         incremental link.
4496         (Sized_dynobj::do_for_all_local_got_entries): New function.
4497         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4498         function.
4499         * fileread.cc (get_mtime): New function.
4500         * fileread.h (get_mtime): New function.
4501         * gold.cc (queue_initial_tasks): Check for incremental update.
4502         (process_incremental_input): New function.
4503         (queue_middle_tasks): Don't force valid target for incremental
4504         update.
4505         * incremental-dump.cc (find_input_containing_global): Adjust
4506         size of symbol info entry.
4507         (dump_incremental_inputs): Dump argument serial number and
4508         in_system_directory flag; bias shndx by 1; print symbol names
4509         when dumping per-file symbol lists; use new symbol info readers.
4510         * incremental.cc
4511         (Output_section_incremental_inputs:update_data_size): New function.
4512         (Sized_incremental_binary::setup_readers): Setup input readers
4513         for each input file; build maps for files added from libraries
4514         and scripts.
4515         (Sized_incremental_binary::check_input_args): New function.
4516         (Sized_incremental_binary::do_check_inputs): Build map of argument
4517         serial numbers to input arguments.
4518         (Sized_incremental_binary::do_file_has_changed): Rename
4519         do_file_is_unchanged to this; compare file modification times.
4520         (Sized_incremental_binary::do_init_layout): New function.
4521         (Sized_incremental_binary::do_reserve_layout): New function.
4522         (Sized_incremental_binary::do_get_input_reader): Remove.
4523         (Sized_incremental_binary::get_symtab_view): New function.
4524         (Incremental_checker::can_incrementally_link_output_file): Remove.
4525         (Incremental_inputs::report_command_line): Exclude --debug options.
4526         (Incremental_inputs::report_archive_begin): Add parameter; track
4527         argument serial numbers; don't put input file entry for archive
4528         before archive members.
4529         (Incremental_inputs::report_archive_end): Put input file entry
4530         for archive after archive members.
4531         (Incremental_inputs::report_object): Add parameter; track argument
4532         serial numbers and in_system_directory flag.
4533         (Incremental_inputs::report_script): Add parameter; track argument
4534         serial numbers.
4535         (Output_section_incremental_inputs::set_final_data_size): Adjust
4536         size of symbol info entry; check for forwarding symbols.
4537         (Output_section_incremental_inputs::write_input_files): Write
4538         in_system_directory flag and argument serial number.
4539         (Output_section_incremental_inputs::write_info_blocks): Map section
4540         indices between incremental info and original input file; store
4541         input section index for each symbol.
4542         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4543         change operator() to visit().
4544         (class Global_got_offset_visitor): Likewise.
4545         (class Global_symbol_visitor_got_plt):
4546         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4547         classes.
4548         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4549         (Sized_incr_relobj::do_read_symbols): New function.
4550         (Sized_incr_relobj::do_layout): New function.
4551         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4552         (Sized_incr_relobj::do_add_symbols): New function.
4553         (Sized_incr_relobj::do_should_include_member): New function.
4554         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4555         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4556         (Sized_incr_relobj::do_section_size): New function.
4557         (Sized_incr_relobj::do_section_name): New function.
4558         (Sized_incr_relobj::do_section_contents): New function.
4559         (Sized_incr_relobj::do_section_flags): New function.
4560         (Sized_incr_relobj::do_section_entsize): New function.
4561         (Sized_incr_relobj::do_section_address): New function.
4562         (Sized_incr_relobj::do_section_type): New function.
4563         (Sized_incr_relobj::do_section_link): New function.
4564         (Sized_incr_relobj::do_section_info): New function.
4565         (Sized_incr_relobj::do_section_addralign): New function.
4566         (Sized_incr_relobj::do_initialize_xindex): New function.
4567         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4568         (Sized_incr_relobj::do_read_relocs): New function.
4569         (Sized_incr_relobj::do_gc_process_relocs): New function.
4570         (Sized_incr_relobj::do_scan_relocs): New function.
4571         (Sized_incr_relobj::do_count_local_symbols): New function.
4572         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4573         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4574         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4575         (Sized_incr_relobj::do_relocate): New function.
4576         (Sized_incr_relobj::do_set_section_offset): New function.
4577         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4578         (Sized_incr_dynobj::do_read_symbols): New function.
4579         (Sized_incr_dynobj::do_layout): New function.
4580         (Sized_incr_dynobj::do_add_symbols): New function.
4581         (Sized_incr_dynobj::do_should_include_member): New function.
4582         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4583         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4584         (Sized_incr_dynobj::do_section_size): New function.
4585         (Sized_incr_dynobj::do_section_name): New function.
4586         (Sized_incr_dynobj::do_section_contents): New function.
4587         (Sized_incr_dynobj::do_section_flags): New function.
4588         (Sized_incr_dynobj::do_section_entsize): New function.
4589         (Sized_incr_dynobj::do_section_address): New function.
4590         (Sized_incr_dynobj::do_section_type): New function.
4591         (Sized_incr_dynobj::do_section_link): New function.
4592         (Sized_incr_dynobj::do_section_info): New function.
4593         (Sized_incr_dynobj::do_section_addralign): New function.
4594         (Sized_incr_dynobj::do_initialize_xindex): New function.
4595         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4596         (make_sized_incremental_object): New function.
4597         (Incremental_library::copy_unused_symbols): New function.
4598         (Incremental_library::do_for_all_unused_symbols): New function.
4599         * incremental.h (enum Incremental_input_flags): New type.
4600         (class Incremental_checker): Remove.
4601         (Incremental_input_entry::Incremental_input_entry): Add argument
4602         serial number.
4603         (Incremental_input_entry::arg_serial): New function.
4604         (Incremental_input_entry::set_is_in_system_directory): New function.
4605         (Incremental_input_entry::is_in_system_directory): New function.
4606         (Incremental_input_entry::arg_serial_): New data member.
4607         (Incremental_input_entry::is_in_system_directory_): New data member.
4608         (class Script_info): Move here from script.h.
4609         (Script_info::Script_info): Add filename parameter.
4610         (Script_info::filename): New function.
4611         (Script_info::filename_): New data member.
4612         (Incremental_script_entry::Incremental_script_entry): Add argument
4613         serial number.
4614         (Incremental_object_entry::Incremental_object_entry): Likewise.
4615         (Incremental_object_entry::add_input_section): Build list of input
4616         sections with map to original shndx.
4617         (Incremental_object_entry::get_input_section_index): New function.
4618         (Incremental_object_entry::shndx_): New data member.
4619         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4620         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4621         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4622         serial number.
4623         (Incremental_inputs::report_archive_begin): Likewise.
4624         (Incremental_inputs::report_object): Likewise.
4625         (Incremental_inputs::report_script): Likewise.
4626         (class Incremental_global_symbol_reader): New class.
4627         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4628         and store flags and input file type.
4629         (Incremental_input_entry_reader::arg_serial): New function.
4630         (Incremental_input_entry_reader::type): Extract type from flags.
4631         (Incremental_input_entry_reader::is_in_system_directory): New function.
4632         (Incremental_input_entry_reader::get_input_section_count): Call
4633         accessor function for type.
4634         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4635         function for type; adjust size of global symbol entry.
4636         (Incremental_input_entry_reader::get_global_symbol_count): Call
4637         accessor function for type.
4638         (Incremental_input_entry_reader::get_object_count): Likewise.
4639         (Incremental_input_entry_reader::get_object_offset): Likewise.
4640         (Incremental_input_entry_reader::get_member_count): Likewise.
4641         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4642         (Incremental_input_entry_reader::get_member_offset): Likewise.
4643         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4644         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4645         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4646         (Incremental_input_entry_reader::get_global_symbol_reader): New
4647         function.
4648         (Incremental_input_entry_reader::get_output_symbol_index): New
4649         function.
4650         (Incremental_input_entry_reader::type_): Remove.
4651         (Incremental_input_entry_reader::flags_): New data member.
4652         (Incremental_inputs_reader::input_file_offset): New function.
4653         (Incremental_inputs_reader::input_file_index): New function.
4654         (Incremental_inputs_reader::input_file): Call input_file_offset.
4655         (Incremental_inputs_reader::input_file_at_offset): New function.
4656         (Incremental_relocs_reader::get_r_type): Reformat.
4657         (Incremental_relocs_reader::get_r_shndx): Reformat.
4658         (Incremental_relocs_reader::get_r_offset): Reformat.
4659         (Incremental_relocs_reader::data): New function.
4660         (Incremental_binary::Incremental_binary): Initialize new data members.
4661         (Incremental_binary::check_inputs): Add cmdline parameter.
4662         (Incremental_binary::file_is_unchanged): Remove.
4663         (Input_reader::arg_serial): New function.
4664         (Input_reader::get_unused_symbol_count): New function.
4665         (Input_reader::get_unused_symbol): New function.
4666         (Input_reader::do_arg_serial): New function.
4667         (Input_reader::do_get_unused_symbol_count): New function.
4668         (Input_reader::do_get_unused_symbol): New function.
4669         (Incremental_binary::input_file_count): New function.
4670         (Incremental_binary::get_input_reader): Change signature to use
4671         index instead of filename.
4672         (Incremental_binary::file_has_changed): New function.
4673         (Incremental_binary::get_input_argument): New function.
4674         (Incremental_binary::get_library): New function.
4675         (Incremental_binary::get_script_info): New function.
4676         (Incremental_binary::init_layout): New function.
4677         (Incremental_binary::reserve_layout): New function.
4678         (Incremental_binary::output_file): New function.
4679         (Incremental_binary::do_check_inputs): New function.
4680         (Incremental_binary::do_file_is_unchanged): Remove.
4681         (Incremental_binary::do_file_has_changed): New function.
4682         (Incremental_binary::do_init_layout): New function.
4683         (Incremental_binary::do_reserve_layout): New function.
4684         (Incremental_binary::do_input_file_count): New function.
4685         (Incremental_binary::do_get_input_reader): Change signature.
4686         (Incremental_binary::input_args_map_): New data member.
4687         (Incremental_binary::library_map_): New data member.
4688         (Incremental_binary::script_map_): New data member.
4689         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4690         new data members.
4691         (Sized_incremental_binary::output_section): New function.
4692         (Sized_incremental_binary::inputs_reader): Add const.
4693         (Sized_incremental_binary::symtab_reader): Add const.
4694         (Sized_incremental_binary::relocs_reader): Add const.
4695         (Sized_incremental_binary::got_plt_reader): Add const.
4696         (Sized_incremental_binary::get_symtab_view): New function.
4697         (Sized_incremental_binary::Inputs_reader): New typedef.
4698         (Sized_incremental_binary::Input_entry_reader): New typedef.
4699         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4700         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4701         (Sized_incremental_binary::do_file_has_changed): New function.
4702         (Sized_incremental_binary::do_init_layout): New function.
4703         (Sized_incremental_binary::do_reserve_layout): New function.
4704         (Sized_input_reader::Inputs_reader): Remove.
4705         (Sized_input_reader::Input_entry_reader): Remove.
4706         (Sized_input_reader::do_arg_serial): New function.
4707         (Sized_input_reader::do_get_unused_symbol_count): New function.
4708         (Sized_input_reader::do_get_unused_symbol): New function.
4709         (Sized_incremental_binary::do_input_file_count): New function.
4710         (Sized_incremental_binary::do_get_input_reader): Change signature;
4711         use index instead of filename.
4712         (Sized_incremental_binary::section_map_): New data member.
4713         (Sized_incremental_binary::input_entry_readers_): New data member.
4714         (class Sized_incr_relobj): New class.
4715         (class Sized_incr_dynobj): New class.
4716         (make_sized_incremental_object): New function.
4717         (class Incremental_library): New class.
4718         * layout.cc (Free_list::num_lists): New static data member.
4719         (Free_list::num_nodes): New static data member.
4720         (Free_list::num_removes): New static data member.
4721         (Free_list::num_remove_visits): New static data member.
4722         (Free_list::num_allocates): New static data member.
4723         (Free_list::num_allocate_visits): New static data member.
4724         (Free_list::init): New function.
4725         (Free_list::remove): New function.
4726         (Free_list::allocate): New function.
4727         (Free_list::dump): New function.
4728         (Free_list::print_stats): New function.
4729         (Layout_task_runner::run): Resize output file for incremental updates.
4730         (Layout::Layout): Initialize new data members.
4731         (Layout::set_incremental_base): New function.
4732         (Layout::init_fixed_output_section): New function.
4733         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4734         incremental updates.
4735         (Layout::create_gold_note): Do not create gold note section for
4736         incremental updates.
4737         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4738         for incremental updates.
4739         (Layout::set_section_offsets): For incremental updates, allocate space
4740         from free list.
4741         (Layout::create_symtab_sections): Layout with offsets relative to
4742         start of section; for incremental updates, allocate space from free
4743         list.
4744         (Layout::create_shdrs): For incremental updates, allocate space from
4745         free list.
4746         (Layout::finish_dynamic_section): For incremental updates, do not
4747         check --as-needed (fixed in subsequent patch).
4748         * layout.h (class Free_list): New class.
4749         (Layout::set_incremental_base): New function.
4750         (Layout::incremental_base): New function.
4751         (Layout::init_fixed_output_section): New function.
4752         (Layout::allocate): New function.
4753         (Layout::incremental_base_): New data member.
4754         (Layout::free_list_): New data member.
4755         * main.cc (main): Print Free_list statistics.
4756         * object.cc (Relobj::finalize_incremental_relocs): Add
4757         clear_counts parameter; clear counts only when clear_counts is set.
4758         (Sized_relobj::Sized_relobj): Initialize new base class.
4759         (Sized_relobj::do_layout): Don't report special sections.
4760         (Sized_relobj::do_for_all_local_got_entries): New function.
4761         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4762         symtab_off to all symbol table offsets.
4763         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4764         * object.h (class Got_offset_list): Move to top of file.
4765         (Object::Object): Allow case where input_file == NULL.
4766         (Object::~Object): Likewise.
4767         (Object::input_file): Assert that input_file != NULL.
4768         (Object::lock): Allow case where input_file == NULL.
4769         (Object::unlock): Likewise.
4770         (Object::is_locked): Likewise.
4771         (Object::token): Likewise.
4772         (Object::release): Likewise.
4773         (Object::is_incremental): New function.
4774         (Object::get_mtime): New function.
4775         (Object::for_all_local_got_entries): New function.
4776         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4777         (Object::set_is_in_system_directory): New function.
4778         (Object::is_in_system_directory): New function.
4779         (Object::do_is_incremental): New function.
4780         (Object::do_get_mtime): New function.
4781         (Object::do_for_all_local_got_entries): New function.
4782         (Object::is_in_system_directory_): New data member.
4783         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4784         (class Sized_relobj_base): New class.
4785         (class Sized_relobj): Derive from Sized_relobj_base.
4786         (class Sized_relobj::Symbols): Redeclare from base class.
4787         (class Sized_relobj::local_got_offset_list): Remove.
4788         (class Sized_relobj::Output_sections): Redeclare from base class.
4789         (class Sized_relobj::do_for_all_local_got_entries): New function.
4790         (class Sized_relobj::write_local_symbols): Add offset parameter.
4791         (class Sized_relobj::local_symbol_offset_): Update comment.
4792         (class Sized_relobj::local_dynsym_offset_): Update comment.
4793         * options.cc (Input_arguments::add_file): Remove const.
4794         * options.h (Input_file_argument::Input_file_argument):
4795         Initialize arg_serial_ (all constructors).
4796         (Input_file_argument::set_arg_serial): New function.
4797         (Input_file_argument::arg_serial): New function.
4798         (Input_file_argument::arg_serial_): New data member.
4799         (Input_arguments::Input_arguments): Initialize file_count_.
4800         (Input_arguments::add_file): Remove const.
4801         (Input_arguments::number_of_input_files): New function.
4802         (Input_arguments::file_count_): New data member.
4803         (Command_line::number_of_input_files): Call
4804         Input_arguments::number_of_input_files.
4805         * output.cc (Output_segment_headers::Output_segment_headers):
4806         Set current size.
4807         (Output_section::Input_section::current_data_size): New function.
4808         (Output_section::Output_section): Initialize new data members.
4809         (Output_section::add_input_section): Don't do merge sections for
4810         an incremental link; allocate space from free list for an
4811         incremental update.
4812         (Output_section::add_output_section_data): Allocate space from
4813         free list for an incremental update.
4814         (Output_section::update_data_size): New function.
4815         (Output_section::set_fixed_layout): New function.
4816         (Output_section::reserve): New function.
4817         (Output_segment::set_section_addresses): Remove const.
4818         (Output_segment::set_section_list_addresses): Remove const; allocate
4819         space from free list for an incremental update.
4820         (Output_segment::set_offset): Adjust size of RELRO segment for an
4821         incremental update.
4822         * output.h (Output_data::current_data_size): Move here from
4823         child classes.
4824         (Output_data::pre_finalize_data_size): New function.
4825         (Output_data::update_data_size): New function.
4826         (Output_section_headers::update_data_size): new function.
4827         (Output_section_data_build::current_data_size): Move to Output_data.
4828         (Output_data_strtab::update_data_size): New function.
4829         (Output_section::current_data_size): Move to Output_data.
4830         (Output_section::set_fixed_layout): New function.
4831         (Output_section::has_fixed_layout): New function.
4832         (Output_section::reserve): New function.
4833         (Output_section::update_data_size): New function.
4834         (Output_section::has_fixed_layout_): New data member.
4835         (Output_section::free_list_): New data member.
4836         (Output_segment::set_section_addresses): Remove const.
4837         (Output_segment::set_section_list_addresses): Remove const.
4838         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4839         New function.
4840         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4841         New function.
4842         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4843         parameter when calling Add_symbols constructor; store argument
4844         serial number for members of a lib group.
4845         (Add_symbols::locks): Allow case where token == NULL.
4846         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4847         (Read_member::~Read_member): New function.
4848         (Read_member::is_runnable): New function.
4849         (Read_member::locks): New function.
4850         (Read_member::run): New function.
4851         (Check_script::~Check_script): New function.
4852         (Check_script::is_runnable): New function.
4853         (Check_script::locks): New function.
4854         (Check_script::run): New function.
4855         (Check_library::~Check_library): New function.
4856         (Check_library::is_runnable): New function.
4857         (Check_library::locks): New function.
4858         (Check_library::run): New function.
4859         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4860         (Add_symbols::library_): New data member.
4861         (class Read_member): New class.
4862         (class Check_script): New class.
4863         (class Check_library): New class.
4864         * reloc.cc (Read_relocs::is_runnable): Allow case where
4865         token == NULL.
4866         (Read_relocs::locks): Likewise.
4867         (Scan_relocs::locks): Likewise.
4868         (Relocate_task::locks): Likewise.
4869         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4870         to clear counters.
4871         (Sized_relobj::incremental_relocs_scan): Fix comment.
4872         (Sized_relobj::do_relocate): Pass output file offset to
4873         write_local_symbols.
4874         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4875         from class declaration.
4876         * script.cc (read_input_script): Allocate Script_info; pass
4877         argument serial number to report_script.
4878         * script.h (class Script_info): Move to incremental.h.
4879         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4880         * symtab.h (Symbol_table::add_from_incrobj): New function.
4881         (Symbol_table::set_file_offset): New function.
4882
4883 2011-04-05  Cary Coutant  <ccoutant@google.com>
4884
4885         * incremental-dump.cc (dump_incremental_inputs): Change signature
4886         to take a Sized_incremental_binary; change caller.  Use readers
4887         in Sized_incremental_binary.
4888         * incremental.cc
4889         (Sized_incremental_binary::find_incremental_inputs_sections):
4890         Rename do_find_incremental_inputs_sections to this.
4891         (Sized_incremental_binary::setup_readers): New function.
4892         (Sized_incremental_binary::do_check_inputs): Check
4893         has_incremental_info_ flag; move setup code to setup_readers;
4894         use input readers.
4895         (Sized_incremental_binary::do_file_is_unchanged): New function.
4896         (Sized_incremental_binary::do_get_input_reader): New function.
4897         * incremental.h (class Incremental_binary): Move to end of file.
4898         (Incremental_binary::file_is_unchanged): New function.
4899         (Incremental_binary::do_file_is_unchanged): New function.
4900         (Incremental_binary::Input_reader): New class.
4901         (Incremental_binary::get_input_reader): New function.
4902         (class Sized_incremental_binary): Move to end of file.
4903         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4904         input section reader classes.
4905         (Sized_incremental_binary::has_incremental_info): New function.
4906         (Sized_incremental_binary::inputs_reader): New function.
4907         (Sized_incremental_binary::symtab_reader): New function.
4908         (Sized_incremental_binary::relocs_reader): New function.
4909         (Sized_incremental_binary::got_plt_reader): New function.
4910         (Sized_incremental_binary::do_file_is_unchanged): New function.
4911         (Sized_incremental_binary::Sized_input_reader): New class.
4912         (Sized_incremental_binary::get_input_reader): New function.
4913         (Sized_incremental_binary::find_incremental_inputs_sections):
4914         Rename do_find_incremental_inputs_sections to this.
4915         (Sized_incremental_binary::setup_readers): New function.
4916         (Sized_incremental_binary::has_incremental_info_): New data member.
4917         (Sized_incremental_binary::inputs_reader_): New data member.
4918         (Sized_incremental_binary::symtab_reader_): New data member.
4919         (Sized_incremental_binary::relocs_reader_): New data member.
4920         (Sized_incremental_binary::got_plt_reader_): New data member.
4921         (Sized_incremental_binary::current_input_file_): New data member.
4922
4923 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4924
4925         PR gold/12640
4926         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4927         violation.
4928
4929 2011-03-30  Cary Coutant  <ccoutant@google.com>
4930
4931         * archive.cc (Archive::include_member): Adjust call to report_object.
4932         (Add_archive_symbols::run): Add script_info to call to
4933         report_archive_begin.
4934         (Lib_group::include_member): Adjust call to report_object.
4935         (Add_lib_group_symbols::run): Adjust call to report_object.
4936         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4937         blocks.  Add object count for script input files.
4938         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4939         script_info parameter; change all callers.
4940         (Incremental_inputs::report_object): Add script_info parameter;
4941         change all callers.
4942         (Incremental_inputs::report_script): Store backpointer to
4943         incremental info entry.
4944         (Output_section_incremental_inputs::set_final_data_size): Record
4945         additional information for scripts.
4946         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4947         * incremental.h (Incremental_script_entry::add_object): New function.
4948         (Incremental_script_entry::get_object_count): New function.
4949         (Incremental_script_entry::get_object): New function.
4950         (Incremental_script_entry::objects_): New data member; adjust
4951         constructor.
4952         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4953         (Incremental_inputs::report_object): Add script_info parameter.
4954         (Incremental_inputs_reader::get_object_count): New function.
4955         (Incremental_inputs_reader::get_object_offset): New function.
4956         * options.cc (Input_arguments::add_file): Return reference to
4957         new input argument.
4958         * options.h (Input_argument::set_script_info): New function.
4959         (Input_argument::script_info): New function.
4960         (Input_argument::script_info_): New data member; adjust all
4961         constructors.
4962         (Input_file_group::add_file): Return reference to new input argument.
4963         (Input_file_lib::add_file): Likewise.
4964         (Input_arguments::add_file): Likewise.
4965         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4966         * script.cc (Parser_closure::Parser_closure): Add script_info
4967         parameter; adjust all callers.
4968         (Parser_closure::script_info): New function.
4969         (Parser_closure::script_info_): New data member.
4970         (read_input_script): Report scripts earlier to incremental info.
4971         (script_add_file): Set script_info in Input_argument.
4972         (script_add_library): Likewise.
4973         * script.h (Script_options::Script_info): Rewrite class.
4974
4975 2011-03-29  Cary Coutant  <ccoutant@google.com>
4976
4977         * archive.cc (Library_base::should_include_member): Move
4978         method here from class Archive.
4979         (Archive::Archive): Initialize base class.
4980         (Archive::should_include_member): Move to base class.
4981         (Archive::do_for_all_unused_symbols): New function.
4982         (Add_archive_symbols::run): Remove redundant access to
4983         incremental_inputs.
4984         (Lib_group::Lib_group): Initialize base class.
4985         (Lib_group::do_filename): New function.
4986         (Lib_group::include_member): Pass pointer to Lib_group to
4987         report_object.
4988         (Lib_group::do_for_all_unused_symbols): New function.
4989         (Add_lib_group_symbols::run): Report archive information for
4990         incremental links.
4991         * archive.h (class Library_base): New base class.
4992         (class Archive): Derive from Library_base.
4993         (Archive::filename): Move to base class.
4994         (Archive::set_incremental_info): Likewise.
4995         (Archive::incremental_info): Likewise.
4996         (Archive::Should_include): Likewise.
4997         (Archive::should_include_member): Likewise.
4998         (Archive::Armap_entry): Remove.
4999         (Archive::Unused_symbol_iterator): Remove.
5000         (Archive::unused_symbols_begin): Remove.
5001         (Archive::unused_symbols_end): Remove.
5002         (Archive::do_filename): New function.
5003         (Archive::do_get_mtime): New function.
5004         (Archive::do_for_all_unused_symbols): New function.
5005         (Archive::task_): Move to base class.
5006         (Archive::incremental_info_): Likewise.
5007         (class Lib_group): Derive from Library_base.
5008         (Lib_group::do_filename): New function.
5009         (Lib_group::do_get_mtime): New function.
5010         (Lib_group::do_for_all_unused_symbols): New function.
5011         (Lib_group::task_): Move to base class.
5012         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5013         function.
5014         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5015         function.
5016         * incremental.cc (Incremental_inputs::report_archive_begin):
5017         Use Library_base; call library's get_mtime; add incremental inputs
5018         entry before members.
5019         (class Unused_symbol_visitor): New class.
5020         (Incremental_inputs::report_archive_end): Use Library_base; use
5021         visitor class to record unused symbols; don't add incremental inputs
5022         entry after members.
5023         (Incremental_inputs::report_object): Use Library_base.
5024         * incremental.h
5025         (Incremental_archive_entry::Incremental_archive_entry): Remove
5026         unused Archive parameter.
5027         (Incremental_inputs::report_archive_begin): Use Library_base.
5028         (Incremental_inputs::report_archive_end): Likewise.
5029         (Incremental_inputs::report_object): Likewise.
5030         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5031         function.
5032         * object.h (Object::for_all_global_symbols): New function.
5033         (Object::do_for_all_global_symbols): New function.
5034         (Sized_relobj::do_for_all_global_symbols): New function.
5035         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5036         function.
5037         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5038         function.
5039
5040 2011-03-27  Ian Lance Taylor  <iant@google.com>
5041
5042         * archive.cc (Archive::interpret_header): Return -1 if something
5043         goes wrong.  Change callers accordingly.
5044
5045 2011-03-25  Cary Coutant  <ccoutant@google.com>
5046
5047         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5048         * testsuite/Makefile.in: Regenerate.
5049
5050 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5051
5052         * plugin.cc (get_view): New.
5053         (Plugin::load): Pass get_view to the plugin.
5054         (Plugin_manager::get_view): New.
5055
5056 2011-03-21  Ian Lance Taylor  <iant@google.com>
5057
5058         * testsuite/final_layout.sh: Rewrite to not use dc.
5059         * testsuite/relro_test.sh: Fail if dc is not present.
5060
5061 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5062
5063         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5064         Change == to -eq.
5065         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5066         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5067         Change == to -eq.
5068         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5069         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5070
5071 2011-03-14  Ian Lance Taylor  <iant@google.com>
5072
5073         * script-sections.cc (Sort_output_sections::script_compare):
5074         Rename from is_before, change return type.
5075         (Sort_output_sections::operator()): Adjust accordingly.
5076
5077 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5078
5079         PR gold/12572
5080         * testsuite/odr_violation2.cc: Add comment to make all error line
5081         numbers double digits.
5082         * testsuite/debug_msg.sh: Adjust expected errors.
5083
5084 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5085
5086         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5087         but mark earlier ones as non-canonical
5088         (offset_to_iterator): Update search target and example
5089         (do_addr2line): Return extra lines in a vector*
5090         (format_file_lineno): Extract from do_addr2line
5091         (one_addr2line): Add vector* out-param
5092         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5093         when a lineno entry appeared last for its instruction
5094         (Dwarf_line_info): Add vector* out-param
5095         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5096         * symtab.cc (Odr_violation_compare): Include the lineno in the
5097         comparison again.
5098         (linenos_from_loc): New. Combine the canonical line for an
5099         address with its other lines.
5100         (True_if_intersect): New. Helper functor to make
5101         std::set_intersection a query.
5102         (detect_odr_violations): Compare sets of lines instead of just
5103         one line for each function. This became less deterministic, but
5104         has fewer false positives.
5105         * symtab.h: Declarations.
5106         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5107         mix an optimized and non-optimized object in the same binary
5108         (odr_violation2.so): Same.
5109         * testsuite/Makefile.in: Regenerate from Makefile.am.
5110         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5111         * testsuite/debug_msg.sh: Update line numbers and add
5112         assertions.
5113         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5114         non-optimized context.
5115         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5116         isn't inlined, and use OdrDerived in an optimized context.
5117         * testsuite/odr_header1.h: Defines OdrDerived, where
5118         optimization will change the
5119         first-instruction-in-the-destructor's file and line number.
5120         * testsuite/odr_header2.h: Defines OdrBase.
5121
5122 2011-03-09  Ian Lance Taylor  <iant@google.com>
5123
5124         * fileread.cc (File_read::clear_views): Don't delete the whole
5125         file view.
5126
5127 2011-03-08  Ian Lance Taylor  <iant@google.com>
5128
5129         PR gold/12525
5130         * fileread.cc: #include <climits>.
5131         (GOLD_IOV_MAX): Define.
5132         (File_read::read_multiple): Limit number of entries by iov_max.
5133         * fileread.h (class File_read): Always set max_readv_entries to
5134         128.
5135
5136 2011-03-07  Ian Lance Taylor  <iant@google.com>
5137
5138         PR gold/12525
5139         * options.h (class General_options): Add -dy and -dn.
5140
5141 2011-03-02  Cary Coutant  <ccoutant@google.com>
5142
5143         * testsuite/script_test_9.t: Add TLS segment.
5144
5145 2011-03-02  Simon Baldwin  <simonb@google.com>
5146
5147         * configure.ac: Add check for gnu_indirect_function support in
5148         the toolchain building binutils.
5149         * configure: Rebuild.
5150
5151 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5152
5153         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5154         plugin only symbols.
5155         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5156         in plugin files as not needed in the symbol table.
5157
5158 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5159
5160         * output.cc (Output_section::add_input_section): Delay fill
5161         generation for section ordering.
5162
5163 2011-02-09  Ian Lance Taylor  <iant@google.com>
5164
5165         PR gold/12316
5166         * object.h (class Sized_relobj): Remove clear_local_symbols.
5167         * reloc.cc (Sized_relobj::do_relocate): Don't call
5168         clear_local_symbols.
5169
5170 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5171
5172         * plugin.cc (is_visible_from_outside): Return true for symbols
5173         in the -u option.
5174
5175 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5176
5177         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5178         filename.
5179
5180 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5181
5182         * icf.h (is_section_foldable_candidate): Change type of parameter
5183         to std::string.
5184         * icf.cc (Icf::find_identical_sections): Change type of local variable
5185         section_name to be std::string.
5186         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5187
5188 2011-01-25  Ian Lance Taylor  <iant@google.com>
5189
5190         * script.cc (script_add_extern): Rewrite to use
5191         add_symbol_reference.
5192
5193 2011-01-25  Doug Kwan  <dougkwan@google.com>
5194
5195         * icf.cc (get_section_contents): Always lock section's object.
5196
5197 2011-01-24  Ian Lance Taylor  <iant@google.com>
5198
5199         * options.h (class General_options): Accept
5200         --no-detect-odr-violations.
5201
5202 2011-01-24  Ian Lance Taylor  <iant@google.com>
5203
5204         * version.cc (version_string): Bump to 1.11.
5205
5206 2011-01-24  Ian Lance Taylor  <iant@google.com>
5207
5208         * plugin.cc (class Plugin_rescan): Define new class.
5209         (Plugin_manager::claim_file): Set any_claimed_.
5210         (Plugin_manager::save_archive): New function.
5211         (Plugin_manager::save_input_group): New function.
5212         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5213         necessary.
5214         (Plugin_manager::new_undefined_symbol): New function.
5215         (Plugin_manager::rescan): New function.
5216         (Plugin_manager::rescannable_defines): New function.
5217         (Plugin_manager::add_input_file): Set any_added_.
5218         * plugin.h (class Plugin_manager): define new fields rescannable_,
5219         undefined_symbols_, any_claimed_, and any_added_.  Declare
5220         Plugin_rescan as friend.  Declare new functions.
5221         (Plugin_manager::Rescannable): Define type.
5222         (Plugin_manager::Rescannable_list): Define type.
5223         (Plugin_manager::Undefined_symbol_list): Define type.
5224         (Plugin_manager::Plugin_manager): Initialize new fields.
5225         * archive.cc (Archive::defines_symbol): New function.
5226         (Add_archive_symbols::run): Pass archive to plugins if any.
5227         * archive.h (class Archive): Declare defines_symbol.
5228         * readsyms.cc (Input_group::~Input_group): New function.
5229         (Finish_group::run): Pass input_group to plugins if any.
5230         * readsyms.h (class Input_group): Declare destructor.
5231         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5232         any.
5233
5234 2011-01-10  Ian Lance Taylor  <iant@google.com>
5235
5236         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5237         section as relro.
5238         (Layout::set_segment_offsets): Reset increase_relro before calling
5239         set_section_addresses a second time.
5240
5241 2011-01-04  Cary Coutant  <ccoutant@google.com>
5242
5243         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5244         sections before NOBITS sections.
5245
5246 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5247
5248         * version.cc (print_version): Update copyright to 2011.
5249
5250 2010-12-23  Cary Coutant  <ccoutant@google.com>
5251
5252         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5253         of OS to this->add.  Add OD parameter to second form of the function.
5254
5255 2010-12-20  Ian Lance Taylor  <iant@google.com>
5256
5257         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5258         second of two consecutive entries with same offset.
5259
5260 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5261
5262         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5263         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5264         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5265         to avoid unneeded links against $(LDADD).
5266         * testsuite/Makefile.in: Regenerate.
5267
5268 2010-12-15  Ian Lance Taylor  <iant@google.com>
5269
5270         PR gold/12324
5271         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5272         for R_X86_64_32 and R_X86_64_PC32.
5273         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5274         ver_matching_def_pic.o.
5275         (ver_matching_def_pic.o): New target.
5276
5277 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5278
5279         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5280         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5281         Move definition before File_read::View member definitions.
5282         (File_read::View::~View): Initialize and hold lock before
5283         updating current_mapped_bytes.
5284
5285 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5286
5287         * dwarf_reader.cc: Remove outdated comment.
5288         * gold-threads.cc: Fix typo in error message.
5289         * archive.cc: Fix typos in comments.
5290         * archive.h: Likewise.
5291         * arm-reloc-property.cc: Likewise.
5292         * arm-reloc-property.h: Likewise.
5293         * arm-reloc.def: Likewise.
5294         * arm.cc: Likewise.
5295         * attributes.h: Likewise.
5296         * cref.cc: Likewise.
5297         * ehframe.cc: Likewise.
5298         * fileread.h: Likewise.
5299         * gold.h: Likewise.
5300         * i386.cc: Likewise.
5301         * icf.cc: Likewise.
5302         * incremental.h: Likewise.
5303         * int_encoding.cc: Likewise.
5304         * layout.h: Likewise.
5305         * main.cc: Likewise.
5306         * merge.h: Likewise.
5307         * object.cc: Likewise.
5308         * object.h: Likewise.
5309         * options.cc: Likewise.
5310         * readsyms.cc: Likewise.
5311         * reduced_debug_output.cc: Likewise.
5312         * reloc.cc: Likewise.
5313         * script-sections.cc: Likewise.
5314         * sparc.cc: Likewise.
5315         * symtab.h: Likewise.
5316         * target-reloc.h: Likewise.
5317         * target.cc: Likewise.
5318         * target.h: Likewise.
5319         * timer.cc: Likewise.
5320         * timer.h: Likewise.
5321         * x86_64.cc: Likewise.
5322
5323 2010-12-09  Cary Coutant  <ccoutant@google.com>
5324
5325         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5326         stack.
5327         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5328         parameter; change all callers.
5329         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5330         * options.h (warn_execstack): New option.
5331
5332 2010-12-07  Doug Kwan  <dougkwan@google.com>
5333
5334         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5335         like function call relocations.
5336
5337 2010-12-07  Ian Lance Taylor  <iant@google.com>
5338
5339         * archive.cc (Archive::get_elf_object_for_member): Permit
5340         punconfigured to be NULL.
5341         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5342         (Archive::include_member): Pass NULL to get_elf_object_for_member
5343         if we searched for the archive and this is the first included
5344         object.
5345
5346 2010-12-01  Ian Lance Taylor  <iant@google.com>
5347
5348         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5349         track_relocs_type_ field.
5350         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5351         Set track_relocs_type_.
5352         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5353         contents when using RELA relocs.
5354         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5355         reloc_map_.
5356         * reloc.cc (Track_relocs::next_addend): New function.
5357         * reloc.h (class Track_relocs): Declare next_addend.
5358
5359 2010-12-01  Ian Lance Taylor  <iant@google.com>
5360
5361         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5362         virtual destructor.
5363
5364 2010-12-01  Ian Lance Taylor  <iant@google.com>
5365
5366         * README: Update compilers known to work and fail.
5367
5368 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5369
5370         * configure.in: For --enable-gold, handle value `default' instead of
5371         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5372         not the default.
5373         * configure: Regenerate.
5374
5375 2010-11-18  Doug Kwan  <dougkwan@google.com>
5376
5377         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5378         and right_alignment to be zero.  Store result alignment only if it is
5379         greater than existing alignment.
5380
5381 2010-11-16  Cary Coutant  <ccoutant@google.com>
5382
5383         PR gold/12220
5384         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5385         Check for ".zdebug_line".
5386
5387 2010-11-16  Doug Kwan  <dougkwan@google.com>
5388             Cary Coutant  <ccoutant@google.com>
5389
5390         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5391         by reference; adjust all callers.
5392         * output.cc (Output_segment::set_section_addresses): Adjust references
5393         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5394         list is empty.
5395         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5396         end at page boundary.
5397
5398 2010-11-16  Cary Coutant  <ccoutant@google.com>
5399
5400         PR gold/12220
5401         * layout.cc (Layout::choose_output_section): Transform names of
5402         compressed sections even when using a script with a SECTIONS clause.
5403         (Layout::output_section_name): Remove code to transform
5404         compressed debug section names.
5405         * output.cc (Output_section::add_input_section): Use uncompressed
5406         section size when tracking input sections.
5407
5408 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5409
5410         * symtab.h (Symbol::NON_PIC_REF): Remove.
5411         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5412         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5413         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5414         (Symbol::use_plt_offset): Take a flags argument and pass it
5415         directly to needs_dynamic_reloc.  Restrict check for undefined
5416         weak symbols to function calls.
5417         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5418         (Target_arm::Scan::global): Use it.
5419         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5420         (Target_arm::Relocate::relocate): Likewise.
5421         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5422         parameter with an r_type parameter.  Use get_reference_flags
5423         to get the flags.
5424         (Target_arm::Relocate::relocate): Update accordingly.
5425         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5426         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5427         (Target_i386::Scan::global): Likewise.
5428         (Target_i386::Relocate::relocate): Likewise.
5429         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5430         parameter with an r_type parameter.  Use get_reference_flags
5431         to get the flags.
5432         (Target_i386::Relocate::relocate): Update accordingly.
5433         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5434         (Target_powerpc::Scan::global): Use it.
5435         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5436         (Target_powerpc::Relocate::relocate): Likewise.
5437         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5438         (Target_sparc::Scan::global): Use it.
5439         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5440         (Target_sparc::Relocate::relocate): Likewise.
5441         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5442         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5443         (Target_x86_64::Scan::global): Likewise.
5444         (Target_x86_64::Relocate::relocate): Likewise.
5445
5446 2010-11-08  Doug Kwan  <dougkwan@google.com>
5447             Cary Coutant  <ccoutant@google.com>
5448
5449         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5450         (Arm_exidx_merge_section::section_contents_): New data member.
5451         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5452         (Arm_input_section::~Arm_input_section): De-allocate memory.
5453         (Arm_input_section::original_contents_): New data member.
5454         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5455         in parameters instead of calling Object::section_contents without
5456         locking.
5457         (Arm_output_section::group_section): New parameter TASK.  Pass it
5458         to callees that need locking objects.
5459         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5460         to lock EXIDX input sections.  Fix a formatting issue.  Call
5461         Arm_exidx_merged_section::build_contents to create merged section
5462         contents.
5463         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5464         to lock object of stub table owner.
5465         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5466         TEXT_SIZE to initialize data member TEXT_SIZE_.
5467         (Arm_exidx_input_section::addralign): Fix typo in comment.
5468         (Arm_exidx_input_section::text_size): New method.
5469         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5470         that require locking objects.  Lock objects before scanning for stubs
5471         and updating local symbols.
5472         (Arm_input_section<big_endian>::init): Copy contents of original
5473         input section.
5474         (Arm_input_section<big_endian>::do_write): Use saved contents of
5475         original input section instead of calling Object::section_contents
5476         without locking.
5477         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5478         size without calling Object::section_size().
5479         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5480         for size.  Allocate a buffer for merged EXIDX entries.
5481         (Arm_exidx_merged_section::build_contents): New method.
5482         (Arm_exidx_merged_section::do_write): Move merge section contents
5483         building code to Arm_exidx_merged_section::build_contetns.  Write
5484         out contetns in buffer instead of building it on the fly.
5485         (Arm_relobj::make_exidx_input_section): Also pass text section size
5486         to Arm_exidx_input_section constructor.
5487         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5488         (Arm_dynobj::do_read_symbols): Fix memory leak.
5489         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5490         * target.h: (class Task): Add forward declaration.
5491         (Target::relax): Add new parameter TASK and pass it to
5492         Target::do_relax().
5493         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5494
5495 2010-11-05  Cary Coutant  <ccoutant@google.com>
5496
5497         PR gold/10708
5498         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5499         object when reading from the file.
5500         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5501         second layout pass.
5502         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5503         when reading section contents.
5504         (get_section_contents): Likewise.
5505         (icf::find_identical_sections): Likewise.
5506         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5507         object when reading from the file.
5508         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5509         the object when doing deferred section layout.
5510
5511 2010-11-03  Nick Clifton  <nickc@redhat.com>
5512
5513         PR gold/12001
5514         * script.h (class Symbol_assignment: name): New member.  Returns
5515         the name of the symbol.
5516         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5517         Returns true if the given symbol name is on the list of
5518         assignments wating to be processed.
5519         * archive.cc (should_incldue_member): If the symbol is undefined,
5520         check to see if it is on the list of symbols pending assignment.
5521
5522 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5523
5524         * script-sections.cc (Script_sections::find_memory_region): Check
5525         for a NULL output section pointer.
5526
5527 2010-10-29  Doug Kwan  <dougkwan@google.com>
5528
5529         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5530         Output_section::add_relaxed_input_section.
5531         * output.cc (Output_section::add_relaxed_input_section): Add new
5532         arguments LAYOUT and NAME.  Set section order index.
5533         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5534         Copy section order index.
5535         * output.h (Output_section::add_relaxed_input_section): Add new
5536         arguments LAYOUT and NAME.
5537
5538 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5539
5540         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5541         NATIVE_OR_CROSS_LINKER.
5542         * testsuite/Makefile.in: Regenerate.
5543
5544 2010-10-20  Doug Kwan  <dougkwan@google.com>
5545
5546         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5547         without SHF_LINK_ORDER flags.
5548         * layout.cc (Layout::choose_output_section): Do not filter
5549         SHF_LINK_ORDER flag in a relocatable link.
5550
5551 2010-10-17  Cary Coutant  <ccoutant@google.com>
5552
5553         * output.h (Output_segment::set_section_addresses): Change function
5554         signature.  Update all callers.
5555         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5556         sections.
5557         (Output_segment::set_section_addresses): Align after last TLS
5558         section.  Add padding before last relro section instead of after.
5559
5560 2010-10-17  Doug Kwan  <dougkwan@google.com>
5561
5562         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5563         GOT output section to be writable.
5564
5565 2010-10-14  Cary Coutant  <ccoutant@google.com>
5566
5567         * debug.h (DEBUG_INCREMENTAL): New flag.
5568         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5569         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5570         mode.
5571         * incremental.cc (report_command_line): Ignore all forms of
5572         --incremental.
5573         * layout.cc (Layout::Layout): Check parameters for incremental link
5574         mode.
5575         * options.cc (General_options::parse_incremental): New function.
5576         (General_options::parse_no_incremental): New function.
5577         (General_options::parse_incremental_full): New function.
5578         (General_options::parse_incremental_update): New function.
5579         (General_options::incremental_mode_): New data member.
5580         (General_options::finalize): Check incremental_mode_.
5581         * options.h (General_options): Update help text for --incremental.
5582         Add --no-incremental, --incremental-full, --incremental-update.
5583         (General_options::Incremental_mode): New enum type.
5584         (General_options::incremental_mode): New function.
5585         (General_options::incremental_mode_): New data member.
5586         * parameters.cc (Parameters::incremental_mode_): New data member.
5587         (Parameters::set_options): Set incremental_mode_.
5588         (Parameters::set_incremental_full): New function.
5589         (Parameters::incremental): New function.
5590         (Parameters::incremental_update): New function.
5591         (set_parameters_incremental_full): New function.
5592         * parameters.h (Parameters::set_incremental_full): New function.
5593         (Parameters::incremental): New function.
5594         (Parameters::incremental_update): New function.
5595         (Parameters::incremental_mode_): New data member.
5596         (set_parameters_incremental_full): New function.
5597         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5598         incremental link mode.
5599         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5600         (Sized_relobj::do_relocate_sections): Likewise.
5601         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5602         option.
5603         * testsuite/Makefile.in: Regenerate.
5604         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5605
5606 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5607
5608         * script-sections.h (class Script_sections): Make
5609         Sections_elements typedef public.
5610         * script-sections.cc (class Sort_output_sections): Add elements_
5611         field.  Add constructor which sets it; change all callers.
5612         (Sort_output_sections::is_before): New function.
5613         (Sort_output_sections::operator()): Call is_before.
5614         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5615         conditional.
5616         * testsuite/script_test_10.sh: New test. Test script section
5617         order.
5618         * testsuite/script_test_10.t: Likewise.
5619         * testsuite/script_test_10.s: Likewise.
5620         * testsuite/Makefile.am: Wrap the cross linker tests and the
5621         common tests into NATIVE_OR_CROSS_LINKER.
5622         (check_SCRIPTS): Add script_test_10.sh.
5623         (check_DATA): Add script_test_10.stdout.
5624         (script_test_10.o, script_test_10): New targets.
5625         (script_test_10.stdout): New target.
5626         * configure, testsuite/Makefile.in: Regenerate.
5627
5628 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5629
5630         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5631         error for the deprecated relocations.
5632         (Target_arm::Scan::global): Likewise.
5633         (Target_arm::Relocate::relocate): Likewise.
5634
5635 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5636
5637         * fileread.cc (Input_file::find_file): Initialize *found_name
5638         and *namep when using the fallback search for case 4.
5639
5640 2010-10-11  Cary Coutant  <ccoutant@google.com>
5641
5642         * options.h (class General_options): Redefine -z lazy as an alias for
5643         the negation of -z now.
5644
5645 2010-10-11  Ian Lance Taylor  <iant@google.com>
5646
5647         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5648         binding.
5649
5650 2010-10-06  Nick Clifton  <nickc@redhat.com>
5651
5652         * script-sections.cc(class Memory_region): Remove
5653         current_lma_offset_ field.  Rename current_vma_offset_ to
5654         current_offset_.  Add last_section_ field.
5655         (Memory_region::get_current_vma_address): Rename to
5656         get_current_address.
5657         (Memory_region::get_current_lma_address): Delete.
5658         (Memory_region::increment_vma_offset): Rename to
5659         increment_offset.
5660         (Memory_region::increment_lma_offset): Delete.
5661         (Memory_region::attributes_compatible): New method.  Returns
5662         true if the provided section is compatible with the region.
5663         (Memory_region::get_last_section): New method.  Returns the last
5664         section to use the region.
5665         (Memory_region::set_last_section): New method.  Stores the last
5666         section to use the region.
5667         (Script_sections::block_in_region): New method.  Returns true if
5668         a block of memory is contained within a region.
5669         (Script_sections::find_memory_region): New method.  Locates a
5670         memory region to be used to set a VMA or LMA address.
5671         (Output_section_definition::set_section_addresses): Add code to
5672         check for addresses set by memory regions.
5673         (Output_segment::set_section_addresses): Remove memory region
5674         walking code.
5675         (Script_sections::create_segment): Add a warning if a header
5676         segment is created outside of any region.
5677         * script-sections.h (class Script_sections): Add prototypes for
5678         find_memory_region and block_in_region methods.
5679         * testsuite/memory_test.s: Use .long instead of .word.
5680         * testsuite/memory_test.t: Add some more output sections.
5681         * testsuite/memory_test.sh: Update expected output.
5682
5683 2010-10-02  Doug Kwan  <dougkwan@google.com>
5684
5685         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5686         defintion to symtab.h
5687         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5688         declaration to defintion.
5689
5690 2010-10-01  Nick Clifton  <nickc@redhat.com>
5691
5692         * expression.cc (eval): Replace dummy argument with NULL.
5693         (eval_maybe_dot): Check for a NULL result section pointer.
5694         (Symbol_expression::value): Likewise.
5695         (Dot_expression::value): Likewise.
5696         (BINARY_EXPRESSION): Likewise.
5697         (Max_expression::value): Likewise.
5698         (Min_expression::value): Likewise.
5699         (Absolute_expression::value): Likewise.
5700         (Addr_expression::value_from_output_section): Likewise.
5701         (Loaddddr_expression::value_from_output_section): Likewise.
5702         (Segment_start_expression::value): Likewise.
5703         * script-sections.cc
5704         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5705         argument with NULL.
5706         (Sections_elememt_dot_assignment::set_section_addresses):
5707         Likewise.
5708         (Output_data_expression::do_write_to_buffer): Likewise.
5709         (Output_section_definition::finalize_symbols): Likewise.
5710         (Output_section_definition::set_section_addresses): Likewise.
5711
5712 2010-09-30  Doug Kwan  <dougkwan@google.com>
5713
5714         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5715
5716 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5717
5718         * target.h (Target::can_icf_inline_merge_sections): New virtual
5719         function.
5720         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5721         virtual function.
5722         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5723         virtual function.
5724         * icf.cc (get_section_contents): Inline merge sections only when
5725         target allows it.
5726
5727 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5728
5729         * configure: Regenerate.
5730
5731 2010-09-17  Ian Lance Taylor  <iant@google.com>
5732
5733         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5734         * testsuite/Makefile.am (memory_test.o): New target.
5735         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5736         memory_test.t.
5737         * testsuite/Makefile.in: Rebuild.
5738
5739 2010-09-17  Doug Kwan  <dougkwan@google.com>
5740
5741         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5742         defintion if relocation uses GOT entries of the symbol.
5743         * testsuite/icf_safe_test.sh: Fix test.
5744         * testsuite/icf_safe_so_test.sh: Fix test.
5745
5746 2010-09-16  Cary Coutant  <ccoutant@google.com>
5747
5748         * script_sections.cc (class Memory_region): Remove "NULL" from
5749         vector initializations.
5750
5751 2010-09-15  Cary Coutant  <ccoutant@google.com>
5752
5753         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5754         Resolve forwarding symbols.
5755
5756 2010-09-15  Doug Kwan  <dougkwan@google.com>
5757
5758         * gold/testsuite/script_test_3.t: Add ARM special sections.
5759         * gold/testsuite/script_test_4.t: Same.
5760         * gold/testsuite/script_test_5.t: Same.
5761         * gold/testsuite/script_test_6.t: Same.
5762         * gold/testsuite/script_test_7.t: Same.
5763         * gold/testsuite/script_test_7.t: Same.
5764         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5765
5766 2010-09-14  Cary Coutant  <ccoutant@google.com>
5767
5768         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5769         (Target_x86_64::Relocate::relocate_tls): Replace check for
5770         saw_tls_block_reloc_ with test for executable section.
5771
5772 2010-09-12  Cary Coutant  <ccoutant@google.com>
5773
5774         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5775         position-independent executables to shared libraries need dynamic
5776         relocations.
5777         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5778         position-independent executables.
5779         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5780         * testsuite/Makefile.in: Regenerate.
5781
5782 2010-09-10  Nick Clifton  <nickc@redhat.com>
5783
5784         PR gold/11997
5785         * testsuite/memory_test.t: Discard any sections that are not
5786         needed.
5787
5788 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5789
5790         PR gold/11996
5791         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5792         "This::" to work around a bug in gcc 4.2.
5793
5794         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5795
5796 2010-09-09  Rafael Espindola  <espindola@google.com>
5797
5798         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5799         sections with different PF_X flags in the same segment.
5800         (Layout::find_first_load_seg): Search all segments to find the first
5801         one.
5802         * options.h (rosegment): New.
5803
5804 2010-09-08  Rafael Espindola  <espindola@google.com>
5805
5806         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5807
5808 2010-09-08  Doug Kwan  <dougkwan@google.com>
5809
5810         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5811         (Arm_relobj::do_relocate_sections): Add new parameter for output
5812         file to match the parent.
5813         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5814         of local symbols instead of input values.  Update code to track
5815         changes in gold::relocate_section.
5816         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5817         (Sized_relobj::compute_final_local_value_internal): New methods.
5818         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5819         body into private version of Sized_relobj::compute_final_local_value.
5820         Call the inline method.
5821         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5822         merged symbol value if there is one.
5823         (Symbol_value::has_output_value): New method defintiion.
5824         (Sized_relobj::Compute_final_local_value_status): New enum type.
5825         (Sized_relobj::compute_final_local_value): New methods.
5826         (Sized_relobj::compute_final_local_value_internal): New methods.
5827         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5828         and arm_cortex_a8.sh.
5829         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5830         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5831         New tests.
5832         * Makefile.in: Regenerate.
5833         * testsuite/arm_bl_out_of_range.s: Update test.
5834         * testsuite/thumb_bl_out_of_range.s: Ditto.
5835         * testsuite/thumb_blx_out_of_range.s: Ditto.
5836         * testsuite/arm_branch_out_of_range.sh: New file.
5837         * testsuite/arm_cortex_a8.sh: Ditto.
5838         * testsuite/arm_cortex_a8_b.s: Ditto.
5839         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5840         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5841         * testsuite/arm_cortex_a8_bl.s: Ditto.
5842         * testsuite/arm_cortex_a8_blx.s: Ditto.
5843         * testsuite/arm_cortex_a8_local.s: Ditto.
5844         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5845         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5846
5847 2010-09-08  Rafael Espindola  <espindola@google.com>
5848
5849         * Makefile.am (memory_test.stdout): Run readelf with -W.
5850         * Makefile.in: Regenerate.
5851         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5852         64 bit output.
5853
5854 2010-09-08  Rafael Espindola  <espindola@google.com>
5855
5856         * script-sections.cc (Script_sections::add_memory_region): Convert
5857         field precision to int.
5858         * script.cc (script_set_section_region, script_set_section_region):
5859         Convert field precision to int.
5860
5861 2010-09-08  Rafael Espindola  <espindola@google.com>
5862
5863         * arm.cc (do_finalize_sections): Create the __exidx_start and
5864         __exdix_end symbols even when the section is missing.
5865
5866 2010-09-08  Nick Clifton  <nickc@redhat.com>
5867
5868         * README: Remove claim that MEMORY is not supported.
5869         * expression.cc (script_exp_function_origin)
5870         (script_exp_function_length): Move from here to ...
5871         * script.cc: ... here.
5872         (script_set_section_region, script_add_memory)
5873         (script_parse_memory_attr, script_include_directive): New
5874         functions.
5875         * script-sections.cc
5876         (class Memory_region): New class.
5877         (class Output_section_definition): Add set_memory_region,
5878         set_section_vma, set_section_lma and get_section_name methods.
5879         (class Script_Sections): Add add_memory_region,
5880         find_memory_region, find_memory_region_origin,
5881         find_memory_region_length and set_memory_region methods.
5882         Have set_section_addresses method walk the list of set memory
5883         regions.
5884         Extend the print methos to display memory regions.
5885         * script-sections.h: Add prototypes for new methods.
5886         Add enum for MEMORY region attributes.
5887         * yyscript.y: Add support for parsing MEMORY regions.
5888         * script-c.h: Add prototypes for new functions.
5889         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5890         * testsuite/Makefile.in: Regenerate.
5891         * testsuite/memory_test.sh: New script.
5892         * testsuite/memory_test.s: New assembler source file.
5893         * testsuite/memory_test.t: New linker script.
5894
5895 2010-08-27  Doug Kwan  <dougkwan@google.com>
5896
5897         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5898         reference override an existing dynamic weak reference.
5899         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5900         * testsuite/Makefile.in: Regenerate.
5901         * testsuite/dyn_weak_ref.sh: New file.
5902         * testsuite/dyn_weak_ref_1.c: Ditto.
5903         * testsuite/dyn_weak_ref_2.c: Ditto.
5904
5905 2010-08-27  Ian Lance Taylor  <iant@google.com>
5906
5907         * incremental.h (class Incremental_input_entry): Add virtual
5908         destructor.
5909
5910 2010-08-27  Ian Lance Taylor  <iant@google.com>
5911
5912         * testsuite/start_lib_test_3.c: Mark t3 as used.
5913
5914 2010-08-27  Nick Clifton  <nickc@redhat.com>
5915
5916         * options.cc (version_script): Fix small typo in previous
5917         whitespace tidyup.
5918
5919 2010-08-25  Nick Clifton  <nickc@redhat.com>
5920
5921         * archive.cc: Formatting fixes: Remove whitespace between
5922         typename and following asterisk.  Remove whitespace between
5923         function name and opening parenthesis.
5924         * archive.h: Likewise.
5925         * arm.cc: Likewise.
5926         * attributes.cc: Likewise.
5927         * attributes.h: Likewise.
5928         * common.cc: Likewise.
5929         * copy-relocs.cc: Likewise.
5930         * dirsearch.h: Likewise.
5931         * dynobj.cc: Likewise.
5932         * ehframe.cc: Likewise.
5933         * ehframe.h: Likewise.
5934         * expression.cc: Likewise.
5935         * fileread.cc: Likewise.
5936         * fileread.h: Likewise.
5937         * gc.h: Likewise.
5938         * gold-threads.cc: Likewise.
5939         * gold.cc: Likewise.
5940         * i386.cc: Likewise.
5941         * icf.h: Likewise.
5942         * incremental-dump.cc: Likewise.
5943         * incremental.cc: Likewise.
5944         * layout.cc: Likewise.
5945         * layout.h: Likewise.
5946         * main.cc: Likewise.
5947         * merge.cc: Likewise.
5948         * merge.h: Likewise.
5949         * object.cc: Likewise.
5950         * object.h: Likewise.
5951         * options.cc: Likewise.
5952         * options.h: Likewise.
5953         * output.cc: Likewise.
5954         * output.h: Likewise.
5955         * plugin.cc: Likewise.
5956         * plugin.h: Likewise.
5957         * powerpc.cc: Likewise.
5958         * reloc.cc: Likewise.
5959         * script-c.h: Likewise.
5960         * script-sections.cc: Likewise.
5961         * script.cc: Likewise.
5962         * stringpool.cc: Likewise.
5963         * symtab.cc: Likewise.
5964         * symtab.h: Likewise.
5965         * target.cc: Likewise.
5966         * timer.cc: Likewise.
5967         * timer.h: Likewise.
5968         * version.cc: Likewise.
5969         * x86_64.cc: Likewise.
5970
5971 2010-08-24  Nick Clifton  <nickc@redhat.com>
5972
5973         PR 11899
5974         * layout.cc (segment_precedes): Sort segments by their physical
5975         addresses, if they have been set.
5976
5977 2010-08-23  Cary Coutant  <ccoutant@google.com>
5978
5979         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5980         symbols data.
5981         (Lib_group::include_member): Unlock object after deleting its
5982         symbols data.
5983         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5984         the bug fixed here.
5985
5986 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5987             Cary Coutant  <ccoutant@google.com>
5988
5989         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5990         constructor, and set_blocker.
5991         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5992         readsyms_blocker_.
5993         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5994         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5995         * testsuite/Makefile.am (start_lib_test): New test case.
5996         * testsuite/Makefile.in: Regenerate.
5997         * testsuite/start_lib_test_main.c: New file.
5998         * testsuite/start_lib_test_1.c: New file.
5999         * testsuite/start_lib_test_2.c: New file.
6000         * testsuite/start_lib_test_3.c: New file.
6001
6002 2010-08-19  Ian Lance Taylor  <iant@google.com>
6003
6004         * Makefile.in: Rebuild with automake 1.11.1.
6005         * aclocal.m4: Likewise.
6006         * testsuite/Makefile.in: Likewise.
6007
6008 2010-08-19  Ian Lance Taylor  <iant@google.com>
6009
6010         PR 10893
6011         * i386.cc (class Output_data_plt_i386): Update declarations.
6012         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6013         local_ifuncs_ fields.
6014         (Target_i386::do_plt_section_for_global): New function.
6015         (Target_i386::do_plt_section_for_local): New function.
6016         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6017         parameter; change all callers.  Initialize global_ifuncs_ and
6018         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6019         __rel_iplt_end.
6020         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6021         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6022         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6023         symbols.
6024         (Target_i386::make_plt_section): New function, broken out of
6025         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6026         (Target_i386::make_plt_entry): Call make_plt_section.
6027         (Target_i386::make_local_ifunc_plt_entry): New function.
6028         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6029         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6030         R_386_IRELATIVE to switch.
6031         (Target_i386::Scan::global): Likewise.
6032         (Target_i386::Relocate::relocate): Likewise.
6033         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6034         switch.
6035         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6036         (Target_x86_64::do_plt_section_for_global): New function.
6037         (Target_x86_64::do_plt_section_for_local): New function.
6038         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6039         parameter; change all callers.  If doing a static link define
6040         __rela_iplt_start and __rela_iplt_end.
6041         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6042         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6043         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6044         to point to .plt.
6045         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6046         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6047         switch.
6048         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6049         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6050         R_X86_64_IRELATIVE to switch.
6051         (Target_x86_64::Scan::global): Likewise.
6052         (Target_x86_64::Relocate::relocate): Likewise.
6053         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6054         switch.
6055         * target.h (class Target): Add plt_section_for_global and
6056         plt_section_for_local functions.  Add do_plt_section_for_global
6057         and do_plt_section_for_local virtual functions.
6058         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6059         clarifying comments.
6060         (Symbol::use_plt_offset): Handle IFUNC symbol.
6061         * object.cc (Sized_relobj::Sized_relobj): Initialize
6062         local_plt_offsets_.
6063         (Sized_relobj::local_has_plt_offset): New function.
6064         (Sized_relobj::local_plt_offset): New function.
6065         (Sized_relobj::set_local_plt_offset): New function.
6066         (Sized_relobj::do_count): Handle IFUNC symbol.
6067         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6068         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6069         is_ifunc_symbol functions.
6070         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6071         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6072         local_plt_offsets_ field.
6073         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6074         * output.h (class Output_section_data): Add non-const
6075         output_section function.
6076         (class Output_data_got): Update declarations.
6077         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6078         Add use_plt_offset parameter to global and local constructors.
6079         Change all callers.  Change local_sym_index_ field to 31 bits.
6080         Change GSYM_CODE and CONSTANT_CODE accordingly.
6081         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6082         doing a static link don't set sh_link field.
6083         (Output_data_got::Got_entry::write): Use PLT offset if
6084         appropriate.
6085         (Output_data_got::add_global_plt): New function.
6086         (Output_data_got::add_local_plt): New function.
6087         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6088         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6089         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6090         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6091         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6092         IFUNC conditional.
6093         * testsuite/ifunc-sel.h: New file.
6094         * testsuite/ifuncmain1.c: New file.
6095         * testsuite/ifuncmain1vis.c: New file.
6096         * testsuite/ifuncmod1.c: New file.
6097         * testsuite/ifuncdep2.c: New file.
6098         * testsuite/ifuncmain2.c: New file.
6099         * testsuite/ifuncmain3.c: New file.
6100         * testsuite/ifuncmod3.c: New file.
6101         * testsuite/ifuncmain4.c: New file.
6102         * testsuite/ifuncmain5.c: New file.
6103         * testsuite/ifuncmod5.c: New file.
6104         * testsuite/ifuncmain6pie.c: New file.
6105         * testsuite/ifuncmod6.c: New file.
6106         * testsuite/ifuncmain7.c: New file.
6107         * configure, testsuite/Makefile.in: Rebuild.
6108
6109 2010-08-18  Ian Lance Taylor  <iant@google.com>
6110
6111         * incremental.cc
6112         (Output_section_incremental_inputs::write_input_files): Add cast
6113         to avoid signed/unsigned comparison warning.
6114         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6115
6116 2010-08-12  Cary Coutant  <ccoutant@google.com>
6117
6118         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6119
6120 2010-08-13  Ian Lance Taylor  <iant@google.com>
6121
6122         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6123
6124 2010-08-12  Cary Coutant  <ccoutant@google.com>
6125             Doug Kwan  <dougkwan@google.com>
6126
6127         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6128         defintion overrides non-weak undef, remember that the original undef
6129         is not weak.
6130         * symtab.cc (Symbol_table::sized_write_global): For undef without
6131         an original weak binding, set binding to global in output.
6132         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6133         * testsuite/Makefile.in: Regenerate.
6134         * testsuite/strong_ref_weak_def.sh: New file.
6135         * testsuite/strong_ref_weak_def_1.c: Ditto.
6136         * testsuite/strong_ref_weak_def_2.c: Ditto.
6137
6138 2010-08-12  Cary Coutant  <ccoutant@google.com>
6139
6140         * testsuite/incremental_test.sh: Rewrite.
6141         * testsuite/incremental_test_1.c: Rewrite.
6142         * testsuite/incremental_test_2.c: Rewrite.
6143
6144 2010-08-12  Cary Coutant  <ccoutant@google.com>
6145
6146         * arm.cc (Target_arm::got_size): Add const.
6147         (Target_arm::got_entry_count): New function.
6148         (Target_arm::plt_entry_count): New function.
6149         (Target_arm::first_plt_entry_offset): New function.
6150         (Target_arm::plt_entry_size): New function.
6151         (Output_data_plt_arm::entry_count): New function.
6152         (Output_data_plt_arm::first_plt_entry_offset): New function.
6153         (Output_data_plt_arm::get_plt_entry_size): New function.
6154         * i386.cc (Target_i386::got_size): Add const.
6155         (Target_i386::got_entry_count): New function.
6156         (Target_i386::plt_entry_count): New function.
6157         (Target_i386::first_plt_entry_offset): New function.
6158         (Target_i386::plt_entry_size): New function.
6159         (Output_data_plt_i386::entry_count): New function.
6160         (Output_data_plt_i386::first_plt_entry_offset): New function.
6161         (Output_data_plt_i386::get_plt_entry_size): New function.
6162         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6163         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6164         * incremental.cc: Include target.h.
6165         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6166         parameter.  Adjust all callers.  Find incremental_got_plt section.
6167         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6168         section.
6169         (Output_section_incremental_inputs::set_final_data_size): Calculate
6170         size of incremental_got_plt section.
6171         (Output_section_incremental_inputs::do_write): Write the
6172         incremental_got_plt section.
6173         (Got_plt_view_info): New struct.
6174         (Local_got_offset_visitor): New class.
6175         (Global_got_offset_visitor): New class.
6176         (Global_symbol_visitor_got_plt): New class.
6177         (Output_section_incremental_inputs::write_got_plt): New function.
6178         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6179         Add parameter.  Adjust all callers.
6180         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6181         (Incremental_inputs::got_plt_section): New function.
6182         (Incremental_inputs::got_plt_section_): New data member.
6183         (Incremental_got_plt_reader): New class.
6184         * layout.cc (Layout::create_incremental_info_sections): Add the
6185         incremental_got_plt section.
6186         * object.h (Got_offset_list::get_list): New function.
6187         (Got offset_list::for_all_got_offsets): New function.
6188         (Sized_relobj::local_got_offset_list): New function.
6189         * powerpc.cc (Target_powerpc::got_size): Add const.
6190         (Target_powerpc::got_entry_count): New function.
6191         (Target_powerpc::plt_entry_count): New function.
6192         (Target_powerpc::first_plt_entry_offset): New function.
6193         (Target_powerpc::plt_entry_size): New function.
6194         (Output_data_plt_powerpc::entry_count): New function.
6195         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6196         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6197         * sparc.cc (Target_sparc::got_size): Add const.
6198         (Target_sparc::got_entry_count): New function.
6199         (Target_sparc::plt_entry_count): New function.
6200         (Target_sparc::first_plt_entry_offset): New function.
6201         (Target_sparc::plt_entry_size): New function.
6202         (Output_data_plt_sparc::entry_count): New function.
6203         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6204         (Output_data_plt_sparc::get_plt_entry_size): New function.
6205         * symtab.h (Symbol::got_offset_list): New function.
6206         (Symbol_table::for_all_symbols): New function.
6207         * target.h (Sized_target::got_entry_count): New function.
6208         (Sized_target::plt_entry_count): New function.
6209         (Sized_target::plt_entry_size): New function.
6210         * x86_64.cc (Target_x86_64::got_size): Add const.
6211         (Target_x86_64::got_entry_count): New function.
6212         (Target_x86_64::plt_entry_count): New function.
6213         (Target_x86_64::first_plt_entry_offset): New function.
6214         (Target_x86_64::plt_entry_size): New function.
6215         (Output_data_plt_x86_64::entry_count): New function.
6216         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6217         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6218
6219 2010-08-12  Cary Coutant  <ccoutant@google.com>
6220
6221         * archive.cc: Include incremental.h.
6222         (Archive::Archive): Initialize incremental_info_.
6223         (Archive::include_member): Record archive members in incremental info.
6224         (Add_archive_symbols::run): Record begin and end of an archive in
6225         incremental info.
6226         (Lib_group::include_member): Record objects in incremental info.
6227         * archive.h (Incremental_archive_entry): Forward declaration.
6228         (Archive::set_incremental_info): New member function.
6229         (Archive::incremental_info): New member function.
6230         (Archive::Unused_symbol_iterator): New class.
6231         (Archive::unused_symbols_begin): New member function.
6232         (Archive::unused_symbols_end): New member function.
6233         (Archive::incremental_info_): New data member.
6234         * incremental-dump.cc (find_input_containing_global): New function.
6235         (dump_incremental_inputs): Dump new incremental info sections.
6236         * incremental.cc: Include symtab.h.
6237         (Output_section_incremental_inputs): New class.
6238         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6239         new incremental info sections.
6240         (Sized_incremental_binary::do_check_inputs): Likewise.
6241         (Incremental_inputs::report_archive): Remove.
6242         (Incremental_inputs::report_archive_begin): New function.
6243         (Incremental_inputs::report_archive_end): New function.
6244         (Incremental_inputs::report_object): New function.
6245         (Incremental_inputs::finalize_inputs): Remove.
6246         (Incremental_inputs::report_input_section): New function.
6247         (Incremental_inputs::report_script): Rewrite.
6248         (Incremental_inputs::finalize): Do nothing but finalize string table.
6249         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6250         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6251         (Incremental_inputs::create_data_sections): New function.
6252         (Incremental_inputs::relocs_entsize): New function.
6253         (Output_section_incremental_inputs::set_final_data_size): New function.
6254         (Output_section_incremental_inputs::do_write): New function.
6255         (Output_section_incremental_inputs::write_header): New function.
6256         (Output_section_incremental_inputs::write_input_files): New function.
6257         (Output_section_incremental_inputs::write_info_blocks): New function.
6258         (Output_section_incremental_inputs::write_symtab): New function.
6259         * incremental.h (Incremental_script_entry): Forward declaration.
6260         (Incremental_object_entry): Forward declaration.
6261         (Incremental_archive_entry): Forward declaration.
6262         (Incremental_inputs): Forward declaration.
6263         (Incremental_inputs_header_data): Remove.
6264         (Incremental_inputs_header): Remove.
6265         (Incremental_inputs_header_write): Remove.
6266         (Incremental_inputs_entry_data): Remove.
6267         (Incremental_inputs_entry): Remove.
6268         (Incremental_inputs_entry_write): Remove.
6269         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6270         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6271         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6272         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6273         Likewise.
6274         (Incremental_input_entry): New class.
6275         (Incremental_script_entry): New class.
6276         (Incremental_object_entry): New class.
6277         (Incremental_archive_entry): New class.
6278         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6279         (Incremental_inputs::report_inputs): Remove.
6280         (Incremental_inputs::report_archive): Remove.
6281         (Incremental_inputs::report_archive_begin): New function.
6282         (Incremental_inputs::report_archive_end): New function.
6283         (Incremental_inputs::report_object): Change prototype.
6284         (Incremental_inputs::report_input_section): New function.
6285         (Incremental_inputs::report_script): Change prototype.
6286         (Incremental_inputs::get_reloc_count): New function.
6287         (Incremental_inputs::set_reloc_count): New function.
6288         (Incremental_inputs::create_data_sections): New function.
6289         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6290         (Incremental_inputs::inputs_section): New function.
6291         (Incremental_inputs::symtab_section): New function.
6292         (Incremental_inputs::relocs_section): New function.
6293         (Incremental_inputs::get_stringpool): Add const.
6294         (Incremental_inputs::command_line): Add const.
6295         (Incremental_inputs::inputs): Remove.
6296         (Incremental_inputs::command_line_key): New function.
6297         (Incremental_inputs::input_file_count): New function.
6298         (Incremental_inputs::input_files): New function.
6299         (Incremental_inputs::relocs_entsize): New function.
6300         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6301         (Incremental_inputs::finalize_inputs): Remove.
6302         (Incremental_inputs::Input_info): Remove.
6303         (Incremental_inputs::lock_): Remove.
6304         (Incremental_inputs::inputs_): Change type.
6305         (Incremental_inputs::inputs_map_): Remove.
6306         (Incremental_inputs::current_object_entry_): New data member.
6307         (Incremental_inputs::inputs_section_): New data member.
6308         (Incremental_inputs::symtab_section_): New data member.
6309         (Incremental_inputs::relocs_section_): New data member.
6310         (Incremental_inputs::reloc_count_): New data member.
6311         (Incremental_inputs_reader): New class.
6312         (Incremental_symtab_reader): New class.
6313         (Incremental_relocs_reader): New class.
6314         * layout.cc (Layout::finalize): Move finalization of incremental info
6315         and creation of incremental info sections to follow finalization of
6316         symbol table.  Set offsets for postprocessing sections.
6317         (Layout::create_incremental_info_sections): Call
6318         Incremental_inputs::create_data_sections.  Add incremental symtab
6319         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6320         sections to layout after input sections.
6321         * layout.h (struct Timespec): Forward declaration.
6322         (Layout::incremental_inputs): Add const.
6323         (Layout::create_incremental_info_sections): Add parameter.
6324         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6325         * object.cc: Include incremental.h.
6326         (Relobj::finalize_incremental_relocs): New function.
6327         (Sized_relobj::do_layout): Record input sections in incremental info.
6328         * object.h (Object::output_section): New function.
6329         (Object::output_section_offset): Moved from Relobj.
6330         (Object::get_incremental_reloc_base): New function.
6331         (Object::get_incremental_reloc_count): New function.
6332         (Object::do_output_section): New function.
6333         (Object::do_output_section_offset): Moved from Relobj.
6334         (Object::do_get_incremental_reloc_base): New function.
6335         (Object::do_get_incremental_reloc_count): New function.
6336         (Object::Object): Initialize new data members.
6337         (Relobj::output_section): Renamed do_output_section and moved to
6338         protected.
6339         (Relobj::output_section_offset): Moved to Object.
6340         (Relobj::do_get_incremental_reloc_base): New function.
6341         (Relobj::do_get_incremental_reloc_count): New function.
6342         (Relobj::allocate_incremental_reloc_counts): New function.
6343         (Relobj::count_incremental_reloc): New function.
6344         (Relobj::finalize_incremental_relocs): New function.
6345         (Relobj::next_incremental_reloc_index): New function.
6346         (Relobj::reloc_counts_): New data member.
6347         (Relobj::reloc_bases_): New data member.
6348         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6349         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6350         (Sized_relobj::incremental_relocs_scan): New function.
6351         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6352         (Sized_relobj::incremental_relocs_write): New function.
6353         (Sized_relobj::incremental_relocs_write_reltype): New function.
6354         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6355         incremental link.
6356         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6357         archives and object files elsewhere.
6358         (Add_symbols::run): Report object files here.
6359         (Finish_group::run): Report end of archive at end of group.
6360         * reloc.cc: Include layout.h, incremental.h.
6361         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6362         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6363         (Sized_relobj::incremental_relocs_scan): New function.
6364         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6365         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6366         (Sized_relobj::incremental_relocs_write): New function.
6367         (Sized_relobj::incremental_relocs_write_reltype): New function.
6368         * script.cc (read_input_script): Rewrite test for incremental link.
6369         Change call to Incremental_inputs::report_script.
6370         * symtab.h (Symbol_table::first_global_index): New function.
6371         (Symbol_table::output_count): New function.
6372
6373 2010-08-12  Doug Kwan  <dougkwan@google.com>
6374
6375         * arm.cc (Target_arm::merge_object_attributes): Check command line
6376         options --no-wchar-size-warning and --no-enum-size-warning.
6377         * options.h (General_options): Add ld-compatible options
6378         --no-enum-size-warning and --no-wchar-size-warning.
6379
6380 2010-08-04  Ian Lance Taylor  <iant@google.com>
6381
6382         * x86_64.cc (Target_x86_64::Scan::local): Use
6383         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6384         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6385         (Target_x86_64::Scan::global): Likewise.
6386         (Target_x86_64::Relocate::relocate): Likewise.
6387         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6388         Likewise.
6389
6390 2010-08-03  Cary Coutant  <ccoutant@google.com>
6391
6392         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6393         to reserve space in merged_strings vector. Keep total input size
6394         for stats.
6395         (Output_merge_string::do_print_merge_stats): Print total input size.
6396         * merge.h (Output_merge_string): Add input_size_ field.
6397         * stringpool.cc (Stringpool_template::string_length): Move
6398         implementations out of Stringpool_template class and place in
6399         stringpool.h.
6400         * stringpool.h (string_length): Move out of Stringpool_template.
6401
6402 2010-08-03  Ian Lance Taylor  <iant@google.com>
6403
6404         PR 11712
6405         * layout.cc (relaxation_loop_body): If address of load segment is
6406         set, adjust address to include headers if possible.
6407
6408 2010-08-03  Ian Lance Taylor  <iant@google.com>
6409
6410         * version.cc (version_string): Bump to 1.10.
6411
6412 2010-08-03  Ian Lance Taylor  <iant@google.com>
6413
6414         PR 11805
6415         * layout.h (enum Output_section_order): Define.
6416         (class Layout): Update declarations.
6417         * layout.cc (Layout::get_output_section): Add order parameter.
6418         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6419         is_first_non_relro parameters.  Change all callers.
6420         (Layout::choose_output_section): Likewise.
6421         (Layout::add_output_section_data): Likewise.
6422         (Layout::make_output_section): Likewise.  Set order.
6423         (Layout::default_section_order): New function.
6424         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6425         * output.cc (Output_section::Output_section): Initialize order_.
6426         Don't initialize deleted fields.
6427         (Output_segment::Output_segment): Don't initialize deleted
6428         fields.
6429         (Output_segment::add_output_section_to_load): New function
6430         replacing add_output_section.  Change all callers to call this or
6431         add_output_section_to_nonload.
6432         (Output_segment::add_output_section_to_nonload): New function.
6433         (Output_segment::remove_output_section): Rewrite.
6434         (Output_segment::add_initial_output_data): Likewise.
6435         (Output_segment::has_any_data_sections): Likewise.
6436         (Output_segment::is_first_section_relro): Likewise.
6437         (Output_segment::maximum_alignment): Likewise.
6438         (Output_segment::has_dynamic_reloc): New function replacing
6439         dynamic_reloc_count.  Change all callers.
6440         (Output_segment::has_dynamic_reloc_list): New function replacing
6441         dynamic_reloc_count_list.  Change all callers.
6442         (Output_segment::set_section_addresses): Rewrite.
6443         (Output_segment::set_offset): Rewrite.
6444         (Output_segment::find_first_and_last_list): Remove.
6445         (Output_segment::set_tls_offsets): Rewrite.
6446         (Output_segment::first_section_load_address): Likewise.
6447         (Output_segment::output_section_count): Likewise.
6448         (Output_segment::section_with_lowest_load_address): Likewise.
6449         (Output_segment::write_section_headers): Likewise.
6450         (Output_segment::print_sections_to_map): Likewise.
6451         * output.h (class Output_data): Remove dynamic_reloc_count_
6452         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6453         (Output_data::add_dynamic_reloc): Rewrite.
6454         (Output_data::has_dynamic_reloc): New function.
6455         (Output_data::dynamic_reloc_count): Remove.
6456         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6457         is_last_relro_, is_first_non_relro_, is_interp_,
6458         is_dynamic_linker_section_ fields.  Add order and set_order
6459         functions.  Remove is_relro_local, set_is_relro_local,
6460         is_last_relro, set_is_last_relro, is_first_non_relro,
6461         set_is_first_non_relro functions, is_interp, set_is_interp,
6462         is_dynamic_linker_section, and set_is_dynamic_linker_section
6463         functions.
6464         (class Output_segment): Change Output_data_list from std::list to
6465         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6466         output_bss_ fields.  Update declarations.
6467
6468 2010-08-02  Ian Lance Taylor  <iant@google.com>
6469
6470         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6471         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6472         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6473
6474 2010-08-02  Ian Lance Taylor  <iant@google.com>
6475
6476         PR 11855
6477         * script.cc (Script_options::Script_options): Initialize
6478         symbol_definitions_ and symbol_references_.
6479         (Script_options::add_symbol_assignment): Update
6480         symbol_definitions_ and symbol_references_.
6481         (Script_options::add_symbol_reference): New function.
6482         (script_symbol): New function.
6483         * script.h (class Script_options): Add symbol_definitions_ and
6484         symbol_references_ fields.
6485         (Script_options::referenced_const_iterator): New type.
6486         (Script_options::referenced_begin): New function.
6487         (Script_options::referenced_end): New function.
6488         (Script_options::is_referenced): New function.
6489         (Script_options::any_unreferenced): New function.
6490         * script-c.h (script_symbol): Declare.
6491         * yyscript.y (exp): Call script_symbol.
6492         * symtab.cc: Include "script.h".
6493         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6494         Change all callers.  Check symbols referenced by scripts.
6495         (Symbol_table::add_undefined_symbols_from_command_line): Add
6496         layout parameter.  Change all callers.
6497         (Symbol_table::do_add_undefined_symbols_from_command_line):
6498         Likewise.  Break out loop body.  Check symbols referenced by
6499         scripts.
6500         (Symbol_table::add_undefined_symbol_from_command_line): New
6501         function broken out of
6502         do_add_undefined_symbols_from_command_line.
6503         * symtab.h (class Symbol_table): Update declarations.
6504         * archive.cc: Include "layout.h".
6505         (Archive::should_include_member): Add layout parameter.  Change
6506         all callers.  Check for symbol mentioned in expression.
6507         * archive.h (class Archive): Update declaration.
6508         * object.cc (Sized_relobj::do_should_include_member): Add layout
6509         parameter.
6510         * object.h (Object::should_include_member): Add layout parameter.
6511         Change all callers.
6512         (Object::do_should_include_member): Add layout parameter.
6513         (class Sized_relobj): Update declaration.
6514         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6515         parameter.
6516         * dynobj.h (class Sized_dynobj): Update declaration.
6517         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6518         layout parameter.
6519         * plugin.h (class Sized_pluginobj): Update declaration.
6520
6521 2010-08-02  Ian Lance Taylor  <iant@google.com>
6522
6523         PR 11866
6524         * output.cc (Output_segment::set_offset): Search for the first and
6525         last sections rather than assuming that the list is in order.
6526         (Output_segment::find_first_and_last_list): New function.
6527         * output.h (class Output_segment): Update declarations.
6528         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6529         (relro_strip_test_SOURCES): New variable.
6530         (relro_strip_test_DEPENDENCIES): New variable.
6531         (relro_strip_test_LDFLAGS): New variable.
6532         (relro_strip_test_LDADD): New variable.
6533         (relro_strip_test.so): New target.
6534
6535 2010-08-02  Ian Lance Taylor  <iant@google.com>
6536
6537         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6538         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6539         (Target_i386::got_tlsdesc_section): New function.
6540         (Target_i386::got_section): Create space for GOT entries for
6541         TLSDESC relocations.
6542         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6543         R_386_TLS_GOTDESC.
6544         (Target_i386::Scan::global): Likewise.
6545         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6546         using TLSDESC GOT.
6547         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6548         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6549         (Target_x86_64::got_tlsdesc_section): New function.
6550         (Target_x86_64::got_section): Create space for GOT entries for
6551         TLSDESC relocations.
6552         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6553         R_386_TLS_GOTDESC.
6554         (Target_x86_64::Scan::global): Likewise.
6555         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6556         using TLSDESC GOT.
6557
6558 2010-08-02  Ian Lance Taylor  <iant@google.com>
6559
6560         * testsuite/final_layout.sh: Use dc to convert from hex to
6561         decimal.
6562
6563 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6564
6565         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6566         paramter to the call to gold::gc_process_relocs.
6567         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6568         paramter to the call to gold::gc_process_relocs.
6569         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6570         parameter to the call to gold::gc_process_relocs.
6571         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6572         template parameter to the call to gold::gc_process_relocs.
6573         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6574         paramter to the call to gold::gc_process_relocs.
6575         * gc.h (get_embedded_addend_size): New function.
6576         (gc_process_relocs): Save the size of the reloc for use by ICF.
6577         * icf.cc (get_section_contents): Get the addend from the text section
6578         for SHT_REL relocation sections.
6579         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6580         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6581         * int_encoding.h (read_from_pointer): New overloaded function.
6582         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6583         * testsuite/icf_sht_rel_addend_test.sh: New file.
6584         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6585         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6586
6587 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6588
6589         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6590         * Makefile.in: Regenerate.
6591         * testsuite/Makefile.in: Regenerate.
6592
6593 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6594
6595         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6596         * gold/testsuite/debug_msg.cc: Likewise.
6597         * gold/testsuite/odr_violation1.cc
6598         * gold/testsuite/odr_violation2.cc
6599
6600 2010-07-21  Cary Coutant  <ccoutant@google.com>
6601
6602         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6603         string, and length fields.
6604         (Output_merge_string::Merged_strings_list): New type.
6605         (Output_merge_string::Merged_strings_lists): New typedef.
6606         (Output_merge_string): Replace merged_strings_ with
6607         merged_strings_lists_.
6608         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6609         Merged_strings_list per input object and section.  Don't store pointer
6610         to the string.  Don't store length with each merged string entry.
6611         (Output_merge_string::finalize_merged_data): Loop over list of merged
6612         strings lists.  Recompute length of each merged string.
6613
6614 2010-07-15  Cary Coutant  <ccoutant@google.com>
6615
6616         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6617         here.
6618
6619 2010-07-14  Ian Lance Taylor  <iant@google.com>
6620
6621         * descriptors.cc (Descriptors::open): Report correct name in error
6622         message.
6623
6624 2010-07-13  Doug Kwan  <dougkwan@google.com>
6625
6626         * arm.cc (Arm_input_section::Arm_input_section): For a
6627         SHT_ARM_EXIDX section, always keeps the input sections.
6628         (Arm_input_section::set_exidx_section_link): New method.
6629         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6630         has_errors_ to false.
6631         (Arm_exidx_input_section::has_errors,
6632         Arm_exidx_input_section::set_has_errors): New methods.
6633         (Arm_exidx_input_section::has_errors_): New data member.
6634         (Arm_relobj::get_exidx_shndx_list): New method.
6635         (Arm_output_section::append_text_sections_to_list): Do not skip
6636         section without SHF_EXECINSTR.
6637         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6638         errors.
6639         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6640         section header.  Make error messages more verbose.  Check for
6641         a non-executable section linked to an EXIDX section.
6642         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6643         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6644         check that there is no deferred EXIDX section if we exit early.
6645         Instead of not making an EXIDX section in case of an error, make one
6646         and set the has_errors flag of it.
6647         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6648         in a relocatable link.
6649         (Target_arm::do_relax): Look for the EXIDX output section instead of
6650         assuming that it is called .ARM.exidx.
6651         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6652         section list.  Do not check for SHF_EXECINSTR section flags but
6653         skip any input section with errors.
6654         * output.cc (Output_section::Output_section): Initialize
6655         always_keeps_input_sections_ to false.
6656         (Output_section::add_input_section): Check for
6657         always_keeps_input_sections_.
6658         *  output.h (Output_section::always_keeps_input_sections,
6659         Output_section::set_always_keeps_input_sections): New methods.
6660         (Output_section::always_keeps_input_sections): New data member.
6661
6662 2010-07-13  Rafael Espindola  <espindola@google.com>
6663
6664         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6665         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6666
6667 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6668             Ian Lance Taylor  <iant@google.com>
6669
6670         * output.h (Output_section_lookup_maps::add_merge_section):
6671         Correct check of whether value was inserted.
6672         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6673         (Output_section_lookup_maps::add_relaxed_input_section):
6674         Likewise.
6675         * arm.cc (Target_arm::got_section): Remove used local os.
6676         * i386.cc (Target_i386::got_section): Likewise.
6677         * x86_64.cc (Target_x86_64::got_section): Likewise.
6678         * sparc.cc (Target_sparc::got_section): Likewise.
6679         (Target_sparc::relocate): Remove unused local have_got_offset.
6680         * powerpc.cc (Target_powerpc::relocate): Likewise.
6681
6682 2010-07-13  Ian Lance Taylor  <iant@google.com>
6683
6684         * compressed_output.cc (zlib_decompress): Fix signature in
6685         !HAVE_ZLIB_H case.
6686
6687         * archive.cc (Archive::include_member): Unlock an external member
6688         of a thin archive.  Don't bother to delete an object we know is
6689         NULL.
6690
6691 2010-07-12  Cary Coutant  <ccoutant@google.com>
6692
6693         * compressed_output.cc (zlib_decompress): New function.
6694         (get_uncompressed_size): New function.
6695         (decompress_input_section): New function.
6696         * compressed_output.h (get_uncompressed_size): New function.
6697         (decompress_input_section): New function.
6698         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6699         Handle compressed debug sections.
6700         * layout.cc (is_compressed_debug_section): New function.
6701         (Layout::output_section_name): Map compressed section names to
6702         canonical names.
6703         * layout.h (is_compressed_debug_section): New function.
6704         (is_debug_info_section): Recognize compressed debug sections.
6705         * merge.cc: Include compressed_output.h.
6706         (Output_merge_data::do_add_input_section): Handle compressed
6707         debug sections.
6708         (Output_merge_string::do_add_input_section): Handle compressed
6709         debug sections.
6710         * object.cc: Include compressed_output.h.
6711         (Sized_relobj::Sized_relobj): Initialize new data members.
6712         (build_compressed_section_map): New function.
6713         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6714         * object.h (Object::section_is_compressed): New method.
6715         (Object::do_section_is_compressed): New method.
6716         (Sized_relobj::Compressed_section_map): New type.
6717         (Sized_relobj::do_section_is_compressed): New method.
6718         (Sized_relobj::compressed_sections_): New data member.
6719         * output.cc (Output_section::add_input_section): Handle compressed
6720         debug sections.
6721         * reloc.cc: Include compressed_output.h.
6722         (Sized_relobj::write_sections): Handle compressed debug sections.
6723
6724 2010-07-08  Cary Coutant  <ccoutant@google.com>
6725
6726         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6727         weak when resolving to a dynamic def.
6728         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6729         for weak undef/dynamic def cases. Adjust callers.
6730         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6731         undef_binding_weak_.
6732         (Symbol_table::sized_write_globals): Adjust symbol binding.
6733         (Symbol_table::sized_write_symbol): Add binding parameter.
6734         * symtab.h (Symbol::set_undef_binding): New method.
6735         (Symbol::is_undef_binding_weak): New method.
6736         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6737         (Symbol_table::should_override): Add new parameter.
6738         (Symbol_table::sized_write_symbol): Add new parameter.
6739
6740         * testsuite/weak_undef_file1.cc: Add new test case.
6741         * testsuite/weak_undef_file2.cc: Fix header comment.
6742         * testsuite/weak_undef_test.cc: Add new test case.
6743
6744 2010-06-29  Doug Kwan  <dougkwan@google.com>
6745
6746         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6747         Initialize USE_SYMBOL_.
6748         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6749         definition.
6750         (Arm_reloc_property::uses_symbol_): New data member declaration.
6751         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6752         uses symbol value and symbol is undefined but not weakly undefined.
6753
6754 2010-06-28  Rafael Espindola  <espindola@google.com>
6755
6756         * plugin.cc (Plugin::load): Use dlerror.
6757
6758 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6759
6760         * symtab.cc (detect_odr_violations): When reporting an ODR
6761         violation, report an object where the symbol is defined.
6762
6763 2010-06-25  Doug Kwan  <dougkwan@google.com>
6764
6765         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6766         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6767         definition.
6768         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6769         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6770         target hook to detect function points.
6771         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6772         * icf.h (Icf::check_section_for_function_pointers): Change type of
6773         parameter SECTION_NAME to const reference to std::string.  Use
6774         target hook to determine if section may have unsafe pointers.
6775         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6776         method definition.
6777
6778 2010-06-21  Rafael Espindola  <espindola@google.com>
6779
6780         * fileread.cc (Input_file::find_fie): New
6781         (Input_file::open): Use Input_file::find_fie.
6782         * fileread.h (Input_file::find_fie): New
6783         * plugin.cc (set_extra_library_path): New.
6784         (Plugin::load): Add set_extra_library_path to the transfer vector.
6785         (Plugin_manager::set_extra_library_path): New.
6786         (Plugin_manager::add_input_file): Use the extra search path if set.
6787         (set_extra_library_path(): New.
6788         * plugin.h (Plugin_manager): Add set_extra_library_path and
6789         extra_search_path_.
6790
6791 2010-06-19  Cary Coutant  <ccoutant@google.com>
6792
6793         * layout.cc (gdb_sections): Add .debug_types.
6794         (lines_only_debug_sections): Likewise.
6795
6796 2010-06-18  Rafael Espindola  <espindola@google.com>
6797
6798         * plugin.cc (add_input_file,add_input_library)
6799         (Plugin_manager::add_input_file): Make filename arguments const.
6800         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6801         const.
6802
6803 2010-06-16  Doug Kwan  <dougkwan@google.com>
6804
6805         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6806         .ARM.attributes section if we have not merged any input
6807         attributes sections.
6808
6809 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6810
6811         * arm.cc: Allow combining objects with no EABI version
6812         information.
6813
6814 2010-06-15  Rafael Espindola  <espindola@google.com>
6815
6816         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6817
6818 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6819
6820         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6821         (struct iovec): Correct !HAVE_READV definition.
6822
6823 2010-06-10  Cary Coutant  <ccoutant@google.com>
6824
6825         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6826         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6827         reloc sections.
6828         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6829
6830         PR 11683
6831         * symtab.h (Symbol::is_placeholder): New member function.
6832         * target-reloc.h (relocate_section): Check for placeholder symbols.
6833
6834         * testsuite/Makefile.am (plugin_test_8): New test.
6835         (plugin_test_9): New test.
6836         * testsuite/Makefile.in: Regenerate.
6837
6838 2010-06-09  Nick Clifton  <nickc@redhat.com>
6839
6840         * yyscript.y (input_list_element): Allow strings prefixed with
6841         the '-' character.  Treat these as libraries.
6842         * script.cc (script_add_library): New function.  Adds a library
6843         specified by "-l<name>" found in an input script.
6844         * script-c.h: Add prototype for script_add_library.
6845
6846 2010-06-07  Doug Kwan  <dougkwan@google.com>
6847
6848         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6849         Restrict stub-group size to be within long conditional branch
6850         range when working around cortex-A8 erratum.
6851
6852 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6853
6854         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6855         #ifdef typo.
6856
6857 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6858
6859         PR gold/11658
6860         * output.cc
6861         (Output_section::Input_section_sort_entry::compare_section_ordering):
6862         Change to return non-zero correctly.
6863         (Output_section::Input_section_sort_section_order_index_compare
6864         ::operator()): Change to fix ambiguity in comparisons.
6865
6866 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6867
6868         * gold.h (is_wildcard_string): New function.
6869         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6870         (Layout::layout_eh_frame): Ditto.
6871         (Layout::find_section_order_index): New method.
6872         (Layout::read_layout_from_file): New method.
6873         * layout.h (Layout::find_section_order_index): New method.
6874         (Layout::read_layout_from_file): New method.
6875         (Layout::input_section_position_): New private member.
6876         (Layout::input_section_glob_): New private member.
6877         * main.cc (main): Call read_layout_from_file here.
6878         * options.h (--section-ordering-file): New option.
6879         * output.cc (Output_section::input_section_order_specified_): New
6880         member.
6881         (Output_section::Output_section): Initialize new member.
6882         (Output_section::add_input_section): Add new parameter.
6883         Keep input sections when --section-ordering-file is used.
6884         (Output_section::set_final_data_size): Sort input sections when
6885         section ordering file is specified.
6886         (Output_section::Input_section_sort_entry): Add new parameter.
6887         Check sorting type.
6888         (Output_section::Input_section_sort_entry::compare_section_ordering):
6889         New method.
6890         (Output_section::Input_section_sort_compare::operator()): Change to
6891         consider section_order_index.
6892         (Output_section::Input_section_sort_init_fini_compare::operator()):
6893         Change to consider section_order_index.
6894         (Output_section::Input_section_sort_section_order_index_compare
6895         ::operator()): New method.
6896         (Output_section::sort_attached_input_sections): Change to sort
6897         according to section order when specified.
6898         (Output_section::add_input_section<32, true>): Add new parameter.
6899         (Output_section::add_input_section<64, true>): Add new parameter.
6900         (Output_section::add_input_section<32, false>): Add new parameter.
6901         (Output_section::add_input_section<64, false>): Add new parameter.
6902         * output.h (Output_section::add_input_section): Add new parameter.
6903         (Output_section::input_section_order_specified): New
6904         method.
6905         (Output_section::set_input_section_order_specified): New method.
6906         (Input_section::Input_section): Initialize section_order_index_.
6907         (Input_section::section_order_index): New method.
6908         (Input_section::set_section_order_index): New method.
6909         (Input_section::section_order_index_): New member.
6910         (Input_section::Input_section_sort_section_order_index_compare): New
6911         struct.
6912         (Output_section::input_section_order_specified_): New member.
6913         * script-sections.cc (is_wildcard_string): Delete and move modified
6914         method to gold.h.
6915         (Output_section_element_input::Output_section_element_input): Modify
6916         call to is_wildcard_string.
6917         (Output_section_element_input::Input_section_pattern
6918         ::Input_section_pattern): Ditto.
6919         (Output_section_element_input::Output_section_element_input): Ditto.
6920         * testsuite/Makefile.am (final_layout): New test case.
6921         * testsuite/Makefile.in: Regenerate.
6922         * testsuite/final_layout.cc: New file.
6923         * testsuite/final_layout.sh: New file.
6924
6925 2010-06-01  Rafael Espindola  <espindola@google.com>
6926
6927         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6928
6929 2010-06-01  Rafael Espindola  <espindola@google.com>
6930
6931         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6932         visibility of symbols.
6933
6934 2010-05-27  Doug Kwan  <dougkwan@google.com>
6935
6936         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6937         from start of output section instead of address for a local symbol
6938         in a merged or relaxed section when doing a relocatable link.
6939
6940 2010-05-26  Rafael Espindola  <espindola@google.com>
6941
6942         PR 11604
6943         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6944         adding sections the garbage collector removed.
6945         * gold/testsuite/Makefile.am: Add test.
6946         * gold/testsuite/Makefile.in: Regenerate.
6947         * gold/testsuite/plugin_test_7.sh: New.
6948         * gold/testsuite/plugin_test_7_1.c: New.
6949         * gold/testsuite/plugin_test_7_2.c: New.
6950
6951 2010-05-26  Rafael Espindola  <espindola@google.com>
6952
6953         * script-sections.cc (Output_section_definition::set_section_addresses):
6954         Check for --section-start.
6955
6956 2010-05-26  Doug Kwan  <dougkwan@google.com>
6957
6958         * arm.cc (Arm_scan_relocatable_relocs): New class.
6959         (Target_arm::relocate_special_relocatable): New method.
6960         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6961         (Arm_relocate_functions::thumb_branch_common): Same.
6962         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6963         instead of Default_scan_relocatable_relocs.
6964         * target-reloc.h (relocate_for_relocatable): Let target handle
6965         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6966         * target.h (Sized_target::relocate_special_relocatable): New method.
6967
6968 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6969
6970         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6971
6972 2010-05-23  Doug Kwan  <dougkwan@google.com>
6973
6974         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6975         instead of a cast.
6976         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6977         with a direct branch, not a conditional branch, to a stub.
6978         * merge.cc (Output_merge_base::record_input_section): New method
6979         defintion.
6980         (Output_merge_data::do_add_input_section): Record input section if
6981         keeps-input-sections flag is set.
6982         (Output_merge_string::do_add_input_section): Ditto.
6983         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6984         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6985         INPUT_SECTIONS_.
6986         (Output_merge_base::keeps_input_sections,
6987         Output_merge_base::set_keeps_input_sections,
6988         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6989         method definitions.
6990         (Output_merge_base::Input_sections): New type declaration.
6991         (Output_merge_base::input_sections_begin,
6992         Output_merge_base::input_sections_end,
6993         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6994         (Output_merge_base::bool keeps_input_sections_,
6995         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6996         Output_merge_base::input_sections_): New data members.
6997         (Output_merge_data::do_set_keeps_input_sections): New method
6998         defintion.
6999         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7000         * output.cc (Output_section::Input_section::relobj): Move method
7001         defintion from class declaration to here and handle merge sections.
7002         (Output_section::Input_section::shndx): Ditto.
7003         (Output_section::Output_section): Remove initializations of removed
7004         data members and initialize new data member LOOKUP_MAPS_.
7005         (Output_section::add_input_section): Set keeps-input-sections flag
7006         for a newly created merge output section as appropriate.  Adjust code
7007         to use Output_section_lookup_maps class.
7008         (Output_section::add_relaxed_input_section): Adjst code for lookup
7009         maps code refactoring.
7010         (Output_section::add_merge_input_section): Add a new parameter
7011         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7012         class.  If adding input section to a newly created merge output
7013         section fails, remove the new merge section.
7014         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7015         Adjust code for use of the Output_section_lookup_maps class.
7016         (Output_section::find_merge_section): Ditto.
7017         (Output_section::build_lookup_maps): New method defintion.
7018         (Output_section::find_relaxed_input_section): Adjust code to use
7019         Output_section_lookup_maps class.
7020         (Output_section::get_input_sections): Export merge sections.  Adjust
7021         code to use Output_section_lookup_maps class.
7022         (Output_section:::add_script_input_section): Adjust code to use
7023         Output_section_lookup_maps class.  Update lookup maps for merge
7024         sections also.
7025         (Output_section::discard_states): Use Output_section_lookup_maps.
7026         (Output_section::restore_states): Same.
7027         * output.h (Merge_section_properties): Move class defintion out of
7028         Output_section.
7029         (Output_section_lookup_maps): New class.
7030         (Output_section::Input_section::is_merge_section): New method
7031         defintion.
7032         (Output_section::Input_section::relobj): Move defintion out of class
7033         defintion.  Declare method only.
7034         (Output_section::Input_section::shndx): Ditto.
7035         (Output_section::Input_section::output_merge_base): New method defintion.
7036         (Output_section::Input_section::u2_.pomb): New union field.
7037         (Output_section::Merge_section_by_properties_map,
7038         Output_section::Output_section_data_by_input_section_map,
7039         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7040         Remove types.
7041         (Output_section::add_merge_input_section): Add new parameter
7042         KEEPS_INPUT_SECTIONS.
7043         (Output_section::build_lookup_maps): New method declaration.
7044         (Output_section::merge_section_map_,
7045         Output_section::merge_section_by_properties_map_,
7046         Output_section::relaxed_input_section_map_,
7047         Output_section::is_relaxed_input_section_map_valid_): Remove data
7048         members.
7049         (Output_section::lookup_maps_): New data member.
7050
7051 2010-05-21  Doug Kwan  <dougkwan@google.com>
7052
7053         PR gold/11619
7054         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7055         avoid a compilation error.
7056
7057 2010-05-19  Rafael Espindola  <espindola@google.com>
7058
7059         * script-sections.cc (Output_section_definition::allocate_to_segment):
7060         Update the phdrs_list even when the output section is NULL.
7061         * testsuite/Makefile.am: Add test.
7062         * testsuite/Makefile.in: Regenerate.
7063         * testsuite/script_test_9.cc: New.
7064         * testsuite/script_test_9.sh: New.
7065         * testsuite/script_test_9.t: New.
7066
7067 2010-05-19  Doug Kwan  <dougkwan@google.com>
7068
7069         * arm.cc (Arm_input_section::original_size): New method.
7070         (Arm_input_section::do_addralign): Add a cast.
7071         (Arm_input_section::do_output_offset): Remove static cast.
7072         (Arm_input_section::original_addralign,
7073          Arm_input_section::original_size_): Change type to uint32_t.
7074         (Arm_input_section::init): Add safe casts for section alignment
7075         and size.
7076         (Arm_input_section::set_final_data_size): Do not set address and
7077         offset of stub table.
7078         (Arm_output_section::fix_exidx_coverage): Change use of of
7079         Output_section::Simple_input_section to that of
7080         Output_section::Input_section.
7081         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7082         except for the first pass.
7083         * output.cc (Output_section::get_input_sections): Change type of
7084         input_sections to std::list<Input_section>.
7085         (Output_section::add_script_input_section): Rename from
7086         Output_section::add_simple_input_section.  Change type of SIS
7087         parameter from Simple_input_section to Input_section.
7088         * output.h (Output_section::Simple_input_section): Remove class.
7089         (Output_section::Input_section): Change class visibility to public.
7090         (Output_section::Input_section::addralign): Use stored alignments
7091         for special input sections if set.
7092         (Output_section::Input_section::set_addralign): New method.
7093         (Output_section::get_input_sections): Change parameter type from
7094         list of Simple_input_section to list of Input_section.
7095         (Output_section::add_script_input_section): Rename from
7096         Output_section::add_simple_input_section. Change first parameter's
7097         type from Simple_input_section to Input_section and remove the
7098         second and third parameters.
7099         * script-sections.cc (Input_section::Input_section_list): Change
7100         type to list of Output_section::Input_section/
7101         (Input_section_info::Input_section_info): Change parameter type of
7102         INPUT_SECTION to Output_section::Input_section.
7103         (Input_section_info::input_section): Change return type.
7104         (Input_section_info::input_section_): Change type to
7105         Output_section::Input_section.
7106         (Output_section_element_input::set_section_addresses): Adjust code
7107         to use Output_section::Input_section instead of
7108         Output_section::Simple_input_section.  Adjust code for renaming
7109         of Output_section::add_simple_input_section.
7110         (Orphan_output_section::set_section_addresses): Ditto.
7111
7112 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7113
7114         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7115         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7116
7117 2010-05-18  Rafael Espindola  <espindola@google.com>
7118
7119         * options.cc (General_options::finalize): Handle -nostdlib.
7120         * options.h (nostdlib): New option.
7121         * script.cc (script_add_search_dir): Handle -nostdlib.
7122
7123 2010-05-12  Doug Kwan  <dougkwan@google.com>
7124
7125         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7126         attributes section only if there no attributes section after merging.
7127         (Target_arm::merge_object_attributes): Move value of
7128         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7129         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7130         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7131         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7132         and arm_attr_merge_7.stdout.
7133         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7134         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7135         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7136         arm_attr_merge_7b.o): New rules.
7137         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7138         arm_attr_merge_7
7139         * testsuite/Makefile.in: Regenerate.
7140         * testsuite/arm_attr_merge.sh: New file.
7141         * testsuite/arm_attr_merge_[67][ab].s: Same.
7142
7143 2010-05-05  Nick Clifton  <nickc@redhat.com>
7144
7145         * po/es.po: Updated Spanish translation.
7146
7147 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7148
7149         * Makefile.am (install-exec-local): Properly install gold as
7150         default cross linker.
7151         * Makefile.in: Regenerated.
7152
7153 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7154             Nick Clifton  <nickc@redhat.com>
7155
7156         * configure.ac (install_as_default): Define and set to false
7157         unless --enable-gold or --enable-gold=both/gold has been
7158         specified.
7159         * configure: Regenerate.
7160
7161         * Makefile.am (install-exec-local): Install the executable as
7162         'ld.gold'.  If install_as_default is true then also install it as
7163         'ld'.
7164         * Makefile.in: Regenerated.
7165
7166 2010-04-24  Ian Lance Taylor  <iant@google.com>
7167
7168         * layout.cc (Layout::layout_reloc): In relocatable link don't
7169         combine reloc sections for grouped sections.
7170
7171 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7172
7173         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7174         sections that are not ordinary to icf.
7175         * icf.cc (get_section_contents): Handle relocation pointing to section
7176         with no object or shndx information.
7177         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7178         * testsuite/Makefile.in: Regenerate.
7179         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7180         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7181
7182 2010-04-22  Ian Lance Taylor  <iant@google.com>
7183
7184         * expression.cc (Expression::Expression_eval_info): Add
7185         result_alignment_pointer field.
7186         (Expression::eval_with_dot): Add result_alignment_pointer
7187         parameter.  Change all callers.
7188         (Expression::eval_maybe_dot): Likewise.
7189         (class Binary_expression): Add alignment_pointer parameter to
7190         left_value and right_value.  Change all callers.
7191         (BINARY_EXPRESSION): Set result alignment.
7192         (class Trinary_expression): Add alignment_pointer parameter to
7193         arg2_value and arg3_value.  Change all callers.
7194         (Trinary_cond::value): Set result alignment.
7195         (Max_expression::value, Min_expression::value): Likewise.
7196         (Align_expression::value): Likewise.
7197         * script-sections.cc (class Sections_element): Add dot_alignment
7198         parameter to set_section_addresses virtual function.  Update
7199         instantiations.
7200         (class Output_section_element): Likewise.
7201         (Script_sections::create_segments): Add dot_alignment parameter.
7202         Change all callers.
7203         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7204         (Script_sections::set_phdrs_clause_addresses): Likewise.
7205         * script-sections.h: Update declarations.
7206         * script.h: Update declarations.
7207         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7208         min_p_align.
7209         * testsuite/script_test_3.t: Set large alignment.
7210         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7211         segment has expected alignment.
7212
7213 2010-04-22  Nick Clifton  <nickc@redhat.com>
7214
7215         * po/gold.pot: Updated by the Translation project.
7216         * po/vi.po: Updated Vietnamese translation.
7217
7218 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7219
7220         * testsuite/Makefile.am (check_PROGRAMS): Add
7221         icf_virtual_function_folding_test.
7222         * testsuite/Makefile.in: Regenerated.
7223
7224 2010-04-15  Andrew Haley  <aph@redhat.com>
7225
7226         * options.h (merge_exidx_entries): New option.
7227         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7228         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7229         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7230         (Target_arm::merge_exidx_entries): New function.
7231         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7232         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7233         to Arm_exidx_fixup constructor.
7234         Add new arg, merge_exidx_entries.
7235         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7236         Arm_output_section::fix_exidx_coverage.
7237
7238 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7239
7240         * icf.cc (get_section_contents): Check for preemptible functions.
7241         Ignore addend when appropriate.
7242         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7243         section folded.
7244         (add_from_relobj): Check for section folded.
7245         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7246         * symtab.h (should_add_dynsym_entry): Add new parameter.
7247         * target-reloc.h (scan_relocs): Check for section folded.
7248         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7249         Check reloc types for function pointers in shared objects.
7250         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7251         case.
7252         (icf_preemptible_functions_test): New test case.
7253         (icf_string_merge_test): New test case.
7254         * testsuite.Makefile.in: Regenerate.
7255         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7256         bar_glob.  Refactor code.
7257         * testsuite/icf_preemptible_functions_test.cc: New file.
7258         * testsuite/icf_preemptible_functions_test.sh: New file.
7259         * testsuite/icf_string_merge_test.cc: New file.
7260         * testsuite/icf_string_merge_test.sh: New file.
7261         * testsuite/icf_virtual_function_folding_test.cc: New file.
7262         * testsuite/icf_virtual_function_folding_test.sh: New file.
7263
7264 2010-04-14  Doug Kwan  <dougkwan@google.com>
7265
7266         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7267         for local symbol recounting if we remove a section due to ICF.
7268         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7269         there are no regular objects in input.
7270
7271 2010-04-13  Doug Kwan  <dougkwan@google.com>
7272
7273         * arm.cc (Arm_input_section::set_final_data_size): Compute
7274         accurate final data size instead of using current data size.
7275
7276 2010-04-09  Doug Kwan  <dougkwan@google.com>
7277
7278         * layout.cc (Layout::choose_output_section): Handle script section
7279         types.
7280         (Layout::make_output_section_for_script): Add section type parameter.
7281         Handle script section types.
7282         * layout.h (Layout::make_output_section_for_script): Add section
7283         type parameter.
7284         * output.cc (Output_section::Output_section): Initialize data member
7285         is_noload_.
7286         (Output_section::do_reset_address_and_file_offset): Do not set address
7287         to 0 if section is a NOLOAD section.
7288         * output.h (Output_section::is_noload): New method.
7289         (Output_section::set_is_noload): Ditto.
7290         (Output_section::is_noload_): New data member.
7291         * script-c.h (Script_section_type): New enum type.
7292         (struct Parser_output_section_header): Add new file section_type.
7293         * script-sections.cc (Sections_element::output_section_name): Add
7294         parameter for returning script section type.
7295         (Output_section_definition::output_section_name): Ditto.
7296         (Output_section_definition::section_type)P; New method.
7297         (Output_section_definiton::script_section_type_name): Ditto.
7298         (Output_section_definition::script_section_type_): New data member.
7299         (Output_section_definition::Output_section_definition): Initialize
7300         data member Output_section_definition::script_section_type_.
7301         (Output_section_definition::create_sections): Pass script section type
7302         to Layout::make_output_section_for_script.
7303         (Output_section_definition::output_section_name): Return script
7304         section type to caller.
7305         (Output_section_definition::set_section_address): Do not advance
7306         dot value and load address if section type is NOLOAD.  Set address
7307         of NOLOAD sections regardless of section flags.
7308         (Output_section_definition::print): Print section type if it is
7309         not SCRIPT_SECTION_TYPE_NONE.
7310         (Output_section_definition::section_type): New method.
7311         (Output_section_definition::script_section_type_name): Ditto.
7312         (Script_sections::output_section_name): Add new parameter
7313         PSECTION_TYPE for returning script section type.  Pass it to
7314         section elements.  Handle discard sections.
7315         (Sort_output_sections::operator()): Handle NOLOAD sections.
7316         * script-sections.h (Script_sections::Section_type): New enum type.
7317         (Script_sections::output_section_name): Add a new parameter for
7318         returning script section type.
7319         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7320         INFO and NOLOAD.
7321         * yyscript.y (union): Add new field SECTION_TYPE.
7322         (COPY, DSECT, INFO, NOLOAD): New tokens.
7323         (opt_address_and_section_type): Change type to output_section_header.
7324         (section_type): New non-terminal
7325         (section_header): Handle section type.
7326         (opt_address_and_section_type): Return section type value.
7327
7328 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7329
7330         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7331         * testsuite/plugin_common_test_2.c (foo): Likewise.
7332
7333 2010-04-08  Doug Kwan  <dougkwan@google.com>
7334
7335         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7336         Output_merge_data.
7337         * output.cc (Output_section::add_merge_input_section): Simplify
7338         code and return status of Output_merge_base::add_input_section.
7339         Update merge section map only if Output_merge_base::add_input_section
7340         returns true.
7341
7342 2010-04-07  Doug Kwan  <dougkwan@google.com>
7343
7344         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7345         if section is marked as containing instructions but has no mapping
7346         symbols.
7347         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7348         correct section index.
7349         (Arm_relobj::find_linked_text_section): Ditto.
7350
7351 2010-04-07  Cary Coutant  <ccoutant@google.com>
7352
7353         * archive.cc (include_member): Destroy Read_symbols_data object before
7354         releasing file.
7355         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7356         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7357         (Read_symbols_data::~Read_symbols_data) New destructor.
7358         (Section_relocs::Section_relocs) New constructor.
7359         (Section_relocs::~Section_relocs) New destructor.
7360         (Read_relocs_data::Read_relocs_data) New constructor.
7361         (Read_relocs_data::~Read_relocs_data) New destructor.
7362         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7363         pointers to NULL after deleting.
7364
7365 2010-04-07  Doug Kwan  <dougkwan@google.com>
7366
7367         * arm.cc: Replace "endianity" with "endianness" in comments.
7368         (Arm_exidx_cantunwind): Ditto.
7369         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7370         (Arm_relobj::merge_flags_and_attributes): New method.
7371         (Arm_relobj::merge_flags_and_attributes_): New data member.
7372         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7373         (Arm_relobj::scan_sections_for_stubs): Ditto.
7374         (Arm_relobj::do_read_symbols): Check to see if we really want to
7375         merge processor-specific flags and attributes.  Exit early if
7376         an object is empty except for section names and the undefined symbol.
7377         (Target_arm::do_finalize_sections): Move check for ELF format to
7378         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7379         attributes from a regular object only when we have determined that
7380         it is aapropriate.  Do not create an .ARM.attributes section in
7381         output if there is no regular input object.
7382         (Target_arm::merge_processor_specific_flags): Check
7383         --warn-mismatch before printing any error.
7384         (Target_arm::merge_object_attributes): Ditto.
7385         * gold.cc (queue_middle_tasks): Handle the case in which there is
7386         no regular object in input.
7387         * options.cc (General_options::parse_EB): New method.
7388         (General_options::parse_EL): Same.
7389         (General_options::General_options): Initialize endianness_.
7390         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7391         New options.
7392         (General_options::Endianness): New enum.
7393         (General_options::endianness): New method.
7394         (General_options::endianness_): New data member.
7395         * parameters.cc (Parameters::set_options): Check target endianness.
7396         (Parameters::set_target_once): Ditto.
7397         (Parameters::check_target_endianness): New method.
7398         (parameters_force_valid_target): If either -EL or -EB is specified,
7399         use it to define endianness of default target.
7400         * parameters.h (Parameters::check_target_endianness): New method
7401         declaration.
7402         * target.h (class Target): Change "endianity" to "endianness"
7403         in comments.
7404
7405 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7406
7407         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7408         * configure: Regenerate.
7409         * Makefile.in: Regenerate.
7410         * testsuite/Makefile.in: Regenerate.
7411
7412 2010-04-06  Cary Coutant  <ccoutant@google.com>
7413
7414         gcc PR lto/42757
7415         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7416         prevailing definitions of common symbols.
7417         * testsuite/plugin_test_6.sh: New test case.
7418         * testsuite/plugin_common_test_1.c: New test case.
7419         * testsuite/plugin_common_test_2.c: New test case.
7420         * testsuite/Makefile.am (plugin_test_6): New test case.
7421         * testsuite/Makefile.in: Regenerate.
7422
7423 2010-04-06  Nick Clifton  <nickc@redhat.com>
7424
7425         * po/vi.po: New Vietnamese translation.
7426
7427 2010-03-30  Doug Kwan  <dougkwan@google.com>
7428
7429         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7430
7431 2010-03-25  Doug Kwan  <dougkwan@google.com>
7432
7433         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7434         to avoid a conversion warning on a 32-bit host.
7435
7436 2010-03-24  Ian Lance Taylor  <iant@google.com>
7437
7438         * testsuite/script_test_3.t: Add a TLS segment.
7439         * testsuite/Makefile.am (check_PROGRAMS): Add
7440         tls_phdrs_script_test.
7441         (tls_phdrs_script_test_SOURCES): Define.
7442         (tls_phdrs_script_test_DEPENDENCIES): Define.
7443         (tls_phdrs_script_test_LDFLAGS): Define.
7444         (tls_phdrs_script_test_LDADD): Define.
7445         * testsuite/Makefile.in: Rebuild.
7446
7447 2010-03-23  Cary Coutant  <ccoutant@google.com>
7448
7449         * fileread.cc (find_or_make_view): Fix comment.
7450
7451 2010-03-23  Ian Lance Taylor  <iant@google.com>
7452
7453         * script-sections.cc (class Orphan_section_placement): Define
7454         PLACE_TLS and PLACE_TLS_BSS.
7455         (Orphan_section_placement::Orphan_section_placement): Initialize
7456         new places.
7457         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7458         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7459         (tls_script_test_SOURCES): Define.
7460         (tls_script_test_DEPENDENCIES): Define.
7461         (tls_script_test_LDFLAGS): Define.
7462         (tls_script_test_LDADD): Define.
7463         * testsuite/Makefile.in: Rebuild.
7464
7465 2010-03-22  Doug Kwan  <dougkwan@google.com>
7466
7467         * arm.cc (Arm_relocate_functions::abs8,
7468         Arm_relocate_functions::abs16): Use correct check for overflow
7469         specified in the ARM ELF specs.
7470         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7471         target of a BLX instruction specially.
7472         (Reloc_stub::stub_type_for_reloc): Ditto.
7473         (Relocate::relocate): Use symbolic names instead of numeric relocation
7474         codes to report error.
7475         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7476         workaround.
7477         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7478         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7479         thumb2_blx_out_of_range.stdout
7480         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7481         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7482         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7483         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7484         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7485         thumb2_blx_in_range, thumb2_blx_in_range.o,
7486         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7487         thumb2_blx_out_of_range.o): New rules.
7488         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7489         thumb2_blx_in_range and thumb2_blx_out_of_range.
7490         * testsuite/Makefile.in: Regenerate.
7491         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7492         * testsuite/thumb_blx_in_range.s: New file.
7493         * testsuite/thumb_blx_out_of_range.s: New file.
7494
7495 2010-03-22  Rafael Espindola  <espindola@google.com>
7496
7497         * archive.cc (Should_include): Move to archive.h.
7498         (should_include_member): Make it a member of Archive.
7499         (Lib_group): New.
7500         (Add_lib_group_symbols): New.
7501         * archive.h: Include options.h.
7502         (Archive_member): Moved from Archive.
7503         (Should_include): Moved from archive.cc.
7504         (Lib_group): New.
7505         (Add_lib_group_symbols): New.
7506         * dynobj.cc (do_should_include_member): New.
7507         * dynobj.h (do_should_include_member): New.
7508         * gold.cc (queue_initial_tasks): Update call to queue.
7509         * main.cc (main): Print lib group stats.
7510         * object.cc (do_should_include_member): New.
7511         * object.h: Include archive.h.
7512         (Object::should_include_member): New.
7513         (Object::do_should_include_member): New.
7514         (Sized_relobj::do_should_include_member): New.
7515         * options.cc (General_options::parse_start_lib): New.
7516         (General_options::parse_end_lib): New.
7517         (Input_arguments::add_file): Handle lib groups.
7518         (Input_arguments::start_group): Check we are not in a lib.
7519         (Input_arguments::start_lib): New.
7520         (Input_arguments::end_lib): New.
7521         * options.h (General_options): Add start_lib and end_lib.
7522         (Input_argument::lib_): New.
7523         (Input_argument::lib): New.
7524         (Input_argument::is_lib): New.
7525         (Input_file_lib): New.
7526         (Input_arguments::in_lib_): New.
7527         (Input_arguments::in_lib): New.
7528         (Input_arguments::start_lib): New.
7529         (Input_arguments::end_lib_): New.
7530         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7531         in unused members as preempted.
7532         (Sized_pluginobj::do_should_include_member): New.
7533         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7534         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7535         return the blocker.
7536         (Read_symbols::do_whole_lib_group): New.
7537         (Read_symbols::do_lib_group): New.
7538         (Read_symbols::do_read_symbols): Handle lib groups.
7539         (Read_symbols::get_name): Handle lib groups.
7540         * readsyms.h (Read_symbols): Add an archive member pointer.
7541         (Read_symbols::do_whole_lib_group): New.
7542         (Read_symbols::do_lib_group): New.
7543         (Read_symbols::member_): New.
7544         * script.cc (read_input_script): Update call to queue_soon.
7545
7546 2010-03-19  Doug Kwan  <dougkwan@google.com>
7547
7548         * arm.cc (Stub_table::Stub_table): Initialize new data members
7549         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7550         (Stub_table::add_reloc_stub): Assign stub offset and update
7551         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7552         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7553         New data members.
7554         (Stub_table::update_data_size_and_addralign): Use
7555         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7556         instead of going over all reloc stubs.
7557         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7558         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7559         Stringpool_template::offset_ to size of Stringpool_char.
7560         (Stringpool_template::new_key_offset): Remove code to initialize
7561         Stringpool_template::offset_.
7562         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7563         Stringpool_template::offset_ to zero.
7564
7565 2010-03-15  Doug Kwan  <dougkwan@google.com>
7566
7567         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7568         offset_.
7569         (Stringpool_template::new_key_offset): New method.
7570         (Stringpool_template::add_string): Assign offsets when adding new
7571         strings.
7572         (Stringpool_template::set_string_offsets): Do not set string offsets
7573         when not optimizing.
7574         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7575         member size_.
7576         (Chunked_vector::clear): Clear size_.
7577         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7578         (Chunked_vector::size): Return size_.
7579         (Chunked_vector::push_back): Use size_ to find insert position.
7580         (Chunked_vector::size_): New data member.
7581         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7582         (Stringpool_template::new_key_offset): New method declaration.
7583         (Stringpool_template::offset_): New data member.
7584
7585 2010-03-15   Rafael Espindola  <espindola@google.com>
7586
7587         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7588         Add_symbols' constructor.
7589         * readsyms.h (Add_symbols): Remove the input_group member.
7590
7591 2010-03-10  Ian Lance Taylor  <iant@google.com>
7592
7593         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7594         target to ask whether a reference to a symbol requires a stack
7595         split.
7596         * target.h (Target::is_call_to_non_split): New function.
7597         (Target::do_is_call_to_non_split): Declare virtual function.
7598         * target.cc: Include "symtab.h".
7599         (Target::do_is_call_to_non_split): New function.
7600         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7601
7602 2010-03-10  Cary Coutant  <ccoutant@google.com>
7603
7604         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7605         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7606         (File_read::open[2]): Add whole_file_view_ to list of views.
7607         (File_read::make_view): Remove test of whole_file_view_.
7608         (File_read::find_or_make_view): Create whole_file_view_ if
7609         necessary.
7610         (File_read::clear_views): Replace bool parameter with enum;
7611         adjust all callers.  Don't delete views with permanent data;
7612         do delete cached views and views from archives if
7613         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7614         if clearing the corresponding view.
7615         * fileread.h (File_read::Clear_views_mode): New enum.
7616         (File_read::View::is_permanent_view): New method.
7617         (File_read::clear_views): Replace bool parameter
7618         with enum; adjust all callers.
7619         * options.h (General_options): Change keep_files_mapped option;
7620         add map_whole_files.
7621         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7622         releasing the file.
7623         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7624         the file.
7625
7626 2010-03-10  David S. Miller  <davem@davemloft.net>
7627
7628         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7629
7630 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7631
7632         * icf.cc (get_section_contents): Add '@' marker after processing the
7633         merge reloc.
7634
7635 2010-03-08  Doug Kwan  <dougkwan@google.com>
7636
7637         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7638         due to a conversion warning.
7639         (Arm_relobj::update_output_local_symbol_count): Check for local
7640         symbol with unset output index.
7641
7642 2010-03-05  Ian Lance Taylor  <iant@google.com>
7643
7644         * options.h (class General_options): Add --spare-dynamic-tags.
7645         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7646         --spare-dynamic-tags.
7647
7648 2010-03-05  Ian Lance Taylor  <iant@google.com>
7649
7650         * incremental.cc: Include "libiberty.h".
7651
7652 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7653
7654         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7655         function, is_info_ member.
7656         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7657         (Versions::Versions): Update caller.
7658         (Versions::define_base_version): Likewise.
7659         (Versions::add_def): Likewise.
7660
7661 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7662
7663         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7664         (Scan::possible_function_pointer_reloc): New function.
7665         (Scan::local_reloc_may_be_function_pointer): Change to call
7666         possible_function_pointer_reloc.
7667         (Scan::global_reloc_may_be_function_pointer): Ditto.
7668         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7669         relocations in ".data.rel.ro._ZTV" section.
7670         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7671         * testsuite/icf_safe_so_test.cc: Ditto.
7672         * testsuite/icf_safe_test.cc: Ditto.
7673         * testsuite/icf_safe_test.sh: Ditto.
7674
7675 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7676             Ian Lance Taylor  <iant@google.com>
7677
7678         * target-reloc.h (relocate_section): Check the symbol table index
7679         for -1U before setting the local symbol index.
7680         (scan_relocatable_relocs): If copying the relocation, record that
7681         the local symbol is required.
7682         * object.h (Symbol_value::is_output_symtab_index_set): New
7683         function.
7684         (Symbol_value::may_be_discarded_from_output_symtab): New
7685         function.
7686         (Symbol_value::has_output_symtab_entry): New function.
7687         (Symbol_value::needs_output_symtab_entry): Remove.
7688         (Symbol_value::output_symtab_index): Make sure the symbol index is
7689         set.
7690         (Symbol_value::set_output_symtab_index): Make sure the symbol
7691         index is not set.  Make sure the new index is valid.
7692         (Symbol_value::set_must_have_output_symtab_entry): New function.
7693         (Symbol_value::has_output_dynsym_entry): New function.
7694         (Symbol_value::set_output_dynsym_index): Make sure the new index
7695         is valid.
7696         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7697         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7698         local symbol if permitted.
7699         (Sized_relobj::do_finalize_local_symbols): Call
7700         is_output_symtab_index_set rather than needs_output_symtab_entry.
7701         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7702         rather than needs_output_symtab_entry.  Call
7703         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7704         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7705         is_output_symtab_index_set rather than needs_output_symtab_entry.
7706         * testsuite/discard_locals_relocatable_test.c: New file.
7707         * testsuite/discard_locals_test.sh: Test -r.
7708         * testsuite/Makefile.am (check_DATA): Add
7709         discard_locals_relocatable_test1.syms,
7710         discard_local_relocatable_test2.syms.
7711         (MOSTLYCLEANFILES): Likewise.  Also add
7712         discard_locals_relocatable_test1.lout and
7713         discard_locals_relocatable_test2.out.
7714         (discard_locals_relocatable_test1.syms): New target.
7715         (discard_locals_relocatable_test.o): New target.
7716         (discard_locals_relocatable_test1.out): New target.
7717         (discard_locals_relocatable_test2.syms): New target.
7718         (discard_locals_relocatable_test2.out): New target.
7719         (various): Add missing ../ld-new dependencies.
7720         * testsuite/Makefile.in: Rebuild.
7721
7722 2010-03-03  Nick Clifton  <nickc@redhat.com>
7723
7724         * po/fi.po: New Finnish translation.
7725
7726 2010-03-01  Doug Kwan  <dougkwan@google.com>
7727
7728         * layout.cc (Layout::Layout): Force section types of .init_array*,
7729         .preinit_array* and .fini_array* sections.
7730         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7731         Fix check of return value of std::string::find.().
7732         (Output_section::Input_section_sort_compare::operator()): Remove
7733         comment about .init_array.
7734         (Output_section::Input_section_sort_init_fini_compare::operator()):
7735         New method.
7736         (Output_section::sort_attached_input_sections): Handle .init_array
7737         and .fini_array specially.
7738         * output.h (Output_section::Inut_section_sort_compare): Update
7739         comment.
7740         (Output_section::Input_section_sort_init_fini_compare): New struct.
7741
7742 2010-02-26  Doug Kwan  <dougkwan@google.com>
7743
7744         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7745         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7746         * testsuite/debug_msg.sh: Avoid matching source line number for
7747         use of global variable undef_int.
7748
7749 2010-02-26  Doug Kwan  <dougkwan@google.com>
7750
7751         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7752         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7753         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7754         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7755         * options.cc (General_options::General_options): Initialize member
7756         fix_v4bx_.
7757         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7758         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7759         and rm_no_fix_v4bx.stdout
7760         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7761         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7762         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7763         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7764         and arm_no_fix_v4bx.
7765         * Makefile.in: Regenerate.
7766         * testsuite/arm_fix_v4bx.s: New file.
7767         * testsuite/arm_fix_v4bx.sh: Ditto.
7768
7769 2010-02-24  Doug Kwan  <dougkwan@google.com>
7770
7771         * arm.cc (Target_arm::got_section): Make the .got section the first
7772         non RELRO section in the data segment.
7773         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7774         suffixes of section names.
7775
7776 2010-02-24  Doug Kwan  <dougkwan@google.com>
7777
7778         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7779         flags and attributes merging if an input file is a binary file.
7780         * fileread.cc (Input_file::open): Record format of original file.
7781         * fileread.h (Input_file::Format): New enum type.
7782         (Input_file::Input_file): Initialize data member format_.
7783         (Input_file::format): New method definition.
7784         (Input_file::format_):: New data member.
7785
7786 2010-02-24  Doug Kwan  <dougkwan@google.com>
7787
7788         * arm.cc (Arm_output_data_got): New class.
7789         (ARM_TCB_SIZE): New constant
7790         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7791         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7792         If user uses a script with a SECTIONS clause, issue only a warning
7793         for a misplaced EXIDX input section.  Otherwise, issue an error.
7794         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7795         garbage collection.
7796         (Target_arm::got_mode_index_entry): Handle static linking.
7797         (Target_arm::Scan::local): Ditto.
7798         (Target_arm::Scan::global): Ditto.
7799         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7800         all incorrectly implemented relocations.
7801         (Target_arm::fix_exidx_coverage): Pass layout to
7802         Arm_output_section::fix_exidx_coverage.
7803         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7804         from ".ARM.exidx." and ".ARM.extab.".
7805
7806 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7807
7808         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7809         section if it does not already exist.
7810         * attributes.cc (Attributes_section_data::Attributes_section_data):
7811         Don't crash if size is zero.
7812
7813 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7814             Ian Lance Taylor  <iant@google.com>
7815
7816         * gold.cc (queue_middle_tasks): If no input files were opened,
7817         exit.
7818         * workqueue.h (Task_function::Task_function): Assert that there is
7819         a blocker.
7820
7821 2010-02-22  Doug Kwan  <dougkwan@google.com>
7822
7823         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7824         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7825         types to avoid warnings due to different uint64_t implementations
7826         on different hosts.
7827
7828 2010-02-21  Doug Kwan  <dougkwan@google.com>
7829
7830         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7831         handling of the maximum backward branch offset.
7832         (Arm_relocate_functions::thumb_branch_common): Ditto.
7833         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7834         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7835         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7836         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7837         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7838         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7839         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7840         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7841         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7842         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7843         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7844         thumb2_bl_out_of_range.o): New rules.
7845         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7846         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7847         thumb2_bl_out_of_range
7848         * testsuite/Makefile.in: Regenerate.
7849         * testsuite/arm_bl_in_range.s: New file.
7850         * testsuite/arm_bl_out_of_range.s: Ditto.
7851         * testsuite/arm_branch_in_range.sh: Ditto.
7852         * testsuite/arm_branch_range.t: Ditto.
7853         * testsuite/thumb2_branch_range.t: Ditto.
7854         * testsuite/thumb_bl_in_range.s: Ditto.
7855         * testsuite/thumb_bl_out_of_range.s: Ditto.
7856         * testsuite/thumb_branch_range.t: Ditto.
7857
7858 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7859
7860         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7861         Add reloc offset information.
7862         * icf.cc (get_section_contents): Change iterators to point to the new
7863         vectors. Add reloc offset information to the contents.
7864         * icf.h (Icf::Sections_reachable_info): New typedef.
7865         (Icf::Sections_reachable_list): New typedef.
7866         (Icf::Offset_info): New typedef.
7867         (Icf::Reloc_info): New struct typedef.
7868         (Icf::Reloc_info_list): New typedef.
7869         (Icf::symbol_reloc_list): Delete method.
7870         (Icf::addend_reloc_list): Delete method.
7871         (Icf::section_reloc_list): Delete method.
7872         (Icf::reloc_info_list): New method.
7873         (Icf::reloc_info_list_): New member.
7874
7875 2010-02-19  Doug Kwan  <dougkwan@google.com>
7876
7877         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7878         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7879         * arm.cc (Arm_relocation_functions): New forward declaration.
7880         (Target_arm::Target_arm): Initialize new data members
7881         got_mod_index_offset_ and tls_base_symbol_defined_.
7882         (Target_arm::Relocate::relocate_tls): New method.
7883         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7884          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7885         New methods.
7886         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7887         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7888         (Target_arm::got_mod_index_offset_,
7889         Target_arm::tls_base_symbol_defined_): New data members.
7890         (Target_arm::Scan::local, Target::Scan::global,
7891         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7892         relocations.
7893
7894 2010-02-18  Doug Kwan  <dougkwan@google.com>
7895
7896         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7897         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7898         text section as a parameter becuase some broken tools may not set
7899         the link in section header.
7900         (Target_arm::has_got_section): New method.
7901         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7902         without any mapping symbol as data only.  Remove warning.
7903         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7904         link in its section header, try to discover the link by inspecting the
7905         REL31 relocation at the beginning of the section.
7906         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7907         in error message.
7908         (Target_arm::Scan::global): Treat any reference to the symbol
7909         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7910
7911 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7912
7913         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7914         (Scan::global_reloc_may_be_function_pointer): New function.
7915         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7916         (Scan::global_reloc_may_be_function_pointer): New function.
7917         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7918         (Scan::global_reloc_may_be_function_pointer): New function.
7919         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7920         (Scan::global_reloc_may_be_function_pointer): New function.
7921         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7922         (Scan::global_reloc_may_be_function_pointer): New function.
7923         (Scan::possible_function_pointer_reloc): New function.
7924         (Target_x86_64::can_check_for_function_pointers): New function.
7925         * gc.h (gc_process_relocs): Scan relocation types to determine if
7926         function pointers were taken for targets that support it.
7927         * icf.cc (Icf::find_identical_sections): Include functions for
7928         folding in safe ICF whose pointer is not taken.
7929         * icf.h (Secn_fptr_taken_set): New typedef.
7930         (fptr_section_id_): New member.
7931         (section_has_function_pointers): New function.
7932         (set_section_has_function_pointers): New function.
7933         (check_section_for_function_pointers): New function.
7934         * options.h: Fix comment for safe ICF option.
7935         * target.h (can_check_for_function_pointers): New function.
7936         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7937         Modify icf_safe_test for X86-64.
7938         * testsuite/Makefile.in: Regenerate.
7939         * testsuite/icf_safe_so_test.cc: New file.
7940         * testsuite/icf_safe_so_test.sh: New file.
7941         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7942         (main): Change to take pointer to function kept_func_3.
7943         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7944         folding is done correctly for X86-64.
7945
7946 2010-02-12  David S. Miller  <davem@davemloft.net>
7947
7948         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7949         is_symbolless parameter.
7950         (Output_reloc<SHT_REL>::is_symbolless): New.
7951         (Output_reloc<SHT_REL>::is_symbolless_): New.
7952         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7953         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7954         (Output_reloc<SHT_RELA>::is_symbolless): New.
7955         (Output_data_reloc::add_global): Handle is_symbolless.
7956         (Output_data_reloc::add_global_relative): Likewise.
7957         (Output_data_reloc::add_local): Likewise.
7958         (Output_data_reloc::add_local_relative): Likewise.
7959         (Output_data_reloc::add_symbolless_global_addend): New.
7960         (Output_data_reloc::add_symbolless_local_addend): New.
7961         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7962         is_symbolless.
7963         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7964         instead of ->is_relative_
7965         (Output_reloc::write): Likewise.
7966         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7967         (Output_reloc::write_rel): Simplify.
7968
7969         * sparc.cc (Target_sparc::Scan::local): Use
7970         ->add_symbolless_local_addend as needed.
7971         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7972         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7973         based upon relocation offset.
7974
7975 2010-02-11  Doug Kwan  <dougkwan@google.com>
7976
7977         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7978         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7979         beginning of function.
7980         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7981         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7982         parameter is_32bit in calls to should_apply_static_reloc.
7983         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7984         (check_DATA): Add arm_abs_global.stdout.
7985         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7986         arm_abs_global.stdout): New rules.
7987         (MOSTLLYCLEANFILES): Add arm_abs_global
7988         * Makefile.in: Regenerate.
7989         * testsuite/arm_abs_global.s: New file.
7990         * testsuite/arm_abs_global.sh: Ditto.
7991         * testsuite/arm_abs_lib.s: Ditto.
7992
7993 2010-02-11  Ian Lance Taylor  <iant@google.com>
7994
7995         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7996         Read_relocs task.
7997         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7998         Allocate_commons_task first.
7999         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8000         task, rather than symtab_lock_.
8001         (Gc_process_relocs::~Gc_process_relocs): New function.
8002         (Gc_process_relocs::is_runnable): Check this_blocker_.
8003         (Gc_process_relocs::locks): Use next_blocker_ rather than
8004         blocker_.
8005         (Scan_relocs::~Scan_relocs): New function.
8006         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8007         symtab_lock_.
8008         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8009         next_blocker_.
8010         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8011         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8012         constructor accordingly.
8013         (class Gc_process_relocs): Likewise.
8014         (class Scan_relocs): Likewise.
8015         * common.h (class Allocate_commons_task): Remove symtab_lock_
8016         field, and corresponding constructor parameter.
8017         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8018         symtab_lock_.
8019         (Allocate_commons_task::locks): Likewise.
8020
8021 2010-02-11  Ian Lance Taylor  <iant@google.com>
8022
8023         * gold-threads.h (class Once): Define.
8024         (class Initialize_lock): Rewrite as child of Once.
8025         * gold-threads.cc (class Once_initialize): Define.
8026         (once_pointer_control): New static variable.
8027         (once_pointer, once_arg): New static variables.
8028         (c_run_once): New static function.
8029         (Once::Once, Once::run_once, Once::internal_run): New functions.
8030         (class Initialize_lock_once): Remove.
8031         (initialize_lock_control): Remove.
8032         (initialize_lock_pointer): Remove.
8033         (initialize_lock_once): Remove.
8034         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8035         (Initialize_lock::initialize): Rewrite.
8036         (Initialize_lock::do_run_once): New function.
8037         * archive.cc (Archive::interpret_header): Only clear name if it is
8038         not already empty.
8039         * fileread.cc: Include "gold-threads.h"
8040         (file_counts_lock): New static variable.
8041         (file_counts_initialize_lock): Likewise.
8042         (File_read::release): Only increment counts when using --stats.
8043         Use a lock around the increment.
8044         * parameters.cc (class Set_parameters_target_once): Define.
8045         (set_parameters_target_once): New static variable.
8046         (Parameters::Parameters): Move here from parameters.h.
8047         (Parameters::set_target): Rewrite.
8048         (Parameters::set_target_once): New function.
8049         (Parameters::clear_target): Move here and rewrite.
8050         * parameters.h (class Parameters): Update declarations.  Add
8051         set_parameters_target_once_ field.
8052         (Parameters::Parameters): Move to parameters.cc.
8053         (Parameters::clear_target): Likewise.
8054         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8055         task.
8056         (Start_group::~Start_group): New function.
8057         (Start_group::is_runnable): New function.
8058         (Start_group::locks, Start_group::run): New functions.
8059         (Finish_group::run): Change saw_undefined to size_t.
8060         * readsyms.h (class Start_group): Define.
8061         (class Finish_group): Change saw_undefined_ field to size_t.
8062         (Finish_group::Finish_group): Remove saw_undefined and
8063         this_blocker parameters.  Change all callers.
8064         (Finish_group::set_saw_undefined): New function.
8065         (Finish_group::set_blocker): New function.
8066         * symtab.h (class Symbol_table): Change saw_undefined to return
8067         size_t.  Change saw_undefined_ field to size_t.
8068         * target-select.cc (Set_target_once::do_run_once): New function.
8069         (Target_selector::Target_selector): Initialize set_target_once_
8070         field.  Don't initialize lock_ and initialize_lock_ fields.
8071         (Target_selector::instantiate_target): Rewrite.
8072         (Target_selector::set_target): New function.
8073         * target-select.h (class Set_target_once): Define.
8074         (class Target_selector): Update declarations.  Make
8075         Set_target_once a friend.  Remove lock_ and initialize_lock_
8076         fields.  Add set_target_once_ field.
8077
8078 2010-02-10  Ian Lance Taylor  <iant@google.com>
8079
8080         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8081         queueing any tasks.
8082         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8083         (queue_middle_tasks): Add all blockers before queueing any tasks.
8084         (queue_final_tasks): Likewise.
8085         * token.h (Task_token::add_blockers): New function.
8086         * object.h (Input_objects::number_of_relobjs): New function.
8087
8088 2010-02-10  Ian Lance Taylor  <iant@google.com>
8089
8090         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8091         shared, not if not position independent.
8092         * x86_64.cc (Relocate::relocate_tls): Likewise.
8093         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8094         (tls_pie_pic_test): New target.
8095         * testsuite/Makefile.in: Rebuild.
8096
8097         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8098         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8099         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8100         * testsuite/Makefile.in: Rebuild.
8101
8102 2010-02-09  David S. Miller  <davem@davemloft.net>
8103
8104         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8105         R_SPARC_RELATIVE using ->add_local_relative().
8106         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8107
8108         * output.h (Output_data_dynamic::add_section_size): New method
8109         that takes two Output_data objects.
8110         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8111         entry param.  Handle it in initializers.
8112         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8113         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8114         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8115         arg.
8116         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8117         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8118         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8119         for dynrel_includes_plt.
8120         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8121         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8122         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8123         before .rela.plt
8124         (Target_sparc::do_finalize_sections): Update to pass true for
8125         dynrel_includes_plt.
8126         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8127         output before .rela.plt
8128         (Target_powerpc::do_finalize_sections): Update to pass true for
8129         dynrel_includes_plt when 32-bit.
8130
8131 2010-02-08  Doug Kwan  <dougkwan@google.com>
8132
8133         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8134         method.
8135         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8136         Arm_relobj::scan_section_for_cortex_a8_stubs,
8137         Arm_relobj::do_relocation_section): Instead of calling
8138         Output_section::output_address, use faster
8139         Arm_relobj::simple_input_section_output_address.
8140
8141 2010-02-08  David S. Miller  <davem@davemloft.net>
8142
8143         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8144         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8145         relocation helper function.
8146
8147         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8148         just like R_SPARC_GOT{10,13,22}.
8149         (Target_sparc::Scan::local): Likewise.
8150         (Target_sparc::Relocate:relocate): Likewise.
8151
8152 2010-02-06  Ian Lance Taylor  <iant@google.com>
8153
8154         * configure.ac: Rewrite targetobjs duplicate removal code to use
8155         only shell constructs.
8156         * configure: Rebuild.
8157
8158 2010-02-05  Doug Kwan  <dougkwan@google.com>
8159
8160         PR 11247
8161         * arm.cc (Arm_relobj::section_is_scannable): New method.
8162         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8163         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8164
8165 2010-02-04  Doug Kwan  <dougkwan@google.com>
8166
8167         PR 11247
8168         * arm-reloc-property.cc (cstdio): Include.
8169         * configure.ac (targetobjs): Remove duplicates.
8170         * configure: Regenerate.
8171         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8172         big and little endian version for a given address size.
8173
8174 2010-02-03  Doug Kwan  <dougkwan@google.com>
8175
8176         * arm-reloc-property.cc
8177         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8178         definition.
8179         * arm-reloc-property.h
8180         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8181         New method definition.
8182         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8183         declaration.
8184         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8185         overflow to N.
8186         (GOT_PREL): Change implemented to Y.
8187         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8188         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8189         (Arm_relocate_functions::movw_abs_nc): Remove method.
8190         (Arm_relocate_functions::movt_abs): Ditto.
8191         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8192         (Arm_relocate_functions::thm_movt_abs): Ditto.
8193         (Arm_relocate_functions::movw_rel_nc): Ditto.
8194         (Arm_relocate_functions::movw_rel): Ditto.
8195         (Arm_relocate_functions::movt_rel): Ditto.
8196         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8197         (Arm_relocate_functions:thm_movw_rel): Ditto.
8198         (Arm_relocate_functions:thm_movt_rel): Ditto.
8199         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8200         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8201         New method definitions.
8202         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8203         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8204         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8205         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8206         (Target_arm::Relocate::relocate): Check for non-static or
8207         unimplemented relocation code and exit early.  Change calls to
8208         Target_arm::reloc_uses_thumb_bit and
8209         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8210         instead.  Refactor code to handle similar relocations to increase
8211         code sharing.  Remove check for unsupported relocation code in switch
8212         statement.
8213         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8214         relocation property table to find out size.  Change error message to
8215         print out the name of a relocation code instead of the numeric value.
8216         (Target_arm::scan_reloc_for_stub): Use relocation property table
8217         instead of calling Target_arm::reloc_uses_thumb_bit().
8218
8219 2010-02-02  Doug Kwan  <dougkwan@google.com>
8220
8221         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8222         types of relaxed input section.
8223
8224 2010-02-02  Doug Kwan  <dougkwan@google.com>
8225
8226         * Makefile.am (HFILES): Add arm-reloc-property.h.
8227         (DEFFILES): New.
8228         (TARGETSOURCES): Add arm-reloc-property.cc
8229         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8230         (libgold_a_SOURCES): $(DEFFILES)
8231         * Makefile.in: Regenerate.
8232         * arm-reloc-property.cc: New file.
8233         * arm-reloc-property.h: New file.
8234         * arm-reloc.def: New file.
8235         * arm.cc: Update comments.
8236         (arm-reloc-property.h): New included header.
8237         (arm_reloc_property_table): New global variable.
8238         (Target_arm::do_select_as_default_target): New method definition.
8239         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8240         arm-reloc-property to targ_extra_obj.
8241         * parameters.cc (set_parameters_target): Call
8242         Target::select_as_default_target().
8243         * target.h (Target::select_as_default_target): New method definition.
8244         (Target::do_select_as_default_target): Same.
8245
8246 2010-02-01  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8249         first_output_text_section_.
8250         (Arm_exidx_fixup::first_output_text_section): New method definition.
8251         (Arm_exidx_fixup::first_output_text_section_): New data member.
8252         (Arm_exidx_fixup::process_exidx_section): Record the first text
8253         output section seen.
8254         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8255         and entsize in output section header.
8256
8257 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8258
8259         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8260         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8261         (Arm_relocate_functions::thm_alu11): New Method.
8262         (Arm_relocate_functions::thm_pc8): New Method.
8263         (Arm_relocate_functions::thm_pc12): New Method.
8264         (Target_arm::Scan::local): Handle the relocations.
8265         (Target_arm::Scan::global): Likewise.
8266         (Target_arm::Relocate::relocate): Likewise.
8267         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8268
8269 2010-01-29  Doug Kwan  <dougkwan@google.com>
8270
8271         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8272         of relocation types as ld.
8273
8274 2010-01-29  Doug Kwan  <dougkwan@google.com>
8275
8276         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8277         to public.
8278         (Arm_relocate_functions::thumb_branch_common): Ditto.
8279         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8280         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8281         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8282         Arm_relocate_functions::jump24): Remove.
8283         (Target_arm::Relocate::relocate): Adjust code to call
8284         Arm_relocation_functions::arm_branch_common and
8285         Arm_relocation_functions::thumb_branch_common instead of their removed
8286         wrappers.  Merge switch-cases together to reduce source code size.
8287
8288 2010-01-29  Doug Kwan  <dougkwan@google.com>
8289
8290         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8291         output_local_symbol_count_needs_update_.
8292         (Arm_relobj::output_local_symbol_count_needs_update,
8293          Arm_relobj::set_output_local_symbol_count_needs_update,
8294          Arm_relobj::update_output_local_symbol_count): New methods.
8295         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8296         member.
8297         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8298         of pointed function as in a R_ARM_PREL31 relocation.
8299         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8300         for output local symbol count updating.
8301         (Target_arm::do_relax): Update output local symbol counts in objects
8302         if necessary.
8303         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8304
8305 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8306
8307         * arm.cc: Added support for the ARM relocations:
8308         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8309         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8310         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8311         movw_prel_nc).
8312         (Arm_relocate_functions::movw_rel): New method.
8313         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8314         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8315         thm_movw_prel_nc).
8316         (Arm_relocate_functions::thm_movw_rel): New method.
8317         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8318         thm_movt_prel).
8319         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8320         relocations.
8321         (Target_arm::Scan::global): Likewise.
8322         (Target_arm::Relocate::relocate): Likewise.
8323         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8324         Likewise.
8325
8326 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8327
8328         * arm.cc: Added support for ARM group relocations.
8329         (Target_arm::reloc_needs_sym_origin): New method.
8330         (Arm_relocate_functions::calc_grp_kn): New method.
8331         (Arm_relocate_functions::calc_grp_residual): New method.
8332         (Arm_relocate_functions::calc_grp_gn): New method.
8333         (Arm_relocate_functions::arm_grp_alu): New Method.
8334         (Arm_relocate_functions::arm_grp_ldr): New Method.
8335         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8336         (Arm_relocate_functions::arm_grp_ldc): New Method.
8337         (Target_arm::Scan::local): Handle the ARM group relocations.
8338         (Target_arm::Scan::global): Likewise.
8339         (Target_arm::Relocate::relocate): Likewise.
8340         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8341         Likewise.
8342
8343 2010-01-26  Doug Kwan  <dougkwan@google.com>
8344
8345         * arm.cc (set): Include.
8346         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8347         pointer type.
8348         (Arm_output_section::Text_section_list): New type.
8349         (Arm_output_section::append_text_sections_to_list): New method.
8350         (Arm_output_section::fix_exidx_coverage): Ditto.
8351         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8352         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8353         Relobj::set_section_offset() instead of
8354         Sized_relobj::invalidate_section_offset().
8355         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8356         parameter for section headers. Ignore relocation sections for
8357         unallocated sections and EXIDX sections.
8358         (Target_arm::fix_exidx_coverage): New method.
8359         (Target_arm::output_section_address_less_than): New type.
8360         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8361         linked text section instead of the EXIDX section.
8362         (Arm_output_section::create_stub_group): Add an assertion to check
8363         that this is not an EXIDX output section.
8364         (Arm_output_section::append_text_sections_to_list): New method.
8365         (Arm_output_section::fix_exidx_coverage): Ditto.
8366         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8367         Arm_relobj::section_needs_reloc_stub_scanning.
8368         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8369         first pass.
8370         (Target_arm::fix_exidx_coverage): New method.
8371         * object.h (Relobj::set_output_section): New method.
8372         (Sized_relobj::invalidate_section_offset): Remove method.
8373         (Sized_relobj::do_invalidate_section_offset): Remove method.
8374         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8375
8376 2010-01-25  Doug Kwan  <dougkwan@google.com>
8377
8378         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8379         Fix warning due to signed and unsigned comparison on a 32-bit host.
8380
8381 2010-01-22  Doug Kwan  <dougkwan@google.com>
8382
8383         * arm.cc (Target_arm::do_relax): Record an output section for section
8384         offset adjustment it contains any stub table that has changed.
8385         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8386         offsets in an output section if necessary.
8387         * output.cc (Output_section::Output_section): Initialize
8388         section_offsets_need_adjustments_.
8389         (Output_section::add_input_section_for_script): Renamed to
8390         Output_section::add_simple_input_section.
8391         (Output_section::save_states): Add a comment.
8392         (Output_section::discard_states): New method defintion.
8393         (Output_section::adjust_section_offsets): Same.
8394         * output.h (Output_section::add_input_section_for_script): Renamed to
8395         Output_section::add_simple_input_section.
8396         (Output_section::discard_states): New method declaration.
8397         (Output_section::adjust_section_offsets): Same.
8398         (Output_section::section_offsets_need_adjustment,
8399         Output_section::set_section_offsets_need_adjustment): New method
8400         definitions.
8401         (Output_section::section_offsets_need_adjustment_): New data member.
8402         * script-sections.cc
8403         (Output_section_element_input::set_section_address): Adjust code for
8404         renaming of Output_section::add_input_section_for_script.
8405         (Orphan_output_section::set_section_address): Same.
8406
8407 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8408
8409         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8410         Fix_v4bx enum values .
8411         * gold/options.h (General_options): New option definitions.
8412         (General_options::fix_v4bx): New method.
8413         (General_options::Fix_v4bx): New enum.
8414         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8415         (General_options::parse_fix_v4bx_interworking): New method.
8416
8417 2010-01-22  Doug Kwan  <dougkwan@google.com>
8418
8419         * arm.cc (Arm_exidx_fixup): New class.
8420
8421 2010-01-21  Doug Kwan  <dougkwan@google.com>
8422
8423         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8424         classes.
8425         (Arm_exidx_section_offset_map): New type.
8426
8427 2010-01-21  Doug Kwan  <dougkwan@google.com>
8428
8429         * arm.cc (Arm_exidx_input_section): New class.
8430         (Arm_relobj::exidx_input_section_by_link,
8431         Arm_relobj::exidx_input_section_by_shndx,
8432         Arm_relobj::make_exidx_input_section): New methods.
8433         (read_arm_attributes_section): Remove.
8434         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8435         information about them.
8436         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8437         to here.
8438
8439 2010-01-20  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8442         Input_section_specifier to Section_id.
8443         (Target_arm::new_arm_input_section: Adjust code for change of key
8444         type.
8445         (Target_arm::find_arm_input_section): Ditto.
8446         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8447         (Section_id): Remove.
8448         (Garbage_collection::Section_id_hash): Remove.
8449         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8450         (Section_id): Remove.
8451         (Icf::Section_id_hash): Remove.
8452         * object.h (Section_id, Const_section_id, Section_id_hash,
8453         Const_section_id_hash): New type definitions.
8454         * output.cc (Output_section::add_relaxed_input_section): Change to
8455         use Const_section_id instead of Input_section_specifier as key type.
8456         (Output_section::add_merge_input_section): Ditto.
8457         (Output_section::build_relaxation_map): Change to use Section_id
8458         instead of Input_section_specifier as key type.
8459         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8460         Ditto.
8461         (Output_section::convert_input_sections_to_relaxed_sections): Change
8462         to use Const_section_id instead of Input_section_specifier as key type.
8463         (Output_section::find_merge_section): Ditto.
8464         (Output_section::find_relaxed_input_section): Ditto.
8465         * output.h (Input_section_specifier): Remove class.
8466         (Output_section::Output_section_data_by_input_section_map): Change
8467         key type to Const_section_id.
8468         (Output_section::Output_relaxed_input_section_by_input_section_map):
8469         Ditto.
8470         (Output_section::Relaxation_map): Change key type to Section_id.
8471
8472 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8473
8474         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8475         (class Arm_v4bx_stub): New class.
8476         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8477         (Stub_factory::make_arm_v4bx_stub): New method.
8478         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8479         (Stub_table::empty): Handle v4bx stubs.
8480         (Stub_table::add_arm_v4bx_stub): New method.
8481         (Stub_table::find_arm_v4bx_stub): New method.
8482         (Arm_relocate_functions::v4bx): New method.
8483         (Target_arm::fix_v4bx): New method.
8484         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8485         (Stub_table::relocate_stubs): Likewise.
8486         (Stub_table::do_write): Likewise.
8487         (Stub_table::update_data_size_and_addralign): Likewise.
8488         (Stub_table::finalize_stubs):  Likewise.
8489         (Target_arm::Scan::local): Likewise.
8490         (Target_arm::Scan::global): Likewise.
8491         (Target_arm::do_finalize_sections): Likewise.
8492         (Target_arm::Relocate::relocate): Likewise.
8493         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8494         Likewise.
8495         (Target_arm::scan_reloc_for_stub): Likewise.
8496         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8497
8498 2010-01-19  Ian Lance Taylor  <iant@google.com>
8499
8500         * output.cc (Output_section_headers::do_sized_write): Write large
8501         segment count to sh_info field.
8502         (Output_file_header::do_sized_write): For large segment count,
8503         write PN_XNUM to e_phnum field.
8504
8505 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8506
8507         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8508         (Arm_relocate_functions::thm_jump8): New function.
8509         (Arm_relocate_functions::thm_jump11): New function.
8510         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8511         R_ARM_THM_JUMP11.
8512         (Target_arm::Scan::global): Likewise.
8513         (Target_arm::Relocate::relocate): Likewise.
8514         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8515         Likewise.
8516
8517 2010-01-14  Doug Kwan  <dougkwan@google.com>
8518
8519         * arm.cc (map, utility): Include headers.
8520         (Target_arm::apply_cortex_a8_workaround): New method.
8521         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8522         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8523         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8524         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8525         the --[no-]fix-cortex-a8 command line options.
8526         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8527         (Target_arm::relocate_stub): Use addend in instruction template.
8528         * options.h (DEFINE_bool): Set the user-set flag.
8529         (General_options): Add --[no-]-fix-cortex options.
8530         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8531         : Update fast look-up map after conversion.
8532
8533 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8534
8535         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8536         in the first pass of do_layout.
8537
8538 2010-01-13  Doug Kwan  <dougkwan@google.com>
8539
8540         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8541         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8542         apparent compiler problem of not folding static constant integral
8543         data members of elfcpp::Elf_sizes<32>.
8544
8545 2010-01-13  Doug Kwan  <dougkwan@google.com>
8546
8547         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8548         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8549         Arm_relobj::scan_section_for_cortex_a8_erratum,
8550         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8551         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8552         sections to scan for relocation stubs into a new method
8553         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8554         relocation and Cortex-A8 stub scanning.
8555         (Target_arm::do_relax): Force stubs to be after stubbed sections
8556         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8557         the beginning of a new relaxation pass.  Update a comment.
8558         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8559
8560 2010-01-12  Ian Lance Taylor  <iant@google.com>
8561
8562         * target-reloc.h (visibility_error): New inline function.
8563         (relocate_section): Call visibility_error.
8564         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8565         (MOSTLYCLEANFILES): Likewise.
8566         (protected_4_pic.o, protected_3.err): New targets.
8567         * testsuite/protected_4.cc: New file.
8568
8569 2010-01-12  Doug Kwan  <dougkwan@google.com>
8570
8571         * arm.cc (Cortex_a8_reloc): New class.
8572         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8573         and cortex_a8_relocs_info_.
8574         (Target_arm::fix_cortex_a8): New method definition.
8575         (Target_arm::Cortex_a8_relocs_info): New type.
8576         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8577         New data member declarations.
8578         (Target_arm::scan_reloc_for_stub): Record information about
8579         relocations for THUMB branches that might be exempted from the
8580         Cortex-A8 workaround.
8581         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8582         at the beginning of a relaxation pass.
8583
8584 2010-01-12  Doug Kwan  <dougkwan@google.com>
8585
8586         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8587         (Arm_relobj::Mapping_symbol_position,
8588          Arm_reloj::Mapping_symbol_position_less,
8589          Arm_relobj::Mapping_symbols_info): New types.
8590         (Target_arm::is_mapping_symbol_name): New method definition.
8591         (Arm_relobj::do_count_local_symbols): Save information about mapping
8592         symbols.
8593
8594 2010-01-11  Doug Kwan  <dougkwan@google.com>
8595
8596         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8597         Arm_relocate_functions::thumb32_branch_upper,
8598         Arm_relocate_functions::thumb32_branch_lower,
8599         Arm_relocate_functions::thumb32_cond_branch_offset,
8600         Arm_relocate_functions::thumb32_cond_branch_upper,
8601         Arm_relocate_functions::thumb32_cond_branch_lower,
8602         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8603         branch offset encoding.
8604         (Arm_relocate_functions::thumb_branch_common): Use new branch
8605         offset encoding methods to avoid code duplication.
8606         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8607         (Stub_addend_reader::operator()): Use new branch encoding method
8608         to avoid code duplication.
8609
8610 2010-01-11  Doug Kwan  <dougkwan@google.com>
8611
8612         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8613         (Target_arm::do_finalize_sections): Define special EXIDX section
8614         symbols only if referenced.
8615         * gc.h (Garbage_collection::add_reference): New method.
8616         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8617         code duplication.
8618
8619 2010-01-11  Ian Lance Taylor  <iant@google.com>
8620
8621         * script.cc (Version_script_info::build_expression_list_lookup):
8622         Change complaing about duplicate wildcard match from error to
8623         warning.
8624
8625         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8626         of 2009-12-30.
8627         (Version_script_info::Version_script_info): Initialize globs_,
8628         default_version_, default_is_global_, and exact_.  Don't
8629         initialize globals_ or locals_.
8630         (Version_script_info::build_lookup_tables): Build local symbols
8631         first.
8632         (Version_script_info::unquote): New function.
8633         (Version_script_info::add_exact_match): New function.
8634         (Version_script_info::build_expression_list_lookup): Remove lookup
8635         parameter.  Add is_global parameter.  Change all callers.  Handle
8636         wildcard pattern specially.  Unquote pattern.  Call
8637         add_exact_match.
8638         (Version_script_info::get_name_to_match): New function.
8639         (Version_script_info::get_symbol_version): New function.
8640         (Version_script_info::get_symbol_version_helper): Remove.
8641         (Version_script_info::check_unmatched_names): Call unquote.
8642         * script.h (class Version_script_info): Change get_symbol_version
8643         to be non-inline and add is_global parameter; change all callers.
8644         Rewrite symbol_is_local.  Update declarations.  Define struct
8645         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8646         Remove globals_ and locals_ members.  Add exact_, globs_,
8647         default_version_, is_global_.
8648         (Version_script_info::Glob): Remove pattern, add expression and
8649         is_global.  Update constructor.  Change all callers.
8650         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8651         default version.
8652         (Versions::symbol_section_contents): If a symbol is undefined, or
8653         defined in a dynamic object, set the version index to
8654         VER_NDX_LOCAL.
8655         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8656         symbol_is_local.
8657         (Symbol_table::add_from_pluginobj): Likewise.
8658         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8659
8660 2010-01-11  Doug Kwan  <dougkwan@google.com>
8661
8662         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8663         (incremental_dump_LDADD): Add linking option for libintl.
8664         * Makefile.in: Regenerate.
8665
8666 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8667
8668         PR gold/11144
8669         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8670         instead of -Ds.
8671         * testsuite/Makefile.in: Regenerated.
8672
8673 2010-01-10  Doug Kwan  <dougkwan@google.com>
8674
8675         * options.h (DEFINE_var): Use parentheses around argument varname__
8676         in macro body to avoid any unintended subsequent substitutions.
8677
8678 2010-01-10  Ian Lance Taylor  <iant@google.com>
8679
8680         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8681         candidates before doing symbol resolution.
8682
8683         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8684         ODR candidates if only one is weak.
8685
8686 2010-01-08  Ian Lance Taylor  <iant@google.com>
8687
8688         * script.cc (Version_script_info::build_expression_list_lookup):
8689         Don't warn about ambiguous version, just record the ambiguity.
8690         (Version_script_info::get_symbol_version_helper): Give error if
8691         version is ambiguous.
8692
8693 2010-01-08  Doug Kwan  <dougkwan@google.com>
8694
8695         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8696         prev_data_size_ and prev_addralign_.  Remove initializer for
8697         deleted data member has_been_changed_.
8698         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8699         to determine if the table is empty.
8700         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8701         Remove.
8702         (Stub_table::add_reloc_stub): Define method in class definition
8703         instead of just declaring it there.
8704         (Stub_table::add_cortex_a8_stub): New method definition.
8705         (Stub_table::update_data_size_and_addralign): Ditto.
8706         (Stub_table::finalize_stubs): Ditto.
8707         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8708         (Stub_table::do_addralign_): Return address alignment in the
8709         (Stub_table::do_reset_address_and_file_offset): Define method in
8710         class definition instead of declaring it there.  Set current data
8711         size to be the data size of the previous pass.
8712         (Stub_table::set_final_data_size): Use current data size as the
8713         final data size.
8714         (Stub_table::relocate_stub): Change parameter type of stub from
8715         Reloc_stub pointer to Stub pointer.
8716         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8717         (Stub_table::Cortex_a8_stub_list): New typedef.
8718         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8719          Stub_table::prev_addralign_): New data member.
8720         (Arm_relobj::Arm_relobj): Initialize data member
8721         section_has_cortex_a8_workaround_.
8722         (Arm_relobj::section_has_cortex_a8_workaround,
8723          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8724          definitions.
8725         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8726         declarations.
8727         (Target_arm::relocate_stub): Change parameter type of stub from
8728         Reloc_stub pointer to Stub pointer.
8729         (Insn_template::size, Insn_template::alignment): Handle
8730         THUMB16_SPECIAL_TYPE.
8731         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8732          Stub_table::update_data_size_and_addralign,
8733          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8734         definitions.
8735         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8736         (Stub_table::do_write): Ditto.
8737         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8738
8739 2010-01-08  Ian Lance Taylor  <iant@google.com>
8740
8741         PR 11108
8742         * symtab.h (class Symbol): Remove fields is_target_special_ and
8743         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8744         (Symbol::is_defined_in_discarded_section): New function.
8745         (Symbol::set_is_defined_in_discarded_section): New function.
8746         (Symbol::has_plt_offset): Rewrite.
8747         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8748         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8749         Don't initialize is_target_special_ or has_plt_offset_.
8750         Initialize is_defined_in_discarded_section_.
8751         (Symbol_table::add_from_relobj): If appropriate, set
8752         is_defined_in_discarded_section.
8753         * resolve.cc (Symbol::override_base_with_special): Don't test
8754         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8755         * target-reloc.h (relocate_section): Do special handling for
8756         symbols defined in discarded sections for global symbols as well
8757         as local symbols.
8758
8759 2010-01-08  Ian Lance Taylor  <iant@google.com>
8760
8761         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8762         the SHT_SYMTAB case.
8763
8764 2010-01-08  Ian Lance Taylor  <iant@google.com>
8765
8766         * object.cc (Sized_relobj::do_layout): Don't get confused if
8767         layout_eh_frame returns NULL.
8768
8769 2010-01-08  Ian Lance Taylor  <iant@google.com>
8770
8771         PR 11084
8772         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8773         dynamic symbol table, use the normal symbol table.
8774         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8775         symbol table.
8776
8777 2010-01-08  Ian Lance Taylor  <iant@google.com>
8778
8779         PR 11072
8780         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8781         sections.
8782
8783 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8784
8785         * version.cc (print_version): Change to "Copyright 2010".
8786
8787 2010-01-08  Ian Lance Taylor  <iant@google.com>
8788
8789         PR 10287
8790         PR 11063
8791         * i386.cc (class Target_i386): Change return type of plt_section
8792         to be non-const.
8793         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8794         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8795         tls_desc_rel_ field.
8796         (Output_data_plt_i386::rel_tls_desc): New function.
8797         (Target_i386::rel_tls_desc_section): New function.
8798         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8799         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8800         R_386_TLS_DESC reloc in rel_tls_desc_section.
8801         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8802         Define struct Tlsdesc_info.
8803         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8804         (Target_x86_64::do_reloc_symbol_index): New function.
8805         (Target_x86_64::add_tlsdesc_info): New function.
8806         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8807         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8808         tlsdesc_rel_ field.
8809         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8810         all callers.
8811         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8812         (Target_x86_64::rela_tlsdesc_section): New function.
8813         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8814         handling.
8815         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8816         (Target_x86_64::do_reloc_addend): New function.
8817         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8818         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8819         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8820         (Output_reloc::type): New function.
8821         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8822         (Output_reloc::is_target_specific): New function.
8823         (Output_reloc::target_arg): New function.
8824         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8825         absolute relocs and target specific relocs.
8826         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8827         add_target_specific.
8828         (class Output_data_reloc) [SHT_RELA]: Likewise.
8829         * output.cc (Output_reloc::Output_reloc): Add four new versions
8830         for absolute relocs and target specific relocs.
8831         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8832         (Output_reloc::get_symbol_index): Likewise.
8833         (Output_reloc::local_section_offset): Check that local_sym_index_
8834         is not TARGET_CODE or 0.
8835         (Output_reloc::symbol_value): Likewise.
8836         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8837         reloc.
8838         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8839         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8840         functions.
8841         * layout.cc (add_target_dynamic_tags): Use output section for
8842         DT_PLTRELSZ and DT_JMPREL.
8843
8844 2010-01-07  Ian Lance Taylor  <iant@google.com>
8845
8846         PR 11061
8847         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8848         function.
8849         (class Output_data_reloc_generic): Define.
8850         (class Output_data_reloc_base): Change base class to
8851         Output_data_reloc_generic.  Change add() method to call
8852         bump_relative_reloc_count for a relative reloc.  Remove
8853         sort_relocs_ field.
8854         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8855         to sort_relocs().
8856         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8857         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8858         appropriate.
8859         * layout.h (class Layout): Update declaration.
8860
8861 2010-01-07  Ian Lance Taylor  <iant@google.com>
8862
8863         * output.h (class Output_data): Add const version of
8864         output_section and do_output_section.
8865         (class Output_section_data): Add const version of
8866         do_output_section.
8867         (class Output_section): Likewise.
8868         * layout.cc (Layout::add_target_dynamic_tags): New function.
8869         * layout.h (class Layout): Update declarations.
8870         * arm.cc (Target_arm::do_finalize_sections): Use
8871         add_target_dynamic_tags.
8872         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8873         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8874         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8875         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8876
8877 2010-01-07  Ian Lance Taylor  <iant@google.com>
8878
8879         PR 11042
8880         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8881         object as needed.
8882
8883 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8884             Ian Lance Taylor  <iant@google.com>
8885
8886         PR 11019
8887         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8888         Xindex::read_symtab_xindex.
8889
8890 2010-01-07  Doug Kwan  <dougkwan@google.com>
8891
8892         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8893         (Insn_template::thumb16_bcond_insn): New method declaration.
8894         (Insn_template): Fix spelling.
8895         (Stub::thumb16_special): New method declaration.
8896         (Stub::do_write): Define virtual method which was previously pure
8897         virtual.
8898         (Stub::do_thumb16_special): New method declaration.
8899         (Stub::do_fixed_endian_write): New template member.
8900         (Reloc_stub::do_write): Remove.
8901         (Reloc_stub::do_fixed_endian_write): Remove.
8902         (Cortex_a8_stub): New class definition.
8903         (Stub_factory::make_cortex_a8_stub): New method definition.
8904         (Stub_factory::Stub_factory): Add missing static storage class
8905         qualifier for elf32_arm_stub_a8_veneer_blx.
8906
8907 2010-01-07  Ian Lance Taylor  <iant@google.com>
8908
8909         PR 10980
8910         * options.h (class General_options): Add --warn-unresolved-symbols
8911         and --error-unresolved-symbols.
8912         * errors.cc (Errors::undefined_symbol): Implement
8913         --warn-unresolved-symbols.
8914
8915         * options.h (class General_options): Add -z text and -z textoff.
8916         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8917
8918 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8919
8920         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8921         (Garbage_collection::cident_sections): New function.
8922         (Garbage_collection::add_cident_section): New function.
8923         (Garbage_collection::cident_sections_): New member.
8924         (gc_process_relocs): Add references to sections whose names are C
8925         identifiers.
8926         * gold.h (cident_section_start_prefix): New constant.
8927         (cident_section_stop_prefix): New constant.
8928         (is_cident): New function.
8929         * layout.cc (Layout::define_section_symbols): Replace string constants
8930         with the newly defined constants.
8931         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8932         C identifiers.
8933         * testsuite/Makefile.am: Add gc_orphan_section_test.
8934         * testsuite/Makefile.in: Regenerate.
8935         * testsuite/gc_orphan_section_test.cc: New file.
8936         * testsuite/gc_orphan_section_test.sh: New file.
8937
8938 2010-01-06  Ian Lance Taylor  <iant@google.com>
8939
8940         PR 10980
8941         * options.h (class General_options): Add --warn-shared-textrel.
8942         * layout.cc (Layout::finish_dynamic_section): Implement
8943         --warn-shared-textrel.
8944
8945         PR 10980
8946         * options.h (class General_options): Add --warn-multiple-gp.
8947
8948 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8949
8950         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8951         $(THREADSLIB) and $(LIBDL).
8952         * Makefile.in: Rebuild.
8953
8954 2010-01-06  Ian Lance Taylor  <iant@google.com>
8955
8956         PR 10980
8957         * options.cc (General_options::parse_section_start): New function.
8958         (General_options::section_start): New function.
8959         (General_options::General_options): Initialize all members.
8960         * options.h: Include <map>
8961         (class General_options): Add --section-start.  Add section_starts_
8962         member.
8963         * layout.cc (Layout::attach_allocated_section_to_segment): If
8964         --section-start was used, set the address of the segment.  Remove
8965         local sort_sections.
8966         (Layout::relaxation_loop_body): If the address of the load segment
8967         has been set by --section-start, don't use it.
8968         * output.h (Output_segment::update_flags_for_output_section): New
8969         function.
8970         * output.cc (Output_segment::add_output_section): Call
8971         update_flags_for_output_section.
8972
8973 2010-01-05  Ian Lance Taylor  <iant@google.com>
8974
8975         PR 10980
8976         * options.h (class General_options): Add --undefined-version.
8977         * script.cc (struct Version_expression): Add was_matched_by_symbol
8978         field.
8979         (Version_script_info::matched_symbol): New function.
8980         (Version_script_info::get_symbol_version_helper): Call
8981         matched_symbol.
8982         (Version_script_info::check_unmatched_names): New function.
8983         * script.h (class Version_script_info): Update declarations.
8984         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8985
8986         * options.h (class General_options): Use DEFINE_bool_alias for
8987         allow_multiple_definition.
8988         * resolve.cc (Symbol_table::should_override): Don't test
8989         allow_multiple_definition.
8990
8991         PR 10980
8992         * options.h (class General_options): Add --cref.
8993         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8994         until after printing cref table.
8995         * cref.cc: Include "symtab.h".
8996         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8997         (Cref_table_compare::operator()): New function.
8998         (Cref_inputs::gather_cref): New function.
8999         (filecol): New static const.
9000         (Cref_inputs::print_cref): New function.
9001         (Cref::print_cref): New function.
9002         * cref.h: Include <cstdio>.
9003         (class Cref): Update declarations.
9004         * mapfile.h (Mapfile::file): New function.
9005         * object.h (class Object): Define Symbols.  Declare virtual
9006         do_get_global_symbols.
9007         (Object::get_global_symbols): New function.
9008         * object.cc (Input_objects::add_object): Pass object to cref_ if
9009         --cref.
9010         (Input_objects::archive_start): Likewise.
9011         (Input_objects::archive_stop): Likewise.
9012         (Input_objects::print_cref): New function.
9013         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9014         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9015         --cref.
9016         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9017         function.
9018         * plugin.h (class Sized_pluginobj): Update declarations.
9019
9020 2010-01-05  Ian Lance Taylor  <iant@google.com>
9021
9022         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9023         to is_default_version.  Rename insdef to insdefault.
9024         (Symbol_table::add_from_relobj): Rename def to is_default_version
9025         and local to is_forced_local.
9026         (Symbol_table::add_from_pluginobj): Likewise.
9027         (Symbol_table::add_from_dynobj): Likewise.
9028         (Symbol_table::define_special_symbol): Rename insdef to
9029         insdefault.
9030
9031 2010-01-04  Ian Lance Taylor  <iant@google.com>
9032
9033         PR 10980
9034         * options.h (class General_options): Add
9035         --allow-multiple-definition and -z muldefs.
9036         * resolve.cc (Symbol_table::should_override): Don't warn about a
9037         multiple symbol definition if --allow-multiple-definition or -z
9038         muldefs.
9039
9040         PR 10980
9041         * options.h (class General_options): Add --add-needed and
9042         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9043         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9044         error if --copy-dt-needed-entries aka --add-needed is used and
9045         would cause a change in behaviour.
9046
9047         PR 10980
9048         * options.h (class General_options): Add -G as a short version of
9049         --shared.  Add no-op options -assert, -g, and -i.
9050
9051 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9052
9053         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9054         check for .text or .gnu.linkonce.t sections.
9055         * icf.cc (Icf::find_identical_sections): Ditto.
9056         Change the detection for mangled function name within the section
9057         name.
9058         * icf.h (is_section_foldable_candidate): New function.
9059
9060 2009-12-30  Ian Lance Taylor  <iant@google.com>
9061
9062         PR 10980
9063         * options.h (class General_options): Permit two dashes with
9064         --retain-symbols-file.
9065
9066 2009-12-30  Ian Lance Taylor  <iant@google.com>
9067
9068         PR 10979
9069         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9070         don't put the file header and segment headers in the text
9071         segment.
9072
9073         PR 10979
9074         * common.cc (Sort_commons::operator()): Stabilize sort when both
9075         entries are NULL.
9076         (Symbol_table::do_allocate_commons_list): When allocating common
9077         symbols, skip a symbol which is no longer common.
9078         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9079         an object before checking its type.
9080         * testsuite/common_test_2.c: New file.
9081         * testsuite/common_test_3.c: New file.
9082         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9083         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9084         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9085         (common_test_2_pic.o, common_test_2.so): New targets.
9086         (common_test_3_pic.o, common_test_3.so): New targets.
9087         * testsuite/Makefile.in: Rebuild.
9088
9089         PR 10979
9090         * script.cc (read_input_script): If we see a new SECTIONS clause,
9091         and we have added an input section, give an error.
9092         * layout.h (class Layout): Add have_added_input_section function.
9093         Add have_added_input_section_ field.
9094         * layout.cc (Layout::Layout): Initialize
9095         have_added_input_section_.
9096         (Layout::layout): Set have_added_input_section_.
9097         (Layout::layout_eh_frame): Likewise.
9098
9099 2009-12-30  Ian Lance Taylor  <iant@google.com>
9100
9101         PR 10931
9102         * options.h (class General_options): Add --sort-common option.
9103         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9104         * common.cc (Sort_common): Add sort_order parameter to
9105         constructor.  Add sort_order_ field.
9106         (Sort_commons::operator): Check sort_order_.
9107         (Symbol_table::allocate_commons): Determine the sort order.
9108         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9109         Change all callers.
9110         (Symbol_table::do_allocate_commons_list): Likewise.
9111
9112 2009-12-30  Ian Lance Taylor  <iant@google.com>
9113
9114         PR 10916
9115         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9116         symbols from this object, don't change the visibility of an
9117         undefined symbol.
9118         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9119
9120 2009-12-30  Ian Lance Taylor  <iant@google.com>
9121
9122         PR 10861
9123         * script.h (class Version_script_info): Define Language enum.
9124         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9125         new fields globals_, locals_, and is_finalized_.
9126         * script.cc: Various formatting fixes.
9127         (class Parser_closure): Change language_stack_ from a vector of
9128         std::string to one of Version_script_info::Language.  Adjust all
9129         uses accordingly.
9130         (class Lazy_demangler): Remove.
9131         (struct Version_expression): Change language from std::string to
9132         Version_script_info::Language.
9133         (Version_script_info::Version_script_info): New function.
9134         (Version_script_info::~Version_script_info): Don't call clear.
9135         (Version_script_info::finalize): New function.
9136         (Version_script_info::build_lookup_tables): New function.
9137         (Version_script_info::build_expression_list_lookup): New
9138         function.
9139         (Version_script_info::get_symbol_version_helper): Rewrite to use
9140         lookup tables.
9141         (Version_script_info::print_expression_list): Adjust to use
9142         Version_script_info::Language.
9143         (script_push_lex_into_version_mode): Check that the version script
9144         has not been finalized.
9145         (version_script_push_lang): Change language string to
9146         Version_script_info::Language.
9147         * options.cc (Command_line::version_script): New function.
9148         * options.h (class General_options): Add finalize_dynamic_list
9149         function.  Change version_script from declaration to definition.
9150         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9151         * testsuite/version_script.map: Remove duplicate def of foo.
9152         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9153         version_script.map.
9154         * testsuite/Makefile.in: Rebuild.
9155
9156 2009-12-30  Ian Lance Taylor  <iant@google.com>
9157
9158         PR 10843
9159         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9160         if the input symbol index is 0, make the output symbol index 0.
9161
9162 2009-12-30  Ian Lance Taylor  <iant@google.com>
9163
9164         PR 10670
9165         * options.h (class General_options): Add -x/--discard-all.
9166         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9167         --discard-all.  If the local symbol needs a dynamic entry, check
9168         that before handling --discard-locals.
9169
9170 2009-12-30  Ian Lance Taylor  <iant@google.com>
9171
9172         PR 10450
9173         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9174         flags to PF_R.
9175         (Output_segment::add_output_section): Don't change the flags if
9176         the type is PT_TLS.
9177
9178         PR 10450
9179         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9180         GNU hash table if they need a dynamic value.  Otherwise, don't add
9181         them if they are defined in a dynamic object or are forced local.
9182
9183 2009-12-29  Ian Lance Taylor  <iant@google.com>
9184
9185         PR 10450
9186         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9187         .gnu.hash table for a 32-bit target.
9188
9189         PR 10450
9190         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9191         regular and a dynamic object only needs a dynamic symbol table
9192         entry if it is externally visible.
9193
9194         PR 10450
9195         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9196         constructor.  Add global_offset_table_ field.
9197         (Target_i386::got_section): Set global_offset_table_.
9198         (Target_i386::do_finalize_sections): Set global_offset_table_
9199         size.
9200         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9201         in constructor.  Add global_offset_table_ field.
9202         (Target_x86_64::got_section): Set global_offset_table_.
9203         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9204         size.
9205
9206         * layout.cc (Layout::Layout): Initialize increase_relro_.
9207         (Layout::get_output_section): Add is_relro, is_last_relro, and
9208         is_first_non_relro parameters.  Change all callers.
9209         (Layout::choose_output_section): Likewise.
9210         (Layout::add_output_section_data): Likewise.
9211         (Layout::make_output_section): Likewise.
9212         (Layout::set_segment_offsets): Clear increase_relro when using a
9213         linker script.
9214         * layout.h (class Layout): Add increase_relro method.  Add
9215         increase_relro_ field.  Update declarations.
9216         * output.cc (Output_section::Output_section): Initialize
9217         is_last_relro_ and is_first_non_relro_.
9218         (Output_segment::add_output_section): Group relro sections is
9219         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9220         (Output_segment::maximum_alignment): Remove relro handling.
9221         (Output_segment::set_section_addresses): Add increase_relro
9222         parameter.  Change all callers.  Add initial alignment to align
9223         relro sections on separate page.  Remove old relro handling.
9224         (Output_segment::set_section_list_addresses): Remove in_relro
9225         parameter.  Change all callers.
9226         (Output_segment::set_offset): Add increase parameter.  Change all
9227         callers.  Remove old relro handling.
9228         * output.h (class Output_section): Add new methods: is_last_relro,
9229         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9230         Add is_last_relro_ and is_first_non_relro_ fields.
9231         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9232         Create separate .got.plt section.  Call increase_relro.
9233         * x86_64.cc (Target_x86_64::got_section): Likewise.
9234         * testsuite/relro_script_test.t: Add .got.plt.
9235
9236         PR 10450
9237         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9238         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9239         (Layout::finalize): Call set_dynamic_symbol_size.
9240         (Layout::set_dynamic_symbol_size): New function.
9241         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9242         set_dynamic_symbol_size.
9243
9244         PR 10450
9245         * output.h (class Output_section): Add is_entsize_zero_ field.
9246         * output.cc (Output_section::Output_section): Initialize
9247         is_entsize_zero_.
9248         (Output_section::set_entsize): If two different entsizes are
9249         requested, force it to zero.
9250         (Output_section::add_input_section): Set flags for .debug_str
9251         before updating section flags.  Set entsize.
9252         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9253         and SHF_STRING if all input sections have those flags.
9254
9255 2009-12-29   Rafael Espindola  <espindola@google.com>
9256
9257         * main.cc (main): Fix the sys time reporting.
9258         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9259         reporting.
9260
9261 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9262
9263         * options.cc (General_options::parse_version): Allow -v to exit
9264         without an error if there is nothing to link.
9265
9266 2009-12-29  Ian Lance Taylor  <iant@google.com>
9267
9268         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9269         using a version of gcc before 4.1.
9270         * configure: Rebuild.
9271
9272 2009-12-28  Chris Demetriou  <cgd@google.com>
9273
9274         * attributes.cc (Output_attributes_section_data::do_write): Use
9275         std::vector::front rather than std::vector::data.
9276
9277 2009-12-28  Ian Lance Taylor  <iant@google.com>
9278
9279         * symtab.h (class Symbol_table): Add enum Defined.
9280         * resolve.cc (Symbol_table::should_override): Add defined
9281         parameter.  Change all callers.  Test whether object is NULL
9282         before calling a method on it.
9283         (Symbol_table::report_resolve_problem): Add defined parameter.
9284         Change all callers.
9285         (Symbol_table::should_override_with_special): Likewise.
9286         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9287         parameter.  Change all callers.
9288         (Symbol_table::do_define_in_output_data): Likewise.
9289         (Symbol_table::define_in_output_segment): Likewise.
9290         (Symbol_table::do_define_in_output_segment): Likewise.
9291         (Symbol_table::define_as_constant): Likewise.
9292         (Symbol_table::do_define_as_constant): Likewise.
9293         * script.h (class Symbol_assignment): Add is_defsym parameter to
9294         constructor; change all callers.
9295         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9296         parameter.  Change all callers.  Add is_defsym_ field.
9297         (class Parser_closure): Add parsing_defsym parameter to
9298         constructor; change all callers.  Add parsing_defsym accessor
9299         function.  Add parsing_defsym_ field.
9300
9301 2009-12-28  Ian Lance Taylor  <iant@google.com>
9302
9303         * gold.cc (queue_middle_tasks): Fix formatting.
9304         * object.cc (Relobj::is_section_name_included): Likewise.
9305
9306 2009-12-23  Ian Lance Taylor  <iant@google.com>
9307
9308         * i386.cc (Target_i386::do_calls_non_split): Recognize
9309         -fsplit-stack prologue for a function with a static chain.
9310         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9311         -fsplit-stack prologue when using %r11.
9312
9313 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9314
9315         * options.cc (General_options::parse_version): Make -v continue and do
9316         the link like GNU ld does.
9317
9318 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9319
9320         * Makefile.am (CCFILES): Add timer.cc.
9321         (HFILES): Add timer.h.
9322         * configure.ac: Check for sysconf and times.
9323         * main.cc: include timer.h.
9324         (main): Use Timer instead of get_run_time.
9325         * timer.cc: New.
9326         * timer.h: New.
9327         * workqueue.cc: include timer.h.
9328         (Workqueue::find_and_run_task):
9329         Report user, sys and wall time.
9330         * Makefile.in: Regenerate.
9331         * config.in: Regenerate.
9332         * configure: Regenerate.
9333
9334 2009-12-16  Doug Kwan  <dougkwan@google.com>
9335
9336         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9337         sections.
9338         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9339         relaxed input sections.
9340         * output.cc (Output_section::find_relaxed_input_section): Change
9341         return type to Output_relaxed_input_section pointer.  Adjust code
9342         for new type of relaxed_input_section_map_.
9343         * output.h (Output_section::find_relaxed_input_section): Change
9344         return type to Output_relaxed_input_section pointer.
9345         (Output_section::Output_relaxed_input_section_by_input_section_map):
9346         New type.
9347         (Output_section::relaxed_input_section_map_): Change type to
9348         Output_section::Output_relaxed_input_section_by_input_section_map.
9349         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9350         input section.
9351
9352 2009-12-15  Ian Lance Taylor  <iant@google.com>
9353
9354         * layout.cc (Layout::create_shstrtab): Only write out after input
9355         sections if we are compressing debug sections.
9356
9357 2009-12-15  Ian Lance Taylor  <iant@google.com>
9358
9359         * archive.cc (Archive::add_symbols): Only look up a symbol without
9360         a version if there is, in fact, a version.
9361
9362 2009-12-14  Ian Lance Taylor  <iant@google.com>
9363
9364         Revert -Wshadow changes, all changes from:
9365         2009-12-11  Doug Kwan  <dougkwan@google.com>
9366         2009-12-11  Nick Clifton  <nickc@redhat.com>
9367         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9368
9369 2009-12-11  Doug Kwan  <dougkwan@google.com>
9370
9371         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9372         due to -Wshadow.
9373         * attributes.cc (Object_attribute::size): Ditto.
9374         (Attributes_section_data::size): Ditto.
9375         (Attributes_section_data::Attributes_section_data): Ditto.
9376         (Output_attributes_section_data::do_write): Ditto.
9377         * attributes.h (Object_attribute::set_type): Ditto.
9378         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9379
9380 2009-12-11  Nick Clifton  <nickc@redhat.com>
9381
9382         * archive.cc: Fix shadowed variable warnings.
9383         * arm.cc: Likewise.
9384         * compressed_output.cc: Likewise.
9385         * compressed_output.h: Likewise.
9386         * configure: Likewise.
9387         * dwarf_reader.cc: Likewise.
9388         * dynobj.cc: Likewise.
9389         * dynobj.h: Likewise.
9390         * ehframe.cc: Likewise.
9391         * ehframe.h: Likewise.
9392         * errors.cc: Likewise.
9393         * expression.cc: Likewise.
9394         * fileread.cc: Likewise.
9395         * fileread.h: Likewise.
9396         * freebsd.h: Likewise.
9397         * i386.cc: Likewise.
9398         * icf.cc: Likewise.
9399         * incremental.h: Likewise.
9400         * layout.cc: Likewise.
9401         * layout.h: Likewise.
9402         * mapfile.cc: Likewise.
9403         * merge.cc: Likewise.
9404         * merge.h: Likewise.
9405         * object.cc: Likewise.
9406         * object.h: Likewise.
9407         * options.h: Likewise.
9408         * output.cc: Likewise.
9409         * output.h: Likewise.
9410         * parameters.cc: Likewise.
9411         * plugin.cc: Likewise.
9412         * powerpc.cc: Likewise.
9413         * reduced_debug_output.cc: Likewise.
9414         * reduced_debug_output.h: Likewise.
9415         * reloc.cc: Likewise.
9416         * reloc.h: Likewise.
9417         * resolve.cc: Likewise.
9418         * script-sections.cc: Likewise.
9419         * script.cc: Likewise.
9420         * script.h: Likewise.
9421         * sparc.cc: Likewise.
9422         * symtab.cc: Likewise.
9423         * symtab.h: Likewise.
9424         * target-select.cc: Likewise.
9425         * target-select.h: Likewise.
9426         * token.h: Likewise.
9427         * workqueue.cc: Likewise.
9428         * workqueue.h: Likewise.
9429         * x86_64.cc: Likewise.
9430
9431 2009-12-10  Doug Kwan  <dougkwan@google.com>
9432
9433         * arm.cc (attributes.h): New include.
9434         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9435         (Arm_relobj::~Arm_relobj): Delete object pointed by
9436         attributes_section_data_.
9437         (Arm_relobj::attributes_section_data): New method definition.
9438         (Arm_relobj::attributes_section_data_): New data member declaration.
9439         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9440         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9441         attributes_section_data_.
9442         (Arm_dynobj::attributes_section_data): New method definition.
9443         (Arm_dynobj::attributes_section_data_): New data member declaration.
9444         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9445         initialization value of may_use_blx_ to false.
9446         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9447         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9448         object attributes to compute results instead of hard-coding.
9449         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9450         Target_arm::get_secondary_compatible_arch,
9451         Target_arm::set_secondary_compatible_arch
9452         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9453         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9454         New method declarations.
9455         (Target_arm::get_aeabi_object_attribute): New method definition.
9456         (Target_arm::attributes_section_data_): New data member declaration.
9457         (read_arm_attributes_section): New template definition.
9458         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9459         (Arm_dynobj::do_read_symbols): Ditto.
9460         (Target_arm::do_finalize_sections): Merge attributes sections from
9461         input.  Check for BLX use after attributes section merging.
9462         Fix __exidx_start and __exidx_end visibility.  Create an
9463         .ARM.attributes section if necessary.
9464         (Target_arm::get_secondary_compatible_arch,
9465         Target_arm::set_secondary_compatible_arch,
9466         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9467         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9468         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9469         New method definitions.
9470
9471 2009-12-09  Ian Lance Taylor  <iant@google.com>
9472
9473         * plugin.cc (Plugin::load): Don't cast from void* to a function
9474         pointer.
9475
9476 2009-12-09  Ian Lance Taylor  <iant@google.com>
9477
9478         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9479         information fields.
9480
9481 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9482
9483         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9484         Replace two_file_shared_1.so with two_file_shared_2.so.
9485         * testsuite/Makefile.in: Regenerated.
9486
9487 2009-12-08  Doug Kwan  <dougkwan@google.com>
9488
9489         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9490         (HFILES): Add attributes.h and int_encoding.h.
9491         * Makefile.in: Regenerate.
9492         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9493         function definitions to int_encoding.cc
9494         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9495         prototypes to int_encoding.h
9496         * reduced_debug_output.cc (int_encoding.h): New include.
9497         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9498         function definitions to int_encoding.cc
9499         (insert_into_vector, read_from_pointer): Move template definitions to
9500         int_encoding.h
9501         * attributes.cc: New file.
9502         * attributes.h: New file.
9503         * int_encoding.cc: New file.
9504         * int_encoding.h: New file.
9505
9506 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9507
9508         PR gold/11055
9509         * incremental-dump.cc (dump_incremental_inputs): New.
9510         (main): Use dump_incremental_inputs.
9511
9512 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9513
9514         PR gold/10893
9515         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9516         checking elfcpp::STT_FUNC.
9517         (Target_i386::Relocate::relocate): Likewise.
9518         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9519
9520         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9521         symbols from shared libraries into normal FUNC symbols.
9522
9523         * symtab.h (Symbol): Add is_func and use it.
9524
9525 2009-12-05  Doug Kwan  <dougkwan@google.com>
9526
9527         * arm.cc (Target_arm::arm_info): Initialize new fields
9528         attributes_section and attributes_vendor.
9529         * i386.cc (Target_i386::i386_info): Same.
9530         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9531         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9532         fields attributes_section and attributes_vendor.
9533         * sparc.cc (Target_sparc::sparc_info): Same.
9534         * target.h (Target::attributes_section, Target::attributes_vendor,
9535         Target::is_attributes_section, Target::attribute_arg_type,
9536         Target::attributes_order): New method definitions.
9537         (Target::Target_info::attributes_section,
9538         Target::Target_info::attributes_vendor): New fields.
9539         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9540         virtual method definitions.
9541         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9542         attributes_section and attributes_vendor.
9543         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9544
9545 2009-12-05  Doug Kwan  <dougkwan@google.com>
9546
9547         * arm.cc: Update comments about interworking and stub generation.
9548         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9549         considered as non-PIC.
9550         (Arm_relocate_functions::base_abs): Fix formatting.
9551         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9552         of function to use GOT entry address instead of offset.
9553         (Target_arm::Scan::global): Issue an error if a symbol would need a
9554         PLT does not get one because it is untyped.  Remove code to create
9555         dynamic symbols for relative branches.
9556         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9557         takes unsigned integer instead of boolean.
9558
9559 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9560
9561         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9562         (two_file_test_LDADD): Likewise.
9563         (common_test_1_LDADD): Likewise.
9564         (exception_test_LDADD) Likewise.
9565         (weak_test_LDADD): Likewise.
9566         (many_sections_test_LDADD): Likewise.
9567         (initpri1_LDADD): Likewise.
9568         (script_test_1_LDADD): Likewise.
9569         (script_test_2_LDADD): Likewise.
9570         (justsyms_LDADD): Likewise.
9571         (binary_test_LDADD): Likewise.
9572         (large_LDADD): Likewise.
9573         * testsuite/Makefile.in: Regenerated.
9574
9575 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9576
9577         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9578         (Symbol_table::override_with_special): Likewise.
9579         (Symbol_table::add_from_object): Likewise.
9580
9581 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9582
9583         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9584         Don't set the data_offset twice.
9585
9586 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9587
9588         * testsuite/Makefile.in: Regenerate.
9589
9590 2009-12-03  Doug Kwan  <dougkwan@google.com>
9591
9592         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9593         (Target_arm::do_finalize_sections): Add parameter for symbol table
9594         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9595         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9596         parameter for symbol table pointer.
9597         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9598         an additional parameter for a pointer to symbol table.
9599         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9600         parameter for a symbol table pointer.
9601         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9602         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9603         Ditto.
9604         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9605         parameter for a symbol table pointer.
9606
9607 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9608
9609         * incremental.cc (Incremental_inputs_header)
9610         (Incremental_inputs_header_write, Incremental_inputs_entry)
9611         (Incremental_inputs_entry_write): Move ...
9612         * incremental.h (Incremental_inputs_header)
9613         (Incremental_inputs_header_write, Incremental_inputs_entry)
9614         (Incremental_inputs_entry_write): here.
9615
9616 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9617
9618         * incremental.cc (make_sized_incremental_binary): Set the target.
9619         Error if it is incompatible.
9620         * output.h (Output_file): Add filename method.
9621
9622 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9623
9624         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9625         from the get_* methods.
9626
9627 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9628
9629         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9630         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9631         Write 0 for the data_offset of scripts.
9632
9633 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9634
9635         * testsuite/Makefile.am: Add the incremental_test.sh test.
9636         * testsuite/incremental_test.sh: New.
9637         * testsuite/incremental_test_1.c: New.
9638         * testsuite/incremental_test_2.c: New.
9639
9640 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9641
9642         * incremental-dump.cc (main): Fix typos.
9643
9644 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9645
9646         PR gold/11025
9647         * incremental-dump.cc (main): Use llu to print 64 bit values.
9648
9649 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9650             H.J. Lu  <hongjiu.lu@intel.com>
9651
9652         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9653         $(LIBDL).
9654         (incremental_dump_LDADD): Likewise.
9655         * Makefile.in: Regenerated.
9656
9657 2009-11-25  Doug Kwan  <dougkwan@google.com>
9658
9659         Revert:
9660
9661         2009-11-25  Doug Kwan  <dougkwan@google.com>
9662
9663                 * arm.cc (Target_arm::Target_arm): Move method definition
9664                 outside of class definition.  Add code to handle
9665                 --target1-rel, --target1-abs and --target2= options.
9666                 (Target_arm::get_reloc_reloc_type): Change method to be
9667                 non-static and const.
9668                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9669                 New data member declaration.
9670                 (Target_arm::Scan::local, Target_arm::Scan::global,
9671                 Target_arm::Relocate::relocate,
9672                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9673                 Adjust call to Target_arm::get_real_reloc_type.
9674                 (Target_arm::get_real_reloc_type): Use command line options
9675                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9676                 * options.h (--target1-rel, --target1-abs, --target2): New
9677                 ARM-only options.
9678
9679 2009-11-25  Doug Kwan  <dougkwan@google.com>
9680
9681         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9682         class definition.  Add code to handle --target1-rel, --target1-abs
9683         and --target2= options.
9684         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9685         and const.
9686         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9687         member declaration.
9688         (Target_arm::Scan::local, Target_arm::Scan::global,
9689         Target_arm::Relocate::relocate,
9690         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9691         call to Target_arm::get_real_reloc_type.
9692         (Target_arm::get_real_reloc_type): Use command line options to
9693         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9694         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9695         options.
9696
9697 2009-11-25  Doug Kwan  <dougkwan@google.com>
9698
9699         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9700         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9701         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9702         formatting.
9703         (Arm_relocate_functions::thm_call): Replace body with a call to
9704         Arm_relocate_functions::thumb_branch_common.
9705         (Arm_relocate_functions::thm_jump24,
9706         Arm_relocate_functions::thm_xpc22): New method definitions.
9707         (Arm_relocate_functions::thumb_branch_common): New method definition.
9708         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9709         operator.
9710         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9711         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9712
9713 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9714
9715         * Makefile.am: Build incremental-dump
9716         * Makefile.in: Regenerate.
9717         * incremental-dump.cc: New.
9718         * incremental.cc (Incremental_inputs_header_data,
9719         Incremental_inputs_entry_data): Move to incremental.h
9720         * incremental.h: (Incremental_inputs_header_data,
9721         Incremental_inputs_entry_data): Move from incremental.cc
9722
9723 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9724
9725         * incremental.cc (Incremental_inputs_header,
9726         Incremental_inputs_header_write, Incremental_inputs_entry,
9727         Incremental_inputs_entry_write): Add a typedef with the data type.
9728
9729 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9730
9731         * incremental.cc (Incremental_inputs_header,
9732         Incremental_inputs_header_write, Incremental_inputs_entry,
9733         Incremental_inputs_entry_write): Update comment about which
9734         type has the filed descriptions.
9735
9736 2009-11-15  Doug Kwan  <dougkwan@google.com>
9737
9738         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9739         (Arm_relocate_functions::arm_branch_common): Change method defintion
9740         in class definition to a method declaration and update list of formal
9741         parameters.
9742         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9743         Arm_relocation_functions::jump24): Adjust call to
9744         Arm_relocate_functions::arm_branch_common.  Update list of formal
9745         parameters.
9746         (Arm_relocate_functions::xpc25): New method definition.
9747         (Arm_relocate_functions::arm_branch_common): Move method defintion
9748         out from class definition.  Use stubs for mode-switching and extending
9749         branch ranges.
9750         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9751         specially.  Change code to enable use of stubs in ARM branches.
9752
9753 2009-11-10  Doug Kwan  <dougkwan@google.com>
9754
9755         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9756         in method declaration.
9757         (Target_arm::relocate_stub): New method declaration.
9758         (Target_arm::default_target): Change to return a pointer instead of
9759         a const reference.
9760         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9761         Target_arm::default_target.
9762         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9763         method definition.
9764         (Target_arm::relocate_section): Adjust view.
9765         (Target_arm::relocate_stub): New method definition.
9766
9767 2009-11-10  Doug Kwan  <dougkwan@google.com>
9768
9769         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9770         a format warning.
9771         * incremental.cc (open_incremental_binary): Initialized local
9772         variables to avoid warnings.
9773         * object.cc (make_elf_object): Ditto.
9774         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9775         a format warning.
9776
9777 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9778
9779         PR gold/10930
9780         * testsuite/plugin_test.c: Include "config.h".
9781
9782 2009-11-09  Doug Kwan  <dougkwan@google.com>
9783
9784         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9785         (arm_symbol_value): Remove.
9786         (Arm_relocate_functions::arm_branch_common,
9787         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9788         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9789         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9790         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9791         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9792         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9793         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9794         Arm_relocate_functions::thm_mobw_abs_nc,
9795         Arm_relocate_functions::thm_mov_abs,
9796         Arm_relocate_functions::movw_prel_nc,
9797         Arm_relocate_functions::thm_movt_abs,
9798         Arm_relocate_functions::movt_prel,
9799         Arm_relocate_functions::thm_movw_prel_nc,
9800         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9801         (Target_arm::Relocate::relocate): Only decompose address into two
9802         parts if relocation type uses the thumb-bit and pass the actual
9803         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9804         calls to methods in Arm_relocate_functions for this change.
9805
9806 2009-11-08  Ian Lance Taylor  <iant@google.com>
9807
9808         PR 10925
9809         * reloc.cc: Instantiate
9810         Sized_relobj::initialize_input_to_output_maps and
9811         Sized_relobj:free_input_to_output_maps.
9812
9813 2009-11-06  Ian Lance Taylor  <iant@google.com>
9814
9815         PR 10876
9816         * defstd.cc (in_segment): Set only_if_ref true for "end".
9817
9818 2009-11-06  Doug Kwan  <dougkwan@google.com>
9819
9820         * arm.cc (class Reloc_stub): Correct a comment.
9821         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9822         (Target_arm::scan_section_for_stubs): New method declaration.
9823         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9824         Change methods from private to protected.
9825         (Target_arm::do_may_relax): New method definition.
9826         (Target_arm::do_relax, Target_arm::group_sections,
9827         Target_arm::scan_reloc_for_stub,
9828         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9829         (Target_arm::arm_input_section_map_): New data member declaration.
9830         (Target_arm::scan_reloc_for_stub,
9831         Target_arm::scan_reloc_section_for_stubs,
9832         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9833         Target_arm::do_relax): New method definitions.
9834
9835 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9836
9837         * configure.ac: Check for (struct stat)::st_mtim
9838         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9839         * config.in: Regenerate.
9840         * configure: Regenerate.
9841
9842 2009-11-05  Ian Lance Taylor  <iant@google.com>
9843
9844         PR 10910
9845         * output.cc (Output_segment::add_output_section): Add missing
9846         return statement.
9847
9848 2009-11-04  Ian Lance Taylor  <iant@google.com>
9849
9850         PR 10880
9851         * object.h (class Object): Add is_needed and set_is_needed
9852         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9853         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9854         defined in a dynamic object and referenced by a regular object,
9855         set is_needed for the dynamic object.
9856         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9857         if the file is marked with as_needed and it is not needed.
9858
9859 2009-11-04  Ian Lance Taylor  <iant@google.com>
9860
9861         PR 10887
9862         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9863         tags if data is discarded by linker script.
9864         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9865         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9866         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9867         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9868
9869 2009-11-04  Ian Lance Taylor  <iant@google.com>
9870
9871         * layout.cc (Layout::get_output_section): Add is_interp and
9872         is_dynamic_linker_section parameters.  Change all callers.
9873         (Layout::choose_output_section): Likewise.
9874         (Layout::make_output_section): Likewise.
9875         (Layout::add_output_section_data): Add is_dynamic_linker_section
9876         parameter.  Change all callers.
9877         * layout.h (class Layout): Update declarations.
9878         * output.h (class Output_section): Add is_interp, set_is_interp,
9879         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9880         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9881         generate_code_fills_at_write_ to a bitfield.
9882         * output.cc (Output_section::Output_sections): Initialize new
9883         fields.
9884         (Output_segment::add_output_section): Add do_sort parameter.
9885         Change all callers.
9886
9887 2009-11-03  Ian Lance Taylor  <iant@google.com>
9888
9889         PR 10860
9890         * options.h (class General_options): Add --warn-common.
9891         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9892         merging two common symbols.
9893         (Symbol_table::should_override): Handle --warn-common when merging
9894         a common symbol with a defined symbol.  Use report_resolve_problem
9895         for multiple definitions.
9896         (Symbol_table::report_resolve_problem): New function.
9897         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9898
9899 2009-11-03  Doug Kwan  <dougkwan@google.com>
9900
9901         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9902         stub_factory_.
9903         (Target_arm::stub_factory): New method definition.
9904         (Target_arm::new_arm_input_section,
9905         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9906         Target_arm::reloc_uses_thumb_bit): New method declarations.
9907         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9908         New type definitions.
9909         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9910         member declarations.
9911         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9912         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9913         New method definitions.
9914
9915 2009-11-03  Ian Lance Taylor  <iant@google.com>
9916
9917         * options.h (class General_options): Add --warn_constructors.
9918
9919 2009-11-03  Ian Lance Taylor  <iant@google.com>
9920
9921         PR 10893
9922         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9923         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9924
9925 2009-11-03  Ian Lance Taylor  <iant@google.com>
9926
9927         PR 10895
9928         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9929         --msgid-bugs-address.
9930         (install-pdf): New target.
9931         (install-data_yes): Look up one directory to find mkinstalldirs.
9932
9933 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9934
9935         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9936         tree.
9937
9938 2009-10-30  Doug Kwan  <dougkwan@google.com>
9939
9940         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9941
9942 2009-10-30  Doug Kwan  <dougkwan@google.com>
9943
9944         * arm.cc (Stub_addend_reader): New struct template definition
9945         and partial specializations.
9946         (Stub_addend_reader::operator()): New method definition for a
9947         partially specialized template.
9948
9949 2009-10-30  Doug Kwan  <dougkwan@google.com>
9950
9951         * arm.cc (Arm_relobj::processor_specific_flags): New method
9952         definition.
9953         (Arm_relobj::do_read_symbols): New method declaration.
9954         (Arm_relobj::processor_specific_flags_): New data member declaration.
9955         (Arm_dynobj): New class definition.
9956         (Target_arm::do_finalize_sections): Add input_objects parameter.
9957         (Target_arm::do_adjust_elf_header): New method declaration.
9958         (Target_arm::are_eabi_versions_compatible,
9959         (Target_arm::merge_processor_specific_flags): New method declaration.
9960         (Target_arm::do_make_elf_object): New overloaded method definitions
9961         and declaration.
9962         (Arm_relobj::do_read_symbols): New method definition.
9963         (Arm_dynobj::do_read_symbols): Ditto.
9964         (Target_arm::do_finalize_sections): Add input_objects parameters.
9965         Merge processor-specific flags from all input objects.
9966         (Target_arm::are_eabi_versions_compatible,
9967         Target_arm::merge_processor_specific_flags,
9968         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9969         New method definitions.
9970         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9971         Input_objects pointer type parameter.
9972         * layout.cc (Layout::finalize): Pass input objects to target's.
9973         finalize_sections function.
9974         * output.cc (Output_file_header::do_sized_write): Set ELF file
9975         header's processor-specific flags.
9976         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9977         Input_objects pointer type parameter.
9978         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9979         * target.h (Input_objects): New forward class declaration.
9980         (Target::processor_specific_flags,
9981         Target::are_processor_specific_flags_sect): New method definitions.
9982         (Target::finalize_sections): Add input_objects parameter.
9983         (Target::Target): Initialize processor_specific_flags_ and
9984         are_processor_specific_flags_set_.
9985         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9986         parameter.
9987         (Target::set_processor_specific_flags): New method definition.
9988         (Target::processor_specific_flags_,
9989         Target::are_processor_specific_flags_set_): New data member
9990         declarations.
9991         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9992         Input_objects pointer type parameter.
9993
9994 2009-10-30  Doug Kwan  <dougkwan@google.com>
9995
9996         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9997
9998 2009-10-28  Ian Lance Taylor  <iant@google.com>
9999
10000         * object.h (class Relobj): Drop options parameter from
10001         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10002         do_scan_relocs, do_relocate.  Change all callers.
10003         (class Sized_relobj): Drop options parameters from
10004         do_gc_process_relocs, do_scan_relocs, do_relocate,
10005         do_relocate_sections, relocate_sections, emit_relocs_scan,
10006         emit_relocs_scan_reltype.  Change all callers.
10007         (struct Relocate_info): Remove options field and all references to
10008         it.
10009         * reloc.h (class Read_relocs): Remove options constructor
10010         parameter and options_ field.  Change all callers.
10011         (class Gc_process_relocs, class Scan_relocs): Likewise.
10012         (class Relocate_task): Likewise.
10013         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10014         all callers.
10015         (scan_relocatable_relocs): Likewise.
10016         * target.h (class Sized_target): Remove options parameter from
10017         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10018         all callers.
10019         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10020         callers.
10021         * arm.cc: Update functions to remove options parameters.
10022         * i386.cc: Likewise.
10023         * powerpc.cc: Likewise.
10024         * sparc.cc: Likewise.
10025         * x86_64.cc: Likewise.
10026         * testsuite/testfile.cc: Likewise.
10027
10028 2009-10-28  Doug Kwan  <dougkwan@google.com>
10029
10030         * arm.cc (Arm_relobj): New class definition.
10031         (Arm_relobj::scan_sections_for_stubs,
10032         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10033         New method definitions.
10034
10035 2009-10-28  Cary Coutant  <ccoutant@google.com>
10036
10037         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10038         (Plugin::cleanup_done_): New member.
10039         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10040         (Plugin_manager::cleanup_done_): Remove.
10041         (Plugin_manager::add_input_file): Edit error message.
10042         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10043         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10044
10045 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10046
10047         * fileread.cc: (File_read::View::~View): Use the new
10048         data_ownership_ filed.
10049         (File_read::~File_read): Dispose the new whole_file_view_.
10050         (File_read::open): Mmap the whole file if needed.
10051         (File_read::open): Use whole_file_view_ instead of contents_.
10052         (File_read::find_view): Use whole_file_view_ if applicable.
10053         (File_read::do_read): Use whole_file_view_ instead of contents_.
10054         (File_read::make_view): Use whole_file_view_ instead of contents_,
10055         update File_read::View::View call.
10056         (File_read::find_or_make_view): Update File_read::View::View
10057         call.
10058         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10059         remove contents_
10060         (File_read::View::Data_ownership): New enum.
10061         (File_read::View::View): Replace bool mapped_ with Data_ownership
10062         argument.
10063         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10064         (File_read::View::data_ownership_): New field.
10065         (File_read::contents_): Remove (replaced by whole_file_view_).
10066         (File_read::whole_file_view_): New field.
10067         * options.h (class General_options): Add --keep-files-mapped.
10068
10069 2009-10-27  Cary Coutant  <ccoutant@google.com>
10070
10071         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10072         * testsuite/Makefile.am (plugin_test_5): New test case.
10073         * testsuite/Makefile.in: Regenerate.
10074
10075 2009-10-25  Doug Kwan  <dougkwan@google.com>
10076
10077         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10078         from private to protected to allow access by child class.
10079         (Sized_relobj::do_relocate_sections): New method declaration.
10080         (Sized_relobj::relocate_sections): Virtualize.
10081         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10082         Sized_relobj::relocate_sections.  Instantiate template explicitly
10083         for different target sizes and endianity.
10084
10085 2009-10-24  Doug Kwan  <dougkwan@google.com>
10086
10087         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10088         (Arm_input_section::as_arm_input_section): New method.
10089         (Arm_output_section): New class definition.
10090         (Arm_output_section::create_stub_group,
10091         Arm_output_section::group_sections): New method definitions.
10092
10093 2009-10-22  Doug Kwan  <dougkwan@google.com>
10094
10095         * arm.cc (Arm_input_section): New class definition.
10096         (Arm_input_section::init, Arm_input_section:do_write,
10097         Arm_input_section::set_final_data_size,
10098         Arm_input_section::do_reset_address_and_file_offset): New method
10099         definitions.
10100
10101 2009-10-21  Doug Kwan  <dougkwan@google.com>
10102
10103         * arm.cc (Stub_table, Arm_input_section): New forward class
10104         declarations.
10105         (Stub_table): New class defintion.
10106         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10107         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10108         New method definition.
10109
10110 2009-10-21  Doug Kwan  <dougkwan@google.com>
10111
10112         * arm.cc: Update copyright comments.
10113         (Target_arm): New forward class template declaration.
10114         (Arm_address): New type.
10115         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10116         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10117         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10118         constants.
10119         (Insn_template): Same.
10120         (DEF_STUBS): New macro.
10121         (Stub_type): New enum type.
10122         (Stub_template): New class definition.
10123         (Stub): Same.
10124         (Reloc_stub): Same.
10125         (Stub_factory): Same.
10126         (Target_arm::Target_arm): Initialize may_use_blx_ and
10127         should_force_pic_veneer_.
10128         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10129         Target_arm::should_force_pic_veneer,
10130         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10131         Target_arm::using_thumb_only, Target_arm:;default_target): New
10132         method defintions.
10133         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10134         New data member declarations.
10135         (Insn_template::size, Insn_template::alignment): New method defintions.
10136         (Stub_template::Stub_template): New method definition.
10137         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10138         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10139         (Stub_factory::Stub_factory): New method definition.
10140         * gold.h (string_hash): New template.
10141         * output.h (Input_section_specifier::hash_value): Use
10142         gold::string_hash.
10143         (Input_section_specifier::string_hash): Remove.
10144         * stringpool.cc (Stringpool_template::string_hash): Use
10145         gold::string_hash.
10146
10147 2009-10-20  Doug Kwan  <dougkwan@google.com>
10148
10149         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10150         symbols of relaxed input sections.
10151         * output.h (Output_section::find_relaxed_input_section): Make
10152         method public.
10153
10154 2009-10-16  Doug Kwan  <dougkwan@google.com>
10155
10156         * dynobj.cc (Versions::Versions): Initialize version_script_.
10157         Only insert base version symbol definition for a shared object
10158         if version script defines any version versions.
10159         (Versions::define_base_version): New method definition.
10160         (Versions::add_def): Check that base version is not needed.
10161         (Versions::add_need): Define base version lazily.
10162         * dynobj.h (Versions::define_base_version): New method declaration.
10163         (Versions::needs_base_version_): New data member declaration.
10164         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10165         (check_DATA): Add no_version_test.stdout.
10166         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10167         New make rules.
10168         * testsuite/Makefile.in: Regenerate.
10169         * testsuite/no_version_test.c: New file.
10170         * testsuite/no_version_test.sh: Ditto.
10171
10172 2009-10-16  Doug Kwan  <dougkwan@google.com>
10173
10174         * expression.cc (class Segment_start_expression): New class definition.
10175         (Segment_start_expression::value): New method definition.
10176         (script_exp_function_segment_start): Return a new
10177         Segment_start_expression.
10178         * gold/script-c.h (script_saw_segment_start_expression): New function
10179         prototype.
10180         * script-sections.cc (Script_sections::Script_sections): Initialize
10181         SAW_SEGMENT_START_EXPRESSION_ to false.
10182         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10183         and -Tbbs options to specify section addresses if given in
10184         command line and no SEGMENT_START expression is seen in a script.
10185         * script-sections.h (Script_sections::saw_segment_start_expression,
10186         Script_sections::set_saw_segment_start_expression): New method
10187         definition.
10188         (Script_sections::saw_segment_start_expression_): New data member
10189         declaration.
10190         * script.cc (script_saw_segment_start_expression): New function.
10191         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10192         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10193         script_test_7.sh and script_test_8.sh.
10194         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10195         script_test_8.stdout.
10196         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10197         (script_test_6, script_test_6.stdout, script_test_7,
10198         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10199         * Makefile.in: Regenerate.
10200         * testsuite/script_test_6.sh: New file.
10201         * testsuite/script_test_6.t: Same.
10202         * testsuite/script_test_7.sh: Same.
10203         * testsuite/script_test_7.t: Same.
10204         * testsuite/script_test_8.sh: Same.
10205
10206 2009-10-16  Doug Kwan  <dougkwan@google.com>
10207
10208         * output.cc (Output_segment::set_section_list_address): Cast
10209         expressions to unsigned long long type to avoid format warnings.
10210
10211 2009-10-15  Ian Lance Taylor  <iant@google.com>
10212
10213         * script.cc (Script_options::add_symbol_assignment): Always add a
10214         dot assignment to script_sections_.
10215         * script-sections.cc (Script_sections::add_dot_assignment):
10216         Initialize if necessary.
10217
10218         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10219         program headers with no load segment if there is a linker script.
10220
10221         * layout.cc (Layout::set_segment_offsets): Align the file offset
10222         to the segment aligment for -N or -n with no load segment.
10223         * output.cc (Output_segment::add_output_section): Don't crash if
10224         the first section is a TLS section.
10225         (Output_segment::set_section_list_addresses): Print an error
10226         message if the address moves backward in a linker script.
10227         * script-sections.cc
10228         (Output_section_element_input::set_section_addresses): Don't
10229         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10230         (Orphan_output_section::set_section_addresses): Likewise.
10231
10232 2009-10-15  Doug Kwan  <dougkwan@google.com>
10233
10234         * layout.cc (Layout::finish_dynamic_section): Generate tags
10235         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10236         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10237         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10238
10239 2009-10-14  Ian Lance Taylor  <iant@google.com>
10240
10241         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10242         fields.
10243         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10244         data_shdr fields of relinfo.
10245         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10246         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10247         R_386_TLS_LDO_32, adjust based on section flags.
10248         (Target_i386::Relocate::fix_up_ldo): Remove.
10249
10250 2009-10-13  Ian Lance Taylor  <iant@google.com>
10251
10252         Add support for -pie.
10253         * options.h (class General_options): Add -pie and
10254         --pic-executable.
10255         (General_options::output_is_position_independent): Test -pie.
10256         (General_options::output_is_executable): Return true if not shared
10257         and not relocatable.
10258         (General_options::output_is_pie): Remove.
10259         * options.cc (General_options::finalize): Reject incompatible uses
10260         of -pie.
10261         * gold.cc (queue_middle_tasks): A -pie link is not static.
10262         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10263         * symtab.cc (Symbol::final_value_is_known): Return false if
10264         output_is_position_independent.
10265         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10266         output_is_position_independent.
10267         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10268         output_is_position_independent.
10269         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10270         output_is_position_independent.
10271         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10272         two_file_pie_test.
10273         (basic_pie_test.o, basic_pie_test): New targets.
10274         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10275         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10276         (two_file_pie_test): New target.
10277         * testsuite/Makefile.in: Rebuild.
10278         * README: Remove note saying that -pie is not supported.
10279
10280 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10281
10282         * options.h (class General_options): Add -init and -fini.
10283         * layout.cc (Layout::finish_dynamic_section): Emit
10284         given init and fini functions.
10285
10286 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10287
10288         * gc.h (gc_process_relocs): Check if icf is enabled using new
10289         function.
10290         * gold.cc (queue_initial_tasks): Likewise.
10291         (queue_middle_tasks): Likewise.
10292         * object.cc (do_layout): Likewise.
10293         * symtab.cc (is_section_folded): Likewise.
10294         * main.cc (main): Likewise.
10295         * reloc.cc (Read_relocs::run): Likewise.
10296         (Sized_relobj::do_scan_relocs): Likewise.
10297         * icf.cc (is_function_ctor_or_dtor): New function.
10298         (Icf::find_identical_sections): Check if function is ctor or dtor when
10299         safe icf is chosen.
10300         * options.h (General_options::icf): Change option to be an enum.
10301         (Icf_status): New enum.
10302         (icf_enabled): New method.
10303         (icf_safe_folding): New method.
10304         (set_icf_status): New method.
10305         (icf_status_): New variable.
10306         * (options.cc) (General_options::finalize): Set icf_status_.
10307         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10308         icf_test and icf_keep_unique_test to use the --icf enum flag.
10309         * testsuite/icf_safe_test.sh: New file.
10310         * testsuite/icf_safe_test.cc: New file.
10311
10312 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10313
10314         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10315         includes to gc.h and icf.h.
10316         * arm.cc: Include gc.h.
10317         * gold.cc: Likewise.
10318         * i386.cc: Likewise.
10319         * powerpc.cc: Likewise.
10320         * sparc.cc: Likewise.
10321         * x86_64.cc: Likewise.
10322         * gc.h: Include icf.h.
10323
10324 2009-10-11  Ian Lance Taylor  <iant@google.com>
10325
10326         * plugin.cc: Include "gold.h" before other header files.
10327
10328 2009-10-10  Chris Demetriou  <cgd@google.com>
10329
10330         * options.h (Input_file_argument::Input_file_type): New enum.
10331         (Input_file_argument::is_lib_): Replace with...
10332         (Input_file_argument::type_): New member.
10333         (Input_file_argument::Input_file_argument): Take Input_file_type
10334         'type' rather than boolean 'is_lib' as second argument.
10335         (Input_file_argument::is_lib): Use type_.
10336         (Input_file_argument::is_searched_file): New function.
10337         (Input_file_argument::may_need_search): Handle is_searched_file.
10338         * options.cc (General_options::parse_library): Support -l:filename.
10339         (General_options::parse_just_symbols): Update for Input_file_argument
10340         changes.
10341         (Command_line::process): Likewise.
10342         * archive.cc (Archive::get_file_and_offset): Likewise.
10343         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10344         * script.cc (read_script_file, script_add_file): Likewise.
10345         * fileread.cc (Input_file::Input_file): Likewise.
10346         (Input_file::will_search_for): Handle is_searched_file.
10347         (Input_file::open): Likewise.
10348         * readsyms.cc (Read_symbols::get_name): Likewise.
10349         * testsuite/Makefile.am (searched_file_test): New test.
10350         * testsuite/Makefile.in: Regenerate.
10351         * testsuite/searched_file_test.cc: New file.
10352         * testsuite/searched_file_test_lib.cc: New file.
10353
10354 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10355             Ian Lance Taylor  <iant@google.com>
10356
10357         * descriptor.cc: Include <cstdio> and "binary-io.h".
10358         (Descriptors::open): Open the files in binary mode always.
10359         * script.cc (Lex::get_token): Treat \r as whitespace.
10360
10361 2009-10-09  Ian Lance Taylor  <iant@google.com>
10362
10363         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10364
10365 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10366             Ian Lance Taylor  <iant@google.com>
10367
10368         * configure.ac: Check for readv function also.
10369         * fileread.cc (readv): Define if not HAVE_READV.
10370         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10371         does not exist.
10372         * config.in: Regenerate.
10373         * configure: Regenerate.
10374
10375 2009-10-09  Doug Kwan  <dougkwan@google.com>
10376
10377         * layout.cc (Layout::make_output_section): Call target hook to make
10378         ordinary output section.
10379         (Layout::finalize): Adjust parameter list of call the
10380         Target::may_relax().
10381         * layout.h (class Layout::section_list): New method.
10382         * merge.h (Output_merge_base::entsize): Change visibility to public.
10383         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10384         New methods.
10385         (Output_merge_string::do_is_string): New method.
10386         * object.cc (Sized_relobj::do_setup): renamed from
10387         Sized_relobj::set_up.
10388         * object.h (Sized_relobj::adjust_shndx,
10389         Sized_relobj::initializ_input_to_output_maps,
10390         Sized_relobj::free_input_to_output_maps): Change visibilities to
10391         protected.
10392         (Sized_relobj::setup): Virtualize.
10393         (Sized_relobj::do_setup): New method declaration.
10394         (Sized_relobj::invalidate_section_offset,
10395         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10396         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10397         * options.cc (parse_int): New function.
10398         * options.h (parse_int): New declaration.
10399         (DEFINE_int): New macro.
10400         (stub_group_size): New option.
10401         * output.cc (Output_section::Output_section): Initialize memebers
10402         merge_section_map_, merge_section_by_properties_map_,
10403         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10404         (Output_section::add_input_section): Handled deferred code-fill
10405         generation and remove an old comment.
10406         (Output_section::add_relaxed_input_section): New method definition.
10407         (Output_section::add_merge_input_section): Use merge section by
10408         properties map to speed to search.  Update merge section maps
10409         as appropriate.
10410         (Output_section::build_relaxation_map): New method definition.
10411         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10412         Same.
10413         (Output_section::relax_input_section): Renamed to
10414         Output_section::convert_input_sections_to_relaxed_sections and change
10415         interface to take a vector of pointers to relaxed sections.
10416         (Output_section::find_merge_section,
10417         Output_section::find_relaxed_input_section): New method definitions.
10418         (Output_section::is_input_address_mapped,
10419         Output_section::output_offset, Output_section::output_address):
10420         Use output section data maps to speed up searching.
10421         (Output_section::find_starting_output_address): Add comments.
10422         (Output_section::do_write,
10423         Output_section::write_to_postprocessing_buffer): Do code-fill
10424         generation as appropriate.
10425         (Output_section::get_input_sections): Invalidate relaxed input section
10426         map.
10427         (Output_section::restore_states): Adjust type of checkpoint .
10428         Invalidate relaxed input section map.
10429         * output.h (Output_merge_base): New class declaration.
10430         (Input_section_specifier): New class defintion.
10431         (class Output_relaxed_input_section) Change base class to
10432         Output_section_data_build.
10433         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10434         base class initializer.
10435         (Output_section::add_relaxed_input_section): New method declaration.
10436         (Output_section::Input_section): Change visibility to protected.
10437         (Output_section::Input_section::relobj,
10438         Output_section::Input_section::shndx): Handle relaxed input sections.
10439         Output_section::input_sections) Change visibility to protected.  Also
10440         define overload to return a non-const pointer.
10441         (Output_section::Merge_section_properties): New class defintion.
10442         (Output_section::Merge_section_by_properties_map,
10443         Output_section::Output_section_data_by_input_section_map,
10444         Output_section::Relaxation_map): New types.
10445         (Output_section::relax_input_section): Rename method to
10446         Output_section::convert_input_sections_to_relaxed_sections and change
10447         interface to take a vector of relaxed section pointers.
10448         (Output_section::find_merge_section,
10449         Output_section::find_relaxed_input_section,
10450         Output_section::build_relaxation_map,
10451         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10452         New method declarations.
10453         (Output_section::merge_section_map_
10454         Output_section::merge_section_by_properties_map_,
10455         Output_section::relaxed_input_section_map_,
10456         Output_section::is_relaxed_input_section_map_valid_,
10457         Output_section::generate_code_fills_at_write_): New data members.
10458         * script-sections.cc
10459         (Output_section_element_input::set_section_addresses): Call
10460         current_data_size and addralign methods of relaxed input sections.
10461         (Orphan_output_section::set_section_addresses): Call current_data_size
10462         and addralign methods of relaxed input sections.
10463         * symtab.cc (Symbol_table::compute_final_value): Extract template
10464         from the body of Symbol_table::sized_finalize_symbol.
10465         (Symbol_table::sized_finalized_symbol): Call
10466         Symbol_table::compute_final_value.
10467         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10468         (Symbol_table::compute_final_value): New templated method declaration.
10469         * target.cc (Target::do_make_output_section): New method defintion.
10470         * target.h (Target::make_output_section): New method declaration.
10471         (Target::relax): Add more parameters for input objects, symbol table
10472         and layout.  Adjust call to do_relax.
10473         (Target::do_make_output_section): New method declaration.
10474         (Target::do_relax): Add parameters for input objects, symbol table
10475         and layout.
10476
10477 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10478
10479         * pread.c: Include stdio.h.
10480
10481 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10482
10483         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10484         defined.
10485
10486 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10487
10488         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10489         Change read_shndx type to unsigned int.
10490         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10491         int.
10492         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10493         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10494         Change read_shndx type to unsigned int.
10495         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10496         int.
10497         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10498         * layout.cc (Layout::create_symtab_sections): Cast the result of
10499         local_symcount * symsize to off_t in the gold_assert.
10500
10501 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10502
10503         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10504         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10505         R_ARM_BASE_ABS.
10506         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10507         (Arm_relocate_functions::thm_abs5): New function.
10508         (Arm_relocate_functions::abs12): New function.
10509         (Arm_relocate_functions::abs16): New function.
10510         (Arm_relocate_functions::base_abs): New function.
10511         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10512         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10513         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10514         R_ARM_BASE_ABS.
10515         (Scan::global): Likewise.
10516         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10517         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10518         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10519         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10520         R_ARM_BASE_ABS.
10521
10522 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10523
10524         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10525         (Arm_relocate_functions::movt_prel): New function.
10526         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10527         (Arm_relocate_functions::thm_movt_prel): New function.
10528         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10529         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10530         (Scan::global, Relocate::relocate): Likewise.
10531         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10532
10533 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10534
10535         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10536         Incremental_checker.
10537         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10538         unsigned int.
10539         (class Incremental_inputs_header): New class.
10540         (Incremental_inputs_header_writer): Edit comment.
10541         (Incremental_inputs_entry): New class.
10542         (Incremental_inputs_entry_writer): Edit comment.
10543         (Sized_incremental_binary::do_find_incremental_inputs_section):
10544         Add *strtab_shndx parameter, fill it.
10545         (Sized_incremental_binary::do_check_inputs): New method.
10546         (Incremental_checker::can_incrementally_link_output_file): Use
10547         Sized_incremental_binary::check_inputs.
10548         (Incremental_inputs::report_command_line): Save command line in
10549         command_line_.
10550         * incremental.h:
10551         (Incremental_binary::find_incremental_inputs_section): New
10552         method.
10553         (Incremental_binary::do_find_incremental_inputs_section): Add
10554         strtab_shndx parameter.
10555         (Incremental_binary::do_check_inputs): New pure virtual method.
10556         (Sized_incremental_binary::do_check_inputs): Declare.
10557         (Incremental_checker::Incremental_checker): Add incremental_inputs
10558         parameter, use it to initialize incremental_inputs_.
10559         (Incremental_checker::incremental_inputs_): New field.
10560         (Incremental_checker::command_line): New method.
10561         (Incremental_checker::inputs): New method.
10562         (Incremental_checker::command_line_): New field.
10563
10564 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10565
10566         * incremental.cc: Include <cstdarg> and "target-select.h".
10567         (vexplain_no_incremental): New function.
10568         (explain_no_incremental): New function.
10569         (Incremental_binary::error): New method.
10570         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10571         method.
10572         (make_sized_incremental_binary): New function.
10573         (open_incremental_binary): New function.
10574         (can_incrementally_link_file): Add checks if output is ELF and has
10575         inputs section.
10576         * incremental.h: Include "elfcpp_file.h" and "output.h".
10577         (Incremental_binary): New class.
10578         (Sized_incremental_binary): New class.
10579         (open_incremental_binary): Declare.
10580         * object.cc (is_elf_object): Use
10581         elfcpp::Elf_recognizer::is_elf_file.
10582         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10583         * output.h (Output_file::filesize): New method.
10584
10585 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10586
10587         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10588         New function.
10589         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10590         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10591         function.
10592         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10593         function.
10594         (Arm_relocate_functions::movw_abs_nc): New function.
10595         (Arm_relocate_functions::movt_abs): New function.
10596         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10597         (Arm_relocate_functions::thm_movt_abs): New function.
10598         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10599         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10600         (Scan::global): Likewise.
10601         (Relocate::relocate): Likewise.
10602         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10603
10604 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10605
10606         * arm.cc (Arm_relocate_functions::got_prel) New function.
10607         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10608         (Relocate::relocate): Likewise.
10609         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10610
10611 2009-10-06  Ian Lance Taylor  <iant@google.com>
10612
10613         * options.h (class General_options): Define
10614         split_stack_adjust_size parameter.
10615         * object.h (class Object): Add uses_split_stack_ and
10616         has_no_split_stack_ fields.  Add uses_split_stack and
10617         has_no_split_stack accessor functions.  Declare
10618         handle_split_stack_section.
10619         (class Reloc_symbol_changes): Define.
10620         (class Sized_relobj): Define Function_offsets.  Declare
10621         split_stack_adjust, split_stack_adjust_reltype, and
10622         find_functions.
10623         * object.cc (Object::handle_split_stack_section): New function.
10624         (Sized_relobj::do_layout): Call handle_split_stack_section.
10625         * dynobj.cc (Sized_dynobj::do_layout): Call
10626         handle_split_stack_section.
10627         * reloc.cc (Sized_relobj::relocate_sections): Call
10628         split_stack_adjust for executable sections in split_stack
10629         objects.  Pass reloc_map to relocate_section.
10630         (Sized_relobj::split_stack_adjust): New function.
10631         (Sized_relobj::split_stack_adjust_reltype): New function.
10632         (Sized_relobj::find_functions): New function.
10633         * target-reloc.h: Include "object.h".
10634         (relocate_section): Add reloc_symbol_changes parameter.  Change
10635         all callers.
10636         * target.h (class Target): Add calls_non_split method.  Declare
10637         do_calls_non_split virtual method.  Declare match_view and
10638         set_view_to_nop.
10639         * target.cc: Include "elfcpp.h".
10640         (Target::do_calls_non_split): New function.
10641         (Target::match_view): New function.
10642         (Target::set_view_to_nop): New function.
10643         * gold.cc (queue_middle_tasks): Give an error if mixing
10644         split-stack and non-split-stack objects with -r.
10645         * i386.cc (Target_i386::relocate_section): Add
10646         reloc_symbol_changes parameter.
10647         (Target_i386::do_calls_non_split): New function.
10648         * x86_64.cc (Target_x86_64::relocate_section): Add
10649         reloc_symbol_changes parameter.
10650         (Target_x86_64::do_calls_non_split): New function.
10651         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10652         parameter.
10653         * powerpc.cc (Target_powerpc::relocate_section): Add
10654         reloc_symbol_changes parameter.
10655         * sparc.cc (Target_sparc::relocate_section): Add
10656         reloc_symbol_changes parameter.
10657         * configure.ac: Call AM_CONDITIONAL for the default target.
10658         * configure: Rebuild.
10659         * testsuite/Makefile.am (TEST_AS): New variable.
10660         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10661         (check_DATA): Add split_i386 and split_x86_64 files.
10662         (SPLIT_DEFSYMS): Define.
10663         (split_i386_[1234n].o): New targets.
10664         (split_i386_[124]): New targets.
10665         (split_i386_[1234r].stdout): New targets.
10666         (split_x86_64_[1234n].o): New targets.
10667         (split_x86_64_[124]): New targets.
10668         (split_x86_64_[1234r].stdout): New targets.
10669         (MOSTLYCLEANFILES): Add new executables.
10670         * testsuite/split_i386.sh: New file.
10671         * testsuite/split_x86_64.sh: New file.
10672         * testsuite/split_i386_1.s: New file.
10673         * testsuite/split_i386_2.s: New file.
10674         * testsuite/split_i386_3.s: New file.
10675         * testsuite/split_i386_4.s: New file.
10676         * testsuite/split_i386_n.s: New file.
10677         * testsuite/split_x86_64_1.s: New file.
10678         * testsuite/split_x86_64_2.s: New file.
10679         * testsuite/split_x86_64_3.s: New file.
10680         * testsuite/split_x86_64_4.s: New file.
10681         * testsuite/split_x86_64_n.s: New file.
10682         * testsuite/testfile.cc (Target_test): Update relocation_section
10683         function.
10684         * testsuite/Makefile.in: Rebuild.
10685
10686 2009-10-06  Ian Lance Taylor  <iant@google.com>
10687
10688         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10689         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10690         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10691         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10692         the address on ldo_addrs_.
10693         (Target_i386::Relocate::fix_up_ldo): New function.
10694
10695 2009-10-06   Rafael Espindola  <espindola@google.com>
10696
10697         * plugin.cc (add_input_library): New.
10698         (Plugin::load): Add add_input_library to tv.
10699         (Plugin_manager::add_input_file): Add the is_lib argument.
10700         (add_input_file): Update call to Plugin_manager::add_input_file.
10701         (add_input_library): New.
10702         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10703
10704 2009-09-30  Doug Kwan  <dougkwan@google.com>
10705
10706         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10707         symbol and call Symbol::may_need_copy_reloc to determine if
10708         a copy reloc is needed.
10709         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10710         nocopyreloc is given in command line.
10711         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10712         given in command line.
10713         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10714         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10715         of the removed Target_i386::may_need_copy_reloc.
10716         * options.h (copyreloc): New option with default value false.
10717         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10718         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10719         instead of the removed Target_powerpc::may_need_copy_reloc.
10720         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10721         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10722         instead of the removed Target_sparc::may_need_copy_reloc.
10723         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10724         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10725         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10726         instead of the removed Target_x86_64::may_need_copy_reloc.
10727
10728 2009-09-30  Ian Lance Taylor  <iant@google.com>
10729
10730         * object.h (class Object): Remove target_ field, and target,
10731         sized_target, and set_target methods.
10732         (Object::sized_target): Remove.
10733         (class Sized_relobj): Update declarations.  Remove sized_target.
10734         * object.cc (Sized_relobj::setup): Remove target parameter.
10735         Change all callers.
10736         (Input_objects::add_object): Don't do anything with the target.
10737         (make_elf_sized_object): Add punconfigured parameter.  Change all
10738         callers.  Set or test parameter target.
10739         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10740         Change all callers.
10741         * parameters.cc (Parameters::set_target): Change parameter type to
10742         be non-const.
10743         (Parameters::default_target): Remove.
10744         (set_parameters_target): Change parameter type to be non-const.
10745         (parameters_force_valid_target): New function.
10746         (parameters_clear_target): New function.
10747         * parameters.h (class Parameters): Update declarations.  Remove
10748         default_target method.  Add sized_target and clear_target
10749         methods.  Change target_ to be non-const.
10750         (set_parameters_target): Update declaration.
10751         (parameters_force_valid_target): Declare.
10752         (parameters_clear_target): Declare.
10753         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10754         as NULL if we aren't searching.
10755         (Add_symbols::run): Don't check for compatible target.
10756         * fileread.cc (Input_file::open_binary): Call
10757         parameters_force_valid_target.
10758         * gold.cc (queue_middle_tasks): Likewise.
10759         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10760         set_target on object.
10761         * dynobj.h (class Sized_dynobj): Update declarations.
10762         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10763         make_elf_object returns NULL.
10764         (Archive::include_member): Don't check whether object target is
10765         compatible.
10766         * output.cc (Output_section::add_input_section): Get target from
10767         parameters.
10768         (Output_section::relax_input_section): Likewise.
10769         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10770         parameters.
10771         (Sized_relobj::do_scan_relocs): Likewise.
10772         (Sized_relobj::relocate_sections): Likewise.
10773         * resolve.cc (Symbol_table::resolve): Likewise.
10774         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10775         parameter.  Change all callers.
10776         (Symbol_table::add_from_object): Get target from parameters.
10777         (Symbol_table::add_from_relobj): Don't check object target.
10778         (Symbol_table::add_from_dynobj): Likewise.
10779         (Symbol_table::define_special_symbol): Get target from
10780         parameters.
10781         * symtab.h (class Symbol_table): Update declaration.
10782         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10783         parameter.  Change all callers.  Clear parameter target.
10784         (Binary_test): Test target here.
10785         * testsuite/object_unittest.cc (gold_testsuite): Remove
10786         target_test_pointer parameter.  Change all callers.
10787         (Object_test): Test target here.
10788
10789 2009-09-26  Ian Lance Taylor  <iant@google.com>
10790
10791         * testsuite/initpri1.c: Don't try to use constructor priorities if
10792         compiling with gcc before 4.3.
10793
10794 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10795
10796         * testsuite/retain_symbols_file_test.sh (check_present): Change
10797         output file name to retain_symbols_file_test.stdout.
10798         (check_absent): Likewise.
10799
10800 2009-09-18  Craig Silverstein  <csilvers@google.com>
10801
10802         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10803         * options.cc: Include <cerrno> and <fstream>.
10804         (General_options::finalize): Parse -retain-symbols-file tag.
10805         * options.h: New flag.
10806         (General_options): New method should_retain_symbol, new
10807         variable symbols_to_retain.
10808         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10809         should_retain_symbol map.
10810         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10811         * testsuite/Makefile.in: Regenerate.
10812         * testsuite/retain_symbols_file_test.sh: New file.
10813
10814 2009-09-18  Nick Clifton  <nickc@redhat.com>
10815
10816         * po/es.po: Updated Spanish translation.
10817
10818 2009-09-17  Doug Kwan  <dougkwan@google.com>
10819
10820         * debug.h (DEBUG_RELAXATION): New constant.
10821         (DEBUG_ALL): Add DEBUG_RELAXATION.
10822         (debug_string_to_enum): Add relaxation debug option.
10823         * layout.cc
10824         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10825         Layout::Relaxation_debug_check::read_sections,
10826         Layout::Relaxation_debug_check::read_sections): New method definitions.
10827         (Layout::Layout): Initialize data members
10828         record_output_section_data_from_scrips_,
10829         script_output_section_data_list_ and relaxation_debug_check_.
10830         (Layout::save_segments, Layout::restore_segments,
10831         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10832         Layout::relaxation_loop_body): New method definitions.
10833         (Layout::finalize): Support relaxation.  Move section layout code to
10834         Layout::relaxation_loop_body.
10835         (Layout::set_asection_address_from_script): Move code for orphan
10836         section placement out.
10837         (Layout::place_orphan_sections_in_script): New method definition.
10838         * layout.h (Output_segment_headers, Output_file_header):
10839         New forward class declarations.
10840         (Layout::~Layout): Define.
10841         (Layout::new_output_section_data_from_script): New method definition.
10842         (Layout::place_orphan_sections_in_script): New method declaration.
10843         (Layout::Segment_states): New type declaration.
10844         (Layout::save_segments, Layout::restore_segments,
10845         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10846         Layout::relaxation_loop_body): New method declarations.
10847         (Layout::Output_section_data_list): New type declaration.
10848         (Layout::Relaxation_debug_check): New class definition.
10849         (Layout::record_output_section_data_from_script_,
10850         Layout::script_output_section_data_list_, Layout::segment_states_,
10851         Layout::relaxation_debug_check_): New data members.
10852         * output.cc: (Output_section_headers::do_size): New method definition.
10853         (Output_section_headers::Output_section_headers): Move size
10854         computation to Output_section_headers::do_size.
10855         (Output_segment_headers::do_size): New method definition.
10856         (Output_file_header::Output_file_header): Move size computation to
10857         Output_file_header::do_size and call it.
10858         (Output_file_header::do_size): New method definition.
10859         (Output_data_group::Output_data_group): Adjust call to
10860         Output_section_data.
10861         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10862         (Output_symtab_xindex::do_write): Add array bound check.
10863         (Output_section::Input_section::print_to_mapfile): Handle
10864         RELAXED_INPUT_SECTION_CODE.
10865         (Output_section::Output_section): Initialize data member checkpoint_.
10866         (Output_section::~Output_section): Delete checkpoint object pointed
10867         by checkpoint_.
10868         (Output_section::add_input_section): Always add an Input_section if
10869         relaxing.
10870         (Output_section::add_merge_input_section): Add assert.
10871         (Output_section::relax_input_section): New method definition.
10872         (Output_section::set_final_data_size): Set load address to zero for
10873         an unallocated section.
10874         (Output_section::do_address_and_file_offset_have_reset_values):
10875         New method definition.
10876         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10877         Handle relaxed input section.
10878         (Output_section::sort_attached_input_sections): Checkpoint input
10879         section list lazily.
10880         (Output_section::get_input_sections): Change type of input_sections to
10881         list of Simple_input_section pointers.  Checkpoint input section list
10882         lazily.  Also handle relaxed input sections.
10883         (Output_section::add_input_section_for_script): Take a reference to
10884         a Simple_input_section object instead of Relobj pointer and section
10885         index as parameter.  Handle relaxed input sections.
10886         (Output_section::save_states, Output_section::restore_states): New
10887         method definitions.
10888         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10889         (Output_data::is_data_size_fixed): New method definition.
10890         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10891         if it is fixed.
10892         (Output_data::address_and_file_offset_have_reset_values): New method
10893         definition.
10894         (Output_data::do_address_and_file_offset_have_reset_values): New method
10895         definition.
10896         (Output_data::set_data_size): Check that data size is not fixed.
10897         (Output_data::fix_data_size): New method definition.
10898         (Output_data::is_data_size_fixed_): New data member.
10899         (Output_section_headers::set_final_data_size): New method definition.
10900         (Output_section_headers::do_size): New method declaration.
10901         (Output_segment_headers::set_final_data_size): New method definition.
10902         (Output_segment_headers::do_size): New method declaration.
10903         (Output_file_header::set_final_data_size)::New method definition.
10904         (Output_file_header::do_size)::New method declaration.
10905         (Output_section_data::Output_section_data): Add new parameter
10906         is_data_size_fixed and use it to fix data size.
10907         (Output_data_const::Output_data_const): Adjust call to base class
10908         constructor and fix data size.
10909         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10910         base class constructor and fix data size.
10911         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10912         base class constructor and fix data size.
10913         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10914         class constructor and fix data size.
10915         (Output_data_group::set_final_data_size): New method definition.
10916         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10917         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10918         class constructor and fix data size.
10919         (Output_relaxed_input_section): New class definition.
10920         (Output_section::Simple_input_section): New class definition.
10921         (Output_section::get_input_sections): Adjust parameter list.
10922         (Output_section::add_input_section_for_script): Same.
10923         (Output_section::save_states, Output_section::restore_states,
10924         Output_section::do_address_and_file_offset_have_reset_values,
10925         (Output_section::Input_section::Input_section): Handle
10926         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10927         Output_relaxed_input_section.
10928         (Output_section::Input_section::is_input_section,
10929         Output_section::Input_section::set_output_section): Handle relaxed
10930         input section.
10931         (Output_section::Input_section::is_relaxed_input_section,
10932         Output_section::Input_section::output_section_data,
10933         Output_section::Input_section::relaxed_input_section): New method
10934         definitions.
10935         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10936         value.
10937         (Output_section::Input_section::u1_): Update comments.
10938         (Output_section::Input_section::u2_): Add new union member poris.
10939         (Output_section::Checkpoint_output_section): New classs definition.
10940         (Output_section::relax_input_section): New method declaration.
10941         (Output_section::checkpoint_): New data member.
10942         (Output_segment): Update comments.
10943         (Output_segment::Output_segment): Un-privatize copy constructor.
10944         (Output_segment::operator=): Un-privatize.
10945         * script-sections.cc (Output_section_element::Input_section_list):
10946         Change element type to Output_section::Simple_input_section.
10947         (Output_section_element_dot_assignment::set_section_addresses):
10948         Register output section data for relaxation clean up.
10949         (Output_data_exression::Output_data_expression): Adjust call to base
10950         constructor to fix data size.
10951         (Output_section_element_data::set_section_addresses): Register
10952         Output_data_expression object for relaxation clean up.
10953         (struct Input_section_info): Replace Relobj pointer and section index
10954         pair with Output_section::Simple_input_section and Convert struct to a
10955         class.
10956         (Input_section_sorter::operator()): Adjust access to
10957         Input_section_info data member to use accessors.
10958         (Output_section_element_input::set_section_addresses): Use layout
10959         parameter.  Adjust code to use Output_section::Simple_input_section
10960         and Input_secction_info classes.  Register filler for relaxation
10961         clean up.
10962         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10963         and section index pair with Output_section::Simple_input_section
10964         class.  Adjust code accordingly.
10965         (Phdrs_element::release_segment): New method definition.
10966         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10967         segment list.
10968         (Script_sections::release_segments): New method definition.
10969         * gold/script-sections.h (Script_sections::release_segments): New
10970         method declaration.
10971         * gold/target.h (Target::may_relax, Target::relax,
10972         Target::do_may_relax, Target::do_relax): New method definitions.
10973
10974 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10975
10976         * arm.cc (has_signed_unsigned_overflow): New function.
10977         (Arm_relocate_functions::abs8): New function.
10978         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10979         (Target_arm::Scan::global): Likewise.
10980         (Target_arm::relocate::relocate): Likewise.
10981         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10982         Likewise.
10983
10984 2009-09-16  Cary Coutant  <ccoutant@google.com>
10985
10986         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10987         * testsuite/Makefile.in: Regenerate.
10988
10989 2009-09-11  Nick Clifton  <nickc@redhat.com>
10990
10991         * po/gold.pot: Updated by the Translation project.
10992
10993 2009-09-08  Cary Coutant  <ccoutant@google.com>
10994
10995         * output.cc (Output_file::open): Add execute permission to empty file.
10996         * testsuite/Makefile.am (permission_test): New test.
10997         * testsuite/Makefile.in: Regenerate.
10998
10999 2009-09-02  Ian Lance Taylor  <iant@google.com>
11000
11001         * output.cc (Output_file::resize): Call map_no_anonymous rather
11002         than map.
11003
11004 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11005
11006         * gold.cc: Include "incremental.h".
11007         (queue_initial_tasks): Call Incremental_checker methods.
11008         * incremental.cc: Include "output.h".
11009         (Incremental_checker::can_incrementally_link_output_file): New
11010         method.
11011         * incremental.h (Incremental_checker): New class.
11012
11013         * output.cc (Output_file::open_for_modification): New method.
11014         (Output_file::map_anonymous): Changed return type to bool.  Record
11015         map in base_ field.
11016         (Output_file::map_no_anonymous): New method, broken out of map.
11017         (Output_file::map): Use map_no_anonymous and map_anonymous.
11018         * output.h (class Output_file): Update declarations.
11019
11020 2009-08-24  Cary Coutant  <ccoutant@google.com>
11021
11022         * options.h (Command_line::Pre_options): New class.
11023         (Command_line::pre_options): New member.
11024         * options.cc (gold::options::ready_to_register): New variable.
11025         (One_option::register_option): Do nothing if not registering options.
11026         Assert if same short option registered twice.
11027         (General_options::General_options): Turn off option registration when
11028         done constructing.
11029         (Command_line::Pre_options::Pre_options): New constructor.
11030
11031 2009-08-24  Cary Coutant  <ccoutant@google.com>
11032
11033         * options.h (General_options::no_keep_memory): Remove incorrect
11034         short option.
11035
11036 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11037
11038         * Makefile.am (am__skiplex, am__skipyacc): New.
11039         * Makefile.in: Regenerate.
11040
11041 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11042
11043         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11044         (INCLUDES): ... this.
11045         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11046         (AM_CPPFLAGS): Renamed from ...
11047         (INCLUDE): ... this.
11048         * Makefile.in, testsuite/Makefile.in: Regenerate.
11049
11050         * Makefile.in: Regenerate.
11051         * aclocal.m4: Likewise.
11052         * config.in: Likewise.
11053         * configure: Likewise.
11054         * testsuite/Makefile.in: Likewise.
11055
11056         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11057         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11058         * Makefile.in: Regenerate.
11059         * testsuite/Makefile.in: Regenerate.
11060
11061 2009-08-19  Cary Coutant  <ccoutant@google.com>
11062
11063         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11064         symbols in shared libraries overridden by hidden or internal symbols
11065         in the main program.
11066
11067 2009-08-19  Chris Demetriou  <cgd@google.com>
11068
11069         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11070         checking source file names in error messages.
11071
11072 2009-08-18  Doug Kwan  <dougkwan@google.com>
11073
11074         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11075         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11076         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11077         an elfcpp::Ehdr as parameter.
11078         * object.cc (Object::set_target): Remove the version that looks up
11079         a target and sets it.
11080         (Sized_relobj::setup): Take a Target object instead of
11081         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11082         (make_elf_sized_object): Find target and ask target to
11083         make an ELF object.
11084         * object.h: (Object::set_target): Remove the version that looks up
11085         a target and sets it.
11086         (Sized_relobj::setup): Take a Target object instead of
11087         an elfcpp:Ehdr as parameter.
11088         * target.cc: Include dynobj.h.
11089         (Target::do_make_elf_object_implementation): New.
11090         (Target::do_make_elf_object): New.
11091         * target.h (Target::make_elf_object): New template declaration.
11092         (Target::do_make_elf_object): New method declarations.
11093         (Target::do_make_elf_object_implementation): New template declaration.
11094
11095 2009-08-14  Ian Lance Taylor  <iant@google.com>
11096
11097         * gold.h (FUNCTION_NAME): Define.
11098         (gold_unreachable): Use FUNCTION_NAME.
11099
11100 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11101
11102         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11103         symbol in the --keep-unique list is not found.
11104
11105 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11106
11107         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11108         been maked as --keep-unique.
11109         (Icf::unfold_section): New function.
11110         * icf.h (Icf::unfold_section): New function.
11111         * options.h (General_options::keep_unique): New option.
11112         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11113         * testsuite/Makefile.in: Regenerate.
11114         * testsuite/icf_keep_unique_test.sh: New file.
11115         * testsuite/icf_keep_unique_test.cc: New file.
11116
11117 2009-08-12  Cary Coutant  <ccoutant@google.com>
11118
11119         PR 10471
11120         * resolve.cc (Symbol_table::resolve): Check for references from
11121         dynamic objects to hidden and internal symbols.
11122         * testsuite/Makefile.am (hidden_test.sh): New test.
11123         * testsuite/Makefile.in: Regenerate.
11124         * testsuite/hidden_test.sh: New script.
11125         * testsuite/hidden_test_1.c: New test source.
11126         * testsuite/hidden_test_main.c: New test source.
11127
11128 2009-08-11  Doug Kwan  <dougkwan@google.com>
11129
11130         * arm.cc: Update comments.
11131         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11132         segment to locate the .ARM.exidx section if present.
11133
11134 2009-08-09  Doug Kwan  <dougkwan@google.com>
11135
11136         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11137         patch.
11138
11139 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11140         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11141         compiler warnings.
11142
11143 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11144
11145         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11146         valid tls_segment only for non-debug-section relocations.
11147         * testsuite/Makefile.am: Add gc_tls_test.
11148         * testsuite/Makefile.in: Regenerate.
11149         * testsuite/gc_tls_test.cc: New file.
11150         * testsuite/gc_tls_test.sh: New file.
11151
11152 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11153
11154         * icf.cc: New file.
11155         * icf.h: New file.
11156         * Makefile.am (CCFILES): Add icf.cc.
11157         (HFILES): Add icf.h
11158         * Makefile.in: Regenerate.
11159         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11160         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11161         section, symbol and addend information for the relocs.
11162         * gold.cc (queue_middle_tasks): Call identical code folding.
11163         * gold.h: Add defines for multimap.
11164         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11165         to the call of finalize_local_symbols.
11166         * main.cc (main): Create object of class Icf.
11167         * object.cc (Sized_relobj::do_layout): Allow this function to be
11168         called twice during icf.
11169         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11170         to sections marked as identical by icf.
11171         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11172         when available.
11173         (Sized_relobj::do_section_entsize): New function.
11174         * object.h (Object::section_entsize): New function.
11175         (Object::do_section_entsize): New pure virtual function.
11176         (Relobj::finalize_local_symbols): Add new parameter.
11177         (Relobj::do_section_entsize): New function.
11178         * options.h (General_options::icf): New option.
11179         (General_options::icf_iterations): New option.
11180         (General_options::print_icf_sections): New option.
11181         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11182         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11183         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11184         icf.
11185         * symtab.cc (Symbol_table::is_section_folded): New function.
11186         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11187         to sections marked as identical by icf.
11188         * symtab.h (Symbol_table::set_icf): New function.
11189         (Symbol_table::icf): New function.
11190         (Symbol_table::is_section_folded): New function.
11191         (Symbol_table::icf_): New data member.
11192         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11193         * testsuite/Makefile.am: Add commands to build icf_test.
11194         * testsuite/Makefile.in: Regenerate.
11195         * testsuite/icf_test.sh: New file.
11196         * testsuite/icf_test.cc: New file.
11197
11198 2009-07-24  Chris Demetriou  <cgd@google.com>
11199
11200         * layout.cc (is_compressible_debug_section): Fix incorrect
11201         comment about compressed section names.
11202
11203 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11204
11205         PR 10419
11206         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11207
11208 2009-07-16  Ian Lance Taylor  <iant@google.com>
11209
11210         PR 10400
11211         * layout.h: #include <map>.
11212         (class Kept_section): Change from struct to class.  Add accessors
11213         and setters.  Add section size to Comdat_group mapping.  Change
11214         Comdat_group to std::map.  Add is_comdat_ field.  Add
11215         linkonce_size field in union.
11216         (class Layout): Update declaration of find_or_add_kept_section.
11217         Don't declare find_kept_object.
11218         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11219         parameter.  Add object, shndx, is_comdat, and is_group_name
11220         parameters.  Change all callers.  Adjust for new Kept_section.
11221         (Layout::find_kept_object): Remove.
11222         * object.cc (Sized_relobj::include_section_group): Update use of
11223         Kept_section.  Rename secnum to shndx.  Only record
11224         Kept_comdat_section if sections are the same size.
11225         (Sized_relobj::include_linkonce_section): Update use of
11226         Kept_section.  Only record Kept_comdat_section if sections are the
11227         same size.  Set size of linkonce section.
11228         (Sized_relobj::map_to_kept_section): Update call to
11229         get_kept_comdat_section.
11230         * object.h (class Sized_relobj): Rename fields in
11231         Kept_comdat_section to drop trailing underscores; change object
11232         field to Relobj*.  Change Kept_comdat_section_table to store
11233         struct rather than pointer.
11234         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11235         Add kept_object and kept_shndx parameters.  Change all callers.
11236         (Sized_relobj::get_kept_comdat_section): Change return type to
11237         bool.  Add kept_object and kept_shndx parameters.  Change all
11238         callers.
11239         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11240         Layout::find_or_add_kept_section.
11241
11242 2009-07-09  Ian Lance Taylor  <iant@google.com>
11243
11244         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11245         Reserve space in the hash table.
11246
11247 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11248
11249         * fileread.cc (File_read::get_mtime): New method.
11250         * fileread.h (Timespec): New structure.
11251         (File_read::get_mtime): New method.
11252         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11253         Renamed from timestamp_nsec.
11254         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11255         Elf_Xword.
11256         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11257         timestamp_nsec.
11258         (Incremental_inputs::report_archive): Save mtime; style fix.
11259         (Incremental_inputs::report_obejct): Save mtime; style fix.
11260         (Incremental_inputs::report_script): Save mtime; style fix.
11261         (Incremental_inputs::finalize_inputs): Style fix.
11262         (Incremental_inputs::finalize): Style fix.
11263         (Incremental_inputs::create_input_section_data): Store inputs
11264         mtime.
11265         * incremental.h (Incremental_inputs::report_script): Add mtime
11266         argument.
11267         (Incremental_inputs::Input_info::Input_info): Intialize only one
11268         union member.
11269         (Incremental_inputs::Input_info::archive): Move to nameless
11270         union.
11271         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11272         (Incremental_inputs::Input_info::script): Move to nameless union.
11273         (Incremental_inputs::mtime): New field.
11274         * script.cc (read_input_script): Pass file mtime to
11275         Incremental_input.
11276         * script.h (Script_info::inputs): Style fix.
11277
11278 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11279
11280         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11281         instead of 32.
11282
11283 2009-06-24  Ian Lance Taylor  <iant@google.com>
11284
11285         PR 10156
11286         * layout.cc (Layout::choose_output_section): If we find an
11287         existing section, update the flags.
11288         (Layout::create_notes): New function, broken out of
11289         Layout::finalize.
11290         (Layout::finalize): Don't create note sections.
11291         (Layout::create_note): Don't crash if linker script discards
11292         section.
11293         (Layout::create_gold_note): Likewise.
11294         (Layout::create_build_id): Likewise.  Don't set
11295         after_input_sections on the section.
11296         (Layout::create_executable_stack_info): Remove target parameter.
11297         Change caller.
11298         * layout.h (class Layout): Declare create_notes.  Update
11299         declaration of create_executable_stack_info.
11300         * gold.cc (queue_middle_tasks): Call create_notes.
11301         * output.cc (Output_section::update_flags_for_input_section): Move
11302         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11303         invalid.
11304         * output.h (Output_data::mark_address_invalid): New function.
11305         (class Output_section): Only declare, not define,
11306         update_flags_for_input_section.  Remove set_flags.
11307
11308 2009-06-24  Ian Lance Taylor  <iant@google.com>
11309
11310         * script-sections.cc (Output_section_definition::
11311         set_section_addresses): Rename shadowing local load_address to
11312         laddr.
11313
11314 2009-06-24  Ian Lance Taylor  <iant@google.com>
11315
11316         PR 10244
11317         * reloc.cc (relocate_sections): Skip empty relocation sections.
11318
11319 2009-06-23  Ian Lance Taylor  <iant@google.com>
11320
11321         PR 10156
11322         * layout.cc (Layout::create_note): Use choose_output_section
11323         rather than make_output_section.
11324
11325 2009-06-23  Ian Lance Taylor  <iant@google.com>
11326
11327         PR 10237
11328         * options.cc (General_options::parse_V): Set printed_version_.
11329         (General_options::General_options): Initialize printed_version_.
11330         * options.h (class General_options): Add printed_version_ field.
11331         * gold.cc (queue_initial_tasks): If there are no input files,
11332         don't give a fatal error if we printed the version information.
11333         (queue_middle_tasks): If using -r with a shared object, give a
11334         fatal error rather than an ordinary error.
11335
11336 2009-06-23  Ian Lance Taylor  <iant@google.com>
11337
11338         PR 10219
11339         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11340         (Layout::make_output_section): Set have_stabstr_section_ if we see
11341         a .stab*str section.
11342         (Layout::finalize): Call link_stabs_sections.
11343         (Layout::link_stabs_sections): New file.
11344         * layout.h (class Layout): Add have_stabstr_section_ field.
11345         Declare link_stabs_sections.
11346
11347 2009-06-23  Doug Kwan  <dougkwan@google.com>
11348
11349         * Makefile.am (libgold_a_LIBADD): New.
11350         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11351         * Makefile.in: Regenerate.
11352         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11353         * configure: Regenerate.
11354         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11355         * fileread.cc: Include sys/state.h
11356         * gold.h: Declare memmem and strndup if found missing.
11357         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11358
11359 2009-06-23  Ian Lance Taylor  <iant@google.com>
11360
11361         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11362         * configure: Rebuild.
11363
11364 2009-06-23  Ian Lance Taylor  <iant@google.com>
11365
11366         PR 10147
11367         * object.cc (Object::section_contents): Don't try to get a view if
11368         the section has length zero.
11369         (Object::handle_gnu_warning_section): If the section is empty, use
11370         the name of the section as the warning.
11371
11372 2009-06-23  Ian Lance Taylor  <iant@google.com>
11373
11374         PR 10133
11375         * stringpool.h (class Stringpool_template): Add optimize_ field.
11376         (Stringpool_template::set_optimize): New function.
11377         * stringpool.cc (Stringpool_template::Stringpool_template):
11378         Initialize optimize_ field.
11379         (Stringpool_template::set_string_offsets): Test local optimize
11380         fild rather than parameter.
11381         * layout.cc (Layout::Layout): Call set_optimize on the section
11382         name stringpool.
11383
11384 2009-06-22  Ian Lance Taylor  <iant@google.com>
11385
11386         PR 10030
11387         * yyscript.y: Parse TARGET.
11388         * script.cc (script_set_target): New function.
11389         * script-c.h (script_set_target): Declare.
11390         * options.cc (General_options::string_to_object_format): Rename
11391         from string_to_object_format in anonymous namespace.  Change
11392         callers.
11393         * options.h (class General_options): Declare
11394         string_to_object_format.
11395
11396 2009-06-22  Ian Lance Taylor  <iant@google.com>
11397
11398         * script-sections.cc (Script_sections::create_segments): Don't put
11399         program headers in a PT_LOAD segment if -n or -N.
11400
11401 2009-06-22  Ian Lance Taylor  <iant@google.com>
11402
11403         PR 10141
11404         * options.h (class General_options): Add -z lazy and -z now.  Sort
11405         -z options into alphabetical order.
11406         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11407
11408 2009-06-21  Ian Lance Taylor  <iant@google.com>
11409
11410         * layout.cc (Layout::make_output_section): Call
11411         Target::new_output_section.
11412         (Layout::attach_allocated_section_to_segment): Put large section
11413         sections in a separate load segment with the large segment flag
11414         set.
11415         (Layout::segment_precedes): Sort large data segments after other
11416         load segments.
11417         (align_file_offset): New static function.
11418         (Layout::set_segment_offsets): Use align_file_offset.
11419         * output.h (class Output_section): Add is_small_section_ and
11420         is_large_section_ fields.
11421         (Output_section::is_small_section): New function.
11422         (Output_section::set_is_small_section):  New function.
11423         (Output_section::is_large_section): New function.
11424         (Output_section::set_is_large_section): New function.
11425         (Output_section::is_large_data_section): New function.
11426         (class Output_segment): Add is_large_data_segment_ field.
11427         (Output_segment::is_large_data_segment): New function.
11428         (Output_segment::set_is_large_data_segment): New function.
11429         * output.cc (Output_section::Output_section): Initialize new
11430         fields.
11431         (Output_segment::Output_segment): Likewise.
11432         (Output_segment::add_output_section): Add assertion that large
11433         data sections always go in large data segments.  Force small data
11434         sections to the end of the list of data sections.  Force small BSS
11435         sections to the start of the list of BSS sections.  For large BSS
11436         sections to the end of the list of BSS sections.
11437         * symtab.h (class Symbol): Declare is_common_shndx.
11438         (Symbol::is_defined): Check Symbol::is_common_shndx.
11439         (Symbol::is_common): Likewise.
11440         (class Symbol_table): Define enum Commons_section_type.  Update
11441         declarations.  Add small_commons_ and large_commons_ fields.
11442         * symtab.cc (Symbol::is_common_shndx): New function.
11443         (Symbol_table::Symbol_table): Initialize new fields.
11444         (Symbol_table::add_from_object): Put small and large common
11445         symbols in the right list.
11446         (Symbol_table::sized_finalized_symbol): Check
11447         Symbol::is_common_shndx.
11448         (Symbol_table::sized_write_globals): Likewise.
11449         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11450         common symbol lists.  Don't call do_allocate_commons_list if the
11451         list is empty.
11452         (Symbol_table::do_allocate_commons_list): Remove is_tls
11453         parameter.  Add comons_section_type parameter.  Change all
11454         callers.  Handle small and large common symbols.
11455         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11456         Symbol::is_common_shndx.
11457         * resolve.cc (symbol_to_bits): Likewise.
11458         * target.h (Target::small_common_shndx): New function.
11459         (Target::small_common_section_flags): New function.
11460         (Target::large_common_shndx): New function.
11461         (Target::large_common_section_flags): New function.
11462         (Target::new_output_section): New function.
11463         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11464         small_common_section_flags, and large_common_section_flags
11465         fields.
11466         (Target::do_new_output_section): New virtual function.
11467         * arm.cc (Target_arm::arm_info): Initialize new fields.
11468         * i386.cc (Target_i386::i386_info): Likewise.
11469         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11470         Likewise.
11471         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11472         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11473         (Target_x86_64::do_new_output_section): New function.
11474         * configure.ac: Define conditional MCMODEL_MEDIUM.
11475         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11476         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11477         (large_LDFLAGS): Define.
11478         * testsuite/large.c: New file.
11479         * testsuite/testfile.cc (Target_test::test_target_info):
11480         Initialize new fields.
11481         * configure, testsuite/Makefile.in: Rebuild.
11482
11483 2009-06-05  Doug Kwan  <dougkwan@google.com>
11484
11485         * Makefile.am (CCFILES): Add target.cc.
11486         * Makefile.in: Regenerate.
11487         * i386.cc (class Target_i386): Define new virtual method to
11488         override do_is_local_label_name in parent.
11489         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11490         local symbols if --discard-locals or -X is given.
11491         * options.h (class General_options): Declare new options
11492         '--discard-locals' and '-X' for discarding locals.
11493         * target.h (class Target): Define new methods is_local_label_name.
11494         Declare new virtual method do_is_local_label_name.
11495         * target.cc: New file.
11496         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11497         (check_SCRIPTS): Add discard_locals_test.sh.
11498         (check_DATA): Add discard_local_tests.syms.
11499         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11500         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11501         * testsuite/Makefile.in: Regenerate.
11502         * testsuite/discard_locals_test.c: New file.
11503         * testsuite/discard_locals_test.sh: Same.
11504
11505 2009-06-05  Doug Kwan  <dougkwan@google.com>
11506
11507         * object.cc (Sized_relobj::Sized_relobj): Initialize
11508         discarded_eh_frame_shndx_ to -1U.
11509         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11510         section.
11511         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11512         a discarded .eh_frame section.
11513         (Sized_relobj::do_finalize_local_symbols): Ditto.
11514         * object.h (class Sized_relobj): Declare new member
11515         discarded_eh_frame_shndx_.
11516         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11517         (local_labels_test.o, local_labels_test): New rules.
11518         * testsuite/Makefile.in: Regenerate.
11519
11520 2009-06-04  Doug Kwan  <dougkwan@google.com>
11521
11522         * layout.cc (Layout::section_name_mapping): Add mapping for
11523         special ARM sections.
11524
11525 2009-06-03  Doug Kwan  <dougkwan@google.com>
11526
11527         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11528         (utils::has_overflow): Same.
11529
11530 2009-06-03  Ian Lance Taylor  <iant@google.com>
11531
11532         * layout.cc (Layout::section_name_mapping): New array, replacing
11533         Layout::linkonce_mapping.
11534         (Layout::section_name_mapping_count): New variable, replacing
11535         Layout::linkonce_mapping_count.
11536         (Layout::linkonce_output_name): Remove.
11537         (Layout::output_section_name): Rewrite.
11538         * layout.h (class Layout): Rename Linkonce_mapping to
11539         Section_name_mapping, linkonce_mapping to section_name_mapping,
11540         linkonce_mapping_count to section_name_mapping_count.  Don't
11541         declare linkonce_output_name.
11542
11543 2009-06-03  Doug Kwan  <dougkwan@google.com>
11544
11545         * gold/arm.cc (namespace utils): New.
11546         (Target_arm::reloc_is_non_pic): Define new method.
11547         (class Arm_relocate_functions): New.
11548         (Target_arm::Relocate::relocate): Handle relocation types used by
11549         Android.
11550
11551 2009-06-03  Ian Lance Taylor  <iant@google.com>
11552
11553         * arm.cc (Target_arm::scan::global): Use || instead of |.
11554
11555 2009-06-02  Doug Kwan  <dougkwan@google.com>
11556
11557         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11558         issued_non_pic_error_.
11559         (class Target_arm::Scan): Declare new method check_non_pic.
11560         Define new method symbol_needs_plt_entry.
11561         Declare new data member issued_non_pic_error_.
11562         (class Target_arm::Relocate): Declare new method
11563         should_apply_static_reloc.
11564         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11565         (Target_arm::Scan::check_non_pic): Define new method.
11566         (Target_arm::Scan::local): Handle a small subset of reloc types used
11567         by Android.
11568         (Target_arm::Scan::local): Same.
11569         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11570
11571 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11572
11573         * incremental.cc (Incremental_inputs::report_command_line): Filter
11574         out --incremental-* options.
11575
11576 2009-05-29  Doug Kwan  <dougkwan@google.com>
11577
11578         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11579         template class.
11580         (class Target_arm): Update comment.
11581         (Target_arm::Target_arm): Initialize new data members GOT_,
11582         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11583         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11584         and Target_arm::rel_dyn_section.
11585         Declare new_enum Target_arm::Got_type.
11586         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11587         and DYNBSS_.
11588         Update commments for member do_dynsym_value.
11589         (Target_arm::got_size, Target_arm::plt_section,
11590         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11591         new methods inside class defintion.
11592         (Target_arm::got_section): Define new method.
11593         (Target_arm::rel_dyn_section): Same.
11594         (Output_data_plt_arm): New template class.
11595         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11596         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11597         (Output_data_plt_arm::add_entry): Same.
11598         (Output_data_plt_arm::first_plt_entry): Define new
11599         static data member for PLT instruction template.
11600         (Output_data_plt_arm::plt_entry): Same.
11601         (Output_data_plt_arm::do_write): Define new method.
11602         (Target_arm::make_plt_entry): Same.
11603         (Target_arm::do_finalize_sections): Same.
11604         (Target_arm::do_dynsym_value): Same.
11605
11606 2009-05-28  Doug Kwan  <dougkwan@google.com>
11607
11608         * Makefile.am (TARGETSOURCES): Add arm.cc.
11609         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11610         * Makefile.in: Regenerate.
11611         * arm.cc: New file.
11612         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11613
11614 2009-05-26  Doug Kwan  <dougkwan@google.com>
11615
11616         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11617         (General_options::check_excluded_libs): Strip off directories in
11618         archive name before matching like GNU ld does.
11619         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11620         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11621         (exclude_libs_test_LDFLAGS): Add linker option
11622         -Wl,--exclude-libs,libexclude_libs_test_3
11623         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11624         an explicit archive without using -l.
11625         (alt/libexclude_libs_test_3.a): New make rule.
11626         * testsuite/Makefile.in: Regenerate.
11627         * testsuite/exclude_libs_test.c : Declare lib3_default().
11628         (main): Call it.
11629         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11630         * exclude_libs_test_3.c: New file.
11631
11632 2009-05-26  Nick Clifton  <nickc@redhat.com>
11633
11634         * po/id.po: New Indonesian translation.
11635         * po/gold.pot: Updated template file.
11636
11637 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11638
11639         * testsuite/Makefile.am: Add -ffunction-sections to compile
11640         gc_comdat_test files.  Add -Wl,--gc-sections to build
11641         gc_comdat_test.
11642         * testsuite/Makefile.in: Regenerate.
11643         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11644
11645 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11646
11647         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11648         kept comdat section was garbage collected.
11649         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11650         * testsuite/Makefile.in: Regenerate.
11651         * testsuite/gc_comdat_test.sh: New file.
11652         * testsuite/gc_comdat_test_1.cc: New file.
11653         * testsuite/gc_comdat_test_2.cc: New file.
11654
11655 2009-05-19  Doug Kwan  <dougkwan@google.com>
11656
11657         * archive.cc (Archive::Archive): Move constructor from archive.h
11658         to here.  Initialize no_export_.
11659         (Archive::get_elf_object_for_member): Set no_export flag of object.
11660         * archive.h (Archive::Archive): Move constructor body to
11661         archive.cc.
11662         (Archive::no_export): New method.
11663         (Archive::no_export_): New field.
11664         * object.h (Object::Object): Initialize no_export_ to false.
11665         (Object::no_export, Object::set_no_export): New methods.
11666         (Object::no_export_): New field.
11667         * options.cc (General_options::parse_exclude_libs): New method.
11668         (General_options::check_excluded_libs) Same.
11669         * options.h (exclude_libs): New option.
11670         (General_options::check_excluded_libs): New method declaration.
11671         (General_options::excluded_libs_): New field.
11672         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11673         default or protected visibility if an object has no-export flag set.
11674         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11675         (check_SCRIPTS): Add exclude_libs_test.sh.
11676         (check_DATA): Add exclude_libs_test.syms.
11677         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11678         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11679         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11680         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11681         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11682         libexclude_libs_test_2.a): New rules.
11683         * testsuite/Makefile.in: Regenerate.
11684         * testsuite/exclude_libs_test.c: New file.
11685         * testsuite/exclude_libs_test.sh: Ditto.
11686         * testsuite/exclude_libs_test_1.c: Ditto.
11687         * testsuite/exclude_libs_test_2.c: Ditto.
11688
11689 2009-05-15  Ian Lance Taylor  <iant@google.com>
11690
11691         * configure.ac: Check for declarations for cases where libiberty.h
11692         checks HAVE_DECL_xxx.
11693         * configure, config.in: Rebuild.
11694
11695 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11696
11697         * gold.h (Incremental_argument_list): Remove (invalid) forward
11698         declaration.
11699         * incremental.cc (Incremental_inputs::report_achive): New method.
11700         (Incremental_inputs::report_object): New method.
11701         (Incremental_inputs::report_script): New method.
11702         (Incremental_inputs::finalize_inputs): New method.
11703         (Incremental_inputs::finalize): Call finalize_inputs().
11704         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11705         Create inputs entries.
11706         * incremental.h (Incremental_input_type): New enum.
11707         (Incremental_inputs::Incremental_input): Initialize new fields.
11708         (Incremental_inputs::report_inputs): New method.
11709         (Incremental_inputs::report_achive): New method.
11710         (Incremental_inputs::report_object): New method.
11711         (Incremental_inputs::report_script): New method.
11712         (Incremental_inputs::finalize_inputs): New method.
11713         (Incremental_inputs::Input_info): New struct.
11714         (Incremental_inputs::Input_info_map): New typedef.
11715         (Incremental_inputs::lock_): New field.
11716         (Incremental_inputs::Inputs_): New field.
11717         (Incremental_inputs::Inputs_map): New field.
11718         * main.cc (main): Call Incremental_input::report_inputs.
11719         * options.h (Input_argument_list): Typedef moved from
11720         Input_arguments.
11721         (Input_file_group::Files): Remove, use ::Input_argument_list.
11722         (Input_file_group::Input_argument_list): Remove, use
11723         ::Input_argument_list.
11724         * plugin.cc (Plugin_manager::add_input_file): Add error in
11725         incremental build.
11726         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11727         functions.
11728         * script.cc (read_input_script): Call
11729         Incremental_input::report_script.
11730         * script.h (Script_info): New class.
11731
11732 2009-04-27  Ian Lance Taylor  <iant@google.com>
11733
11734         * x86_64.cc (do_adjust_output_section): Set entsize to
11735         plt_entry_size.
11736
11737 2009-04-23  Elliott Hughes  <enh@google.com>
11738
11739         * output.cc (Output_file::close): After short writes, continue
11740         writing from the correct offset in the buffer being written.
11741
11742 2009-04-23  Chris Demetriou  <cgd@google.com>
11743
11744         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11745         * configure: Regenerate.
11746         * config.in: Regenerate.
11747         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11748         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11749
11750 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11751
11752         * incremental.cc (Incremental_inputs_header_data): Renamed from
11753         Incremental_input_header_data.
11754         (Incremental_inputs_header_data::data_size): New field.
11755         (Incremental_inputs_header_data::put_input_file_count): Renamed
11756         from input_file_count.
11757         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11758         from command_line_offset.
11759         (Incremental_inputs_header_data::put_reserved): Renamed from
11760         put_reserved.
11761         (Incremental_inputs_entry_data): Renamed from
11762         Incremental_input_entry_data.
11763         (Incremental_inputs_entry_data::data_size): New field.
11764         (Incremental_inputs::report_command_line): New method.
11765         (Incremental_inputs::finalize): New method.
11766         (Incremental_inputs::create_incremental_inputs_data): New method.
11767         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11768         * incremental.h: New file.
11769         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11770         (Layout::finalize): Create incremental inputs section in
11771         incremental builds.
11772         (Layout::create_incremental_info_sections): New method.
11773         * layout.h (Layout::incremental_inputs): New method.
11774         (Layout::create_incremental_info_sections): New method.
11775         (Layout::incremental_inputs_): New field.
11776         * main.cc (main): Notify Incremental_input of the command line.
11777
11778 2009-04-01  Ian Lance Taylor  <iant@google.com>
11779             Mikolaj Zalewski  <mikolajz@google.com>
11780
11781         * gold.h (reserve_unordered_map): Define, three versions, one for
11782         each version of Unordered_map.
11783         * layout.cc (Layout::Layout): Remove options parameter.  Add
11784         number_of_input_files parameter.  Don't initialize options_.
11785         Initialize number_of_input_files_ and resized_signatures_.  Move
11786         sections_are_attached_.
11787         (Layout::layout_group): Reserve space for group_signatures_.
11788         (Layout::find_or_add_kept_section): Change name parameter to be a
11789         reference.  Resize signatures_ map when it gets large enough.
11790         (Layout::layout_eh_frame): Use parameters->options() instead of
11791         this->options_.
11792         (Layout::make_output_section): Likewise.
11793         (Layout::attach_allocated_section_to_segment): Likewise.
11794         (Layout::finalize, Layout::create_executable_stack): Likewise.
11795         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11796         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11797         * layout.h (class Layout): Update declarations.  Remove options_
11798         field.  Add number_of_input_files_ and resized_signatures_
11799         fields.  Move sections_are_attached_ field.
11800         * main.cc (main): Pass number of input files to Layout
11801         constructor.  Don't pass options.
11802
11803 2009-03-30  Ian Lance Taylor  <iant@google.com>
11804
11805         * ffsll.c (ffsll): Correct implementation.
11806
11807 2009-03-27  Ian Lance Taylor  <iant@google.com>
11808
11809         * ffsll.c: New file.
11810         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11811         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11812         * ftruncate.c (ftruncate): Declare before definition.
11813         * mremap.c (mremap): Likewise.
11814         * pread.c (pread): Likewise.
11815         * configure, Makefile.in, config.in: Rebuild.
11816
11817         * mremap.c: New file.
11818         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11819         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11820         (mremap): Declare if HAVE_MREMAP is not defined.
11821         * configure, Makefile.in, config.in: Rebuild.
11822
11823 2009-03-27  Cary Coutant  <ccoutant@google.com>
11824
11825         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11826         position independent.
11827         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11828         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11829
11830 2009-03-24  Cary Coutant  <ccoutant@google.com>
11831
11832         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11833         an executable.
11834         (needs_dynamic_reloc): Likewise.
11835
11836 2009-03-24  Ian Lance Taylor  <iant@google.com>
11837
11838         * yyscript.y (file_cmd): Recognize EXTERN.
11839         (extern_name_list, extern_name_list_body): New nonterminals.
11840         * script.cc (script_add_extern): Define.
11841         * script-c.h (script_add_extern): Declare.
11842
11843 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11844
11845         * object.cc (is_elf_object): Define.
11846         * object.h (is_elf_object): Declare.
11847         * archive.cc (Archive::get_elf_object_for_member): Call
11848         is_elf_object.
11849         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11850
11851 2009-03-24  Elliott Hughes  <enh@google.com>
11852
11853         * output.cc (Output_file::map_anonymous): Define.
11854         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11855         try an anonymous one.  Report the size if the mmap fails.
11856         * output.h (class Output_file): Declare map_anonymous.
11857
11858 2009-03-24  Ian Lance Taylor  <iant@google.com>
11859
11860         * target-select.cc (instantiate_target): Don't acquire the lock if
11861         the instantiated_target_ field has already been set.
11862
11863 2009-03-23  Ian Lance Taylor  <iant@google.com>
11864
11865         * gold-threads.h (class Initialize_lock): Define.
11866         * gold-threads.cc (class Initialize_lock_once): Define.
11867         (initialize_lock_control): New static variable.
11868         (initialize_lock_pointer): New static variable.
11869         (initialize_lock_once): New static function.
11870         (Initialize_lock::Initialize_lock): Define.
11871         (Initialize_lock::initialize): Define.
11872         * target-select.h: Include "gold-threads.h".
11873         (class Target_selector): Add lock_ and initialize_lock_ fields.
11874         Don't define instantiate_target, just declare it.
11875         * target-select.cc (Target_selector::Target_selector): Initialize
11876         new fields.
11877         (Target_selector::instantiate_target): Define.
11878         * descriptors.h: Include "gold-threads.h".
11879         (class Descriptors): Add initialize_lock_ field.
11880         * descriptors.cc (Descriptors::Descriptors): Initialize new
11881         field.
11882         (Descriptors::open): Use initialize_lock_ field
11883         * errors.h (class Errors): Add initialize_lock_ field.
11884         * errors.cc (Errors::Errors): Initialize new field.
11885         (Errors::initialize_lock): Use initialize_lock_ field.
11886         * powerpc.cc (class Target_selector_powerpc): Remove
11887         instantiated_target_ field.  In do_recognize call
11888         instantiate_target rather than do_instantiate_target.  In
11889         do_instantiate_target just allocate a new target.
11890         * sparc.cc (class Target_selector_sparc): Likewise.
11891
11892         * freebsd.h: New file.
11893         * i386.cc: Include "freebsd.h".
11894         (Target_i386): Derive from Target_freebsd rather than
11895         Sized_target.
11896         (Target_selector_i386): Derive from Target_selector_freebsd rather
11897         than Target_selector.
11898         * x86_64.cc: Include "freebsd.h".
11899         (Target_x86_64): Derive from Target_freebsd rather than
11900         Sized_target.
11901         (Target_selector_x86_64): Derive from Target_selector_freebsd
11902         rather than Target_selector.
11903         * target.h (class Target): Add adjust_elf_header and
11904         do_adjust_elf_header.
11905         * output.cc (Output_file_header:: do_sized_write): Call target
11906         adjust_elf_header routine.
11907         * configure.tgt: Set targ_osabi.
11908         * configure.ac: Define GOLD_DEFAULT_OSABI.
11909         * parameters.cc (Parameters::default_target): Pass
11910         GOLD_DEFAULT_OSABI to select_target.
11911         * target-select.h (class Target_selector): Make instantiate_target
11912         protected rather than private.
11913         * Makefile.am (HFILES): Add freebsd.h.
11914         * configure, Makefile.in, config.in: Rebuild.
11915
11916         * merge.cc (do_add_input_section): Correct pend value.  Change
11917         message about last entry not being null terminated from error to
11918         warning.
11919
11920 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11921
11922         * incremental.cc: New file.
11923         * Makefile.am (CCFILES): Add incremental.cc.
11924         * Makefile.in: Rebuild.
11925
11926 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11927
11928         * layout.cc (Layout::output_section_name): Preserve names
11929         of '.note.' sections.
11930
11931 2009-03-19  Ian Lance Taylor  <iant@google.com>
11932
11933         * descriptors.cc (Descriptors::open): Check that the options are
11934         valid before using them.
11935
11936 2009-03-18  Ian Lance Taylor  <iant@google.com>
11937
11938         * script-sections.h: Include <list>.
11939         (class Script_sections): Change Sections_elements from std::vector
11940         to std::list.  Typedef public Elements_iterator.  Add
11941         orphan_section_placement_, data_segment_align_start_, and
11942         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11943         field.
11944         * script-sections.cc (class Orphan_section_placement): New class.
11945         (class Sections_element): Add virtual functions is_relro and
11946         orphan_section_init.  Remove virtual function place_orphan_here.
11947         (class Output_section_definition): Add is_relro and
11948         orphan_section_init.  Remove place_orphan_here.
11949         (class Orphan_output_section): Likewise.
11950         (Script_sections::Script_sections): Update for field changes.
11951         (Script_sections::data_segment_align): Set saw_data_segment_align_
11952         and data_segment_align_start_, not data_segment_align_index.
11953         (Script_sections::data_segment_relro_end): Check
11954         saw_data_segment_align_.  Use data_segment_align_start_ rather
11955         than data_segment_align_index_.
11956         (Script_sections::place_orphan): Rewrite to use
11957         Orphan_section_placement.
11958
11959 2009-03-17  Ian Lance Taylor  <iant@google.com>
11960
11961         * archive.cc (Archive::add_symbols): Check for a version attached
11962         to the symbol name in the archive map.
11963         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11964         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11965         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11966         (ver_test_11.a): New target.
11967         * testsuite/Makefile.in: Rebuild.
11968
11969         * configure.ac: Check for chsize and posix_fallocate.  Replace
11970         ftruncate.
11971         * ftruncate.c: New file, from gnulib.
11972         * output.cc (posix_fallocate): Define dummy version if not
11973         HAVE_POSIX_FALLOCATE.
11974         (Output_file::map): Call posix_fallocate rather than lseek and
11975         write.
11976         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11977         * configure, Makefile.in, config.in: Rebuild.
11978
11979 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11980
11981         * layout.h (Layout::create_note): Add section_name parameter.
11982         * layout.cc (Layout::create_note): Likewise.
11983         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11984
11985 2009-03-17  Ian Lance Taylor  <iant@google.com>
11986
11987         * descriptors.cc: Include "options.h".
11988         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11989         (Descriptors::open): Always use O_CLOEXEC when opening a new
11990         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11991         then set FD_CLOEXEC.
11992
11993         * sparc.cc (class Target_sparc): Add has_got_section.
11994         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11995         make sure we have a GOT section.
11996
11997         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11998         (Target_sparc::Scan::local): Likewise.
11999         (Target_sparc::Scan::global): Likewise.
12000         (Target_sparc::Relocate::relocate): Likewise.
12001         (Target_sparc::Relocate::relocate_tls): Likewise.
12002
12003         * symtab.cc (Symbol_table::define_default_version): New function,
12004         broken out of add_from_object.
12005         (Symbol_table::add_from_object): Call define_default_version.
12006         (Symbol_table::define_special_symbol): Add resolve_oldsym
12007         parameter.  Change all callers.  If the version for a symbol comes
12008         from a version script, resolve it with the symbol with the same
12009         name with no version.  Also add the symbol without a version if
12010         appropriate.
12011         (do_define_in_output_data): If resolving with oldsym, don't delete
12012         sym.
12013         (do_define_in_output_segment): Likewise.
12014         (do_define_as_constant): Likewise.
12015         * symtab.h (class Symbol_table): Update declarations.
12016
12017 2009-03-13  Ian Lance Taylor  <iant@google.com>
12018
12019         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12020         (Read_symbols::requeue): New function.
12021         (Read_symbols::do_read_symbols): If make_elf_object fails because
12022         the target type is not configured, and the file was searched for,
12023         issue a warning and retry with the next directory.
12024         (Add_symbols::run): If the file has an incompatible format, and
12025         it was searched for, requeue the Read_symbols task.  On error,
12026         release the object.
12027         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12028         dirindex parameter to constructor.  Change all callers.  Declare
12029         incompatible_warning and requeue.
12030         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12031         input_argument_ and input_group_ fields.  Add them to
12032         constructor.  Change all callers.
12033         (class Read_script): Add dirindex_ field.  Add it to constructor.
12034         Change all callers.
12035         * archive.cc (Archive::setup): Remove input_objects parameter.
12036         Change all callers.
12037         (Archive::get_file_and_offset): Likewise.
12038         (Archive::read_all_symbols): Likewise.
12039         (Archive::read_symbols): Likewise.
12040         (Archive::get_elf_object_for_member): Remove input_objects
12041         parameter.  Add punconfigured parameter.  Change all callers.
12042         (Archive::add_symbols): Change return type to bool.  Check return
12043         value of include_member.
12044         (Archive::include_all_members): Likewise.
12045         (Archive::include_member): Change return type to bool.  Return
12046         false if first included object has incompatible target.  Set
12047         included_member_ field.
12048         (Add_archive_symbols::run): If add_symbols returns false, requeue
12049         Read_symbols task.
12050         * archive.h (class Archive): Add included_member_ field.
12051         Initialize it in constructor.  Add input_file and searched_for
12052         methods.  Update declarations.
12053         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12054         input_argument_ fields.  Add them to constructor.  Change all
12055         callers.
12056         * script.cc: Include "target-select.h".
12057         (class Parser_closure): Add skip_on_incompatible_target_ and
12058         found_incompatible_target_ fields.  Add
12059         skip_on_incompatible_target parameter to constructor.  Change all
12060         callers.  Add methods skip_on_incompatible_target,
12061         clear_skip_on_incompatible_target, found_incompatible_target, and
12062         set_found_incompatible_target.
12063         (read_input_script): Add dirindex parameter.  Change all callers.
12064         If parser finds an incompatible target, requeue Read_symbols
12065         task.
12066         (script_set_symbol): Clear skip_on_incompatible_target in
12067         closure.
12068         (script_add_assertion, script_parse_option): Likewise.
12069         (script_start_sections, script_add_phdr): Likewise.
12070         (script_check_output_format): New function.
12071         * script.h (read_input_script): Update declaration.
12072         * script-c.h (script_check_output_format): Declare.
12073         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12074         (ignore_cmd): Remove OUTPUT_FORMAT.
12075         * fileread.cc (Input_file::Input_file): Add explicit this.
12076         (Input_file::will_search_for): New function.
12077         (Input_file::open): Add pindex parameter.  Change all callers.
12078         * fileread.h (class Input_file): Add input_file_argument method.
12079         Declare will_search_for.  Update declarations.
12080         * object.cc (make_elf_object): Add punconfigured parameter.
12081         Change all callers.
12082         * object.h (class Object): Make input_file public.  Add
12083         searched_for method.
12084         (make_elf_object): Update declaration.
12085         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12086         restart search.
12087         * dirsearch.h (class Dirsearch): Update declaration.
12088         * options.h (class General_options): Add --warn-search-mismatch.
12089         * parameters.cc (Parameters::is_compatible_target): New function.
12090         * parameters.h (class Parameters): Declare is_compatible_target.
12091         * workqueue.cc (Workqueue::add_blocker): New function.
12092         * workqueue.h (class Workqueue): Declare add_blocker.
12093
12094         * fileread.cc (Input_file::open): Remove options parameter.
12095         Change all callers.
12096         (Input_file::open_binary): Likewise.
12097         * script.cc (read_input_script): Likewise.
12098         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12099         options parameter from constructor.  Change all callers.
12100         (class Read_script): Likewise.
12101         * fileread.h (class Input_file): Update declarations.
12102         * script.h (read_input_script): Update declaration.
12103
12104 2009-03-10  Nick Clifton  <nickc@redhat.com>
12105
12106         * po/es.po: New Spanish translation.
12107
12108 2009-03-06  Cary Coutant  <ccoutant@google.com>
12109
12110         * options.cc (parse_short_option): Keep dash_z from registering itself.
12111
12112 2009-03-03  Ian Lance Taylor  <iant@google.com>
12113
12114         PR 9918
12115         * target-reloc.h (relocate_section): Pass output_section to
12116         relocate.
12117         * i386.cc (Target_i386::should_apply_static_reloc): Add
12118         output_section parameter.  Change all callers.
12119         (Target_i386::Relocate::relocate): Add output_section parameter.
12120         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12121         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12122         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12123         * testsuite/two_file_shared.sh: New script.
12124         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12125         (check_DATA): Add two_file_shared.dbg.
12126         (two_file_shared.dbg): New target.
12127         * testsuite/Makefile.in: Rebuild.
12128
12129 2009-03-01  Ian Lance Taylor  <iant@google.com>
12130
12131         * configure.ac: Check for byteswap.h.
12132         * configure: Rebuild.
12133         * config.in: Rebuild.
12134
12135 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12136
12137         * layout.cc (Layout::find_or_add_kept_section): New function.
12138         (Layout::add_comdat): Removed.
12139         * layout.h (struct Kept_section): Move out of class Layout.
12140         Remove trailing underscores from field names.  Add group_sections
12141         field.  Rename group_ field to is_group.  Change all uses.
12142         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12143         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12144         comdat_groups_ field.
12145         (Sized_relobj::include_section_group): Use
12146         find_or_add_kept_section and Kept_section::group_sections.
12147         (Sized_relobj::include_linkonce_section): Likewise.
12148         * object.cc (class Sized_relobj): Don't define Comdat_group or
12149         Comdat_group_table.  Remove find_comdat_group and
12150         add_comdat_group.  Remove comdat_groups_ field.
12151         * plugin.cc (include_comdat_group): Use
12152         Layout::find_or_add_kept_section.
12153
12154 2009-02-28  Ian Lance Taylor  <iant@google.com>
12155
12156         * README: --gc-sections and map files are now supported.  Document
12157         some build requirements.
12158
12159         PR 6992
12160         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12161         relocatable link set the value of the section symbol to zero.
12162         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12163         relocatable link don't include the section address in the local
12164         symbol value.
12165
12166 2009-02-27  Ian Lance Taylor  <iant@google.com>
12167
12168         PR 6811
12169         * options.h (class Search_directory): Add is_system_directory.
12170         (class General_options): Declare is_in_system_directory.
12171         * options.cc (get_relative_sysroot): Make static.
12172         (get_default_sysroot): Make static.
12173         (General_optoins::is_in_system_directory): New function.
12174         * fileread.cc (Input_file::is_in_system_directory): New function.
12175         * fileread.h (class Input_file): Declare is_in_system_directory.
12176         * object.h (class Object): Add is_in_system_directory.
12177         (class Input_objects): Remove system_library_directory_ field.
12178         * object.cc (Input_objects::add_object): Don't set
12179         system_library_directory_.
12180         (input_objects::found_in_system_library_directory): Remove.
12181         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12182         parameter.  Change all callers.
12183         (Symbol_table::sized_write_globals): Likewise.
12184         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12185         Call Object::is_in_system_directory.
12186         * symtab.h (class Symbol_table): Update declarations.
12187
12188         PR 5990
12189         * descriptors.h (Open_descriptor): Add is_on_stack field.
12190         * descriptors.cc (Descriptors::open): If the descriptor is on the
12191         top of the stack, remove it.  Initialize is_on_stack field.
12192         (Descriptors::release): Only add pod to stack if it is not on the
12193         stack already.
12194         (Descriptors::close_some_descriptor): Clear stack_next and
12195         is_on_stack fields.
12196
12197         PR 7091
12198         * output.cc (Output_section::find_starting_output_address): Rename
12199         from starting_output_address; add PADDR parameter; change return
12200         type.
12201         * output.h (class Output_section): Declare
12202         find_starting_output_address instead of starting_output_address.
12203         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12204         section symbol for which we can't find a merge section.
12205
12206         PR 9836
12207         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12208         hidden or internal, force the symbol to be local.
12209         * resolve.cc (Symbol::override_visibility): Define.
12210         (Symbol::override_base): Use override_visibility.
12211         (Symbol_table::resolve): Likewise.
12212         (Symbol::override_base_with_special): Likewise.
12213         (Symbol_table::override_with_special): If the visibility is hidden
12214         or internal, force the symbol to be local.
12215         * symtab.h (class Symbol): Add set_visibility and
12216         override_visibility.
12217         * testsuite/ver_test_1.sh: New file.
12218         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12219         (check_DATA): Add ver_test_1.syms.
12220         (ver_test_1.syms): New target.
12221         * testsuite/Makefile.in: Rebuild.
12222
12223 2009-02-25  Cary Coutant  <ccoutant@google.com>
12224
12225         * layout.cc (Layout::choose_output_section): Don't rename sections
12226         when using a linker script that has a SECTIONS clause.
12227         * Makefile.in: Regenerate.
12228
12229         * testsuite/Makefile.am (script_test_5.sh): New test case.
12230         * testsuite/Makefile.in: Regenerate.
12231         * testsuite/script_test_5.cc: New file.
12232         * testsuite/script_test_5.sh: New file.
12233         * testsuite/script_test_5.t: New file.
12234
12235 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12236
12237         * archive.cc (Archive::include_member): Update calls to add_symbols.
12238         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12239         the Layout argument.
12240         * dynobj.h (do_add_symbols): Add the Layout argument.
12241         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12242         Layout argument.
12243         * object.h (Object::add_symbols): Add the Layout argument.
12244         (Object::do_add_symbols): Add the Layout argument.
12245         (Sized_relobj::do_add_symbols): Add the Layout argument.
12246         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12247         Unify the two versions.
12248         (Add_plugin_symbols): Remove.
12249         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12250         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12251         (Add_plugin_symbols): Remove.
12252         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12253         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12254         (Add_symbols::run): Make it work with Pulginobj.
12255
12256 2009-02-06  Ian Lance Taylor  <iant@google.com>
12257
12258         * object.cc (Sized_relobj::do_layout): Make info message start
12259         with lower case letter.
12260
12261 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12262
12263         * binary.cc: Fix file comment.
12264
12265         * options.h (enum Incremental_disposition): Define.
12266         (class General_options): Add new options: --incremental,
12267         --incremental_changed, --incremental_unchanged,
12268         --incremental_unknown.  Add incremental_disposition_ and
12269         implicit_incremental_ fields.
12270         (General_options::incremental_disposition): New function.
12271         (class Position_dependent_options): Add incremental_disposition
12272         option.
12273         (Position_dependent_options::copy_from_options): Set incremental
12274         dispositions.
12275         * options.cc (General_options::parse_incremental_changed): New
12276         function.
12277         (General_options::parse_incremental_unchanged): New function.
12278         (General_options::parse_incremental_unknown): New function.
12279         (General_options::General_options): Initialize new fields
12280         incremental_disposition_ and implicit_incremental_.
12281         (General_options::finalize): Check for uasge of --incremental-*
12282         without --incremental.
12283
12284 2009-02-06  Chris Demetriou  <cgd@google.com>
12285
12286         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12287         pointer and to report location as the file name associated with
12288         the symbol.
12289         (gold_undefined_symbol_at_location): New function to replace the
12290         old gold_undefined_symbol functionality.
12291         * target-reloc.h (relocate_section): Update to use
12292         gold_undefined_symbol_at_location.
12293         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12294         Call gold_undefined_symbol function rather than gold_error.
12295         * errors.h (Errors::undefined_symbol): Take location as a
12296         string, rather than calculating it from a relocation.
12297         * errors.cc (Errors::fatal): Print "fatal error:" before the
12298         formatted message.
12299         (Errors::error, Errors::error_at_location): Print "error: "
12300         before the formatted message.
12301         (Errors::undefined_symbol): Take location as a string, rather
12302         than calculating it from a relocation.
12303         (gold_undefined_symbol_at_location): New function akin to
12304         old gold_undefined_symbol, calculates location from relocation.
12305         (gold_undefined_symbol): Change to take only a Symbol pointer
12306         and to report location as the file name associated with the symbol.
12307         * testsuite/debug_msg.sh: Update for changed error messages.
12308         * testsuite/undef_symbol.sh: Likewise.
12309
12310 2009-02-04  Duncan Sands  <baldrick@free.fr>
12311
12312         PR 9812
12313         * reduced_debug_output.h
12314         (Output_reduced_debug_abbrev_section::failed): Use format for
12315         gold_warning.
12316         (Output_reduced_debug_info_section::faild): Likewise.
12317
12318 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12319
12320         * script.cc (Lazy_demangler): New class.
12321         (Version_script_info::get_symbol_version_helper): Demangle a
12322         symbol only once.
12323
12324 2009-01-29  Cary Coutant  <ccoutant@google.com>
12325
12326         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12327         to __tls_get_addr.
12328         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12329
12330 2009-01-28  Ian Lance Taylor  <iant@google.com>
12331
12332         * version.cc (version_string): Bump to 1.9.
12333
12334         * gold.h: Include <cstring> and <stdint.h>.
12335         * version.cc: Include <cstdio>.
12336         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12337         warning.
12338         * reduced_debug_output.cc (insert_into_vector): Rename from
12339         Insert_into_vector; change all callers.  Use Swap_unaligned to
12340         avoid aliasing issue; remove union since it is unnecessary.
12341
12342 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12343
12344         * Makefile.am (CCFILES): Add gc.cc.
12345         (HFILES): Add gc.h.
12346         * Makefile.in: Regenerate.
12347         * gold.cc (Gc_runner): New class.
12348         (queue_initial_tasks): Call garbage collection related tasks
12349         when corresponding options are invoked.
12350         (queue_middle_gc_tasks): New function.
12351         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12352         processed early before laying out sections during garbage collection.
12353         * gold.h (queue_middle_gc_tasks): New function.
12354         (is_prefix_of): Move from "layout.cc".
12355         * i386.cc (Target_i386::gc_process_relocs): New function.
12356         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12357         * main.cc (main): Create object of class "Garbage_collection".
12358         * object.cc (Relobj::copy_symbols_data): New function.
12359         (Relobj::is_section_name_included): New function.
12360         (Sized_relobj::do_layout): Allow this function to be called twice
12361         during garbage collection and defer layout of section during the
12362         first call.
12363         * object.h (Relobj::get_symbols_data): New function.
12364         (Relobj::is_section_name_included): New function.
12365         (Relobj::copy_symbols_data): New function.
12366         (Relobj::set_symbols_data): New function.
12367         (Relobj::get_relocs_data): New function.
12368         (Relobj::set_relocs_data): New function.
12369         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12370         (Relobj::gc_process_relocs): New function.
12371         (Relobj::do_gc_process_relocs): New pure virtual function.
12372         (Relobj::sd_): New data member.
12373         (Sized_relobj::is_output_section_offset_invalid): New function.
12374         (Sized_relobj::do_gc_process_relocs): New function.
12375         * options.h (General_options::gc_sections): Modify to not be a no-op.
12376         (General_options::print_gc_sections): New option.
12377         * plugin.cc (Plugin_finish::run): Remove function call to
12378         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12379         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12380         * reloc.cc (Read_relocs::run): Add task to process relocs and
12381         determine unreferenced sections when doing garbage collection.
12382         (Gc_process_relocs): New class.
12383         (Sized_relobj::do_gc_process_relocs): New function.
12384         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12385         sections that are garbage collected.
12386         * reloc.h (Gc_process_relocs): New class.
12387         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12388         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12389         symbols whose corresponding sections are garbage collected.
12390         (Symbol_table::Symbol_table): Add new parameter for the garbage
12391         collection object.
12392         (Symbol_table::gc_mark_undef_symbols): New function.
12393         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12394         (Symbol_table::gc_mark_dyn_syms): New function.
12395         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12396         as garbage.
12397         (Symbol_table::add_from_object): Likewise.
12398         (Symbol_table::add_from_relobj): When building shared objects, do not
12399         treat externally visible symbols as garbage.
12400         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12401         table information for static and relocatable links.
12402         * symtab.h (Symbol_table::set_gc): New function.
12403         (Symbol_table::gc): New function.
12404         (Symbol_table::gc_mark_undef_symbols): New function.
12405         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12406         (Symbol_table::gc_mark_dyn_syms): New function.
12407         (Symbol_table::gc_): New data member.
12408         * target.h (Sized_target::gc_process_relocs): New pure virtual
12409         function.
12410         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12411         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12412
12413 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12414
12415         * options.h (General_options::gc_sections): Define as a no-op for now.
12416         (General_options::no_keep_memory): Ditto.
12417         (General_options::Bshareable): Define.
12418         * options.cc (General_options::finalize): Honor -Bshareable.
12419
12420 2009-01-20  Andreas Schwab  <schwab@suse.de>
12421
12422         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12423         read the value in the contents, since we don't use it.  Use the
12424         template endianness when writing.
12425         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12426
12427 2009-01-19  Andreas Schwab  <schwab@suse.de>
12428
12429         * configure.tgt (powerpc64-*): Fix targ_obj.
12430
12431 2009-01-15  Ian Lance Taylor  <iant@google.com>
12432
12433         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12434         local symbols when stripping all symbols.
12435
12436 2009-01-14  Cary Coutant  <ccoutant@google.com>
12437
12438         * output.cc (Output_reloc): Add explicit instantiations.
12439
12440 2009-01-14  Cary Coutant  <ccoutant@google.com>
12441
12442         * archive.cc (Archive::get_elf_object_for_member): Remove call
12443         to File_read::claim_for_plugin.
12444         * descriptors.cc (Descriptors::open): Remove reference to
12445         is_claimed.
12446         (Descriptors::claim_for_plugin): Remove.
12447         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12448         (Descriptors::is_claimed): Remove.
12449         (claim_descriptor_for_plugin): Remove.
12450         * fileread.cc (File_read::claim_for_plugin): Remove.
12451         * fileread.h (File_read::claim_for_plugin): Remove.
12452         (File_read::descriptor): Reopen descriptor if necessary.
12453         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12454         (Plugin_manager::all_symbols_read): Add task parameter. Change
12455         all callers.
12456         (Plugin_manager::get_input_file): New function.
12457         (Plugin_manager::release_input_file): New function.
12458         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12459         corresponding data member.
12460         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12461         and pass to base constructor. Change all callers.
12462         (get_input_file, release_input_file): New functions.
12463         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12464         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12465         (Plugin_manager::all_symbols_read): Add task parameter.
12466         (Plugin_manager::get_input_file): New function.
12467         (Plugin_manager::release_input_file): New function.
12468         (Plugin_manager::task_): New data member.
12469         (Pluginobj::Pluginobj): Add filesize parameter.
12470         (Pluginobj::filename): New function.
12471         (Pluginobj::descriptor): New function.
12472         (Pluginobj::filesize): New function.
12473         (Pluginobj::filesize_): New data member.
12474         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12475         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12476         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12477
12478         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12479         with archive libraries.
12480         * testsuite/Makefile.in: Regenerate.
12481         * testsuite/plugin_test.c (struct sym_info): New type.
12482         (get_input_file, release_input_file): New static variables.
12483         (onload): Capture new transfer vector entries.
12484         (claim_file_hook): Stop reading at end of file according to filesize.
12485         Factor out parsing of readelf output into separate function.
12486         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12487         APIs and get the source file name from the symbol table.  Convert
12488         source file name to corresponding object file name.  Print info
12489         message when adding new input files.
12490         (parse_readelf_line): New function.
12491         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12492         * testsuite/plugin_test_2.sh: Likewise.
12493         * testsuite/plugin_test_3.sh: Likewise.
12494         * testsuite/plugin_test_4.sh: New test case.
12495
12496 2009-01-07  Ian Lance Taylor  <iant@google.com>
12497
12498         * version.cc (version_string): Bump to 1.8.
12499
12500 2008-12-23  Cary Coutant  <ccoutant@google.com>
12501
12502         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12503         * plugin.cc (Plugin_manager::finish): Rename as
12504         layout_deferred_objects.  Move cleanup to separate function.
12505         (Plugin_manager::cleanup): New function.
12506         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12507         separately.
12508         * plugin.h (Plugin_manager::finish): Rename as
12509         layout_deferred_objects.
12510         (Plugin_manager::cleanup): New function.
12511         (Plugin_manager::cleanup_done): New field.
12512
12513 2008-12-23  Cary Coutant  <ccoutant@google.com>
12514
12515         * plugin.cc (is_visible_from_outside): New function.
12516         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12517         so we don't return "IR only" status for exported symbols or -r links.
12518
12519         * testsuite/Makefile.am (plugin_test_3): New test case.
12520         * testsuite/Makefile.in: Regenerate.
12521         * testsuite/plugin_test_3.sh: New file.
12522
12523 2008-12-22  Cary Coutant  <ccoutant@google.com>
12524
12525         * object.cc (Sized_relobj::layout_section): New function.
12526         (Sized_relobj::do_layout): Defer layout of input sections until after
12527         plugin has provided replacement files.
12528         (Sized_relobj::do_layout_deferred_sections): New function.
12529         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12530         (Relobj::layout_deferred_sections): New function.
12531         (Relobj::do_layout_deferred_sections): New function.
12532         (Sized_relobj::do_layout_deferred_sections): New function.
12533         (Sized_relobj::layout_section): New function.
12534         (Sized_relobj::Deferred_layout): New structure.
12535         (Sized_relobj::deferred_layout_): New field.
12536         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12537         Change all callers.  Layout deferred sections.
12538         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12539         references.
12540         (Plugin_hook::run): Move code from do_plugin_hook inline.
12541         (Plugin_hook::do_plugin_hook): Remove.
12542         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12543         (Plugin_manager::finish): Renamed, was cleanup.
12544         (Plugin_manager::should_defer_layout): New function.
12545         (Plugin_manager::add_deferred_layout_object): New function.
12546         (Plugin_manager::Deferred_layout_list): New type.
12547         (Plugin_manager::deferred_layout_objects_): New field.
12548         (Plugin_hook::do_plugin_hook): Remove.
12549
12550 2008-12-17  Ian Lance Taylor  <iant@google.com>
12551
12552         * options.h (class General_options): Add --no case for
12553         --export-dynamic.
12554
12555 2008-12-16  Cary Coutant  <ccoutant@google.com>
12556
12557         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12558         vector.
12559         (Plugin_manager::claim_file): Create plugin object even if
12560         plugin did not call the add_symbols callback.
12561         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12562         asking for more symbols than were added.
12563         * testsuite/Makefile.am (plugin_test_1): Add test case with
12564         no global symbols.
12565         (empty.syms): New target.
12566         * testsuite/Makefile.in: Regenerate.
12567         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12568         message. Don't call add_symbols if no globals.
12569         (all_symbols_read_hook): Don't provide replacement for empty
12570         claimed file.
12571
12572 2008-12-12  Ian Lance Taylor  <iant@google.com>
12573
12574         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12575         r_type == 0 for a local symbol with r_sym == 0.
12576         (scan_relocatable_relocs): Pass r_sym to
12577         local_non_section_strategy.
12578         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12579         r_sym parameter.
12580
12581         * configure.ac: Update test for TLS descriptors: they are
12582         supported as of glibc 2.9.
12583         * configure: Rebuild.
12584
12585 2008-12-11  Ian Lance Taylor  <iant@google.com>
12586
12587         PR 7091
12588         * target-reloc.h (Default_scan_relocatable_relocs): For each
12589         function, map r_type == 0 to RELOC_DISCARD.
12590
12591 2008-12-10  Cary Coutant  <ccoutant@google.com>
12592
12593         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12594         object to override a kept COMDAT group from a plugin object.
12595
12596 2008-12-09  Ian Lance Taylor  <iant@google.com>
12597
12598         PR 7088
12599         * yyscript.y (file_cmd): Handle INPUT.
12600
12601         * testsuite/initpri1.c: Change all declarations to be full
12602         prototypes by adding void, to avoid compiler warnings.
12603
12604 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12605
12606         * options.cc (General_options::parse_plugin_opt): New.
12607         (General_options::add_plugin): The argument now is just the filename.
12608         (General_options::add_plugin_option): New.
12609         * options.h (plugin_opt): New.
12610         (add_plugin): Change argument name.
12611         (add_plugin_option): New.
12612         * plugin.cc (Plugin::load): Don't parse the plugin option.
12613         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12614         (Plugin::add_option): New.
12615         (Plugin::args_): Change type.
12616         (Plugin::filename_): New.
12617         (Plugin_manager::add_plugin_option): New.
12618         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12619         * testsuite/Makefile.in: Regenerate.
12620
12621 2008-12-05  Cary Coutant  <ccoutant@google.com>
12622
12623         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12624         Handle --strip-lto-sections option.
12625         * options.h (strip_lto_sections): New option.
12626
12627 2008-12-01  Cary Coutant  <ccoutant@google.com>
12628
12629         * plugin.cc (ld_plugin_message): Change format parameter to const.
12630         Fix mismatch between new[] and delete.
12631
12632 2008-11-14  Cary Coutant  <ccoutant@google.com>
12633
12634         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12635         instead of -1U.
12636
12637 2008-11-05  Craig Silverstein  <csilvers@google.com>
12638
12639         * options.cc (General_options::parse_dynamic_list): New function.
12640         * options.h (General_options): New flags dynamic_list,
12641         dynamic_list_data, dynamic_list_cpp_new, and
12642         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12643         (General_options::in_dynamic_list): New function.
12644         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12645         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12646         (Lex::can_continue_name): Likewise.
12647         (yylex): Likewise.
12648         (read_script_file): New parameter script_options.
12649         (read_dynamic_list): New function.
12650         (Script_options::define_dynamic_list): New function.
12651         (dynamic_list_keyword_parsecodes): New variable.
12652         (dynamic_list_keywords): New variable.
12653         * script.h (Script_options::define_dynamic_list): New function
12654         prototype.
12655         (read_dynamic_list): New function prototype.
12656         * symtab.cc (strprefix): New macro.
12657         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12658         dynamic_list_data, dynamic_list_cpp_new, and
12659         dynamic_list_cpp_typeinfo.
12660         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12661         (dynamic_list_expr): New rule.
12662         (dynamic_list_nodes): Likewise.
12663         (dynamic_list_node): Likewise.
12664         * testsuite/Makefile.am (dynamic_list): New test.
12665         * testsuite/Makefile.in: Regenerated.
12666         * testsuite/dynamic_list.t: New file.
12667         * testsuite/dynamic_list.sh: New file.
12668
12669 2008-11-05  Craig Silverstein  <csilvers@google.com>
12670
12671         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12672         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12673         (t11_last): Likewise.
12674         * testsuite/ver_test_6.c (main): Likewise.
12675
12676 2008-10-07  Cary Coutant  <ccoutant@google.com>
12677
12678         * options.c (General_options::finalize): Add check for -static and
12679         -shared.
12680         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12681         is not empty.
12682
12683 2008-10-02  Cary Coutant  <ccoutant@google.com>
12684
12685         * plugin.cc (make_sized_plugin_object): Fix conditional
12686         compilation to work when not all targets are enabled.
12687
12688 2008-09-29  Cary Coutant  <ccoutant@google.com>
12689
12690         * archive.cc (Archive::get_file_and_offset): Use filename instead
12691         of name to get library path.
12692         (Archive::include_member): Unlock external member of a thin archive.
12693
12694         * testsuite/Makefile.am (TEST_AR): New variable.
12695         (thin_archive_test_1): New test.
12696         (thin_archive_test_2): New test.
12697         * testsuite/Makefile.in: Regenerate.
12698         * testsuite/thin_archive_main.cc: New file.
12699         * testsuite/thin_archive_test_1.cc: New file.
12700         * testsuite/thin_archive_test_2.cc: New file.
12701         * testsuite/thin_archive_test_3.cc: New file.
12702         * testsuite/thin_archive_test_4.cc: New file.
12703
12704 2008-09-29  Cary Coutant  <ccoutant@google.com>
12705
12706         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12707         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12708         instead of -1U.
12709         (Sized_relobj::do_finalize_local_symbols): Likewise.
12710         (Sized_relobj::map_to_kept_section): Likewise.
12711         * object.h (Sized_relobj::invalid_address): New constant.
12712         (Sized_relobj::do_output_section_offset): Check for invalid_address
12713         and return -1ULL.
12714         * output.cc (Output_reloc::local_section_offset): Use constant
12715         invalid_address instead of -1U.
12716         (Output_reloc::get_address): Likewise.
12717         (Output_section::output_address): Change -1U to -1ULL.
12718         * output.h (Output_reloc::invalid_address): New constant.
12719         * reloc.cc (Sized_relobj::write_sections): Use constant
12720         invalid_address instead of -1U.
12721         (Sized_relobj::relocate_sections): Likewise.
12722         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12723         values for merge sections.
12724         * target-reloc.h (relocate_for_relocatable): Use constant
12725         invalid_address instead of -1U.
12726
12727 2008-09-19  Cary Coutant  <ccoutant@google.com>
12728
12729         Add plugin functionality for link-time optimization (LTO).
12730         * configure.ac (plugins): Add --enable-plugins option.
12731         * configure: Regenerate.
12732         * config.in: Regenerate.
12733         * Makefile.am (LIBDL): New variable.
12734         (CCFILES): Add plugin.cc.
12735         (HFILES): Add plugin.h.
12736         (ldadd_var): Add LIBDL.
12737         * Makefile.in: Regenerate.
12738
12739         * archive.cc: Include "plugin.h".
12740         (Archive::setup): Don't preread archive symbols when using a plugin.
12741         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12742         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12743         files.
12744         (Archive::include_member): Add symbols from plugin objects.
12745         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12746         * descriptors.cc (Descriptors::open): Check for file descriptors
12747         abandoned by plugins.
12748         (Descriptors::claim_for_plugin): New function.
12749         * descriptors.h (Descriptors::claim_for_plugin): New function.
12750         (Open_descriptor::is_claimed): New field.
12751         (claim_descriptor_for_plugin): New function.
12752         * fileread.cc (File_read::claim_for_plugin): New function.
12753         * fileread.h (File_read::claim_for_plugin): New function.
12754         (File_read::descriptor): New function.
12755         * gold.cc: Include "plugin.h".
12756         (queue_initial_tasks): Add task to call plugin hooks for generating
12757         new object files.
12758         * main.cc: Include "plugin.h".
12759         (main): Load plugin libraries.
12760         * object.h (Pluginobj): Declare.
12761         (Object::pluginobj): New function.
12762         (Object::do_pluginobj): New function.
12763         (Object::set_target): New function.
12764         * options.cc: Include "plugin.h".
12765         (General_options::parse_plugin): New function.
12766         (General_options::General_options): Initialize plugins_ field.
12767         (General_options::add_plugin): New function.
12768         * options.h (Plugin_manager): Declare.
12769         (General_options): Add --plugin option.
12770         (General_options::has_plugins): New function.
12771         (General_options::plugins): New function.
12772         (General_options::add_plugin): New function.
12773         (General_options::plugins_): New field.
12774         * plugin.cc: New file.
12775         * plugin.h: New file.
12776         * readsyms.cc: Include "plugin.h".
12777         (Read_symbols::do_read_symbols): Check for archive before checking
12778         for ELF file.  Call plugin hooks to claim files.
12779         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12780         from a real object file; force override when processing replacement
12781         files.
12782         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12783         (Symbol::init_base_object): Likewise.
12784         (Symbol::init_base_output_data): Likewise.
12785         (Symbol::init_base_output_segment): Likewise.
12786         (Symbol::init_base_constant): Likewise.
12787         (Symbol::init_base_undefined): Likewise.
12788         (Symbol::output_section): Assert that object is not a plugin.
12789         (Symbol_table::add_from_pluginobj): New function.
12790         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12791         undefined.
12792         (Symbol_table::sized_write_globals): Likewise.
12793         (Symbol_table::add_from_pluginobj): Instantiate template.
12794         * symtab.h (Sized_pluginobj): Declare.
12795         (Symbol::in_real_elf): New function.
12796         (Symbol::set_in_real_elf): New function.
12797         (Symbol::in_real_elf_): New field.
12798         (Symbol_table::add_from_pluginobj): New function.
12799
12800         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12801         (LIBDL): New variable.
12802         (LDADD): Add LIBDL.
12803         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12804         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12805         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12806         (MOSTLYCLEANFILES): Likewise.
12807         * testsuite/Makefile.in: Regenerate.
12808         * testsuite/plugin_test.c: New file.
12809         * testsuite/plugin_test_1.sh: New file.
12810         * testsuite/plugin_test_2.sh: New file.
12811
12812 2008-09-16  Ian Lance Taylor  <iant@google.com>
12813
12814         * target-reloc.h (relocate_section): Check whether a symbol is
12815         defined by the ABI before reporting an undefined symbol error.
12816         * target.h (Target::is_defined_by_abi): Make parameter const.
12817         (Target::do_is_defined_by_abi): Likewise.
12818         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12819         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12820         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12821         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12822         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12823         * testsuite/Makefile.in: Rebuild.
12824
12825         * fileread.cc (make_view): Add casts to avoid warning.
12826
12827 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12828
12829         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12830         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12831
12832 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12833
12834         * options.h (General_options::output_is_executable): New.
12835         (General_options::output_is_pie): New.
12836         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12837         for shared libraries.
12838         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12839
12840 2008-09-11  Chris Demetriou  <cgd@google.com>
12841
12842         * options.h (origin): New -z option.
12843         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12844         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12845         in DT_FLAGS_1.
12846
12847 2008-09-05  Cary Coutant  <ccoutant@google.com>
12848
12849         * fileread.cc (File_read::make_view): Add check for attempt to map
12850         beyond end of file.
12851
12852 2008-09-05  Cary Coutant  <ccoutant@google.com>
12853
12854         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12855         explicit instantiations.
12856
12857 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12858
12859         PR gold/6858
12860         * options.cc (General_options::finalize): Allow undefined symbols
12861         in shlibs if linking -shared.
12862
12863         PR gold/6859
12864         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12865         symbols as not needing a dynsym entry.
12866
12867 2008-08-20  Craig Silverstein  <csilvers@google.com>
12868
12869         * fileread.cc (File_read::open): Do not lock the file unless it
12870         was successfully opened.
12871
12872 2008-08-14  Cary Coutant  <ccoutant@google.com>
12873
12874         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12875         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12876         * testsuite/tls_test.cc (struct int128): 128-bit struct
12877         for testing TLS relocs with non-zero addend.
12878         (v12): New TLS variable.
12879         (t12): New test.
12880         (t_last): Add check for v12.
12881         * testsuite/tls_test.h (t12): New function.
12882         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12883
12884 2008-08-13  Ian Lance Taylor  <iant@google.com>
12885
12886         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12887         set tls_segment_ or relro_segment_.
12888         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12889         when appropriate.
12890         * output.h (Output_section::clear_is_relro): New function.
12891         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12892         sections specially even when output_data_ is empty.
12893         (Output_segment::maximum_alignment): When first section is relro,
12894         only force alignment for PT_LOAD segments.
12895         * script.cc (script_data_segment_align): New function.
12896         (script_data_segment_relro_end): New function.
12897         * script-c.h (script_data_segment_align): Declare.
12898         (script_data_segment_relro_end): Declare.
12899         * script-sections.h (class Script_sections): Declare
12900         data_segment_align and data_segment_relro_end.  Add fields
12901         segment_align_index_ and saw_relro_end_.
12902         * script-sections.cc (class Sections_element): Add set_is_relro
12903         virtual function.  Add new bool* parameter to place_orphan_here.
12904         Add get_output_section virtual function.
12905         (class Output_section_definition): Add set_is_relro.  Add new
12906         bool* parameter to place_orphan_here.  Add get_output_section.
12907         Add is_relro_ field.
12908         (Output_section_definition::Output_section_definition): Initialize
12909         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12910         and is_relro_ fields.
12911         (Output_section_definition::place_orphan_here): Add is_relro
12912         parameter.
12913         (Output_section_definition::set_section_addresses): Set relro for
12914         output section.
12915         (Output_section_definition::alternate_constraint): Likewise.
12916         (class Orphan_output_section): Add new bool* parameter to
12917         place_orphan_here.  Add get_output_section.
12918         (Orphan_output_section::place_orphan_here): Add is_relro
12919         parameter.
12920         (Script_sections::Script_sections): Initialize
12921         data_segment_align_index_ and saw_relro_end_.
12922         (Script_sections::data_segment_align): New function.
12923         (Script_sections::data_segment_relro_end): New function.
12924         (Script_sections::place_orphan): Set or clear is_relro.
12925         (Script_sections::set_section_addresses): Force alignment of first
12926         TLS section.
12927         * yyscript.y (exp): Call script_data_segment_align and
12928         script_data_segment_relro_end.
12929         * testsuite/relro_script_test.t: New file.
12930         * testsuite/relro_test.cc (using_script): Declare.
12931         (t1, t2): Test using_script.
12932         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12933         (relro_script_test_SOURCES): Define.
12934         (relro_script_test_DEPENDENCIES): Define.
12935         (relro_script_test_LDFLAGS): Define.
12936         (relro_script_test_LDADD): Define.
12937         (relro_script_test.so): New target.
12938         * testsuite/Makefile.in: Rebuild.
12939
12940 2008-08-06  Cary Coutant <ccoutant@google.com>
12941
12942         * archive.cc (Archive::total_archives, Archive::total_members)
12943         (Archive::total_members_loaded): New variables.
12944         (Archive::setup): Add parameter.  Add option to preread
12945         archive symbols.
12946         (Archive::read_armap): Add counter.
12947         (Archive::get_file_and_offset): New function.
12948         (Archive::get_elf_object_for_member): New function.
12949         (Archive::read_all_symbols): New function.
12950         (Archive::read_symbols): New function.
12951         (Archive::add_symbols): Add counters.
12952         (Archive::include_all_members): Use armap to find members if it's
12953         already built.
12954         (Archive::include_member): Skip reading symbols if already read.
12955         Factored code into Archive::get_file_and_offset and
12956         Archive::get_elf_object_for_member.  Changed call to
12957         Mapfile::report_include_archive_member.
12958         (Archive::print_stats): New function.
12959         * archive.h: Declare Object and Read_symbols_data classes.
12960         (Archive::Archive): Add initializers for new members.
12961         (Archive::setup): Add parameter.
12962         (Archive::print_stats): New function.
12963         (Archive::total_archives, Archive::total_members)
12964         (Archive::total_members_loaded): New variables.
12965         (Archive::get_file_and_offset): New function.
12966         (Archive::get_elf_object_for_member): New function.
12967         (Archive::read_all_symbols): New function.
12968         (Archive::read_symbols): New function.
12969         (Archive::Archive_member): New class.
12970         (Archive::members_): New member.
12971         (Archive::num_members_): New member.
12972         * main.cc: Include archive.h.
12973         (main): Call Archive::print_stats.
12974         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12975         archive parameter; member_name is now the fully-decorated name.
12976         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12977         * options.h: (General_options): Add --preread-archive-symbols option.
12978         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12979         Archive::setup.
12980
12981 2008-08-04  Ian Lance Taylor  <iant@google.com>
12982
12983         * symtab.h (Symbol::use_plt_offset): New function.
12984         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12985         * powerpc.cc (Relocate::relocate): Likewise.
12986         * sparc.cc (Relocate::relocate): Likewise.
12987         * x86_64.cc (Relocate::relocate): Likewise.
12988         * testsuite/weak_plt.sh: New test.
12989         * testsuite/weak_plt_main.cc: New test.
12990         * testsuite/weak_plt_shared.cc: New test.
12991         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12992         (check_PROGRAMS): Add weak_plt.
12993         (check_DATA): Add weak_plt_shared.so.
12994         (weak_plt_main_pic.o, weak_plt): New targets.
12995         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12996         * testsuite/Makefile.in: Rebuild.
12997
12998         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12999         gcctestdir/ld.
13000         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13001         * testsuite/Makefile.in: Rebuild.
13002
13003 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13004
13005         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13006         * Makefile.in: Regenerate.
13007         * po/POTFILES.in: Regenerate.
13008
13009 2008-07-29  Ian Lance Taylor  <iant@google.com>
13010
13011         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13012         symbols before other symbols.
13013         * testsuite/script_test_2.cc (test_addr): Declare.
13014         (test_addr_alias): Declare.
13015         (main): Check that test_addr and test_addr_alias have the right
13016         values.
13017         * testsuite/script_test_2.t: Define test_addr_alias and
13018         test_addr.
13019
13020 2008-07-24  Ian Lance Taylor  <iant@google.com>
13021
13022         PR 5990
13023         * descriptors.cc: New file.
13024         * descriptors.h: New file.
13025         * gold-threads.h (class Hold_optional_lock): New class.
13026         * fileread.cc: Include "descriptors.h".
13027         (File_read::~File_read): Release descriptor rather than closing
13028         it.
13029         (File_read::open) [file]: Call open_descriptor rather than open.
13030         Set is_descriptor_opened_.
13031         (File_read::open) [memory]: Assert that descriptor is not open.
13032         (File_read::reopen_descriptor): New function.
13033         (File_read::release): Release descriptor.
13034         (File_read::do_read): Make non-const.  Reopen descriptor.
13035         (File_read::read): Make non-const.
13036         (File_read::make_view): Reopen descriptor.
13037         (File_read::do_readv): Likewise.
13038         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13039         Update declarations.
13040         * layout.cc: Include "descriptors.h".
13041         (Layout::create_build_id): Use open_descriptor rather than open.
13042         * output.cc: Include "descriptors.h".
13043         (Output_file::open): Use open_descriptor rather than open.
13044         * archive.cc (Archive::const_iterator): Change Archive to be
13045         non-const.
13046         (Archive::begin, Archive::end): Make non-const.
13047         (Archive::count_members): Likewise.
13048         * archive.h (class Archive): Update declarations.
13049         * object.h (Object::read): Make non-const.
13050         * Makefile.am (CCFILES): Add descriptors.cc.
13051         (HFILES): Add descriptors.h.
13052         * Makefile.in: Rebuild.
13053
13054         PR 6716
13055         * gold.h: Always include <clocale>.  Add Solaris workarounds
13056         following code in binutils/sysdep.h.
13057
13058         PR 6048
13059         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13060         this->eh_frame_hdr_ is NULL before using it.
13061
13062         * dynobj.cc (Versions::Versions): Update comment.
13063
13064         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13065         the base version name.
13066
13067         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13068         array size plus one.
13069         (Stringpool_template::set_string_offsets): Subtract one from key
13070         before using it as an array index.
13071         (Stringpool_template::get_offset_with_length): Likewise.
13072         (Stringpool_template::write_to_buffer): Likewise.
13073         * stringpool.h (Stringpool_template::get_offset_from_key):
13074         Likewise.
13075
13076 2008-07-23  Ian Lance Taylor  <iant@google.com>
13077
13078         PR 6658
13079         * object.h (Merged_symbol_value::value): Do our best to handle a
13080         negative addend.
13081
13082         PR 6647
13083         * script.cc (Version_script_info::get_versions): Don't add empty
13084         version tag to return value.
13085         (Version_script_info::get_symbol_version_helper): Change return
13086         type to bool.  Add pversion parameter.  Change all callers.
13087         (script_register_vers_node): Don't require a non-NULL tag.
13088         * script.h (class Version_script_info): Update declarations.
13089         (Version_script_info::get_symbol_version): Change return type to
13090         bool.  Add version parameter.  Change all callers.
13091         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13092         handling.  Handle an empty version from a version script.
13093         (Symbol_table::define_special_symbol): Likewise.
13094         * testsuite/ver_test_10.script: New file.
13095         * testsuite/ver_test_10.sh: New file.
13096         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13097         (check_DATA): Add ver_test_10.syms.
13098         (ver_test_10.syms, ver_test_10.so): New target.
13099         * testsuite/Makefile.in: Rebuild.
13100
13101 2008-07-23  Simon Baldwin  <simonb@google.com>
13102
13103         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13104         to zero for undefined symbols from dynamic libraries.
13105
13106 2008-07-23  Ian Lance Taylor  <iant@google.com>
13107
13108         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13109         Change all callers.
13110         * symtab.h (class Symbol_table): Update declaration.
13111         * testsuite/ver_test_9.cc: New file.
13112         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13113         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13114         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13115         (ver_test_9.so, ver_test_9.o): New targets.
13116         * testsuite/Makefile.in: Rebuild.
13117
13118 2008-07-22  Ian Lance Taylor  <iant@google.com>
13119
13120         * options.h (class General_options): Define --check-sections.
13121         * layout.cc (Layout::set_segment_offsets): Handle
13122         --check-sections.
13123
13124         * options.h (class General_options): Define -n/--nmagic and
13125         -N/--omagic.
13126         * options.cc (General_options::finalize): For -n/--nmagic or
13127         -N/--omagic, set -static.
13128         * layout.cc (Layout::attach_allocated_section_to_segment): If
13129         -N/--omagic, don't put read-only and read-write sections in
13130         different segments.
13131         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13132         finding a read-only segment.
13133         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13134         don't set the minimum segment alignment to the common page size,
13135         and don't set the file offset to the address modulo the page size.
13136         * script-sections.cc (Script_sections::create_segments): If
13137         -n/--omagic, don't put read-only and read-write sections in
13138         different segments.
13139
13140         * cref.cc: New file.
13141         * cref.h: New file.
13142         * options.h (class General_options): Add --print-symbol-counts.
13143         * main.cc (main): Issue defined symbol report if requested.
13144         * archive.cc (Archive::interpret_header): Make into a const member
13145         function.
13146         (Archive::add_symbols): Call Input_objects::archive_start and
13147         archive_stop.
13148         (Archive::const_iterator): Define new class.
13149         (Archive::begin, Archive::end): New functions.
13150         (Archive::include_all_members): Rewrite to use iterator.
13151         (Archive::count_members): New function.
13152         * archive.h (class Archive): Update declarations.
13153         (Archive::filename): New function.
13154         * object.cc: Include "cref.h".
13155         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13156         (Sized_relobj::do_get_global_symbol_counts): New function.
13157         (Input_objects::add_object): Add object to cross-referencer.
13158         (Input_objects::archive_start): New function.
13159         (Input_objects::archive_stop): New function.
13160         (Input_objects::print_symbol_counts): New function.
13161         * object.h: Declare Cref and Archive.
13162         (Object::get_global_symbol_counts): New function.
13163         (Object::do_get_global_symbol_counts): New pure virtual function.
13164         (class Sized_relobj): Add defined_count_ field.  Update
13165         declarations.
13166         (class Input_objects): Add cref_ field.  Update constructor.
13167         Update declarations.
13168         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13169         defined_count_.
13170         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13171         symbol counts.
13172         (Sized_dynobj::do_get_global_symbol_counts): New function.
13173         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13174         defined_count_.  Update declarations.  Define Symbols typedef.
13175         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13176         parameter.  Change all callers.
13177         (Symbol_table::add_from_dynobj): Add sympointers and defined
13178         parameters.  Change all callers.
13179         * symtab.h (class Symbol_table): Update declarations.
13180         * Makefile.am (CCFILES): Add cref.cc.
13181         (HFILES): Add cref.h.
13182         * Makefile.in: Rebuild.
13183
13184 2008-07-22  Simon Baldwin  <simonb@google.com>
13185
13186         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13187         to zero when writing undefined symbols.
13188
13189 2008-07-22  Ian Lance Taylor  <iant@google.com>
13190
13191         * output.cc (Output_section::add_input_section): Don't try to
13192         merge empty merge sections.
13193
13194 2008-07-21  Craig Silverstein  <csilvers@google.com>
13195
13196         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13197         Include symbol version in error message.
13198
13199 2008-07-20  Chris Demetriou  <cgd@google.com>
13200
13201         * configure.ac (gold_cv_c_random_seed): New configured variable.
13202         (RANDOM_SEED_CFLAGS): New substituted variable.
13203         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13204         * configure: Rebuild.
13205         * Makefile.in: Likewise.
13206         * testsuite/Makefile.in: Likewise.
13207
13208 2008-07-18  Ian Lance Taylor  <iant@google.com>
13209
13210         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13211         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13212         * testsuite/ver_test_main.cc (main): Call t4.
13213         (t4, t4_2a): Define.
13214         * testsuite/ver_test_2.cc (t4_2): Define.
13215         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13216         * testsuite/ver_test_4.cc (t4_2a): Define.
13217         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13218         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13219
13220 2008-07-17  Ian Lance Taylor  <iant@google.com>
13221
13222         * dynobj.cc (Versions::add_def): If we give an error about a
13223         missing version, go ahead and create the version anyhow.
13224
13225 2008-07-10  Ian Lance Taylor  <iant@google.com>
13226
13227         Handle output sections with more than 0x7fffffff bytes.
13228         * object.h (class Relobj): Change map_to_output_ to
13229         output_sections_, and just keep a section pointer.  Change all
13230         uses.  Move comdat group support to Sized_relobj.
13231         (Relobj::is_section_specially_mapped): Remove.
13232         (Relobj::output_section): Remove poff parameter.  Change all
13233         callers.
13234         (Relobj::output_section_offset): New function.
13235         (Relobj::set_section_offset): Rewrite.
13236         (Relobj::map_to_output): Remove.
13237         (Relobj::output_sections): New function.
13238         (Relobj::do_output_section_offset): New pure virtual function.
13239         (Relobj::do_set_section_offset): Likewise.
13240         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13241         group support from Relobj.  Update declarations.
13242         (Sized_relobj::get_output_section_offset): New function.
13243         (Sized_relobj::do_output_section_offset): New function.
13244         (Sized_relobj::do_set_section_offset): New function.
13245         * object.cc (Relobj::output_section_address): Remove.
13246         (Sized_relobj::Sized_relobj): Initialize new fields.
13247         (Sized_relobj::include_section_group): Cast find_kept_object to
13248         Sized_relobj.
13249         (Sized_relobj::include_linkonce_section): Likewise.
13250         (Sized_relobj::do_layout): Use separate arrays for output section
13251         and output offset.
13252         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13253         output_sections.
13254         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13255         output_sections and section_offsets.
13256         (Sized_relobj::write_local_symbols): Likewise.
13257         (map_to_kept_section): Compute output address directly.
13258         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13259         output_sections and section_offsets.
13260         (Sized_relobj::write_sections): Likewise.
13261         (Sized_relobj::relocate_sections): Likewise.
13262         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13263         * output.h (class Output_reloc): Update declarations.  Change
13264         u2_.relobj to Sized_relobj*.
13265         (class Output_data_reloc): Change add functions to use
13266         Sized_relobj*.
13267         * output.cc (Output_reloc::Output_reloc): Change relobj to
13268         Sized_relobj*.
13269         (Output_reloc::local_section_offset): Change return type to
13270         Elf_Addr.  Use get_output_section_offset.
13271         (Output_reloc::get_address): Likewise.
13272         (Output_section::is_input_address_mapped): Don't call
13273         is_section_specially_mapped.
13274         (Output_section::output_offset): Likewise.
13275         (Output_section::output_address): Likewise.
13276         (Output_section::starting_output_address): Likewise.
13277         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13278         parameter to Sized_relobj*.
13279         (Copy_relocs::need_copy_reloc): Likewise.
13280         (Copy_relocs::save): Likewise.
13281         * copy-relocs.h (class Copy_relocs): Update declarations.
13282         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13283         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13284         * target-reloc.h (relocate_for_relocatable): Change
13285         offset_in_output_section type to Elf_Addr.  Change code that uses
13286         it as well.
13287         * layout.cc (Layout::layout): Always set *off.
13288         * mapfile.cc (Mapfile::print_input_section): Use
13289         output_section_offset.
13290         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13291         Sized_relobj*.
13292         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13293         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13294         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13295
13296 2008-07-03  Ian Lance Taylor  <iant@google.com>
13297
13298         * layout.cc (Layout::include_section): Do not discard unrecognized
13299         SHT_STRTAB sections.
13300
13301 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13302
13303         * script.cc (Lex::can_continue_name): Make '?' allowable in
13304         version-script names.
13305         * testsuite/version_script.map: Change glob pattern to use '?'
13306
13307 2008-06-30  Manish Singh  <yosh@gimp.org>
13308
13309         PR 6585
13310         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13311         Correct typo.
13312
13313 2008-06-30  Ian Lance Taylor  <iant@google.com>
13314
13315         PR 6660
13316         PR 6682
13317         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13318         versions]: Don't try to read the value in the contents, since we
13319         don't use it.  Use the template endianness when writing.
13320
13321 2008-06-25  Cary Coutant  <ccoutant@google.com>
13322
13323         * fileread.cc (File_read::make_view): Assert on zero-length view.
13324         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13325         symbol table when there are no symbols to read.
13326
13327 2008-06-23  Craig Silverstein  <csilvers@google.com>
13328
13329         * version.cc (version_string): Bump to 1.7
13330
13331 2008-06-18  Craig Silverstein  <csilvers@google.com>
13332
13333         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13334         constant 0xFFFF to type Valtype.
13335         (Powerpc_relocate_functions::rel16_ha): Likewise.
13336
13337 2008-06-17  Ian Lance Taylor  <iant@google.com>
13338
13339         * output.h (Output_section::Input_section): Initialize p2align_ to
13340         zero for Output_section_data constructors.
13341         (Output_section::Input_section::addralign): If not an input
13342         section, return the alignment of the Output_section_data.
13343         * testsuite/copy_test.cc: New file.
13344         * testsuite/copy_test_1.cc: New file.
13345         * testsuite/copy_test_2.cc: New file.
13346         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13347         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13348         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13349         (copy_test_1_pic.o, copy_test_1.so): New targets.
13350         (copy_test_2_pic.o, copy_test_2.so): New targets.
13351         * testsuite/Makefile.in: Rebuild.
13352
13353         * script-sections.cc (Script_sections::place_orphan): Initialize
13354         local variable exact.
13355
13356 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13357
13358         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13359
13360 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13361             David S. Miller  <davem@davemloft.net>
13362
13363         * powerpc.cc: New file.
13364         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13365         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13366         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13367         * Makefile.in: Rebuild.
13368
13369 2008-06-09  Ian Lance Taylor  <iant@google.com>
13370
13371         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13372         <exception>.
13373         (throwing, orig_terminate): New static variables.
13374         (terminate_handler): New static function.
13375         (t2): Set terminate handler.
13376
13377 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13378
13379         PR 6584
13380         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13381         alignment.
13382
13383 2008-05-30  Cary Coutant  <ccoutant@google.com>
13384
13385         * archive.cc (Archive::include_all_members) Correct to step
13386         over symbol table and extended name table in thin archives.
13387
13388 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13389
13390         PR 6407
13391         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13392         calculation.
13393
13394 2008-05-28  Caleb Howe  <cshowe@google.com>
13395
13396         * reduced_debug_output.cc: New file.
13397         * reduced_debug_output.h: New file.
13398         * options.h (class General_options): Add --strip-debug-non-line.
13399         * options.cc (General_options::finalize): Add strip_debug_non_line
13400         to the strip heirarchy.
13401         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13402         fields.
13403         * layout.cc: Include "reduced_debug_output.h".
13404         (Layout::Layout): Initialize new fields.
13405         (line_only_debug_sections): New static array.
13406         (is_lines_only_debug_sections): New static inline function.
13407         (Layout::include_section): Handle --strip-debug-non-line.
13408         (Layout::make_output_section): If --strip-debug-non-line, build
13409         new output sections for .debug_abbrev and .debug_info.
13410         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13411         gold.  Warn about possible overflow.
13412         (read_signed_LEB_128): Likewise.
13413         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13414         (read_signed_LEB_128): Declare.
13415         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13416         (HFILES): Add reduced_debug_output.h.
13417         * Makefile.in: Rebuild.
13418
13419 2008-05-21  Ian Lance Taylor  <iant@google.com>
13420
13421         * mapfile.cc: New file.
13422         * mapfile.h: New file.
13423         * options.h (class General_options): Add -M/--print-map and -Map.
13424         * options.cc (General_options::finalize): Make -M equivalent to
13425         -Map -.
13426         * main.cc: Include <cstdio> and "mapfile.h".
13427         (main): Open mapfile if requested.
13428         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13429         constructor.  Change caller.
13430         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13431         (queue_middle_tasks): Likewise.
13432         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13433         declarations.
13434         * archive.cc: Include "mapfile.h".
13435         (Archive::add_symbols): Add mapfile parameter.  Change all
13436         callers.  Pass mapfile, symbol, and reason to include_member.
13437         (Archive::include_all_members): Add mapfile parameter.  Change all
13438         callers.
13439         (Archive::include_member): Add mapfile, sym, and why parameters.
13440         Change all callers.  Report inclusion to map file.
13441         * archive.h: Include "fileread.h".
13442         (class Archive): Update declarations.
13443         (Archive::file): New const method.
13444         (class Add_archive_symbols): Add mapfile_ field.  Update
13445         constructor.  Change all callers.
13446         * readsyms.h (class Read_symbols): Likewise.
13447         (class Finish_group): Likewise.
13448         (class Read_script): Likewise.
13449         * common.cc: Include "mapfile.h".
13450         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13451         all callers.
13452         (Symbol_table::do_allocate_commons): Likewise.
13453         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13454         symbol allocation to mapfile.
13455         * common.h (class Allocate_commons_task): Add mapfile_ field.
13456         Update constructor.  Change all callers.
13457         * symtab.h (class Symbol_table): Update declarations.
13458         * layout.cc: Include "mapfile.h".
13459         (Layout_task_runner::run): Print information to mapfile.
13460         (Layout::create_gold_note): Change Output_data_fixed_space to
13461         Output_data_zero_fill.
13462         (Layout::create_build_id): Likewise.
13463         (Layout::print_to_mapfile): New function.
13464         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13465         constructor.  Change caller.
13466         (class Layout): Declare print_to_mapfile.
13467         * output.cc (Output_section::Input_section::print_to_mapfile): New
13468         function.
13469         (Output_section::add_input_section): If producing a map, always
13470         add to input_sections_ list.
13471         (Output_section::do_print_to_mapfile): New function.
13472         (Output_segment::print_sections_to_mapfile): New function.
13473         (Output_segment::print_section_list_to_mapfile): New function.
13474         * output.h: Include "mapfile.h".
13475         (Output_data::print_to_mapfile): New function.
13476         (Output_data::do_print_to_mapfile): New virtual function.
13477         (Output_segment_headers::do_print_to_mapfile): New function.
13478         (Output_file_header::do_print_to_mapfile): New function.
13479         (Output_data_const::do_print_to_mapfile): New function.
13480         (class Output_data_const_buffer): Add map_name_ field.  Update
13481         constructor.  Change all callers.  Add do_print_to_mapfile
13482         function.
13483         (class Output_data_fixed_space): Likewise.
13484         (class Output_data_space): Likewise.
13485         (class Output_data_zero_fill): New class.
13486         (Output_data_strtab::do_print_to_mapfile): New function.
13487         (Output_data_reloc_base::do_print_to_mapfile): New function.
13488         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13489         (Output_data_group::do_print_to_mapfile): New function.
13490         (Output_data_got::do_print_to_mapfile): New function.
13491         (Output_data_dynamic::do_print_to_mapfile): New function.
13492         (Output_symtab_xindex::do_print_to_mapfile): New function.
13493         (class Output_section): Declare do_print_to_mapflie.  Declare
13494         print_to_mapfile in Input_section.
13495         (class Output_segment): Declare new functions.
13496         * object.h (Sized_relobj::symbol_count): New function.
13497         * script-sections.cc
13498         (Output_section_element_dot_assignment::set_section_addresses):
13499         Change Output_data_fixed_space to Output_data_zero_fill.
13500         (Output_data_expression::do_print_to_mapfile): New function.
13501         * script.cc (read_input_script): Add mapfile parameter.  Change
13502         all callers.
13503         * script.h (read_input_script): Update declaration.
13504         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13505         (Eh_frame::do_print_to_mapfile): New function.
13506         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13507         (Output_merge_string::do_print_to_mapfile): New function.
13508         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13509         function.
13510         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13511         function.
13512         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13513         function.
13514         * Makefile.am (CCFILES): Add mapfile.cc.
13515         (HFILES): Add mapfile.h.
13516         * Makefile.in: Rebuild.
13517
13518 2008-05-19  Ian Lance Taylor  <iant@google.com>
13519
13520         * options.h (class General_options): Add -z relro.
13521         * layout.cc (Layout::Layout): Initialize relro_segment_.
13522         (Layout::add_output_section_data): Return the output section.
13523         (Layout::make_output_section): Rcognize relro sections and mark
13524         them appropriately.
13525         (Layout::attach_allocated_section_to_segment): Put relro sections
13526         in a PT_GNU_RELRO segment.
13527         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13528         section as relro.
13529         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13530         PT_TLS segments.
13531         (Layout::linkonce_mapping): Map d.rel.ro.local to
13532         .data.rel.ro.local.
13533         (Layout::output_section_name): Us .data.rel.ro.local for any
13534         section which begins with that.
13535         * layout.h (class Layout): Update add_output_section_data
13536         declaration.  Add relro_segment_ field.
13537         * output.cc (Output_section::Output_section): Initialize is_relro_
13538         and is_relro_local_ fields.
13539         (Output_segment::add_output_section): Group relro sections.
13540         (Output_segment::is_first_section_relro): New function.
13541         (Output_segment::maximum_alignment): If there is a relro section,
13542         align the segment to the common page size.
13543         (Output_segment::set_section_addresses): Track whether we are
13544         looking at relro sections.  If the last section is a relro
13545         section, align to the common page size.
13546         (Output_segment::set_section_list_addresses): Add in_relro
13547         parameter.  Change all callers.  Align to the page size when
13548         moving from relro to non-relro section.
13549         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13550         segment.
13551         * output.h (class Output_section): Add is_relro_ and
13552         is_relro_local_ fields.
13553         (Output_section::is_relro): New function.
13554         (Output_section::set_is_relro): New function.
13555         (Output_section::is_relro_local): New function.
13556         (Output_section::set_is_relro_local): New function.
13557         (class Output_segment): Update declarations.
13558         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13559         * sparc.cc (Target_sparc::got_section): Likewise.
13560         * x86_64.cc (Target_x86_64::got_section): Likewise.
13561         * testsuite/relro_test_main.cc: New file.
13562         * testsuite/relro_test.cc: New file.
13563         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13564         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13565         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13566         (relro_test.so, relro_test_pic.o): New targets.
13567         * testsuite/Makefile.in: Rebuild.
13568
13569 2008-05-16  Ian Lance Taylor  <iant@google.com>
13570
13571         * output.cc (Output_segment::add_output_section): Remove front
13572         parameter.
13573         * output.h (class Output_segment): Remove
13574         add_initial_output_section and overloaded add_output_section.
13575         Update declaration of remaining add_output_section.
13576         * layout.cc (Layout::create_interp): Call add_output_section
13577         rather than add_initial_output_section.
13578         (Layout::finish_dynamic_section): Likewise.
13579
13580         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13581         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13582         know the dynamic type.
13583         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13584         field.  Initialize it in constructor.
13585         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13586         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13587         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13588         reloc.
13589
13590         * output.cc (Output_reloc::get_address): Change return type to
13591         Elf_Addr.
13592         * output.h (class Output_reloc): Update get_address declaration.
13593         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13594         for section addresses.
13595
13596 2008-05-09  Ian Lance Taylor  <iant@google.com>
13597
13598         PR 6493
13599         * gold.cc (gold_nomem): Use return value of write.
13600
13601 2008-05-08  Ian Lance Taylor  <iant@google.com>
13602
13603         * symtab.c (Symbol::init_base_output_data): Add version
13604         parameter.  Change all callers.
13605         (Symbol::init_base_output_segment): Likewise.
13606         (Symbol::init_base_constant): Likewise.
13607         (Symbol::init_base_undefined): Likewise.
13608         (Sized_symbol::init_output_data): Likewise.
13609         (Sized_symbol::init_output_segment): Likewise.
13610         (Sized_symbol::init_constant): Likewise.
13611         (Sized_symbol::init_undefined): Likewise.
13612         (Symbol_table::do_define_in_output_data): If the new symbol has a
13613         version, mark it as the default.
13614         (Symbol_table::do_define_in_output_segment): Likewise.
13615         (Symbol_table::do_define_as_constant): Likewise.
13616         * symtab.h (class Symbol): Update declarations.
13617         (class Sized_symbol): Likewise.
13618         * resolve.cc (Symbol::override_version): New function.
13619         (Symbol::override_base): Call override_version.
13620         (Symbol::override_base_with_special): Likewise.
13621         * testsuite/ver_script_8.script: New file.
13622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13623         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13624         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13625         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13626
13627 2008-05-06  Ian Lance Taylor  <iant@google.com>
13628
13629         PR 6049
13630         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13631         functions.
13632         (class General_options): Remove existing --undefined, and add
13633         --no-undefined instead.  Add new --undefined as synonym for -u.
13634         * archive.cc (Archive::add_symbols): Check whether symbol was
13635         named with -u.
13636         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13637         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13638         all uses.  Add IS_UNDEFINED.  Update declarations to split
13639         different versions of init_base.  Declare init_base_undefined.
13640         (Symbol::is_defined): Handle IS_UNDEFINED.
13641         (Symbol::is_undefined): Likewise.
13642         (Symbol::is_weak_undefined): Call is_undefined.
13643         (Symbol::is_absolute): Handle IS_CONSTANT.
13644         (class Sized_symbol): Update declarations to split different
13645         versions of init.  Declare init_undefined.
13646         (class Symbol_table): Declare new functions.
13647         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13648         Change all callers.
13649         (Symbol::init_base_output_data): Likewise.
13650         (Symbol::init_base_output_segment): Likewise.
13651         (Symbol::init_base_constant): Likewise.
13652         (Symbol::init_base_undefined): New function.
13653         (Sized_symbol::init_object): Rename from init.  Change all
13654         callers.
13655         (Sized_symbol::init_output_data): Likewise.
13656         (Sized_symbol::init_output_segment): Likewise.
13657         (Sized_symbol::init_constant): Likewise.
13658         (Sized_symbol::init_undefined): New function.
13659         (Symbol_table::add_undefined_symbols_from_command_line): New
13660         function.
13661         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13662         function.
13663         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13664         (Symbol::output_section): Likewise.
13665         (Symbol::set_output_section): Likewise.
13666         (Symbol_table::sized_finalize_symbol): Likewise.
13667         (Symbol_table::sized_write_globals): Likewise.
13668         * resolve.cc (Symbol_table::should_override): Likewise.
13669         (Symbol::override_base_with_special): Likewise.
13670
13671         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13672         symbol, change it to have default visibility.
13673         * testsuite/protected_1.cc: New file.
13674         * testsuite/protected_2.cc: New file.
13675         * testsuite/protected_3.cc: New file.
13676         * testsuite/protected_main_1.cc: New file.
13677         * testsuite/protected_main_2.cc: New file.
13678         * testsuite/protected_main_3.cc: New file.
13679         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13680         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13681         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13682         (protected_1.so): New target.
13683         (protected_1_pic.o, protected_2_pic.o): New targets.
13684         (protected_3_pic.o): New target.
13685         (check_PROGRAMS): Add protected_2.
13686         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13687         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13688         * testsuite/Makefile.in: Rebuild.
13689
13690         * options.h (DEFINE_var): Add set_user_set_##varname__.
13691         (DEFINE_bool_alias): New macro.
13692         (class General_options): Define -Bstatic using DEFINE_bool_alias
13693         rather than DEFINE_special.  Add --undefined as an alias for -z
13694         defs.
13695         * options.cc (General_options::parse_Bstatic): Remove.
13696
13697         * options.h (class General_options): Add --fatal-warnings.
13698         * main.cc (main): Implement --fatal-warnings.
13699         * errors.h (Errors::warning_count): New function.
13700
13701         * options.h (class General_options): Add -Bsymbolic-functions.
13702         * symtab.h (Symbol::is_preemptible): Check for
13703         -Bsymbolic-functions.
13704
13705 2008-05-05  Ian Lance Taylor  <iant@google.com>
13706
13707         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13708         as noVARNAME rather than no-VARNAME.
13709         (class General_options): Add option -z combreloc.
13710         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13711         get_address.
13712         (Output_reloc::sort_before) [SHT_REL]: New function.
13713         (Output_reloc::sort_before) [SHT_RELA]: New function.
13714         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13715         Sort_relocs_comparison.
13716         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13717         parameter.  Change all callers.
13718         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13719         sort_relocs parameter.  Change all callers.
13720         * output.cc (Output_reloc::get_address): New function, broken out
13721         of write_rel.
13722         (Output_reloc::write_rel): Call it.
13723         (Output_reloc::compare): New function.
13724         (Output_data_reloc_base::do_write): Optionally sort relocs.
13725
13726         * configure.ac: If targ_extra_obj is set, link it in.
13727         * configure.tgt: Initialize all variables.
13728         (x86_64*): Set targ_extra_obj and targ_extra_size.
13729         * configure: Rebuild.
13730
13731         * object.cc (Sized_relobj::include_section_group): Adjust section
13732         indexes read from group data.  Build vector to pass to
13733         layout_group.
13734         * layout.cc (Layout::layout_group): Add flags and shndxes
13735         parameters.  Remove contents parameter.  Change caller.  Update
13736         explicit instantiations.
13737         * layout.h (class Layout): Update layout_group declaration.
13738         * output.cc (Output_data_group::Output_data_group): Add flags and
13739         input_shndxes parameters.  Remove contents parameter.  Change
13740         caller.
13741         (Output_data_group::do_write): Change input_sections_ to
13742         input_shndxes_.
13743         * output.h (class Output_data_group): Update constructor
13744         declaration.  Rename input_sections_ to input_shndxes_.
13745         * testsuite/many_sections_test.cc: Add template.
13746
13747 2008-04-30  Cary Coutant  <ccoutant@google.com>
13748
13749         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13750
13751         * layout.cc (Layout::include_section): Refactored check for debug
13752         info section.
13753         (Layout::add_comdat): Add new parameters.  Change type
13754         of signature parameter.  Add object and shndx to signatures table.
13755         (Layout::find_kept_object): New function.
13756         * layout.h: Include <cstring>.
13757         (Layout::is_debug_info_section): New function.
13758         (Layout::add_comdat): Add new parameters.
13759         (Layout::find_kept_object): New function.
13760         (Layout::Kept_section): New struct.
13761         (Layout::Signatures): Change type of map range.
13762         * object.cc (Relobj::output_section_address): New function.
13763         (Sized_relobj::include_section_group): Add new parameters.  Change
13764         calls to Layout::add_comdat.  Change to build table of kept comdat
13765         groups and table mapping discarded sections to kept sections.
13766         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13767         (Sized_relobj::do_layout): Change calls to include_section_group and
13768         include_linkonce_section.
13769         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13770         value to zero when section is discarded.
13771         (Sized_relobj::map_to_kept_section): New function.
13772         * object.h (Relobj::output_section_address): New function.
13773         (Relobj::Comdat_group): New type.
13774         (Relobj::find_comdat_group): New function.
13775         (Relobj::Comdat_group_table): New type.
13776         (Relobj::Kept_comdat_section): New type.
13777         (Relobj::Kept_comdat_section_table): New type.
13778         (Relobj::add_comdat_group): New function.
13779         (Relobj::set_kept_comdat_section): New function.
13780         (Relobj::get_kept_comdat_section): New function.
13781         (Relobj::comdat_groups_): New field.
13782         (Relobj::kept_comdat_sections_): New field.
13783         (Symbol_value::input_value): Update comment.
13784         (Sized_relobj::map_to_kept_section) New function.
13785         (Sized_relobj::include_linkonce_section): Add new parameter.
13786         * target-reloc.h (Comdat_behavior): New type.
13787         (get_comdat_behavior): New function.
13788         (relocate_section): Add code to map a discarded section to the
13789         corresponding kept section when applying a relocation.
13790
13791 2008-04-30  Craig Silverstein  <csilvers@google.com>
13792
13793         * dwarf_reader.cc (next_generation_count): New static var.
13794         (Addr2line_cache_entry): New struct.
13795         (addr2line_cache): New static var.
13796         (Dwarf_line_info::one_addr2line): Added caching.
13797         (Dwarf_line_info::clear_addr2line_cache): New function.
13798         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13799         cache-size parameter.
13800         (Dwarf_line_info::one_addr2line_cache): New function.
13801         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13802         new cache-size argument to one_addr2line(), and clear cache.
13803
13804 2008-04-28  Cary Coutant  <ccoutant@google.com>
13805
13806         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13807         R_386_PC8 relocations.
13808
13809 2008-04-23  Ian Lance Taylor  <iant@google.com>
13810
13811         * object.cc (Sized_relobj::include_section_group): Check for
13812         invalid section group.
13813
13814         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13815         header size.
13816
13817         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13818         than read for file header.
13819         * archive.cc (Archive::include_member): Likewise.
13820
13821 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13822
13823         * aclocal.m4: Regenerate.
13824         * configure: Regenerate.
13825
13826 2008-04-19  Ian Lance Taylor  <iant@google.com>
13827
13828         * version.cc (version_string): Bump to 1.6.
13829
13830         * testsuite/Makefile.am (many_sections_r_test): New target.
13831         (many_sections_r_test_SOURCES): Remove.
13832         (many_sections_r_test_DEPENDENCIES): Remove.
13833         (many_sections_r_test_LDFLAGS): Remove.
13834         (many_sections_r_test_LDADD): Remove.
13835
13836         * object.cc (Sized_relobj::do_add_symbols): Always pass
13837         local_symbol_count_ to add_from_relobj.
13838
13839         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13840         every thousand variables.
13841         * testsuite/Makefile.in: Rebuild.
13842
13843         * object.cc (Xindex::initialize_symtab_xindex): New function.
13844         (Xindex::read_symtab_xindex): New function.
13845         (Xindex::sym_xindex_to_shndx): New function.
13846         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13847         available.
13848         (Sized_relobj::do_initialize_xindex): New function.
13849         (Sized_relobj::do_read_symbols): Adjust section links.
13850         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13851         parameter.  Change all callers.
13852         (Sized_relobj::include_section_group): Adjust section links and
13853         symbol section indexes.
13854         (Sized_relobj::do_layout): Adjust section links.
13855         (Sized_relobj::do_count_local_symbols): Adjust section links and
13856         symbol section indexes.
13857         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13858         ordinary and special symbols.
13859         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13860         dynsym_xindex parameters.  Change all callers.  Adjust section
13861         links.  Use SHN_XINDEX when needed.
13862         (Sized_relobj::get_symbol_location_info): Adjust section links.
13863         Don't get fooled by special symbols.
13864         * object.h (class Xindex): Define.
13865         (class Object): Add xindex_ parameter.  Declare virtual functoin
13866         do_initialize_xindex.
13867         (Object::adjust_sym_shndx): New function.
13868         (Object::set_xindex): New protected function.
13869         (class Symbol_value): Add is_ordinary_shndx_ field.
13870         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13871         (Symbol_value::value): Assert ordinary section.
13872         (Symbol_value::initialize_input_to_output_map): Likewise.
13873         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13874         Change all callers.
13875         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13876         all callers.
13877         (class Sized_relobj): Update declarations.
13878         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13879         parameter.  Change all callers.
13880         (Sized_relobj::adjust_shndx): New function.
13881         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13882         field.
13883         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13884         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13885         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13886         (Sized_dynobj::read_dynsym_section): Adjust section links.
13887         (Sized_dynobj::read_dynamic): Likewise.
13888         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13889         section links.
13890         (Sized_dynobj::do_initialize_xindex): New function.
13891         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13892         do_initialize_xindex.
13893         (Sized_dynobj::adjust_shndx): New function.
13894         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13895         dynsym_xindex_ fields.
13896         (Layout::finalize): Add a call to set_section_indexes before
13897         creating the symtab sections.
13898         (Layout::set_section_indexes): Don't do anything if the section
13899         already has a section index.
13900         (Layout::create_symtab_sections): Add shnum parameter.  Change
13901         caller.  Create .symtab_shndx section if needed.
13902         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13903         caller.
13904         (Layout::allocated_output_section_count): New function.
13905         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13906         needed.
13907         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13908         fields.  Update declarations.
13909         (Layout::symtab_xindex): New function.
13910         (Layout::dynsym_xindex): New function.
13911         (class Write_symbols_task): Add layout_ field.
13912         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13913         Change caller.
13914         * output.cc (Output_section_headers::Output_section_headers): Add
13915         shstrtab_section parameter.  Change all callers.
13916         (Output_section_headers::do_sized_write): Store overflow values
13917         for section count and section string table section index in
13918         section header zero.
13919         (Output_file_header::do_sized_write): Check for overflow of
13920         section count and section string table section index.
13921         (Output_symtab_xindex::do_write): New function.
13922         (Output_symtab_xindex::endian_do_write): New function.
13923         * output.h (class Output_section_headers): Add shstrtab_section_.
13924         Update declarations.
13925         (class Output_symtab_xindex): Define.
13926         (Output_section::has_out_shndx): New function.
13927         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13928         field.
13929         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13930         Change all callers.
13931         (Sized_symbol::init): Likewise.
13932         (Symbol::output_section): Check for ordinary symbol.
13933         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13934         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13935         callers.
13936         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13937         Change all callers.  Simplify handling of symbols from sections
13938         not included in the link.
13939         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13940         distinction.
13941         (Weak_alias_sorter::operator()): Assert that symbols are
13942         ordinary.
13943         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13944         distinction.
13945         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13946         parameters.  Change all callers.
13947         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13948         symbol distinction.  Use SHN_XINDEX when needed.
13949         (Symbol_table::write_section_symbol): Add symtab_xindex
13950         parameter.  Change all callers.
13951         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13952         SHN_XINDEX when needed.
13953         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13954         declarations.
13955         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13956         (Symbol::is_defined): Check is_ordinary.
13957         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13958         (Symbol::is_absolute, Symbol::is_common): Likewise.
13959         (class Sized_symbol): Update declarations.
13960         (class Symbol_table): Update declarations.
13961         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13962         parameters.  Change all callers.
13963         (Sized_symbol::override): Likewise.
13964         (Symbol_table::override): Likewise.
13965         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13966         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13967         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13968         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13969         to be in an ordinary section.
13970         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13971         object and is_ordinary parameters.  Change all callers.
13972         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13973         Change all callers.  Don't add undefined or non-ordinary symbols
13974         to reloc_map_.
13975         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13976         Change all callers.
13977         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13978         declarations.
13979         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13980         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13981         (Sized_relobj::relocate_sections): Likewise.
13982         * target-reloc.h (scan_relocs): Adjust section symbol index.
13983         (scan_relocatable_relocs): Likewise.
13984         * i386.cc (Scan::local): Check for ordinary symbols.
13985         * sparc.cc (Scan::local): Likewise.
13986         * x86_64.cc (Scan::local): Likewise.
13987         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13988         to symbol_section_and_value.
13989         * testsuite/many_sections_test.cc: New file.
13990         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13991         (check_PROGRAMS): Add many_sections_test.
13992         (many_sections_test_SOURCES): Define.
13993         (many_sections_test_DEPENDENCIES): Define.
13994         (many_sections_test_LDFLAGS): Define.
13995         (BUILT_SOURCES): Add many_sections_define.h.
13996         (many_sections_define.h): New target.
13997         (BUILT_SOURCES): Add many_sections_check.h.
13998         (many_sections_check.h): New target.
13999         (check_PROGRAMS): Add many_sections_r_test.
14000         (many_sections_r_test_SOURCES): Define.
14001         (many_sections_r_test_DEPENDENCIES): Define.
14002         (many_sections_r_test_LDFLAGS): Define.
14003         (many_sections_r_test_LDADD): Define.
14004         (many_sections_r_test.o): New target.
14005         * testsuite/Makefile.in: Rebuild.
14006
14007 2008-04-17  Cary Coutant  <ccoutant@google.com>
14008
14009         * errors.cc (Errors::info): New function.
14010         (gold_info): New function.
14011         * errors.h (Errors::info): New function.
14012         * gold.h (gold_info): New function.
14013         * object.cc (Input_objects::add_object): Print trace output.
14014         * options.cc (options::parse_set): New function.
14015         (General_options::parse_wrap): Deleted.
14016         (General_options::General_options): Deleted initializer.
14017         * options.h (options::String_set): New typedef.
14018         (options::parse_set): New function.
14019         (DEFINE_set): New macro.
14020         (General_options::wrap): Changed to use DEFINE_set. Changed
14021         callers of any_wrap_symbols and is_wrap_symbol.
14022         (General_options::trace, General_options::trace_symbol):
14023         New options.
14024         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14025         (General_options::wrap_symbols_): Deleted.
14026         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14027
14028 2008-04-17  David S. Miller  <davem@davemloft.net>
14029
14030         * options.cc (General_options::parse_V): New function.
14031         * options.h: Add entries for -V and -Qy.
14032
14033 2008-04-17  Ian Lance Taylor  <iant@google.com>
14034
14035         * common.cc (Symbol_table::allocate_commons): Remove options
14036         parameter.  Change caller.
14037         (Symbol_table::do_allocate_commons): Remove options parameter.
14038         Change caller.  Just call do_allocate_commons_list twice.
14039         (Symbol_table::do_allocate_commons_list): New function, broken out
14040         of do_allocate_commons.
14041         * common.h (class Allocate_commons_task): Remove options_ field.
14042         Update constructor.
14043         * symtab.cc (Symbol_table::Symbol_table): Initialize
14044         tls_commons_.
14045         (Symbol_table::add_from_object): Put TLS common symbols on
14046         tls_commons_ list.
14047         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14048         which are IN_OUTPUT_DATA.
14049         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14050         allocate_commons and do_allocate_commons declarations.  Declare
14051         do_allocate_commons_list.
14052         * gold.cc (queue_middle_tasks): Update creation of
14053         Allocate_commons_task to not pass options.
14054         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14055         (TLS_TEST_C_FLAGS): New variable.
14056         (tls_test_c_pic.o): New target.
14057         (tls_test_shared.so): Link in tls_test_c_pic.o.
14058         (tls_test_c_pic_ie.o): New target.
14059         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14060         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14061         (tls_test_c.o): New target.
14062         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14063         (tls_pic_test_LDADD): Likewise.
14064         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14065         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14066         (tls_test_c_gnu2.o): New target.
14067         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14068         tls_test_c_gnu2.o.
14069         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14070         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14071         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14072         * testsuite/tls_test.cc: Include "config.h".
14073         (t_last): Call t11_last.
14074         * testsuite/tls_test.h (t11, t11_last): Declare.
14075         * testsuite/tls_test_c.c: New file.
14076         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14077         * configure.ac: Check for OpenMP support.
14078         * configure, config.in, Makefile.in: Rebuild.
14079         * testsuite/Makefile.in: Rebuild.
14080
14081 2008-04-16  Cary Coutant  <ccoutant@google.com>
14082
14083         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14084         (Target_i386::tls_base_symbol_defined_): New field.
14085         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14086         (Target_i386::Scan::global): Likewise.
14087         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14088         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14089         (Target_x86_64::tls_base_symbol_defined_): New field.
14090         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14091         (Target_x86_64::Scan::global): Likewise.
14092
14093 2008-04-16  Cary Coutant  <ccoutant@google.com>
14094
14095         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14096         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14097         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14098         building shared libraries.
14099         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14100         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14101         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14102         * testsuite/Makefile.in: Rebuild.
14103         * testsuite/weak_undef.h: New file.
14104         * testsuite/weak_undef_file1.cc: Add extra test cases.
14105         * testsuite/weak_undef_file2.cc: Likewise.
14106         * testsuite/weak_undef_test.cc: Likewise.
14107
14108 2008-04-16  David S. Miller  <davem@davemloft.net>
14109
14110         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14111         Add issued_non_pic_error_ field.  Declare check_non_pic.
14112         (Target_sparc::Scan::check_non_pic): New function.
14113         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14114         (Target_sparc::Scan::global): Likewise.
14115
14116         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14117         * configure: Rebuild.
14118
14119         * options.h (DEFINE_enable): New macro.
14120         (new_dtags): New enable option.
14121         (initfirst, interpose, loadfltr, nodefaultlib,
14122         nodelete, nodlopen, nodump): New -z options.
14123         * layout.cc (Layout:finish_dynamic_section): If new
14124         dtags enabled, emit DT_RUNPATH.  Also, emit a
14125         DT_FLAGS_1 containing any specified -z flags.
14126
14127 2008-04-16  Ian Lance Taylor  <iant@google.com>
14128
14129         * copy-relocs.cc: New file.
14130         * copy-relocs.h: New file.
14131         * reloc.cc: Remove Copy_relocs code.
14132         * reloc.h: Likewise.
14133         * reloc-types.h (struct Reloc_types) [both versions]: Add
14134         get_reloc_addend_noerror.
14135         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14136         variants of add_global which take an addend which must be zero.
14137         * i386.cc: Include "copy-relocs.h".
14138         (class Target_i386): Change type of copy_relocs_ to variable,
14139         update initializer.
14140         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14141         Change all callers.
14142         (Target_i386::do_finalize_sections): Change handling of
14143         copy_relocs_.
14144         * sparc.cc: Include "copy-relocs.h".
14145         (class Target_sparc): Change type of copy_relocs_ to variable,
14146         update initializer.
14147         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14148         Change all callers.
14149         (Target_sparc::do_finalize_sections): Change handling of
14150         copy_relocs_.
14151         * x86_64.cc: Include "copy-relocs.h".
14152         (class Target_x86_64): Change type of copy_relocs_ to variable,
14153         update initializer.
14154         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14155         class.  Change all callers.
14156         (Target_x86_64::do_finalize_sections): Change handling of
14157         copy_relocs_.
14158         * Makefile.am (CCFILES): Add copy-relocs.cc.
14159         (HFILES): Add copy-relocs.h.
14160
14161         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14162
14163         * testsuite/script_test_4.sh: Permit leading zeroes.
14164
14165 2008-04-15  Ian Lance Taylor  <iant@google.com>
14166
14167         * script-sections.cc (Script_sections::create_segments): Use
14168         header_size_adjustment even when there is enough room for the
14169         headers.
14170         * testsuite/script_test_4.sh: New file.
14171         * testsuite/script_test_4.t: New file.
14172         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14173         (check_DATA): Add script_test_4.stdout.
14174         (MOSTLYCLEANFILES): Likewise.
14175         (script_test_4): New target.
14176         (script_test_4.stdout): New target.
14177         * testsuite/Makefile.in: Rebuild.
14178
14179         * sparc.cc: Add definitions for Output_data_plt_sparc class
14180         constants.
14181
14182 2008-04-14  David S. Miller  <davem@davemloft.net>
14183
14184         * sparc.cc: New file.
14185         * Makefile.am (TARGETSOURCES): Add sparc.cc
14186         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14187         * configure.tgt: Document targ_extra_size and
14188         targ_extra_big_endian.  Add entries for sparc-* and
14189         sparc64-*.
14190         * configure.ac: Handle targ_extra_size and
14191         targ_extra_big_endian.
14192         * Makefile.in: Rebuild.
14193         * configure: Likewise.
14194         * po/POTFILES.in: Likewise.
14195         * po/gold.pot: Likewise.
14196
14197 2008-04-14  Ian Lance Taylor  <iant@google.com>
14198
14199         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14200         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14201         in the name/type/flags to section mapping.  Don't call
14202         allocate_output_section.
14203         (Layout::choose_output_section): Change parameter from adjust_name
14204         to is_input_section.  Don't permit input sections after sections
14205         are attached to segments.  Don't call allocate_output_section.
14206         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14207         not write_enable_output_section.
14208         (Layout::make_output_section): Don't push to
14209         unattached_section_list_ nor call attach_to_segment.  Call
14210         attach_section_to_segment if sections are attached.
14211         (Layout::attach_sections_to_segments): New function.
14212         (Layout::attach_section_to_segment): New function.
14213         (Layout::attach_allocated_section_to_segment): Rename from
14214         attach_to_segment.  Remove flags parameter.
14215         (Layout::allocate_output_section): Remove function.
14216         (Layout::write_enable_output_section): Remove function.
14217         * layout.h (class Layout): Update for above changes.  Add new
14218         field sections_are_attached_.
14219         * output.h (Output_section::update_flags_for_input_section): New
14220         function.
14221         * output.cc (Output_section::add_input_section): Call
14222         update_flags_for_input_section.
14223         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14224
14225 2008-04-11  Cary Coutant  <ccoutant@google.com>
14226
14227         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14228         thought unnecessary.
14229         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14230
14231 2008-04-11  Ian Lance Taylor  <iant@google.com>
14232
14233         * output.h (class Output_section_data): Remove inline definition
14234         of set_addralign.
14235         * output.cc (Output_section_data::set_addralign): New function.
14236
14237 2008-04-11  Cary Coutant  <ccoutant@google.com>
14238
14239         Add support for TLS descriptors for i386 and x86_64.
14240         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14241         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14242         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14243         GOT_TYPE_TLS_DESC.
14244         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14245         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14246         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14247         relocations.
14248         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14249         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14250         Fix problem with initial-exec relocations.
14251         (Target_i386::Relocate::relocate_tls): Likewise.
14252         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14253         relaxation.
14254         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14255         support for section-plus-offset dynamic table entries.
14256         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14257         (Output_data_dynamic::Dynamic_entry): Add support for
14258         section-plus-offset dynamic table entries.
14259         (Output_data_dynamic::Classification): Likewise.
14260         (Output_data_dynamic::classification_): Renamed offset_.
14261         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14262         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14263         (Target_x86_64::make_plt_section): New function.
14264         (Target_x86_64::reserve_tlsdesc_entries): New function.
14265         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14266         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14267         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14268         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14269         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14270         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14271         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14272         add extra PLT entry for TLS descriptors.
14273         (Output_data_plt_x86_64::got_): New field.
14274         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14275         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14276         fields.
14277         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14278         descriptors.
14279         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14280         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14281         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14282         R_386_TLS_DESC_CALL relocations.
14283         (Target_x86_64::Scan::global): Likewise.
14284         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14285         for TLS descriptors.
14286         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14287         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14288         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14289         GD-to-IE relaxation.
14290         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14291         and TLS_DESCRIPTORS.
14292         * Makefile.in: Rebuild.
14293         * configure: Rebuild.
14294         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14295         (tls_test_shared2.so): New target.
14296         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14297         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14298         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14299         (tls_shared_gd_to_ie_test_LDADD): New variable.
14300         (tls_shared_gnu2_gd_to_ie_test): New target.
14301         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14302         New targets.
14303         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14304         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14305         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14306         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14307         (tls_shared_gnu2_test): New target.
14308         (tls_test_gnu2_shared.so): New target.
14309         (tls_shared_gnu2_test_SOURCES): New variable.
14310         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14311         (tls_shared_gnu2_test_LDFLAGS): New variable.
14312         (tls_shared_gnu2_test_LDADD): New variable.
14313         * testsuite/Makefile.in: Rebuild.
14314         * testsuite/Makefile.
14315
14316 2008-04-11  Ian Lance Taylor  <iant@google.com>
14317
14318         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14319         justsyms.t.
14320         * testsuite/Makefile.in: Rebuild.
14321
14322         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14323         long.
14324         * testsuite/script_test_2.cc (main): Adjust test.
14325
14326 2008-04-11  David S. Miller  <davem@davemloft.net>
14327             Ian Lance Taylor  <iant@google.com>
14328
14329         * options.h (General_options): Add entries for '-Y' and
14330         '-relax'.
14331         * options.cc (General_options:finalize): If -Y was used, add those
14332         entries to the library path instead of the default "/lib" and
14333         "/usr/lib".
14334
14335 2008-04-11  David S. Miller  <davem@davemloft.net>
14336
14337         * testsuite/justsyms.t: Start at 0x100.
14338         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14339         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14340         long.
14341         * testsuite/script_test_2.cc: Adjust string and section length
14342         checks.
14343
14344 2008-04-09  Ian Lance Taylor  <iant@google.com>
14345
14346         PR gold/5996
14347         * script-sections.cc (Sections_element::allocate_to_segment): Add
14348         orphan parameter.
14349         (Output_section_definition::allocate_to_segment): Likewise.
14350         (Orphan_output_section::allocate_to_segment): Likewise.
14351         (Script_sections::attach_sections_using_phdrs_clause): Don't
14352         propagate non-PT_LOAD segments to orphan sections.
14353         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14354         readelf rather than objdump.
14355         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14356         .interp section and PT_INTERP segment are the same size.
14357         * testsuite/Makefile.in: Rebuild.
14358
14359         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14360         aliases for symbols defined in the same object.
14361         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14362         (weak_alias_test_SOURCES): New variable.
14363         (weak_alias_test_DEPENDENCIES): New variable.
14364         (weak_alias_test_LDFLAGS): New variable.
14365         (weak_alias_test_LDADD): New variable.
14366         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14367         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14368         (weak_alias_test_3.o): New target.
14369         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14370         * testsuite/weak_alias_test_main.cc: New file.
14371         * testsuite/weak_alias_test_1.cc: New file.
14372         * testsuite/weak_alias_test_2.cc: New file.
14373         * testsuite/weak_alias_test_3.cc: New file.
14374
14375 2008-04-08  Ian Lance Taylor  <iant@google.com>
14376
14377         * options.h (class General_options): Add --noinhibit-exec option.
14378         * main.cc (main): Check --noinhibit-exec.
14379
14380         * options.h (class General_options): Define --wrap as a special
14381         option.  Add wrap_symbols_ field.
14382         (General_options::any_wrap_symbols): New function.
14383         (General_options::is_wrap_symbol): New function.
14384         * options.cc (General_options::parse_wrap): New function.
14385         (General_options::General_options): Initialize wrap_symbols_.
14386         * symtab.cc (Symbol_table::wrap_symbol): New function.
14387         (Symbol_table::add_from_object): Handle --wrap.
14388         * symtab.h (class Symbol_table): Declare wrap_symbol.
14389         * target.h (Target::wrap_char): New function.
14390         (Target::Target_info): Add wrap_char field.
14391         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14392         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14393         * testsuite/testfile.cc (Target_test::test_target_info):
14394         Likewise.
14395
14396         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14397         there is one.
14398
14399         * layout.h (class Layout): Add added_eh_frame_data_ field.
14400         * layout.cc (Layout::Layout): Initialize new field.
14401         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14402         output section until we find a section we merged successfully.
14403         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14404         that the size be non-zero.
14405
14406         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14407         qualifier.
14408
14409 2008-04-08  Craig Silverstein  <csilvers@google.com>
14410
14411         * configure.ac: Export new conditional variable HAVE_ZLIB.
14412         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14413         on HAVE_ZLIB.
14414         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14415         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14416
14417 2008-04-07  Ian Lance Taylor  <iant@google.com>
14418
14419         * version.cc (version_string): Set to "1.5".
14420
14421         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14422         Add issued_non_pic_error_ field.  Declare check_non_pic.
14423         (Target_x86_64::Scan::check_non_pic): New function.
14424         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14425         (Target_x86_64::Scan::global): Likewise.
14426
14427         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14428         addend parameter.  Change caller.  Handle merge sections.
14429         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14430         Address to Addend.  Don't add in the result of
14431         local_section_offset, pass down the addend and use the returned
14432         value.
14433         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14434         Update declarations of local_section_offset and symbol_value.
14435         * testsuite/two_file_test_1.cc (t18): New function.
14436         * testsuite/two_file_test_2.cc (f18): New function.
14437         * testsuite/two_file_test_main.cc (main): Call t18.
14438         * testsuite/two_file_test.h (t18, f18): Declare.
14439
14440         * configure.ac: Don't test for objdump, c++filt, or readelf.
14441         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14442         conditionals.
14443         (TEST_READELF): New variable.
14444         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14445         (check_PROGRAMS): Add two_file_strip_test.
14446         (two_file_strip_test): New target.
14447         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14448         (two_file_same_shared_strip_test_SOURCES): New variable.
14449         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14450         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14451         (two_file_same_shared_strip_test_LDADD): New variable.
14452         (two_file_shared_strip.so): New target.
14453         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14454         (ver_test_5.syms, ver_test_7.syms): Likewise.
14455         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14456         (strip_test_3.stdout): Use TEST_OBJDUMP.
14457         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14458
14459 2008-04-04  Cary Coutant  <ccoutant@google.com>
14460
14461         * symtab.h (Symbol::is_weak_undefined): New function.
14462         (Symbol::is_strong_undefined): New function.
14463         (Symbol::is_absolute): New function.
14464         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14465         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14466         absolute symbols.
14467         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14468         (weak_undef_test): New target.
14469         * testsuite/Makefile.in: Rebuild.
14470         * testsuite/weak_undef_file1.cc: New file.
14471         * testsuite/weak_undef_file2.cc: New file.
14472         * testsuite/weak_undef_test.cc: New file.
14473
14474 2008-04-03  Craig Silverstein  <csilvers@google.com>
14475
14476         * compressed_output.h (class Output_compressed_section): Use
14477         unsigned buffer.
14478         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14479         add zlib header.
14480         (zlib_compressed_suffix): Removed.
14481         (Output_compressed_section::set_final_data_size): Use unsigned
14482         buffers.
14483         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14484         Fix linker invocation.
14485         (flagstest_o_specialfile_and_compress_debug_sections):
14486         Likewise.
14487         * testsuite/Makefile.in: Regenerated.
14488
14489 2008-04-02  David S. Miller  <davem@davemloft.net>
14490
14491         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14492         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14493
14494 2008-04-02  Craig Silverstein  <csilvers@google.com>
14495
14496         * TODO: New file.
14497
14498 2008-04-02  Ian Lance Taylor  <iant@google.com>
14499
14500         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14501         parameters.  Update for new key type to views_.  Change all
14502         callers.
14503         (File_read::read): Adjust for byteshift in returned view.
14504         (File_read::add_view): New function, broken out of
14505         find_and_make_view.
14506         (File_read::make_view): New function, broken out of
14507         find_and_make_view.
14508         (File_read::find_or_make_view): Add offset and aligned
14509         parameters.  Rewrite accordingly.  Change all callers.
14510         (File_read::get_view): Add offset and aligned parameters.  Adjust
14511         for byteshift in return value.
14512         (File_read::get_lasting_view): Likewise.
14513         * fileread.h (class File_read): Update declarations.
14514         (class File_read::View): Add byteshift_ field.  Add byteshift to
14515         constructor.  Add byteshift method.
14516         * archive.h (Archive::clear_uncached_views): New function.
14517         (Archive::get_view): Add aligned parameter.  Change all callers.
14518         * object.h (Object::get_view): Add aligned parameter.  Change all
14519         callers.
14520         (Object::get_lasting_view): Likewise.
14521
14522         * fileread.cc (File_read::release): Don't call clear_views if
14523         there are multiple objects.
14524         * fileread.h (File_read::clear_uncached_views): New function.
14525         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14526         on the archive.
14527
14528 2008-03-31  Cary Coutant  <ccoutant@google.com>
14529
14530         Add thin archive support.
14531         * archive.cc (Archive::armagt): New const.
14532         (Archive::setup): Remove task parameter and calls to unlock.
14533         (Archive::unlock_nested_archives): New function.
14534         (Archive::read_header): Add nested_off parameter. Change
14535         all callers.
14536         (Archive::interpret_header): Likewise.
14537         (Archive::include_all_members): Change to handle thin
14538         archives.
14539         (Archive::include_member): Likewise.
14540         * archive.h (Archive::Archive): Add new parameters and
14541         initializers.
14542         (Archive::armagt): New const.
14543         (Archive::setup): Remove task parameter.
14544         (Archive::unlock_nested_archives): New function.
14545         (Archive::read_header): Add nested_off parameter.
14546         (Archive::interpret_header): Likewise.
14547         (Archive::Nested_archive_table): New typedef.
14548         (Archive::is_thin_archive_): New field.
14549         (Archive::nested_archives_): New field.
14550         (Archive::options_): New field.
14551         (Archive::dirpath_): New field.
14552         (Archive::task_): New field.
14553         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14554         for thin archives.  Pass additional parameters to
14555         Archive::Archive.  Unlock the archive file after calling
14556         Archive::setup.
14557
14558 2008-03-29  Ian Lance Taylor  <iant@google.com>
14559
14560         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14561         version symbol to be local.
14562         * testsuite/ver_test_4.sh: New file.
14563         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14564         (check_DATA): Add ver_test_4.syms.
14565         (ver_test_4.syms): New target.
14566         * testsuite/Makefile.in: Rebuild.
14567
14568         * output.cc
14569         (Output_section::Input_section_sort_entry::has_priority): New
14570         function.
14571         (Output_section::Input_section_sort_entry::match_file_name): New
14572         function.
14573         (Output_section::Input_section_sort_entry::match_section_name):
14574         Remove.
14575         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14576         Remove.
14577         (Output_section::Input_section_sort_entry::match_section_file):
14578         Remove.
14579         (Output_section::Input_section_sort_compare::operator()): Rewrite
14580         using new Input_section_sort_entry functions.  Sort crtbegin and
14581         crtend first.  Sort sections with no priority before sections with
14582         a priority.
14583         * testsuite/initpri1.c (d3): Check j != 4.
14584         (cd5): New constructor/destructor function.
14585         (main): Check j != 2.
14586
14587         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14588         new symbol when resolving, don't call set_is_default.
14589         * testsuite/ver_test_7.cc: New file.
14590         * testsuite/ver_test_7.sh: New file.
14591         * testsuite/Makefile.am (ver_test_7.so): New target.
14592         (ver_test_7.o): New target.
14593         (check_SCRIPTS): Add ver_test_7.sh.
14594         (check_DATA): Add ver_test_7.syms.
14595         (ver_test_7.syms): New target.
14596
14597 2008-03-28  Ian Lance Taylor  <iant@google.com>
14598
14599         * layout.cc (Layout::layout): If we see an input section with a
14600         name that needs sorting, set the must_sort flag for the output
14601         section.
14602         (Layout::make_output_section): If the name of the output section
14603         indicates that it might require sorting, set the may_sort flag.
14604         * output.h (Output_section::may_sort_attached_input_sections): New
14605         function.
14606         (Output_section::set_may_sort_attached_input_sections): New
14607         function.
14608         (Output_section::must_sort_attached_input_sections): New
14609         function.
14610         (Output_section::set_must_sort_attached_input_sections): New
14611         function.
14612         (class Output_section): Declare Input_section_sort_entry.  Define
14613         Input_section_sort_compare.  Declare
14614         sort_attached_input_sections.  Add new fields:
14615         may_sort_attached_input_sections_,
14616         must_sort_attached_input_sections_,
14617         attached_input_sections_are_sorted_.
14618         * output.cc (Output_section::Output_section): Initialize new
14619         fields.
14620         (Output_section::add_input_section): Add an entry to
14621         input_sections_ if may_sort or must_sort are true.
14622         (Output_section::set_final_data_size): Call
14623         sort_attached_input_sections if necessary.
14624         (Output_section::Input_section_sort_entry): Define new class.
14625         (Output_section::Input_section_sort_compare::operator()): New
14626         function.
14627         (Output_section::sort_attached_input_sections): New function.
14628         * configure.ac: Check whether the compiler supports constructor
14629         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14630         * testsuite/initpri1.c: New file.
14631         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14632         CONSTRUCTOR_PRIORITY.
14633         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14634         (initpri1_LDFLAGS): New variable.
14635         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14636
14637 2008-03-27  Ian Lance Taylor  <iant@google.com>
14638
14639         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14640         * testsuite/common_test_1.c: New file.
14641         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14642         (common_test_1_SOURCES): New variable.
14643         (common_test_1_DEPENDENCIES): New variable.
14644         (common_test_1_LDFLAGS): New variable.
14645
14646         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14647         and commons_ correctly when NAME/VERSION does not override
14648         NAME/NULL.
14649         * testsuite/ver_test_6.c: New file.
14650         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14651         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14652         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14653
14654 2008-03-26  Ian Lance Taylor  <iant@google.com>
14655
14656         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14657         of an undefined symbol from a version script.
14658         * testsuite/Makefile.am (ver_test_5.so): New target.
14659         (ver_test_5.o): New target.
14660         (check_SCRIPTS): Add ver_test_5.sh.
14661         (check_DATA): Add ver_test_5.syms.
14662         (ver_test_5.syms): New target.
14663         * testsuite/ver_test_5.cc: New file.
14664         * testsuite/ver_test_5.script: New file.
14665         * testsuite/ver_test_5.sh: New file.
14666         * Makefile.in, testsuite/Makefile.in: Rebuild.
14667
14668         PR gold/5986
14669         Fix problems building gold with gcc 4.3.0.
14670         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14671         (gold_error_at_location, gold_warning_at_location): Use it.
14672         * configure.ac: Check whether we can compile and use a template
14673         function with a printf attribute.
14674         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14675         when jumping over bytes.
14676         * object.cc: Instantiate Object::read_section_data.
14677         * debug.h: Include <cstring>
14678         * dwarf_reader.cc: Include <algorithm>
14679         * main.cc: Include <cstring>.
14680         * options.cc: Include <cstring>.
14681         * output.cc: Include <cstring>.
14682         * script.cc: Include <cstring>.
14683         * script.h: Include <string>.
14684         * symtab.cc: Include <cstring> and <algorithm>.
14685         * target-select.cc: Include <cstring>.
14686         * version.cc: Include <string>.
14687         * testsuite/testmain.cc: Include <cstdlib>.
14688         * configure, config.in: Rebuild.
14689
14690 2008-03-25  Ian Lance Taylor  <iant@google.com>
14691
14692         * options.cc: Include "../bfd/bfdver.h".
14693         (options::help): Print bug reporting address.
14694
14695         * version.cc (print_version): Adjust output for current value of
14696         BFD_VERSION_STRING.
14697
14698         * NEWS: New file.
14699
14700         * options.cc (options::help): Print list of supported targets.
14701         * target-select.h: Include <vector>.
14702         (class Target_selector): Make machine_, size_, and is_big_endian_
14703         fields const.  Add bfd_name_ and instantiated_target_ fields.
14704         (Target_selector::Target_selector): Add bfd_name parameter.
14705         (Target_selector::recognize): Make non-virtual, call
14706         do_recognize.
14707         (Target_selector::recognize_by_name): Make non-virtual, call
14708         do_recognize_by_name.
14709         (Target_selector::supported_names): New function.
14710         (Target_selector::bfd_name): New function.
14711         (Target_selector::do_instantiate_target): New pure virtual
14712         function.
14713         (Target_selector::do_recognize): New virtual function.
14714         (Target_selector::do_recognize_by_name): New virtual function.
14715         (Target_selector::instantiate_target): New private function.
14716         (supported_target_names): Declare.
14717         * target-select.cc (Target_selector::Target_selector): Update for
14718         new parameter and fields.
14719         (select_target_by_name): Check that the name matches before
14720         calling recognize_by_name.
14721         (supported_target_names): New function.
14722         * i386.cc (class Target_selector_i386): Update Target_selector
14723         constructor call.  Remove recognize and recognize_by_name.  Add
14724         do_instantiate_target.
14725         * x86_64.cc (class Target_selector_x86_64): Likewise.
14726         * testsuite/testfile.cc (class Target_selector_test): Update for
14727         changes to Target_selector.
14728
14729         * README: Rewrite, with some notes on unsupported features.
14730
14731 2008-03-24  Cary Coutant  <ccoutant@google.com>
14732
14733         * i386.cc (Target_i386::Got_type): New enum declaration.
14734         (Target_i386::Scan::local): Updated callers of Output_data_got
14735         member functions.
14736         (Target_i386::Scan::global): Likewise.
14737         (Target_i386::Relocate::relocate): Likewise.
14738         (Target_i386::Relocate::relocate_tls): Likewise.
14739         * object.h (Got_offset_list): New class.
14740         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14741         (Sized_relobj::local_got_offset): Likewise.
14742         (Sized_relobj::set_local_got_offset): Likewise.
14743         (Sized_relobj::local_has_tls_got_offset): Removed.
14744         (Sized_relobj::local_tls_got_offset): Removed.
14745         (Sized_relobj::set_local_tls_got_offset): Removed.
14746         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14747         * output.cc (Output_data_got::add_global): Added got_type parameter.
14748         (Output_data_got::add_global_with_rel): Likewise.
14749         (Output_data_got::add_global_with_rela): Likewise.
14750         (Output_data_got::add_global_pair_with_rel): New function.
14751         (Output_data_got::add_global_pair_with_rela): New function.
14752         (Output_data_got::add_local): Added got_type parameter.
14753         (Output_data_got::add_local_with_rel): Likewise.
14754         (Output_data_got::add_local_with_rela): Likewise.
14755         (Output_data_got::add_local_pair_with_rel): New function.
14756         (Output_data_got::add_local_pair_with_rela): New function.
14757         (Output_data_got::add_global_tls): Removed.
14758         (Output_data_got::add_global_tls_with_rel): Removed.
14759         (Output_data_got::add_global_tls_with_rela): Removed.
14760         (Output_data_got::add_local_tls): Removed.
14761         (Output_data_got::add_local_tls_with_rel): Removed.
14762         (Output_data_got::add_local_tls_with_rela): Removed.
14763         * output.h (Output_data_got::add_global): Added got_type parameter.
14764         (Output_data_got::add_global_with_rel): Likewise.
14765         (Output_data_got::add_global_with_rela): Likewise.
14766         (Output_data_got::add_global_pair_with_rel): New function.
14767         (Output_data_got::add_global_pair_with_rela): New function.
14768         (Output_data_got::add_local): Added got_type parameter.
14769         (Output_data_got::add_local_with_rel): Likewise.
14770         (Output_data_got::add_local_with_rela): Likewise.
14771         (Output_data_got::add_local_pair_with_rel): New function.
14772         (Output_data_got::add_local_pair_with_rela): New function.
14773         (Output_data_got::add_global_tls): Removed.
14774         (Output_data_got::add_global_tls_with_rel): Removed.
14775         (Output_data_got::add_global_tls_with_rela): Removed.
14776         (Output_data_got::add_local_tls): Removed.
14777         (Output_data_got::add_local_tls_with_rel): Removed.
14778         (Output_data_got::add_local_tls_with_rela): Removed.
14779         * resolve.cc (Symbol::override_base_with_special): Removed
14780         reference to has_got_offset_ field.
14781         * symtab.cc (Symbol::init_fields): Replaced initialization
14782         of got_offset_ with got_offsets_.  Removed initialization
14783         of has_got_offset_
14784         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14785         (Symbol::got_offset): Likewise.
14786         (Symbol::set_got_offset): Likewise.
14787         (Symbol::has_tls_got_offset): Removed.
14788         (Symbol::tls_got_offset): Removed.
14789         (Symbol::set_tls_got_offset): Removed.
14790         (Symbol::got_offset_): Removed.
14791         (Symbol::tls_mod_got_offset_): Removed.
14792         (Symbol::tls_pair_got_offset_): Removed.
14793         (Symbol::got_offsets_): New field.
14794         (Symbol::has_got_offset): Removed.
14795         (Symbol::has_tls_mod_got_offset): Removed.
14796         (Symbol::has_tls_pair_got_offset): Removed.
14797         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14798         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14799         member functions.
14800         (Target_x86_64::Scan::global): Likewise.
14801         (Target_x86_64::Relocate::relocate): Likewise.
14802         (Target_x86_64::Relocate::relocate_tls): Likewise.
14803
14804 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14805
14806         * yyscript.y: Fix spelling error in comment.
14807
14808 2008-03-24  Ian Lance Taylor  <iant@google.com>
14809
14810         * options.h (class General_options): Define build_id option.
14811         * layout.h (class Layout): Declare write_build_id, create_note,
14812         create_build_id.  Add build_id_note_ member.
14813         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14814         "libiberty.h", "md5.h", "sha1.h".
14815         (Layout::Layout): Initialize eh_frame_data_,
14816         eh_frame_hdr_section_, and build_id_note_.
14817         (Layout::finalize): Call create_build_id.
14818         (Layout::create_note): New function, broken out of
14819         Layout::create_gold_note.
14820         (Layout::create_gold_note): Call create_note.
14821         (Layout::create_build_id): New function.
14822         (Layout::write_build_id): New function.
14823         (Close_task_runner::run): Call write_build_id.
14824
14825         * x86_64.cc: Correct license to GPLv3.
14826
14827 2008-03-23  Ian Lance Taylor  <iant@google.com>
14828
14829         * options.cc: Include "demangle.h".
14830         (parse_optional_string): New function.
14831         (parse_long_option): Handle takes_optional_argument.
14832         (parse_short_option): Update dash_z initializer.  Handle
14833         takes_optional_argument.
14834         (General_options::General_options): Initialize do_demangle_.
14835         (General_options::finalize): Set do_demangle_.  Handle demangling
14836         style.
14837         * options.h (parse_optional_string): Declare.
14838         (struct One_option): Add optional_arg field.  Update constructor.
14839         Update call constructor calls.  Add takes_optional_argument
14840         function.
14841         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14842         (DEFINE_optional_string): Define.
14843         (General_options::demangle): Change from DEFINE_bool to
14844         DEFINE_optional_string.
14845         (General_options::no_demangle): New function.
14846         (General_options::do_demangle): New function.
14847         (General_options::set_do_demangle): New function.
14848         (General_options::execstack_status_): Move definition to end of
14849         class definition.
14850         (General_options::static_): Likewise.
14851         (General_options::do_demangle_): New field.
14852         * object.cc (big_endian>::get_symbol_location_info): Call
14853         Options::do_demangle, not Options::demangle.
14854         * symtab.cc (demangle): Likewise.
14855
14856 2008-03-22  Ian Lance Taylor  <iant@google.com>
14857
14858         * gold.h: Include <cstddef> and <sys/types.h>
14859         * options.h: Include <cstring>.
14860
14861 2008-03-21  Ian Lance Taylor  <iant@google.com>
14862
14863         * Added source code to GNU binutils.
14864 \f
14865 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14866
14867 Copying and distribution of this file, with or without modification,
14868 are permitted in any medium without royalty provided the copyright
14869 notice and this notice are preserved.
14870
14871 Local Variables:
14872 mode: change-log
14873 left-margin: 8
14874 fill-column: 74
14875 version-control: never
14876 End: