gold/
[external/binutils.git] / gold / ChangeLog
1 2013-07-11  Cary Coutant  <ccoutant@google.com>
2
3         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
4         correct BRLT entry size.
5
6 2013-07-03  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
9         comment.
10
11 2013-07-01  Cary Coutant  <ccoutant@google.com>
12
13         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
14         reloc_type_.
15         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
16         (Dwarf_ranges_table::lookup_reloc): New function.
17         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
18         reloc_type_.
19         (Dwarf_ranges_table::lookup_reloc): New function.
20         (Dwarf_ranges_table::reloc_type_): New data member.
21
22 2013-06-27  Jing Yu  <jingyu@google.com>
23
24         PR gold/15662
25         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
26         function.
27         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
28         (Target_powerpc::do_relax): Call the above.
29
30 2013-06-27  Cary Coutant  <ccoutant@google.com>
31
32         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
33         on garbage collected .opd section.
34
35 2013-06-27  Alan Modra  <amodra@gmail.com>
36
37         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
38         is non-zero.
39         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
40         (Target_powerpc::do_function_location): Likewise for loc->shndx.
41
42 2013-06-14  Cary Coutant  <ccoutant@google.com>
43
44         * resolve.cc (Symbol::override_base): Don't override st_type
45         from plugin placeholder symbols.
46         (Symbol_table::resolve): Likewise.
47         (Symbol_table::should_override): Don't complain about TLS mismatch
48         if the TO symbol is a plugin placeholder.
49         * testsuite/Makefile.am (plugin_test_tls): New test.
50         * testsuite/Makefile.in: Regenerate.
51         * testsuite/plugin_test_tls.sh: New test script.
52         * testsuite/two_file_test_2_tls.cc: New test source.
53         * testsuite/two_file_test_tls.cc: New test source.
54
55 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
56
57         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
58         the maximum segment alignment is larger than the page size.
59         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
60         correctly aligns the symbols with large alignemnt.
61         * testsuite/Makefile.in: Regenerate.
62         * testsuite/large_symbol_alignment.cc: New file.
63
64 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
65             Sriraman Tallam  <tmsriram@google.com>
66
67         * options.h (sort_section): New option.
68         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
69         Rename from Input_section_sort_section_name_special_ordering_compare.
70         (Input_section_sort_section_name_compare): New struct.
71         * output.cc (Output_section::Input_section_sort_section_name_compare::
72         operator()): New function.
73         (Output_section::sort_attached_input_sections): Use new sort function
74         for .text if --sort-section=name is specified.
75         * layout.cc (Layout::make_output_section):
76         Add sorting by name when --sort-section=name is specified.
77         * testsuite/Makefile.am (text_section_grouping): Test option
78         --sort-section=name.
79         * testsuite/Makefile.in: Regenerate.
80         * testsuite/section_sorting_name.cc: New file.
81         * testsuite/section_sorting_name.sh: New file.
82
83 2013-05-21  Cary Coutant  <ccoutant@google.com>
84
85         * symtab.h (Symbol::is_cxx_vtable): New function.
86         * target-reloc.h (relocate_section): Check for vtable symbol.
87         * testsuite/Makefile.am (missing_key_func.sh): New test case.
88         * testsuite/Makefile.in: Regenerate.
89         * testsuite/missing_key_func.cc: New test source.
90         * testsuite/missing_key_func.sh: New test script.
91
92 2013-05-21  Cary Coutant  <ccoutant@google.com>
93
94         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
95         type of enclosing symbol.
96         (Relocate_info::location): Check symbol type when describing symbol.
97         * object.h (Symbol_location_info): Remove unused line_number;
98         add enclosing_symbol_type.
99         * testsuite/debug_msg.sh: Adjust expected output.
100
101 2013-05-13  Cary Coutant  <ccoutant@google.com>
102
103         * configure.ac: Export DEFAULT_TARGET.
104         * configure: Regenerate.
105         * Makefile.in: Regenerate.
106         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
107         * testsuite/Makefile.in: Regenerate.
108         * testsuite/debug_msg.sh: Delete duplicate tests.
109         Don't check undef_int error message match for powerpc where the
110         source file and line number aren't available.
111
112 2013-05-10  Roland McGrath  <mcgrathr@google.com>
113
114         * options.h (General_options): Add --rosegment-gap option.
115         * options.cc (finalize): --rosegment-gap implies --rosegment.
116         * layout.cc (set_segment_offsets): Let user option override
117         target->rosegment_gap().
118
119 2013-05-10  Roland McGrath  <mcgrathr@google.com>
120
121         * options.h (General_options): Remove leading space from help
122         messages for -nostdlib and --rosegment.
123
124 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
125
126         PR ld/15365
127         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
128
129 2013-05-03  Alan Modra  <amodra@gmail.com>
130
131         * merge.cc (Output_merge_string::do_add_input_section): Correct
132         scan for number of strings.  Rename vars to avoid shadowing.
133         Include missing terminator in input_size_.
134
135 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
136
137         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
138         Restore empty string handling.
139
140 2013-05-01  Cary Coutant  <ccoutant@google.com>
141
142         * stringpool.cc (Stringpool_template::new_key_offset): Fix
143         uninitialized warning.
144
145 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
146
147         * output.cc (Output_section::add_merge_input_section): Allow
148         to merge sections if the alignment is more than character size.
149         * merge.h (Output_merge_string::Output_merge_string): Remove
150         assert.
151         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
152         only not-null strings. Check the alignment of strings.
153         * stringpool.h
154         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
155         alignment as the argument.
156         (Stringpool_template<Stringpool_char>::addralign_): New class member.
157         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
158         Align non-zero length strings according to the addralign_.
159         (Stringpool_template<Stringpool_char>::set_string_offsets):
160         Updating offsets according to the given alignment.
161         * testsuite/Makefile.am (text_section_grouping): Test if string
162         literals are getting merged.
163         * testsuite/Makefile.in: Regenerate.
164         * testsuite/merge_string_literals_1.c: New file.
165         * testsuite/merge_string_literals_2.c: Ditto.
166         * testsuite/merge_string_literals.sh: Ditto.
167
168 2013-04-26  Ian Lance Taylor  <iant@google.com>
169
170         * target-reloc.h (relocate_section): If the reloc offset is out of
171         range, pass VIEW as NULL to relocate.relocate.
172         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
173         * i386.cc (Target_i386::Relocate::relocate): Likewise.
174         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
175         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
176         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
177         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
178
179 2013-04-26  Geoff Pike  <gpike@chromium.org>
180
181         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
182         * layout.cc (Hash_task): New class.
183         (Layout::queue_build_id_tasks): New function.
184         (Layout::write_build_id): Handle single-thread portion of build ID
185         computation.  (In some cases, all of it is single-threaded.)  Replace
186         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
187         functionality in fewer lines of code.
188         * layout.h (Layout::queue_build_id_tasks): New function declaration.
189         * options.h (General_options): make "--build-id" default to tree
190         rather than sha1.  Add two new options related to --build-id=tree:
191         --build-id-chunk-size-for-treehash and
192         --build-id-min-file-size-for-treehash.
193         * Makefile.am: add testing of --build-id=tree and related new options
194         (these tests will be invoked by "make check").
195         * Makefile.in: Regenerate.
196
197 2013-04-25  Alan Modra  <amodra@gmail.com>
198
199         * configure.tgt: Add powerpcle and powerpc64le.
200
201 2013-04-22  Alan Modra  <amodra@gmail.com>
202
203         PR gold/15355
204         * layout.cc (Layout::segment_precedes): Allow more than one
205         segment with the same type and flags.
206
207 2013-04-15  Cary Coutant  <ccoutant@google.com>
208
209         * layout.cc (Layout::set_relocatable_section_offsets): Don't
210         allocate space in file for BSS sections.
211
212 2013-04-15  Cary Coutant  <ccoutant@google.com>
213
214         * script-sections.cc (Orphan_output_section): Reset address
215         to zero after each orphaned section for relocatable links.
216
217 2013-04-15  Cary Coutant  <ccoutant@google.com>
218
219         * symtab.cc (Symbol_table::sized_write_globals): Subtract
220         section starting address for relocatable link.
221         * testsuite/Makefile.am (script_test_11): New test.
222         * testsuite/Makefile.in: Regenerate.
223         * testsuite/script_test_11.c: New source file.
224         * testsuite/script_test_11.t: New linker script.
225
226 2013-04-13  Alan Modra  <amodra@gmail.com>
227
228         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
229         owner when sections are not adjacent and exceed group size.
230         (Target_powerpc::group_sections): Handle corner case.
231         (Target_powerpc::Branch_info::make_stub): Handle case where
232         stub table doesn't exist due to branches in non-exec sections.
233         (Target_powerpc::Relocate::relocate): Likewise.
234
235 2013-04-11  Alan Modra  <amodra@gmail.com>
236
237         PR gold/15354
238         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
239         .branch_lt to match bfd ld.  Adjust comments throughout file.
240
241 2013-04-04  Ian Lance Taylor  <iant@google.com>
242
243         GCC PR c++/56840
244         * object.cc (do_layout_deferred_sections): Handle .eh_frame
245         sections before checking whether they are included in the link.
246
247 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
248
249         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
250         object before calling the plugin claim_file handler.  Pass the elf
251         object of the archive to the plugin. Delete the elf object if the
252         plugin claims the file.
253
254 2013-03-21  Alan Modra  <amodra@gmail.com>
255
256         * layout.cc (Layout::set_segment_offsets): Accept writable .text
257         segment when omagic.
258
259 2013-03-21  Alan Modra  <amodra@gmail.com>
260
261         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
262         comparison warning.
263         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
264         uninitialized" warning.
265
266 2013-03-20  Alan Modra  <amodra@gmail.com>
267
268         * symtab.h (Symbol::clear_version): New function.
269         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
270         is_needed by weak references.  Clear version for symbols defined
271         in as-needed objects that are not needed.
272
273 2013-03-15  Alan Modra  <amodra@gmail.com>
274
275         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
276         static and public.  Add report_err param.  Return false for data refs.
277         (Target_powerpc::rela_dyn_section): New overloaded function.
278         (Target_powerpc::plt_, iplt_): Elucidate.
279         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
280         (Output_data_plt_powerpc::do_write): Don't write .iplt.
281         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
282         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
283         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
284         push_branch and make_plt_entry for ifunc syms when
285         reloc_needs_plt_for_ifunc.
286         (Target_powerpc::Relocate::relocate): Don't use plt entry value
287         for ifunc unless reloc_needs_plt_for_ifunc.
288
289 2013-03-15  Alan Modra  <amodra@gmail.com>
290
291         * gc.h (gc_process_relocs): Don't look through function descriptors.
292         * icf.cc (get_section_contents): Do so here instead.
293
294 2013-03-13  Alan Modra  <amodra@gmail.com>
295
296         * powerpc.cc (is_branch_reloc): Forward declare.
297         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
298         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
299         false for 64-bit, true for 32-bit non-branch relocs.
300         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
301         * testsuite/Makefile.am (icf_test): Use linker map file instead of
302         nm output.
303         (icf_safe_test): Generate linker map file as well as nm output.
304         (icf_safe_so_test): Likewise.
305         * testsuite/Makefile.in: Regenerate.
306         * testsuite/icf_test.sh: Parse linker map file to determine
307         section folding.
308         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
309         * testsuite/icf_safe_so_test.sh: Likewise.
310         (X86_32_or_ARM_specific_safe_fold): Merge into..
311         (arch_specific_safe_fold): ..this.
312         (X86_64_specific_safe_fold): Delete unused function.
313
314 2013-03-12  Alan Modra  <amodra@gmail.com>
315
316         * gc.h (gc_process_relocs): Look through function descriptors
317         to determine shndx, symvalue and addend used by ICF.  Tidy
318         variable duplication.
319
320 2013-03-11  Alan Modra  <amodra@gmail.com>
321
322         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
323         * layout.cc (Layout_task_runner::run): ..to here.
324         * symtab.h (struct Symbol_location): Extract from..
325         (class Symbol_table): ..here.
326         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
327         * target.h (class Target): Add function_location and
328         do_function_location functions.
329         (class Sized_target): Add do_function_location.
330         * object.h (class Sized_relobj_file): Move find_shdr..
331         (class Object): ..to here.
332         * object.cc: Likewise.  Update to suit.  Instantiate.
333         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
334         * powerpc.cc (class Powerpc_dynobj): New.
335         (Target_powerpc::do_function_location): New function.
336         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
337         (Powerpc_dynobj::do_read_symbols): New function.
338         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
339
340 2013-03-08  Ian Lance Taylor  <iant@google.com>
341
342         * options.cc (General_options::string_to_object_format): Accept
343         "default".
344
345 2013-03-08  Alan Modra  <amodra@gmail.com>
346
347         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
348         pointer to Post_fde.
349         (struct Post_fde): Move definition to here..
350         * ehframe.cc (struct Post_fde): ..from here.
351         (Cie::write): Don't alloc Post_fde.
352         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
353
354 2013-03-07  Alan Modra  <amodra@gmail.com>
355
356         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
357         relocation referencing .LC0.
358         * testsuite/discard_locals_test.sh: Remove FIXMEs.
359
360 2013-03-07  Alan Modra  <amodra@gmail.com>
361
362         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
363         always_inline.  Add assembly for powerpc to avoid GOT.
364
365 2013-03-07  Alan Modra  <amodra@gmail.com>
366
367         * testsuite/script_test_10.sh: Don't test .bss section
368         header number.
369
370 2013-03-06  Alan Modra  <amodra@gmail.com>
371
372         * powerpc.cc (class Powerpc_relobj): Move some member functions.
373         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
374         all callers.  Handle folded sections.
375         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
376         to Powerpc_relobj.
377         (Global_symbol_visitor_opd::operator()): Likewise.
378
379 2013-03-04  Alan Modra  <amodra@gmail.com>
380
381         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
382         * testsuite/Makefile.in: Regenerate.
383
384 2013-03-01  Cary Coutant  <ccoutant@google.com>
385
386         Add dwp support for v2 DWARF package file format.
387         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
388         tu_length parameter.  Adjust all callers.
389         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
390         * dwp.cc: Include dwarf.h.
391         (Section_bounds): New struct type.
392         (Unit_set): New struct type.
393         (Dwo_file::Dwo_file): Initialize new data member.
394         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
395         Combine and rename to...
396         (Dwo_file::read_unit_index): ...this.
397         (Dwo_file::sized_read_compunit_index)
398         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
399         (Dwo_file::sized_read_unit_index): ...this.
400         (Dwo_file::copy_section): Remove section_name, is_str_offsets
401         parameters; add section_id parameter.
402         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
403         (Dwo_file::add_unit_set): ...this.
404         (Dwo_file::shndx_map_): Remove.
405         (Dwo_file::sect_offsets_): New data member.
406         (Dwp_output_file::Dwp_output_file): Initialize new data members.
407         (Dwp_output_file::add_section): Rename to...
408         (Dwp_output_file::add_contribution): ...this.
409         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
410         (Dwp_output_file::add_tu_set): Likewise.
411         (Dwp_output_file::Contribution): New type.
412         (Dwp_output_file::Section::contributions): New data member.
413         (Dwp_output_file::Cu_or_tu_set): Remove.
414         (Dwp_output_file::Section::Section): New ctor.
415         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
416         (Dwp_output_file::Dwp_index::Section_table): New type.
417         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
418         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
419         parameter.
420         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
421         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
422         (Dwp_output_file::Dwp_index::section_table): New member function.
423         (Dwp_output_file::Dwp_index::section_table_end): New member function.
424         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
425         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
426         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
427         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
428         (Dwp_output_file::Dwp_index::section_table_): New data member.
429         (Dwp_output_file::Dwp_index::section_mask_): New data member.
430         (Dwp_output_file::add_output_section): New member function.
431         (Dwp_output_file::write_new_section): New member function.
432         (Dwp_output_file::write_contributions): New member function.
433         (Dwp_output_file::section_id_map_): New data member.
434         (class Dwo_id_info_reader): Remove.
435         (class Unit_reader): New class.
436         (get_dwarf_section_name): New function.
437         (Dwo_file::read_executable): Adjust initializations of class data.
438         (Dwo_file::read): Add support for v2 package file format.
439         (Dwo_file::read_unit_index): Likewise.
440         (Dwo_file::sized_read_unit_index): Likewise.
441         (Dwo_file::copy_section): Likewise.
442         (Dwo_file::add_unit_set): Likewise.
443         (Dwp_output_file::add_output_section): Likewise.
444         (Dwp_output_file::add_contribution): Likewise.
445         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
446         for empty slot.
447         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
448         file format.
449         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
450         slot.
451         (Dwp_output_file::initialize): Remove unused function.
452         (Dwp_output_file::finalize): Add support for v2 package file format.
453         (Dwp_output_file::write_index): Likewise.
454         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
455         function prototype.
456
457 2013-03-01  Cary Coutant  <ccoutant@google.com>
458
459         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
460         function into class definition in header file.
461         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
462         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
463         New function.
464         (Dwarf_info_reader::check_buffer): Move here from .cc file.
465
466 2013-02-28  Alan Modra  <amodra@gmail.com>
467
468         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
469         * target.cc (Target::do_plt_fde_location): New function.
470         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
471         accessor function, and constructor param.
472         (struct Post_fde, Post_fdes): Declare.
473         (Cie::write): Add post_fdes param.
474         * ehframe.cc (Fde::write): Use plt_fde_location.
475         (struct Post_fde): Define.
476         (Cie::write): Stash FDEs added post merge mapping.
477         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
478         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
479         (Eh_frame::do_sized_write): Arrange to write post map FDES after
480         other FDEs.
481         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
482         (Target_powerpc::has_glink): New function.
483         (Target_powerpc::do_relax): Add eh_frame info for stubs.
484         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
485         glink_eh_frame_fde_32, default_fde): New data.
486         (Stub_table::eh_frame_added_): New var.
487         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
488         Make const.
489         (Stub_table::add_eh_frame): New function.
490         (Output_data_glink::add_eh_frame): New function.
491         (Target_powerpc::make_glink_section): Call add_eh_frame.
492
493 2013-02-15  Ian Lance Taylor  <iant@google.com>
494
495         * options.h (DEFINE_uint64_alias): Define.
496         (class General_options): Add -Ttext-segment as an alias for
497         -Ttext.
498
499 2013-02-15  Alan Modra  <amodra@gmail.com>
500
501         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
502         (Stub_table::do_write): ..here, two places.
503         (Stub_table::plt_call_size): Use it here too.
504
505 2013-02-11  Ian Lance Taylor  <iant@google.com>
506
507         * descriptors.cc (Descriptors::close_all): New function.
508         * descriptors.h (class Descriptors): Declare close_all.
509         (close_all_descriptors): New inline function.
510         * plugin.cc: Include "descriptors.h".
511         (Plugin_manager::cleanup): Call close_all_descriptors.
512
513 2013-02-06  Alan Modra  <amodra@gmail.com>
514
515         * README: Update coding style link.
516
517 2013-01-28  Cary Coutant  <ccoutant@google.com>
518
519         * dwp.cc (File_list): New typedef.
520         (Dwo_name_info_reader): New class.
521         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
522         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
523         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
524         (Dwo_file::read_executable): New function.
525         (Dwo_file::read): Move common setup code to ...
526         (Dwo_file::make_object): ... here.
527         (dwp_options): Add --exec/-e.
528         (usage): Likewise.
529         (main): Likewise.
530
531 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
532
533         * layout.cc (Layout::layout): Check for option text_reorder.
534         (Layout::make_output_section): Ditto.
535         * options.h (text_reorder): New option.
536         * output.cc (Input_section_sort_compare): Remove special ordering
537         of section names.
538         (Output_section::
539          Input_section_sort_section_name_special_ordering_compare::
540          operator()): New function.
541         (Output_section::sort_attached_input_sections): Use new sort function
542         for .text.
543         * output.h (Input_section_sort_section_name_special_ordering_compare):
544         New struct.
545         * testsuite/Makefile.am (text_section_grouping): Test option
546         --no-text-reorder
547         * testsuite/Makefile.in: Regenerate.
548         * testsuite/text_section_grouping.sh: Check order of functions without
549         default text reordering.
550
551 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
552
553         * options.h (General_options): Change default to true for new_dtags.
554
555 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
556
557         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
558         when enable_new_dtags is false.  Only add DT_RUNPATH when
559         enable_new_dtags is true.
560
561 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
562
563         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
564         used in declaration and definition consistent.
565         (Target_powerpc::symval_for_branch): Ditto.
566
567 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
568
569         * testsuite/plugin_final_layout.cc: Fix comment.
570
571 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
572
573         * layout.cc (Layout::layout): Do not do default sorting for
574         text sections when section ordering is specified.
575         (make_output_section): Ditto.
576         * testsuite/plugin_final_layout.cc: Name the function sections
577         to catch reordering issues.
578
579 2013-01-15  Alan Modra  <amodra@gmail.com>
580
581         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
582         plt-thread-safe.
583
584 2013-01-15  Alan Modra  <amodra@gmail.com>
585
586         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
587         * testsuite/Makefile.in: Regenerate.
588
589 2013-01-14  Alan Modra  <amodra@gmail.com>
590
591         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
592         * testsuite/Makefile.in: Regenerate.
593
594 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
595
596         PR bfd/14430
597         Fix mingw gold build with plugins enabled
598         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
599         * configure.ac: Export DLOPEN_LIBS and add headers check.
600         * plugin.cc: Handle non-dlfcn case.
601         * Makefile.in: Regenerate.
602         * config.in: Regenerate.
603         * configure: Regenerate.
604         * testsuite/Makefile.in: Regenerate.
605
606 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
607
608         * output.h (sort_attached_input_sections): Change to be public.
609         * script-sections.cc
610         (Output_section_definition::set_section_addresses): Sort
611         attached input sections according to section order before linker
612         script assigns section addresses.
613         (Orphan_output_section::set_section_addresses): Sort
614         attached input sections according to section order before linker
615         script assigns section addresses.
616         * Makefile.am (final_layout.sh): Use a simple linker script to
617         check if section ordering still works.
618         * Makefile.in: Regenerate.
619
620 2013-01-09  Ben Cheng  <bccheng@google.com>
621
622         * arm.cc (Target_arm::attributes_accept_div): New function.
623         (Target_arm::attributes_forbid_div): New function.
624         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
625         attribute using the same new functions as what bfd/elf32_arm.c
626         does.
627
628 2013-01-07  Cary Coutant  <ccoutant@google.com>
629
630         PR gold/14993
631         * output.cc (Output_section::add_input_section): For incremental
632         updates, don't track input sections that are allocated from patch
633         space.
634
635 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
636             Ian Lance Taylor  <iant@google.com>
637
638         PR gold/14897
639         * configure.ac (--enable-ld): Removed.
640         (install_as_default): Set to yes only for --enable-gold=default
641         or --disable-ld.
642         * configure: Regenerated.
643
644 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
645
646         * options.h (General_options): Add -fuse-ld= for GCC linker
647         option compatibility.
648
649 2013-01-04  Cary Coutant  <ccoutant@google.com>
650
651         * configure.ac: Fix typo restoring CXXFLAGS.
652         * configure: Regenerate.
653
654 2013-01-04  Cary Coutant  <ccoutant@google.com>
655
656         * testsuite/Makefile.am (CXXLINK_S): New macro.
657         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
658         * testsuite/Makefile.in: Regenerate.
659
660 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
661
662         * version.cc (print_version): Update copyright year to 2013.
663
664 2012-12-20  Ian Lance Taylor  <iant@google.com>
665
666         * layout.cc (Layout::special_ordering_of_input_section): New
667         function.
668         (Layout::layout): If input section requires special ordering, must
669         sort input sections.
670         (Layout::make_output_section): May sort .text input sections.
671         (Layout::is_section_name_prefix_grouped): Remove.
672         * layout.h (class Layout): Declare
673         special_ordering_of_input_section.  Don't declare
674         is_section_name_prefix_grouped.
675         * output.cc (Output_section::add_input_section): Revert last
676         change.
677         (Output_section::Input_section_sort::match_file_name): Don't crash
678         if called on output section data.
679         (Output_section::Input_section_sort_compare): Sort based on
680         special ordering.
681         (Output_section::Input_section_sort_section_order_index_compare):
682         Revert last patch.
683         (Output_section::sort_attached_input_sections): Likewise.
684
685 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
686
687         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
688         * layout.h (Layout::is_section_name_prefix_grouped): New function.
689         * output.cc (Output_section::add_input_section): Check if section
690         name contains special prefix.  Keep input sections to sort such
691         sections.
692         (Output_section::Input_section_sort_section_order_index_compare
693          ::operator()): Group sections according to prefixes.
694         (Output_section::sort_attached_input_sections): Add condition to
695         Input_section_entry constructor call.
696         * testsuite/Makefile.am (text_section_grouping): New test.
697         * testsuite/Makefile.in: Regenerate.
698         * testsuite/text_section_grouping.cc: New file.
699         * testsuite/text_section_grouping.sh: New file.
700
701 2012-12-17  Nick Clifton  <nickc@redhat.com>
702
703         * Makefile.am: Add copyright notice.
704         * NEWS: Likewise.
705         * README: Likewise.
706         * configure.ac: Likewise.
707         * ftruncate.c: Likewise.
708         * Makefile.in: Regenerate.
709
710 2012-12-14  Cary Coutant  <ccoutant@google.com>
711
712         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
713         --no-as-needed flag.
714         (exception_separate_shared_12_test): Likewise.
715         (incremental_copy_test): Likewise.
716         * testsuite/Makefile.in: Regenerate.
717
718 2012-12-14  Cary Coutant  <ccoutant@google.com>
719
720         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
721         (Dwp_output_file::Dwp_index::enter_set): Add assert.
722
723 2012-12-12  Alan Modra  <amodra@gmail.com>
724
725         * powerpc.cc (class Track_tls): New.
726         (class Relocate, class Scan): Inherit Track_tls.
727         (Target_powerpc::Scan::local, global): Track tls optimization
728         and avoid creating plt entry for __tls_get_addr if all uses
729         are optimized away.
730         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
731
732 2012-12-12  Alan Modra  <amodra@gmail.com>
733
734         * options.h (General_options): Add --toc-sort/--no-toc-sort.
735         Replace no_toc_optimize with toc_optimize.
736         * output.h (Output_section::input_sections): Provide non-const variant.
737         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
738         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
739         accessors.
740         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
741         (class Sort_toc_sections): New.
742         (Target_powerpc::do_finalize_sections): Sort toc sections.
743         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
744
745 2012-12-10  Roland McGrath  <mcgrathr@google.com>
746
747         * testsuite/binary_unittest.cc (read_all): New function.
748         (Sized_binary_test): Use it instead of ::read.
749         * fileread.cc (do_read): Don't assume pread always reads the whole
750         amount in a single call.
751
752 2012-12-10  Alan Modra  <amodra@gmail.com>
753
754         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
755         Set EM_PPC64 or EM_PPC here.
756         (Target_selector_powerpc::do_recognize): Delete.
757
758 2012-12-10  Alan Modra  <amodra@gmail.com>
759
760         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
761         stub_table_.
762         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
763
764 2012-12-07  Roland McGrath  <mcgrathr@google.com>
765
766         * testsuite/binary_unittest.cc (Sized_binary_test):
767         Use open_descriptor rather than ::open.
768
769 2012-12-07  Alan Modra  <amodra@gmail.com>
770
771         * powerpc.cc (Stub_table::do_write): Delete redundant Address
772         typedef and invalid_address constant.
773         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
774         instantiate constants.
775
776 2012-12-06  Roland McGrath  <mcgrathr@google.com>
777
778         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
779         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
780         * aclocal.m4: Regenerate.
781         * configure: Regenerate.
782         * Makefile.in: Regenerate.
783         * testsuite/Makefile.in: Regenerate.
784
785 2012-12-07  Alan Modra  <amodra@gmail.com>
786
787         * options.h (General_options): Add no_toc_optimize.
788         * powerpc.cc (ok_lo_toc_insn): New function.
789         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
790
791 2012-12-06  Alan Modra  <amodra@gmail.com>
792
793         * options.h (General_options): Add plt_align, plt_static_chain,
794         plt_thread_safe.  Update stub_group_size help text.
795         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
796         for new plt_thread_safe_ var.
797         (use_plt_offset): Correct comments.
798         (Target_powerpc::do_relax): Look for thread creation symbols to
799         determine default plt_thread_safe value.  Clear plt call stubs
800         as well as branch stubs each iteration.
801         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
802         insn constants.
803         (l, hi, ha, write_insn): Move earlier.
804         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
805         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
806         plt stubs too.
807         (Stub_table::update_size): Adjust.
808         (Stub_table::prev_size, set_prev_size): Delete.
809         (Stub_table::stub_align): Let --plt-align affect result.
810         (Stub_table::plt_call_size): Calculate sizes for various stubs.
811         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
812         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
813         (Stub_table::do_write): Support more stub variants.
814
815 2012-12-04  Alan Modra  <amodra@gmail.com>
816
817         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
818         (Target_powerpc::do_define_standard_symbols): New function.
819
820 2012-12-03  Alan Modra  <amodra@gmail.com>
821
822         * output.h: Formatting, whitespace.
823
824 2012-12-03  Alan Modra  <amodra@gmail.com>
825
826         * layout.h (Layout::get_executable_sections): Declare.
827         * layout.cc (Layout::get_executable_sections): New function.
828         * arm.cc (Target_arm::group_sections): Use it.
829         (Arm_output_section::group_sections): Delete now redundant test.
830         * output.cc (Output_reloc::Output_reloc): Add is_relative.
831         param to handle relative relocs.
832         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
833         (Output_data_reloc::add_absolute): Adjust.
834         (Output_data_reloc::add_relative): New function.
835         (Output_data::reset_data_size): New function.
836         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
837         (Output_section::set_addralign): New function.
838         (Output_section::checkpoint_set_addralign): New function.
839         (Output_section::clear_section_offsets_need_adjustment): New function.
840         (Output_section::input_sections): Make public.
841         * powerpc.cc (class Output_data_brlt_powerpc): New.
842         (class Stub_table, class Stub_control): New.
843         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
844         stub_table_, set_stub_table, stub_table): New vectors and accessor
845         functions.
846         (Target_powerpc::do_may_relax, do_relax, push_branch,
847         new_stub_table, stub_tables, brlt_section, group_sections,
848         add_branch_lookup_table, find_branch_lookup_table,
849         write_branch_lookup_table, make_brlt_section): New functions.
850         (Target_powerpc::struct Sort_sections, class Branch_info): New.
851         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
852         branch_info_): New vars.
853         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
854         make call stubs here.
855         (Output_data_glink): Remove all call stub handling from this class.
856         (Target_powerpc::Scan::local, global): Save interesting branch
857         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
858         (Target_powerpc::do_finalize_sections): Only make reg save/restore
859         functions on final link.
860         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
861         Handle long branch destinations too.
862         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
863         do_plt_address_for_local): Adjust lookup of plt call stubs.
864
865 2012-11-30  Alan Modra  <amodra@gmail.com>
866
867         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
868         relocs against protected symbols when building 32-bit shared libs.
869
870 2012-11-30  Alan Modra  <amodra@gmail.com>
871
872         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
873         param.  Call got_section() to make .got.  Update all callers
874         and their callers and so on.
875
876 2012-11-30  Alan Modra  <amodra@gmail.com>
877
878         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
879         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
880         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
881         value if it already exists.
882
883 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
884
885         PR gold/14858
886         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
887
888 2012-11-14  Roland McGrath  <mcgrathr@google.com>
889
890         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
891         than bfc instruction for data sandboxing.
892
893 2012-11-08  Alan Modra  <amodra@gmail.com>
894
895         * po/POTFILES.in: Regenerate.
896
897 2012-11-05  Alan Modra  <amodra@gmail.com>
898
899         * configure.ac: Apply 2012-09-10 change to config.in here.
900         * configure: Regenerate.
901
902 2012-11-05  Alan Modra  <amodra@gmail.com>
903
904         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
905         (struct Opd_ent): Use "Address" rather than "Offset".
906         (Output_data_got_powerpc::got_base_offset): Return Valtype.
907         (Target_powerpc::got_section): Make public.
908         (Target_powerpc::scan_relocs): Move code setting symbols..
909         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
910         Create _SDA_BASE_ only when referenced.
911
912 2012-11-02  Roland McGrath  <mcgrathr@google.com>
913
914         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
915         from last change.
916
917 2012-11-01  Roland McGrath  <mcgrathr@google.com>
918
919         * target.h (Sized_target::relocate_relocs): Use Elf_Off
920         for offset_in_output_section parameter.
921         (Sized_target::relocate_special_relocatable): Likewise.
922         * arm.cc (Target_arm::relocate_relocs): Likewise.
923         (Target_arm::relocate_special_relocatable): Likewise.
924         * i386.cc (Target_i386::relocate_relocs): Likewise.
925         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
926         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
927         * target-reloc.h (relocate_relocs): Likewise.
928         * testsuite/testfile.cc (Target_test): Likewise.
929         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
930         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
931
932         * system.h: Move inclusion of <clocale> to after <libintl.h> in
933         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
934
935         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
936         parameter, which is unused in the [!F_SETFD] case.
937
938         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
939         SYMNDX to off_t before comparing it to this->data_size().
940         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
941         * incremental.cc (Output_section_incremental_inputs::do_write):
942         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
943
944         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
945
946 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
947
948         * gold.cc (Target_arm::do_adjust_elf_header): Add the
949         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
950         in EABI_VER5.
951
952 2012-10-29  Cary Coutant  <ccoutant@google.com>
953
954         * dwp.cc (usage): Add file and exit status parameters;
955         add --help and --version options.
956         (print_version): New function.
957         (main): Add --help and --version options.
958
959 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
960
961         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
962         final_layout_sequence.txt.
963         * testsuite/Makefile.in: Regenerated.
964
965 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
966
967         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
968         COMPILE generated by automake.
969         (LINK1): Likewise.
970         (CXXCOMPILE1): Likewise.
971         (CXXLINK1): Likewise.
972         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
973         (LINK): Likewise.
974         (CXXCOMPILE): Likewise.
975         (CXXLINK): Likewise.
976         * testsuite/Makefile.in: Regenerated.
977
978 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
979
980         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
981         on bad fwrite return.
982
983 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
984
985         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
986         on val.
987
988 2012-10-23  Cary Coutant  <ccoutant@google.com>
989
990         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
991         * testsuite/Makefile.in: Regenerate.
992         * testsuite/dwp_test.h: New source file.
993         * testsuite/dwp_test_1.cc: New source file.
994         * testsuite/dwp_test_1.s: New source file.
995         * testsuite/dwp_test_1.sh: New source file.
996         * testsuite/dwp_test_1b.cc: New source file.
997         * testsuite/dwp_test_1b.s: New source file.
998         * testsuite/dwp_test_2.cc: New source file.
999         * testsuite/dwp_test_2.s: New source file.
1000         * testsuite/dwp_test_2.sh: New source file.
1001         * testsuite/dwp_test_main.cc: New source file.
1002         * testsuite/dwp_test_main.s: New source file.
1003
1004 2012-10-23  Cary Coutant  <ccoutant@google.com>
1005
1006         * dwp.h: New header file.
1007         * dwp.cc: New source file.
1008         * gold.h: Move shared declarations to system.h.
1009         * system.h: New header file.
1010         * Makefile.am: Add dwp.
1011         * Makefile.in: Regenerate.
1012
1013 2012-10-23  Cary Coutant  <ccoutant@google.com>
1014
1015         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1016         Dwarf_info_reader::read_from_pointer.
1017         (Dwarf_pubnames_table::read_header): Likewise.
1018         (Dwarf_pubnames_table::next_name): Likewise.
1019         (Dwarf_die::read_attributes): Likewise.
1020         (Dwarf_die::skip_attributes): Likewise.
1021         (Dwarf_info_reader::read_from_pointer): New function template.
1022         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1023         (Dwarf_pubnames_table): Likewise.
1024         (Dwarf_info_reader::read_from_pointer): New function template.
1025         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1026         Dwarf_pubnames_table ctor.
1027
1028 2012-10-23  Cary Coutant  <ccoutant@google.com>
1029
1030         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1031         abbrev_shndx.
1032         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1033         abbrev_shndx_.
1034         (Dwarf_info_reader::set_abbrev_shndx): New method.
1035         (Dwarf_info_reader::abbrev_shndx_): New data member.
1036
1037 2012-10-23  Cary Coutant  <ccoutant@google.com>
1038
1039         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1040         from object, not parameters.
1041         (Dwarf_info_reader::parse): Likewise.
1042         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1043         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1044         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1045         methods.
1046
1047 2012-10-23  Cary Coutant  <ccoutant@google.com>
1048
1049         * fileread.cc (Input_file::Input_file): New constructor.
1050         * fileread.h (class Input_file): Add new constructor.
1051
1052 2012-10-18  Alan Modra  <amodra@gmail.com>
1053
1054         PR gold/14727
1055         * object.cc (Relobj::is_section_name_included): Also match
1056         .sdata personality section.
1057
1058 2012-10-18  Alan Modra  <amodra@gmail.com>
1059
1060         * target-reloc.h (class Default_comdat_behavior): New, package up..
1061         (get_comdat_behaviour): ..this.
1062         (relocate_section): Add Relocate_comdat_behavior template arg,
1063         adjust code to suit.
1064         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1065         (Target_arm::scan_reloc_section): Likewise.
1066         * i386.cc (Target_i386::relocate_section): Likewise.
1067         * sparc.cc (Target_sparc::relocate_section): Likewise.
1068         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1069         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1070         * powerpc.cc (class Relocate_comdat_behavior): New.
1071         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1072         gold::relocate_section with new template arg.
1073
1074 2012-10-18  Alan Modra  <amodra@gmail.com>
1075
1076         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1077         dynamic relocs for GOT_TPREL got entries, without symbol if
1078         resolving locally.
1079         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1080         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1081         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1082
1083 2012-10-17  Alan Modra  <amodra@gmail.com>
1084
1085         PR gold/14726
1086         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1087
1088 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1089
1090         * layout.cc (Layout::include_section): Keep sections marked
1091         SHF_EXCLUDE when doing relocatable links.
1092
1093 2012-10-16  Alan Modra  <amodra@gmail.com>
1094
1095         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1096         (Target_powerpc::do_finalize_sections): Call it.
1097         (Output_data_save_res): New class and supporting functions.
1098         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1099         normal symbols defined in object files.
1100
1101 2012-10-12  Alan Modra  <amodra@gmail.com>
1102
1103         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1104         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1105         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1106         section if scan_opd_relocs not yet called.
1107         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1108
1109 2012-10-12  Alan Modra  <amodra@gmail.com>
1110
1111         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1112         add_local_ifunc_entry): Revert last change.
1113         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1114
1115 2012-10-05  Alan Modra  <amodra@gmail.com>
1116
1117         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1118         do_plt_address_for_global): New functions.
1119         (Output_data_got_powerpc::do_write): Don't segfault when linking
1120         statically.
1121         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1122         add_local_ifunc_entry): Return true on adding entry..
1123         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1124         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1125         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1126         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1127         set up symbols here.
1128         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1129         syms here.  Do so even when no .iplt.  Don't segfault when linking
1130         statically.
1131         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1132         new variants without reloc param.
1133         (Glink_sym_ent::Glink_sym_ent): Likewise.
1134         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1135         reloc when refs will resolve to plt call stub.
1136         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1137         R_PPC_PLTREL24 to resolve locally.
1138         (Target_powerpc::Scan::global): Correct ifunc handling.
1139         (Target_powerpc::Relocate::relocate): Correct local sym glink
1140         lookup.  Don't destroy "value" when we have a plt call stub,
1141         and when checking plt call validity.
1142         (Target_powerpc::do_dynsym_value): Simplify.
1143
1144 2012-10-05  Alan Modra  <amodra@gmail.com>
1145
1146         * i386.cc (Output_data_plt_i386::address_for_global,
1147         address_for_local): Add plt offset to returned value.  Adjust uses.
1148         * sparc.cc (Output_data_plt_sparc::address_for_global,
1149         address_for_local): Likewise.
1150         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1151         address_for_local): Likewise.
1152         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1153         address_for_local): Likewise.
1154         * target.h (Target::plt_address_for_global, plt_address_for_local):
1155         Update comment.
1156         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1157         (Output_data_got::Got_entry::write): Nor here.
1158         * output.h: Comment fix.
1159
1160 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1161
1162         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1163         global_offset_table_ value for larget got.
1164         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1165
1166 2012-09-29  Alan Modra  <amodra@gmail.com>
1167
1168         * powerpc.cc (Target_powerpc::iplt_): New output section.
1169         (Target_powerpc::iplt_section, make_iplt_section,
1170         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1171         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1172         Target_powerpc::plt_entry_count): Count iplt entries too.
1173         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1174         reloc section in constructor.  New params.
1175         (Target_powerpc::make_plt_section): Create reloc section here instead.
1176         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1177         functions.
1178         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1179         (Output_data_glink::add_entry, find_entry): New functions to
1180         deal with local syms.
1181         (Glink_sym_ent): Add support for local syms.
1182         (Output_data_glink::do_write): Handle ifunc plt entries.
1183         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1184         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1185         (Target_powerpc::Relocate::relocate): Likewise.
1186         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1187
1188 2012-09-25  Alan Modra  <amodra@gmail.com>
1189
1190         * object.h (Sized_relobj_file::adjust_local_symbol,
1191         do_adjust_local_symbol): New functions.
1192         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1193         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1194         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1195         and irregular opd entry spacing.
1196         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1197         (Global_symbol_visitor_opd): New functor.
1198         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1199         on deleted opd entries.
1200
1201 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1202
1203         * tilegx.cc: New file.
1204         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1205         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1206         * configure.tgt: Add entries for tilegx*.
1207         * configure.ac: Likewise.
1208         * Makefile.in: Rebuild.
1209         * configure: Likewise.
1210         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1211         tilegx.
1212
1213 2012-09-13  Alan Modra  <amodra@gmail.com>
1214
1215         * target-reloc.h (scan_relocs): Call scan.local for relocs
1216         against symbols in discarded sections.  Pass is_discarded
1217         param.
1218         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1219         Add is_discarded param.
1220         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1221         is_discarded to flag opd entry as discarded.  Don't emit dyn
1222         relocs on such entries.
1223         (Target_powerpc::Scan::global): Similarly detect and handle
1224         such opd entries.
1225         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1226         opd_ent_.  Update all uses.
1227         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1228         (Target_powerpc::relocate_section): Zero out discarded opd
1229         entry relocs.
1230
1231 2012-09-12  Ian Lance Taylor  <iant@google.com>
1232
1233         PR gold/14570
1234         * output.cc: Rename Output_data_got template parameter from size
1235         to got_size for all functions.  Compile all variants of
1236         Output_data_got.
1237         (Output_data_got::Got_entry::write): Correct use of size for
1238         symbol value.  Use local_is_tls rather than casting to
1239         Sized_relobj_file.
1240         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1241         (class Sized_relobj_file): Add do_local_is_tls.
1242         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1243
1244 2012-09-11  Alan Modra  <amodra@gmail.com>
1245
1246         PR gold/14566
1247         * layout.cc (Layout::set_segment_offsets): When using
1248         common-page-size alignment, ensure we are on a new max-page-size
1249         page.
1250         * output.cc (Output_segment::set_section_addresses): Use
1251         abi_pagesize, not common_pagesize for relro boundary.
1252         (Output_segment::set_offset): Likewise.
1253
1254 2012-09-11  Alan Modra  <amodra@gmail.com>
1255
1256         * output.h (Output_data_got::add_global_tls, add_local_tls,
1257         add_local_tls_pair): New functions.
1258         (Output_data_got::add_local_pair_with_rel): Remove second
1259         reloc param.  Expand comment.
1260         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1261         use_plt_or_tls_offset_, similarly for constructor param.
1262         (Output_data_got::Got_entry::write): Add got_index param.
1263         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1264         add_local_tls_pair): New functions.
1265         (Output_data_got::Got_entry::write): Handle tls symbols
1266         with use_plt_or_tls_offset_ set specially.
1267         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1268         (Output_data_got::do_write): Replace iterator with index, pass
1269         index to entry write function.
1270         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1271         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1272         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1273         call.
1274         * i386.cc (Target_i386::Scan::local): Likewise.
1275         * sparc.cc (Target_sparc::Scan::local): Likewise.
1276         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1277         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1278         do_tls_offset_for_global): New functions.
1279         (Target_powerpc::Scan::local): Correct TLS relocations and got
1280         entry values.
1281         (Target_powerpc::Scan::global): Don't emit unnecessary
1282         dynamic relocations on TLS GOT entries.
1283
1284 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1285
1286         * config.in: Disable sanity check for kfreebsd.
1287
1288 2012-09-10  Sterling Augustine  <saugustine@google.com>
1289
1290         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1291         (Gdb_index::pubtypes_read): New parameter.
1292         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1293         to calls.
1294         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1295         pubtypes_object_.
1296
1297 2012-09-09  Alan Modra  <amodra@gmail.com>
1298
1299         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1300         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1301         * gc.h (gc_process_relocs): Call target gc_add_reference.
1302         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1303         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1304         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1305         unnecessary cast.
1306         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1307         to cater for when we don't need code offset.  Update use.
1308         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1309         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1310         set_opd_valid): New functions.
1311         (Target_powerpc::do_gc_add_reference): New function.
1312         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1313         stashed refs.
1314         (Target_powerpc::do_gc_mark_symbol): New function.
1315
1316 2012-09-06  Cary Coutant  <ccoutant@google.com>
1317
1318         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1319         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1320         (Dwarf_die::skip_attributes): Likewise.
1321         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1322         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1323         (main): Call it.
1324         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1325
1326 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1327
1328         * testsuite/script_test_3.t: Add .got.plt output section
1329         statement.
1330         * testsuite/script_test_4.t: Likewise.
1331
1332 2012-09-05  Alan Modra  <amodra@gmail.com>
1333
1334         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1335         update all uses and lose "enum" when using type.
1336
1337 2012-09-05  Alan Modra  <amodra@gmail.com>
1338
1339         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1340         * configure: Regenerate.
1341         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1342         (plugin_final_layout.stdout): Likewise.
1343         (memory_test): Set page sizes to 0x1000.
1344         * testsuite/Makefile.in: Regenerate.
1345         * testsuite/discard_locals_test.sh: Add FIXME comment.
1346         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1347         * testsuite/pr14265.t: Add .got output section statement.
1348         * testsuite/script_test_2.t: Likewise.
1349         * testsuite/script_test_3.t: Likewise.
1350         * testsuite/script_test_4.t: Likewise.
1351         * testsuite/script_test_5.t: Likewise.
1352         * testsuite/script_test_6.t: Likewise.
1353         * testsuite/script_test_7.t: Likewise.
1354         * testsuite/script_test_9.t: Likewise.
1355
1356 2012-09-05  Alan Modra  <amodra@gmail.com>
1357
1358         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1359         (Powerpc_relocate_functions::Status): New typedef.
1360         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1361         (Target_powerpc::Scan::local): Handle REL64.
1362         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1363         for REL32 and REL64.
1364         (Target_powerpc::symval_for_branch): New function, extracted from..
1365         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1366         checks.  Report overflow errors.
1367
1368 2012-09-05  Alan Modra  <amodra@gmail.com>
1369
1370         * object.h (Sized_relobj_file::emit_relocs): Delete.
1371         (Sized_relobj_file::emit_relocs_reltype): Delete.
1372         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1373         relocate_relocs for --emit-relocs.
1374         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1375         * output.h: Update comment.
1376         (Output_segment::first_section): New function.
1377         (Output_segment::first_section_load_address): Use first_section.
1378         * output.cc (Output_segment::first_section): New function extracted..
1379         (Output_segment::first_section_load_address): ..from here.  Delete.
1380         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1381         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1382         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1383         adjust call to target.h function.
1384         * i386.cc (Target_i386): Likewise.
1385         * sparc.cc (Target_sparc): Likewise.
1386         * x86_64.cc (Target_x86_64): Likewise.
1387         * powerpc.cc (Target_powerpc): Likewise.
1388         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1389         first tls section has section symbol for optimised local dynamic
1390         output relocs.
1391         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1392         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1393         optimised tls code.
1394         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1395         Rename to relocate_relocs.  Update error message.
1396
1397 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1398
1399         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1400         --just-symbols.
1401
1402 2012-08-31  Alan Modra  <amodra@gmail.com>
1403
1404         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1405         (Powerpc_relobj::toc_base_offset): New stub function.
1406         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1407         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1408         (Target_powerpc::Relocate::enum skip_tls): New.
1409         (Target_powerpc::call_tls_get_addr_): New var.
1410         (Target_powerpc::is_branch_reloc): Move to file scope.
1411         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1412         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1413         New functions.
1414         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1415         (powerpc_info): Correct common_pagesize for ppc64.
1416         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1417         (Powerpc_relocate_functions): Add overflow check enums and functions.
1418         Add non-shift version of rela, rela_ua.  Delete all rel public
1419         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1420         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1421         addr16_ha3, addr14 functions.
1422         (Output_data_got_powerpc::add_constant_pair): New function.
1423         (Output_data_got_powerpc::got_base_offset): Likewise.
1424         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1425         (instruction constants): Sort, add some more.
1426         (Output_data_glink::do_write): Add and use Address typedef.  Use
1427         object->toc_base_offset() stub for 64-bit.
1428         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1429         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1430         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1431         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1432         Always treat .opd relocs as against locally defined symbol.
1433         Correct condition for RELATIVE relocs.
1434         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1435         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1436         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1437         calculations.  Handle TLS relocs, and more.  Add overflow
1438         checking and adjust for Powerpc_relocate_functions changes.
1439         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1440         Reinstate --emit-relocs code with FIXME.
1441
1442 2012-08-30  Alan Modra  <amodra@gmail.com>
1443
1444         * layout.cc (Layout::set_segment_offsets): Set p_align to
1445         abi_pagesize, not common_pagesize.
1446         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1447         to determine whether file header can go in segment.
1448
1449 2012-08-30  Alan Modra  <amodra@gmail.com>
1450
1451         * output.h (Output_reloc::Output_reloc <output section>): Add
1452         is_relative param.  Adjust calls.
1453         (Output_reloc::add_output_section_relative): New functions.
1454         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1455         is_relative.
1456         (Output_reloc::symbol_value): Handle SECTION_CODE.
1457
1458 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1459
1460         * gold.cc (queue_middle_tasks): Call layout again when unique
1461         segments for sections is desired.
1462         * layout.cc (Layout::Layout): Initialize new members.
1463         (Layout::get_output_section_flags): New function.
1464         (Layout::choose_output_section): Call get_output_section_flags.
1465         (Layout::layout): Make output section for mapping to a unique segment.
1466         (Layout::insert_section_segment_map): New function.
1467         (Layout::attach_allocated_section_to_segment): Make unique segment for
1468         output sections marked so.
1469         (Layout::segment_precedes): Check for unique segments when sorting.
1470         * layout.h (Layout::Unique_segment_info): New struct.
1471         (Layout::Section_segment_map): New typedef.
1472         (Layout::insert_section_segment_map): New function.
1473         (Layout::get_output_section_flags): New function.
1474         (Layout::is_unique_segment_for_sections_specified): New function.
1475         (Layout::set_unique_segment_for_sections_specified): New function.
1476         (Layout::unique_segment_for_sections_specified_): New member.
1477         (Layout::section_segment_map_): New member.
1478         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1479         Rename is_gc_pass_one to is_pass_one.
1480         Rename is_gc_pass_two to is_pass_two.
1481         Rename is_gc_or_icf to is_two_pass.
1482         Check for which pass based on whether symbols data is present.
1483         Make it two pass when unique segments for sections is desired.
1484         * output.cc (Output_section::Output_section): Initialize new
1485         members.
1486         * output.h (Output_section::is_unique_segment): New function.
1487         (Output_section::set_is_unique_segment): New function.
1488         (Output_section::is_unique_segment_): New member.
1489         (Output_section::extra_segment_flags): New function.
1490         (Output_section::set_extra_segment_flags): New function.
1491         (Output_section::extra_segment_flags_): New member.
1492         (Output_section::segment_alignment): New function.
1493         (Output_section::set_segment_alignment): New function.
1494         (Output_section::segment_alignment_): New member.
1495         (Output_segment::Output_segment): Initialize is_unique_segment_.
1496         (Output_segment::is_unique_segment): New function.
1497         (Output_segment::set_is_unique_segment): New function.
1498         (Output_segment::is_unique_segment_): New member.
1499         * plugin.cc (allow_unique_segment_for_sections): New function.
1500         (unique_segment_for_sections): New function.
1501         (Plugin::load): Add new functions to transfer vector.
1502         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1503         * Makefile.in: Regenerate.
1504         * testsuite/plugin_final_layout.sh: Check if unique segment
1505         functionality works.
1506         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1507         are available.
1508         (allow_unique_segment_for_sections): New global.
1509         (unique_segment_for_sections): New global.
1510         (claim_file_hook): Call allow_unique_segment_for_sections.
1511         (all_symbols_read_hook): Call unique_segment_for_sections.
1512
1513 2012-08-22  Cary Coutant  <ccoutant@google.com>
1514
1515         * layout.cc (Layout::include_section): Don't assert on GROUP
1516         sections with --emit-relocs.
1517
1518 2012-08-21  Cary Coutant  <ccoutant@google.com>
1519
1520         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1521         if --export-dynamic-symbol names an undef symbol.
1522
1523 2012-08-18  Alan Modra  <amodra@gmail.com>
1524
1525         * powerpc.cc: Formatting and white space.
1526         (Powerpc_relobj): Rename got2_section_ to special_.
1527         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1528         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1529         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1530         (Target_powerpc): Add Address typedef and invalid_address.  Use
1531         throughout.
1532         (Target_powerpc::is_branch_reloc): New function.
1533         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1534         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1535         for dst_mask, value and addend.
1536         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1537         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1538         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1539         uint16_t for 24-bit offset.  Use get_output_section_offset and
1540         check return.
1541         (Target_powerpc::Scan::local): Handle more relocs.
1542         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1543         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1544         Plug in toc restoring insn after plt calls.  Translate branches
1545         to function descriptor symbols to corresponding entry point.
1546         (Target_powerpc::relocate_for_relocatable): Check return from
1547         get_output_section_offset.
1548         * symtab.h: Comment typo.
1549
1550 2012-08-14  Ian Lance Taylor  <iant@google.com>
1551
1552         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1553         unsupported_relocal_local to call unsupported_reloc_global.
1554
1555 2012-08-14  Nick Clifton  <nickc@redhat.com>
1556
1557         PR ld/14265
1558         * script-sections.cc (Sections_element::output_section_name): Add
1559         keep return parameter.
1560         (Output_section_element::match_name): Add keep return parameter.
1561         Return the value of the keep_ member.
1562         * script-sections.h (class Output_section): Update
1563         output_section_name prototype.
1564         * layout.cc (Layout::keep_input_section): New public member
1565         function.
1566         (Layout::choose_output_section): Pass keep parameter to
1567         output_section_name.
1568         * layout.h (class Layout): Add keep_input_section.
1569         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1570         sections.
1571         * testsuite/Makefile.am: Add a test.
1572         * testsuite/Makefile.in: Regenerate.
1573         * testsuite/pr14265.c: Source file for the test.
1574         * testsuite/pr14265.t: Linker script for the test.
1575         * testsuite/pr14265.sh: Shell script for the test.
1576
1577 2012-08-14  Alan Modra  <amodra@gmail.com>
1578
1579         * target.h (Target::output_section_name): New function.
1580         (Target::do_output_section_name): New function.
1581         * layout.cc (Layout::choose_output_section): Call the above.
1582         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1583
1584 2012-08-14  Alan Modra  <amodra@gmail.com>
1585
1586         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1587         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1588         for replace_constant call.
1589         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1590         (Output_data_glink::do_print_to_mapfile): New function.
1591         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1592         (Target_powerpc::Relocate::relocate): Likewise.
1593
1594 2012-08-14  Alan Modra  <amodra@gmail.com>
1595
1596         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1597         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1598         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1599         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1600         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1601         here.
1602         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1603         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1604         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1605         here.
1606         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1607         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1608
1609 2012-08-12  Alan Modra  <amodra@gmail.com>
1610
1611         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1612         (glink insn constants): Use uint32_t.
1613         (Output_data_glink::add_entry): Use insert, not [] operator.
1614
1615 2012-08-11  Alan Modra  <amodra@gmail.com>
1616
1617         * object.h (Sized_relobj_file::find_shdr): New function.
1618         (Sized_relobj_file::find_special_sections): New function.
1619         * object.cc (Sized_relobj_file::find_shdr): New function.
1620         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1621         (Sized_relobj_file::find_special_sections): New function, split out..
1622         (Sized_relobj_file::do_read_symbols): ..from here.
1623         * output.h (Output_data_got::replace_constant): New function.
1624         (Output_data_got::num_entries): New function.
1625         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1626         (Output_data_got::got_offset): Protected rather than private.
1627         (Output_data_got::replace_got_entry): New function.
1628         * output.cc (Output_data_got::replace_got_entry): New function.
1629         * powerpc.cc (class Powerpc_relobj): New.
1630         (class Powerpc_relocate_functions): Delete all psymval variants or
1631         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1632         Implement _ha functions using corresponding _hi function.
1633         (Powerpc_relobj::find_special_sections): New function.
1634         (Target_powerpc::do_make_elf_object): New function.
1635         (class Output_data_got_powerpc): New.
1636         (class Output_data_glink): New.
1637         (class Powerpc_scan_relocatable_reloc): New.
1638         Many more changes througout file.
1639
1640 2012-08-09  Nick Clifton  <nickc@redhat.com>
1641
1642         * po/vi.po: Updated Vietnamese translation.
1643
1644 2012-08-07  Ian Lance Taylor  <iant@google.com>
1645
1646         * layout.cc (Layout::add_target_dynamic_tags): If
1647         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1648         plt_rel.
1649
1650 2012-07-30  Nick Clifton  <nickc@redhat.com>
1651
1652         * po/gold.pot: Updated template.
1653         * po/es.po: Updated Spanish translation.
1654
1655 2012-07-18  Cary Coutant  <ccoutant@google.com>
1656
1657         PR gold/14344
1658         * configure.ac: Add check for -gpubnames support.
1659         * configure: Regenerate.
1660         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1661         support; force -gno-pubnames.
1662         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1663         support.
1664         (gdb_index_test_4): New test.
1665         * testsuite/Makefile.in: Regenerate.
1666         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1667         * testsuite/gdb_index_test_2.sh: Likewise.
1668         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1669         * testsuite/gdb_index_test_4.sh: New script.
1670         * testsuite/gdb_index_test_comm.sh: New script with common code;
1671         don't look for space after colon.
1672
1673 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1674
1675         * gold.cc (queue_middle_tasks): Update function order only after
1676         deferred objects due to plugins are processed.
1677
1678 2012-07-11  Ian Lance Taylor  <iant@google.com>
1679
1680         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1681         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1682         (Target_arm::scan_reloc_for_stub): Likewise.
1683         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1684         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1685         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1686         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1687         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1688
1689 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1690             Ian Lance Taylor  <iant@google.com>
1691
1692         PR gold/14309
1693         * configure.ac: Test whether std::tr1::hash<off_t> works.
1694         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1695         needed.
1696         * output.h (class Output_fill): Add virtual destructor.
1697         * configure, config.in: Rebuild.
1698
1699 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1700
1701         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1702
1703 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1704
1705         * plugin.cc (Plugin::load): Handle position independent executables.
1706
1707 2012-06-06  Cary Coutant  <ccoutant@google.com>
1708
1709         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1710         add .debug_macro.
1711         (lines_only_debug_sections): Likewise.
1712         (gdb_fast_lookup_sections): New static array.
1713         (is_gdb_debug_section): Rename formal parameter.
1714         (is_lines_only_debug_section): Likewise.
1715         (is_gdb_fast_lookup_section): New function.
1716         (Layout::include_section): Check for ".zdebug_" prefix; pass
1717         section name suffix to is_gdb_debug_section, et al.; check for
1718         fast-lookup sections when building .gdb_index.
1719         * options.h (--strip-debug-gdb): Update GDB version number.
1720
1721 2012-06-06  Cary Coutant  <ccoutant@google.com>
1722
1723         * configure.ac: Add check for fallocate.
1724         * configure: Regenerate.
1725         * config.in: Regenerate.
1726
1727         * options.h (class General_options): Add --mmap-output-file and
1728         --posix-fallocate options.
1729         * output.cc: (posix_fallocate): Remove; replace with...
1730         (gold_fallocate): New function.
1731         (Output_file::map_no_anonymous): Call gold_fallocate.
1732         (Output_file::map): Check --mmap-output-file option.
1733
1734 2012-06-05  Jing Yu  <jingyu@google.com>
1735
1736         * gold.h (textdomain): Add do {} to empty while(0).
1737         (bindtextdomain): Likewise.
1738
1739 2012-06-04  Cary Coutant  <ccoutant@google.com>
1740
1741         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1742         has_dynsym_index.
1743
1744 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1745
1746         * symtab.cc (Symbol_table::define_special_symbol):
1747         Initialize *poldsym to prevent uninitialized variable errors.
1748
1749 2012-05-23  Cary Coutant  <ccoutant@google.com>
1750
1751         * layout.cc (Layout::section_name_mapping): Add rules to handle
1752         exact match on .data.rel.ro.local or .data.rel.ro.
1753         (Layout::output_section_name): Check for exact matches.
1754
1755 2012-05-23  Cary Coutant  <ccoutant@google.com>
1756
1757         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1758         more carefully.
1759
1760 2012-05-22  Cary Coutant  <ccoutant@google.com>
1761
1762         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1763         object before exporting symbol.
1764
1765 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1766
1767         * testsuite/tls_test.cc: Include "config.h" first.
1768         * testsuite/tls_test_c.c: Likewise.
1769
1770 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1771             Nick Clifton  <nickc@redhat.com>
1772
1773         PR 14072
1774         * configure.in: Add check that sysdep.h has been included before
1775         any system header files.
1776         * configure: Regenerate.
1777         * config.in: Regenerate.
1778
1779 2012-05-14  Cary Coutant  <ccoutant@google.com>
1780
1781         * layout.cc (Layout::make_output_section): Mark .tdata section
1782         as RELRO.
1783         * testsuite/relro_test.cc: Add a TLS variable.
1784
1785 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1786
1787         PR gold/14091
1788         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1789         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1790         R_X86_64_64.
1791
1792 2012-05-08  Cary Coutant  <ccoutant@google.com>
1793
1794         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1795         (lines_only_debug_sections): Likewise.
1796
1797 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1798
1799         * nacl.cc: New file.
1800         * nacl.h: New file.
1801         * Makefile.am (CCFILES, HFILES): Add them.
1802         * Makefile.in: Regenerate.
1803         * i386.cc (Output_data_plt_i386_nacl): New class.
1804         (Output_data_plt_i386_nacl_exec): New class.
1805         (Output_data_plt_i386_nacl_dyn): New class.
1806         (Target_i386_nacl): New class.
1807         (Target_selector_i386_nacl): New class.
1808         (target_selector_i386): Use it instead of Target_selector_i386.
1809         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1810         (Target_x86_64_nacl): New class.
1811         (Target_selector_x86_64_nacl): New class.
1812         (target_selector_x86_64, target_selector_x32): Use it instead of
1813         Target_selector_x86_64.
1814         * arm.cc (Output_data_plt_arm_nacl): New class.
1815         (Target_arm_nacl): New class.
1816         (Target_selector_arm_nacl): New class.
1817         (target_selector_arm, target_selector_armbe): Use it instead of
1818         Target_selector_arm.
1819
1820         * target-select.cc (select_target): Take new Input_file* and off_t
1821         arguments, pass them on to recognize method of selector.
1822         * object.cc (make_elf_sized_object): Update caller.
1823         * parameters.cc (parameters_force_valid_target): Likewise.
1824         * incremental.cc (make_sized_incremental_binary): Likewise.
1825         * target-select.h: Update decl.
1826         (Target_selector::recognize): Take new Input_file* argument,
1827         pass it on to do_recognize.
1828         (Target_selector::do_recognize): Take new Input_file* argument.
1829         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1830         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1831         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1832         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1833
1834         * target.h (Target::Target_info): New members isolate_execinstr
1835         and rosegment_gap.
1836         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1837         * arm.cc (Target_arm::arm_info): Update initializer.
1838         * i386.cc (Target_i386::i386_info): Likewise.
1839         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1840         * sparc.cc (Target_sparc::sparc_info): Likewise.
1841         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1842         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1843         * layout.cc (Layout::attach_allocated_section_to_segment):
1844         Take new const Target* argument.  If target->isolate_execinstr(), act
1845         like --rosegment.
1846         (Layout::find_first_load_seg): Take new const Target* argument;
1847         if target->isolate_execinstr(), reject PF_X segments.
1848         (Layout::relaxation_loop_body): Update caller.
1849         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1850         reset file offset to zero when we hit LOAD_SEG, and then do a second
1851         loop over the segments before LOAD_SEG to reassign offsets after
1852         addresses have been determined.  Handle target->rosegment_gap().
1853         (Layout::attach_section_to_segment): Take new const Target* argument;
1854         pass it to attach_allocated_section_to_segment.
1855         (Layout::make_output_section): Update caller.
1856         (Layout::attach_sections_to_segments): Take new const Target* argument;
1857         pass it to attach_section_to_segment.
1858         * gold.cc (queue_middle_tasks): Update caller.
1859         * layout.h (Layout): Update method decls with new arguments.
1860
1861         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1862         Target_info pointer to use.
1863         (Target_arm::do_make_data_plt): New virtual method.
1864         (Target_arm::make_data_plt): New method that calls it.
1865         (Target_arm::make_plt_entry): Use it.
1866         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1867         for the section alignment.
1868         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1869         method.
1870         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1871         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1872         method.
1873         (Output_data_plt_arm::get_plt_entry_size): Call it.
1874         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1875         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1876         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1877         method.
1878         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1879         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1880         method instead of sizeof(plt_entry).
1881         (Output_data_plt_arm::add_entry): Likewise.
1882         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1883         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1884         than static method.
1885         (Target_arm::plt_entry_size): Likewise.
1886         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1887         Move to ...
1888         (Output_data_plt_arm_standard): ... here, new class.
1889         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1890         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1891         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1892
1893         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1894         Take additional argument for the PLT entry size.
1895         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1896         Use get_plt_entry_size method rather than plt_entry_size variable.
1897         (Output_data_plt_x86_64::reserve_slot): Likewise.
1898         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1899         (Output_data_plt_x86_64::add_entry): Likewise.
1900         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1901         (Output_data_plt_x86_64::address_for_global): Likewise.
1902         (Output_data_plt_x86_64::address_for_local): Likewise.
1903         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1904         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1905         Make method non-static.
1906         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1907         method.
1908         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1909         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1910         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1911         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1912         virtual method.
1913         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1914         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1915         virtual method.
1916         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1917         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1918         virtual method.
1919         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1920         (Output_data_plt_x86_64::plt_entry_size)
1921         (Output_data_plt_x86_64::first_plt_entry)
1922         (Output_data_plt_x86_64::plt_entry)
1923         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1924         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1925         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1926         (Output_data_plt_x86_64_standard): ... here, new class.
1927         (Target_x86_64::Target_x86_64): Take optional argument for the
1928         Target_info pointer to use.
1929         (Target_x86_64::do_make_data_plt): New virtual method.
1930         (Target_x86_64::make_data_plt): New method to call it.
1931         (Target_x86_64::init_got_plt_for_update): Use that.
1932         Call this->plt_->add_eh_frame method here.
1933         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1934         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1935         rather than static method.
1936         (Target_x86_64::plt_entry_size): Likewise.
1937         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1938         rather than plt_entry_size variable.  Move guts of PLT filling to...
1939         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1940         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1941         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1942
1943         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1944         additional argument for the section alignment.
1945         Don't do add_eh_frame_for_plt here.
1946         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1947         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1948         variable.
1949         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1950         method.
1951         (Output_data_plt_i386::get_plt_entry_size): Call it.
1952         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1953         (Output_data_plt_i386::add_eh_frame): New method to call it.
1954         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1955         method.
1956         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1957         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1958         method.
1959         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1960         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1961         method instead of plt_entry_size.
1962         (Output_data_plt_i386::plt_entry_size)
1963         (Output_data_plt_i386::plt_eh_frame_fde_size)
1964         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1965         (Output_data_plt_i386_standard): ... here, new class.
1966         (Output_data_plt_i386_exec): New class.
1967         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1968         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1969         (Output_data_plt_i386::exec_plt_entry): Move to ...
1970         (Output_data_plt_i386_exec::plt_entry): ... here.
1971         (Output_data_plt_i386_dyn): New class.
1972         (Output_data_plt_i386::first_plt_entry): Move to ...
1973         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1974         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1975         (Output_data_plt_i386_dyn::plt_entry): ... here.
1976         (Target_i386::Target_i386): Take optional argument for the Target_info
1977         pointer to use.
1978         (Target_i386::do_make_data_plt): New virtual method.
1979         (Target_i386::make_data_plt): New method to call it.
1980         (Target_i386::make_plt_section): Use that.
1981         Call this->plt_->add_eh_frame method here.
1982         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1983         rather than plt_entry_size variable.
1984         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1985         (Output_data_plt_i386::address_for_local): Likewise.
1986         (Output_data_plt_i386::do_write): Likewise.
1987         Move guts of PLT filling to...
1988         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1989         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1990         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1991         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1992
1993 2012-05-01  Cary Coutant  <ccoutant@google.com>
1994
1995         * dwarf_reader.cc (Dwarf_die::read_attributes)
1996         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1997         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1998         * reduced_debug_output.cc
1999         (Output_reduced_debug_info_section::get_die_end): Remove
2000         DW_FORM_GNU_ref_index.  Add default case.
2001
2002 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2003
2004         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2005         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2006         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2007         DW_AT_high_pc as offset from DW_AT_low_pc.
2008
2009         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2010         * testsuite/Makefile.in: Regenerate.
2011         * testsuite/gdb_index_test_3.c: New test source file.
2012         * testsuite/gdb_index_test_3.sh: New test source file.
2013
2014 2012-04-25  Ian Lance Taylor  <iant@google.com>
2015
2016         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2017         pointer.
2018         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2019         as a class, not a struct.
2020         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2021         (Target_arm::apply_cortex_a8_workaround): Likewise.
2022         * gc.h: Declare Reloc_types as a struct, not a class.
2023         * object.h: Declare Symbols_data as a struct.
2024         * reloc.h: Declare Read_relocs_data as a struct.
2025         * target.h: Declare Relocate_info as a struct.
2026
2027 2012-04-24  David S. Miller  <davem@davemloft.net>
2028
2029         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2030         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2031         and R_SPARC_WPLT30.
2032
2033 2012-04-24  Cary Coutant  <ccoutant@google.com>
2034
2035         * incremental-dump.cc (find_input_containing_global): Replace
2036         magic number with symbolic constant.
2037         (dump_incremental_inputs): Update version number.
2038         * incremental.cc (Output_section_incremental_inputs): Update version
2039         number; import symbolic constants from Incremental_inputs_reader.
2040         (Incremental_inputs::create_data_sections): Align relocations
2041         section correctly for 64-bit targets.
2042         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2043         constants; add padding.
2044         (Output_section_incremental_inputs::write_header): Add assert for
2045         header_size.
2046         (Output_section_incremental_inputs::write_input_files): Add assert
2047         for input_entry_size.
2048         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2049         add assert for object_info_size, input_section_entry_size,
2050         global_sym_entry_size.
2051         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2052         for data structure sizes; use them.
2053         (Incremental_input_entry_reader): Import symbolic constants from
2054         Incremental_inputs_reader; use them.
2055
2056 2012-04-23  David S. Miller  <davem@davemloft.net>
2057
2058         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2059         and elf_flags_set_.
2060         (Target_sparc::Target_sparc): Initialize new fields.
2061         (Target_sparc::do_make_elf_object): New function.
2062         (Target_sparc::do_adjust_elf_header): New function.
2063
2064 2012-04-23  Cary Coutant  <ccoutant@google.com>
2065
2066         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2067         CU range table of gdb index.
2068
2069 2012-04-20  David S. Miller  <davem@davemloft.net>
2070
2071         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2072         instead of false.
2073
2074 2012-04-16  David S. Miller  <davem@davemloft.net>
2075
2076         * sparc.cc (Target_sparc::got_address): New function.
2077         (Sparc_relocate_functions::gdop_hix22): New function.
2078         (Sparc_relocate_functions::gdop_lox10): New function.
2079         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2080         relocs.
2081         (Target_sparc::Scan::local): Likewise if the global symbol is not
2082         preemptible and is not IFUNC.
2083         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2084         transformations for local and non-preemptible non-IFUNC global
2085         symbols.
2086
2087         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2088         writing out 64-bit part of ranges.
2089
2090         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2091         -fpic and -fpie respectively.
2092         * Makefile.in: Regenerate.
2093
2094         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2095         (Target_sparc::Target_sparc): Initialize new field.
2096         (Target_sparc::do_plt_section_for_global): New function.
2097         (Target_sparc::do_plt_section_for_local): New function.
2098         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2099         (Target_sparc::make_plt_section): New function, broken out of
2100         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2101         (Target_sparc::make_plt_entry): Call make_plt_section.
2102         (Target_sparc::make_local_ifunc_plt_entry): New function.
2103         (Target_sparc::rela_ifunc_section): New function.
2104         (Target_sparc::plt_section): Remove const.
2105         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2106         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2107         and ifunc_count_ fields.
2108         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2109         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2110         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2111         (Output_data_plt_sparc::rela_ifunc): New function.
2112         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2113         (Output_data_plt_sparc::has_ifunc_section): New function.
2114         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2115         (Output_data_plt_sparc::address_for_global): New function.
2116         (Output_data_plt_sparc::address_for_local): New function.
2117         (Output_data_plt_sparc::plt_index_to_offset): New function.
2118         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2119         and entry_count.
2120         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2121         entry_count.
2122         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2123         R_SPARC_JMP_IREL to switch.
2124         (Target_sparc::Scan::check_non_pic): Likewise.
2125         (Target_sparc::Scan::local): Handle IFUNC symbols.
2126         (Target_sparc::Scan::local): Likewise.
2127         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2128         and plt_address_for_local.
2129         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2130         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2131
2132         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2133         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2134         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2135         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2136         global relocs too.
2137         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2138         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2139         calls.
2140         * sparc.cc (Target_sparc::Scan::global): Likewise.
2141         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2142
2143 2012-04-16  Cary Coutant  <ccoutant@google.com>
2144
2145         * archive.cc (Library_base::should_include_member): Check for
2146         --export-dynamic-symbol.
2147         * options.h (class General_options): Add --export-dynamic-symbol.
2148         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2149         --export-dynamic-symbol.
2150         (Symbol_table::gc_mark_undef_symbols): Likewise.
2151         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2152
2153 2012-04-12  David S. Miller  <davem@davemloft.net>
2154
2155         * sparc.cc (Reloc::wdisp10): New relocation method.
2156         (Reloc::h34): Likewise.
2157         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2158         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2159         R_SPARC_WDISP10.
2160         (Target_sparc::Scan::local): Likewise.
2161         (Target_sparc::Scan::global): Likewise.
2162         (Target_sparc::Relocate::relocate): Likewise.
2163
2164 2012-04-09  Cary Coutant  <ccoutant@google.com>
2165
2166         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2167         low_pc == 0.
2168
2169 2012-04-06  Ian Lance Taylor  <iant@google.com>
2170
2171         * timer.cc: #include <unistd.h>.
2172
2173 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2174
2175         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2176         * config.in: Regenerate.
2177         * configure: Regenerate.
2178
2179 2012-04-05  Nick Clifton  <nickc@redhat.com>
2180
2181         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2182         (AM_LC_MESSAGES): Add.
2183         * aclocal.m4: Regenerate.
2184         * config.in: Regenerate.
2185         * configure: Regenerate.
2186
2187 2012-03-21  Cary Coutant  <ccoutant@google.com>
2188
2189         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2190         * Makefile.in: Regenerate.
2191         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2192         (Sized_elf_reloc_mapper::symbol_section): New function.
2193         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2194         (make_elf_reloc_mapper): New function.
2195         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2196         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2197         (Dwarf_abbrev_table::do_get_abbrev): New function.
2198         (Dwarf_ranges_table::read_ranges_table): New function.
2199         (Dwarf_ranges_table::read_range_list): New function.
2200         (Dwarf_pubnames_table::read_section): New function.
2201         (Dwarf_pubnames_table::read_header): New function.
2202         (Dwarf_pubnames_table::next_name): New function.
2203         (Dwarf_die::Dwarf_die): New function.
2204         (Dwarf_die::read_attributes): New function.
2205         (Dwarf_die::skip_attributes): New function.
2206         (Dwarf_die::set_name): New function.
2207         (Dwarf_die::set_linkage_name): New function.
2208         (Dwarf_die::attribute): New function.
2209         (Dwarf_die::string_attribute): New function.
2210         (Dwarf_die::int_attribute): New function.
2211         (Dwarf_die::uint_attribute): New function.
2212         (Dwarf_die::ref_attribute): New function.
2213         (Dwarf_die::child_offset): New function.
2214         (Dwarf_die::sibling_offset): New function.
2215         (Dwarf_info_reader::check_buffer): New function.
2216         (Dwarf_info_reader::parse): New function.
2217         (Dwarf_info_reader::do_parse): New function.
2218         (Dwarf_info_reader::do_read_string_table): New function.
2219         (Dwarf_info_reader::lookup_reloc): New function.
2220         (Dwarf_info_reader::get_string): New function.
2221         (Dwarf_info_reader::visit_compilation_unit): New function.
2222         (Dwarf_info_reader::visit_type_unit): New function.
2223         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2224         Sized_elf_reloc_mapper.
2225         (Sized_dwarf_line_info::symbol_section): Remove function.
2226         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2227         (Sized_dwarf_line_info::read_line_mappings): Remove object
2228         parameter, adjust callers.
2229         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2230         * dwarf_reader.h: Include <sys/types.h>.
2231         (class Track_relocs): Remove forward declaration.
2232         (class Elf_reloc_mapper): New class.
2233         (class Sized_elf_reloc_mapper): New class.
2234         (class Dwarf_abbrev_table): New class.
2235         (class Dwarf_range_list): New class.
2236         (class Dwarf_ranges_table): New class.
2237         (class Dwarf_pubnames_table): New class.
2238         (class Dwarf_die): New class.
2239         (class Dwarf_info_reader): New class.
2240         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2241         (Sized_dwarf_line_info::symbol_section): Remove member function.
2242         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2243         base class.
2244         * gdb-index.cc: New source file.
2245         * gdb-index.h: New source file.
2246         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2247         and .debug_types sections, call Layout::add_to_gdb_index.
2248         (Sized_relobj_incr::do_section_name): Implement.
2249         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2250         return type; Implement.
2251         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2252         return type.
2253         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2254         parameter list and return type.
2255         (Sized_incr_dynobj::do_section_contents): Likewise.
2256         * layout.cc: Include gdb-index.h.
2257         (Layout::Layout): Initialize gdb_index_data_.
2258         (Layout::init_fixed_output_section): Check for .gdb_index section.
2259         (Layout::add_to_gdb_index): New function. Instantiate.
2260         * layout.h: Add forward declaration for class Gdb_index.
2261         (Layout::add_to_gdb_index): New member function.
2262         (Layout::gdb_index_data_): New data member.
2263         * main.cc: Include gdb-index.h.
2264         (main): Print statistics for gdb index.
2265         * object.cc (Object::section_contents): Move code into
2266         do_section_contents.
2267         (need_decompressed_section): Check for sections needed when building
2268         gdb index.
2269         (build_compressed_section_map): Likewise.
2270         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2271         gdb index.
2272         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2273         sections; call Layout::add_to_gdb_index.
2274         (Sized_relobj_file::do_decompressed_section_contents): Call
2275         do_section_contents directly.
2276         * object.h (Object::do_section_contents): Adjust parameter list and
2277         return type.
2278         (Object::do_decompressed_section_contents): Call do_section_contents
2279         directly.
2280         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2281         return type.
2282         * options.h (class General_options): Add --gdb-index option.
2283         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2284         list and return type.
2285         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2286         * reloc.h (Track_relocs::checkpoint): New function.
2287         (Track_relocs::reset): New function.
2288
2289         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2290         New test cases.
2291         * testsuite/Makefile.in: Regenerate.
2292         * testsuite/gdb_index_test.cc: New test source file.
2293         * testsuite/gdb_index_test_1.sh: New test source file.
2294         * testsuite/gdb_index_test_2.sh: New test source file.
2295
2296 2012-03-19  Doug Kwan  <dougkwan@google.com>
2297
2298         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2299         (Target_arm::do_finalize_sections): Remove code which defines
2300         __exidx_start and __exidx_end.  Make symbol table parameter
2301         anonymous as it is not used.
2302         * gold.cc (queue_middle_tasks): Call target hook to define any
2303         target-specific symbols.
2304         * target.h (Target::define_standard_symbols): New method.
2305         (Target::do_define_standard_symbols): Same.
2306         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2307         * testsuite/Makefile.in: Regenerate.
2308         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2309         and __exidx_end.
2310         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2311         relocations are generated for __exidx_start and __exidx_end.
2312
2313 2012-03-16  Doug Kwan  <dougkwan@google.com>
2314
2315         * testsuite/Makefile.am: Disable test initpri3b.
2316         * testsuite/Makefile.in: Regenerate.
2317
2318 2012-03-15  Doug Kwan  <dougkwan@google.com>
2319
2320         * arm.cc (Target_arm::got_section): Make .got section read-only
2321         if -z now is given.
2322
2323 2012-03-15  Ian Lance Taylor  <iant@google.com>
2324
2325         PR gold/13850
2326         * layout.cc (Layout::make_output_section): Correctly mark
2327         SHT_INIT_ARRAY, et. al., as relro.
2328
2329 2012-03-14  Doug Kwan  <dougkwan@google.com>
2330
2331         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2332         dynamic relocations for protected symbols in shared objects.
2333
2334 2012-03-13  Ian Lance Taylor  <iant@google.com>
2335
2336         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2337         keep the larger alignment.
2338
2339 2012-03-12  Cary Coutant  <ccoutant@google.com>
2340
2341         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2342         handling of DW_LNE_define_file.
2343
2344 2012-03-12  Cary Coutant  <ccoutant@google.com>
2345
2346         * reduced_debug_output.cc
2347         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2348         codes to switch.
2349
2350 2012-02-29  Cary Coutant  <ccoutant@google.com>
2351
2352         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2353
2354 2012-02-29  Cary Coutant  <ccoutant@google.com>
2355
2356         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2357         Call Object::decompressed_section_contents.
2358         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2359         New dtor.
2360         (Sized_dwarf_line_info::buffer_start_): New data member.
2361         * merge.cc (Output_merge_data::do_add_input_section): Call
2362         Object::decompressed_section_contents.
2363         (Output_merge_string::do_add_input_section): Likewise.
2364         * object.cc (need_decompressed_section): New function.
2365         (build_compressed_section_map): Decompress sections needed later.
2366         (Sized_relobj_file::do_decompressed_section_contents): New function.
2367         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2368         * object.h (Object::decompressed_section_contents): New function.
2369         (Object::discard_decompressed_sections): New function.
2370         (Object::do_decompressed_section_contents): New function.
2371         (Object::do_discard_decompressed_sections): New function.
2372         (Compressed_section_info): New type.
2373         (Compressed_section_map): Include decompressed section contents.
2374         (Sized_relobj_file::do_decompressed_section_contents): New function.
2375         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2376
2377 2012-02-16  Cary Coutant  <ccoutant@google.com>
2378
2379         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2380         * testsuite/Makefile.in: Regenerate.
2381
2382 2012-02-14  Cary Coutant  <ccoutant@google.com>
2383
2384         * options.cc (General_options::finalize): Disallow -pie and -static.
2385
2386 2012-02-03  Doug Kwan  <dougkwan@google.com>
2387
2388         * arm.cc (Arm_relocate_functions::abs8,
2389         Arm_relocate_functions::abs16): Use
2390         Bits::has_signed_unsigned_overflow32.
2391         (Arm_relocate_functions::thm_abs8): Correct range of
2392         overflow check.
2393         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2394         in assertions.
2395
2396 2012-02-02  Doug Kwan  <dougkwan@google.com>
2397
2398         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2399         position independent outputs, not just shared objects.
2400
2401 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2402
2403         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2404         * configure: Regenerated.
2405
2406 2012-01-27  Ian Lance Taylor  <iant@google.com>
2407
2408         * reloc.h (Bits): New class with static functions, copied from
2409         namespace utils in arm.cc.
2410         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2411         instead.
2412
2413 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2414
2415         * incremental.cc (write_info_blocks): Correct relocation offset.
2416
2417 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2418
2419         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2420         (Relocate::tls_gd_to_le): Likewise.
2421
2422 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2423
2424         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2425
2426 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2427
2428         * configure.ac: Check if -mcmodel=medium works.
2429         * configure: Regenerated.
2430
2431 2012-01-24  Cary Coutant  <ccoutant@google.com>
2432
2433         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2434         definition and ...
2435         (read_unsigned_LEB_128_x): ... this new function.
2436         (read_signed_LEB_128): Replaced with inline definition and ...
2437         (read_signed_LEB_128_x): ... this new function.
2438         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2439         (read_unsigned_LEB_128): Add inline definition.
2440         (read_signed_LEB_128_x): New function.
2441         (read_signed_LEB_128): Add inline definition.
2442         * testsuite/Makefile.am (leb128_unittest): New unit test.
2443         * testsuite/Makefile.in: Regenerate.
2444         * testsuite/leb128_unittest.cc: New unit test.
2445
2446 2012-01-23  Ian Lance Taylor  <iant@google.com>
2447
2448         PR gold/13617
2449         * i386.cc (Target_i386::do_code_fill): When using a jmp
2450         instruction, pad with nop instructions.
2451         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2452
2453 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2454
2455         * x86_64.cc (gc_process_relocs): Add typename on types used in
2456         template.
2457         (scan_relocs): Likewise.
2458         (relocate_section): Likewise.
2459         (apply_relocation): Likewise.
2460
2461 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2462
2463         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2464         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2465         under x32.
2466
2467 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2468
2469         * x86_64.cc: Initial support for x32.
2470
2471 2012-01-03  Cary Coutant  <ccoutant@google.com>
2472
2473         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2474         Use abstract base class for GOT.
2475         * gold/output.h (class Output_data_got_base): New abstract base class.
2476         (class Output_data_got): Derive from new base class, adjust ctors.
2477         (Output_data_got::reserve_slot): Make virtual; rename to
2478         do_reserve_slot; Adjust callers.
2479         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2480         pointer to abstract base class.
2481         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2482
2483 2011-12-18  Ian Lance Taylor  <iant@google.com>
2484
2485         * object.h (Relobj::local_symbol_value): New function.
2486         (Relobj::local_plt_offset): New function.
2487         (Relobj::local_has_got_offset): New function.
2488         (Relobj::local_got_offset): New function.
2489         (Relobj::set_local_got_offset): New function.
2490         (Relobj::do_local_symbol_value): New pure virtual function.
2491         (Relobj::do_local_plt_offset): Likewise.
2492         (Relobj::do_local_has_got_offset): Likewise.
2493         (Relobj::do_local_got_offset): Likewise.
2494         (Relobj::do_set_local_got_offset): Likewise.
2495         (Sized_relobj::do_local_has_got_offset): Rename from
2496         local_has_got_offset.
2497         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2498         (Sized_relobj::do_set_local_got_offset): Rename from
2499         set_local_got_offset.
2500         (Sized_relobj_file::do_local_plt_offset): Rename from
2501         local_plt_offset.
2502         (Sized_relobj_file::do_local_symbol_value): New function.
2503         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2504         local_plt_offset.
2505         * output.cc (Output_data_got::Got_entry::write): Change object to
2506         Relobj.  Use local_symbol_value.
2507         (Output_data_got::add_global_with_rel): Change rel_dyn to
2508         Output_data_reloc_generic*.  Use add_global_generic.
2509         (Output_data_got::add_global_with_rela): Remove.  Change all
2510         callers to use add_global_with_rel.
2511         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2512         Output_data_reloc_generic*.  Use add_global_generic.
2513         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2514         callers to use add_global_pair_with_rel.
2515         (Output_data_got::add_local): Change object to Relobj*.
2516         (Output_data_got::add_local_plt): Likewise.
2517         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2518         change rel_dyn to Output_data_reloc_generic*.  Use
2519         add_local_generic.
2520         (Output_data_got::add_local_with_rela): Remove.  Change all
2521         callers to use all_local_with_rel.
2522         (Output_data_got::add_local_pair_with_rel): Change object to
2523         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2524         add_output_section_generic.
2525         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2526         callers to use add_local_pair_with_rel.
2527         (Output_data_got::reserve_local): Change object to Relobj*.
2528         * output.h: (class Output_data_reloc_generic): Add pure virtual
2529         declarations for add_global_generic, add_local_generic,
2530         add_output_section_generic.
2531         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2532         functions for Output_data_reloc_generic.  Update declarations for
2533         changes listed in output.cc.
2534         (class Output_data_got): Change template parameter to got_size.
2535         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2536         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2537         function.
2538         (Sized_relobj_incr::do_local_plt_offset): New function.
2539         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2540         add_global_generic.
2541
2542 2011-12-17  Cary Coutant  <ccoutant@google.com>
2543
2544         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2545         * resolve.cc (Symbol_table::resolve): Likewise.
2546         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2547         arrays.
2548         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2549
2550 2011-12-16  Ian Lance Taylor  <iant@google.com>
2551
2552         * output.h (Output_data_reloc_generic::add): Only call
2553         add_dynamic_reloc if this is a dynamic reloc section.
2554
2555 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2556
2557         PR gold/13505
2558         * target-reloc.h (apply_relocation): Replace <64, false> with
2559         <size, big_endian>.
2560
2561 2011-11-25  Nick Clifton  <nickc@redhat.com>
2562
2563         * po/it.po: New Italian translation.
2564
2565 2011-11-17  Sterling Augustine  <saugustine@google.com>
2566
2567         * script.cc (script_include_directive): Implement.
2568         (read_script_file): New local variables name and search_path. Update
2569         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2570         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2571         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2572
2573 2011-11-11  Sterling Augustine  <saugustine@google.com>
2574
2575         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2576         (file_or_sections_cmd): Likewise.
2577
2578 2011-11-11  Doug Kwan  <dougkwan@google.com>
2579
2580         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2581         if --just-symbols is given.
2582
2583 2011-11-10  Doug Kwan  <dougkwan@google.com>
2584
2585         PR gold/13362
2586         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2587         when processing data relocs.
2588         * reloc.h (Relocate_functions::rel_unaligned): New method.
2589         (Relocate_functions::pcrel_unaligned): Ditto.
2590         (Relocate_functions::rel32_unaligned): Ditto.
2591         (Relocate_functions::pcrel32_unaligned): Ditto.
2592
2593 2011-11-09  Doug Kwan  <dougkwan@google.com>
2594
2595         PR gold/13362
2596         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2597         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2598         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2599         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2600         (Relocate_functions::rel_unaligned): New.
2601         (Relocate_functions::rel32_unaligned): New.
2602         * target-reloc.h (relocate_for_relocatable): Add code to handle
2603         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2604         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2605         arm_unaligned_reloc_r): New targets.
2606         * testsuite/Makefile.in: Regenerate.
2607         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2608         linking.
2609
2610 2011-11-02  Ian Lance Taylor  <iant@google.com>
2611
2612         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2613         NATIVE_LINKER.
2614         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2615         * options.cc (General_options::finalize): Use library search path
2616         from configure script if specified.  If not native and no sysroot,
2617         only search TOOLLIBDIR.
2618         * options.h (Search_directory::Search_directory): Change name to
2619         const std::string&.
2620         (General_options::add_to_library_path_with_sysroot): Change arg to
2621         const std::string&.
2622         * configure, Makefile.in, config.in: Rebuild.
2623
2624 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2625
2626         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2627         we are working around the ARM1176 Erratum.
2628         * options.h (General_options::fix_arm1176): Add option.
2629         * testsuite/Makefile.am: Add testcases, and keep current ones
2630         working.
2631         * testsuite/Makefile.in: Regenerate.
2632         * testsuite/arm_fix_1176.s: New file.
2633         * testsuite/arm_fix_1176.sh: Likewise.
2634
2635 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2636
2637         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2638         may_use_blx_.
2639         (Target_arm::may_use_blx): Remove method.
2640         (Target_arm::set_may_use_blx): Likewise.
2641         (Target_arm::may_use_v4t_interworking): New method.
2642         (Target_arm::may_use_v5t_interworking): Likewise.
2643         (Target_arm::may_use_blx_): Remove member variable.
2644         (Arm_relocate_functions::arm_branch_common): Check for v5T
2645         interworking.
2646         (Arm_relocate_functions::thumb_branch_common): Likewise.
2647         (Reloc_stub::stub_type_for_reloc): Likewise.
2648         (Target_arm::do_finalize_sections): Correct interworking checks.
2649         * testsuite/Makefile.am: Add new tests.
2650         * testsuite/Makefile.in: Regenerate.
2651         * testsuite/arm_farcall_arm_arm.s: New test.
2652         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2653         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2654         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2655         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2656         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2657         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2658         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2659
2660 2011-10-31  Cary Coutant  <ccoutant@google.com>
2661
2662         PR gold/13023
2663         * expression.cc (Expression::eval_with_dot): Add
2664         is_section_dot_assignment parameter.
2665         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2666         absolute and assigning to dot within a section.
2667         * script-sections.cc
2668         (Output_section_element_assignment::set_section_addresses): Pass
2669         dot_section to set_if_absolute.
2670         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2671         as is_section_dot_assignment flag to eval_with_dot.
2672         (Output_section_element_dot_assignment::set_section_addresses):
2673         Likewise.
2674         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2675         parameter.  Also set value if relative to dot_section; set the
2676         symbol's output_section.
2677         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2678         parameter.  Adjust all callers.
2679         (Expression::eval_maybe_dot): Likewise.
2680         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2681         Adjust all callers.
2682         * testsuite/script_test_2.t: Test assignment of an absolute value
2683         to dot within an output section element.
2684
2685 2011-10-31  Cary Coutant  <ccoutant@google.com>
2686
2687         * options.h (class General_options): Add --[no-]gnu-unique options.
2688         * symtab.cc (Symbol_table::sized_write_globals): Convert
2689         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2690
2691 2011-10-31  Cary Coutant  <ccoutant@google.com>
2692
2693         PR gold/13359
2694         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2695         unnecessary assertion.
2696         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2697
2698 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2699
2700         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2701         gc_mark_symbol.
2702         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2703         gc_mark_symbol.
2704         Change to just keep the section associated with symbol.
2705         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2706         they are externally visible and --export-dynamic is turned on.
2707         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2708
2709 2011-10-19  Ian Lance Taylor  <iant@google.com>
2710
2711         PR gold/13163
2712         * script-sections.cc
2713         (Output_section_element_dot_assignment::needs_output_section): New
2714         function.
2715
2716 2011-10-19  Ian Lance Taylor  <iant@google.com>
2717
2718         PR gold/13204
2719         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2720         --section-start option was seen.
2721         * options.h (General_options::any_section_start): New function.
2722
2723 2011-10-18  David S. Miller  <davem@davemloft.net>
2724
2725         PR binutils/13301
2726         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2727         member to track relocation locations that have moved during TLS
2728         reloc optimizations.
2729         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2730         (Target_sparc::Relocate::relocate): Adjust view down by 4
2731         bytes if it matches reloc_adjust_addr_.
2732         (Target_sparc::Relocate::relocate_tls): Always move the
2733         __tls_get_addr call delay slot instruction forward 4 bytes when
2734         performing relaxation.
2735
2736 2011-10-18  Cary Coutant  <ccoutant@google.com>
2737
2738         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2739         (Output_file::map_no_anonymous): Check for non-zero
2740         return code from posix_fallocate.
2741
2742 2011-10-17  Cary Coutant  <ccoutant@google.com>
2743
2744         PR gold/13245
2745         * plugin.cc (is_visible_from_outside): Check for symbols
2746         referenced from dynamic objects.
2747         * resolve.cc (Symbol_table::resolve): Don't count references
2748         from dynamic objects as references from real ELF files.
2749         * testsuite/plugin_test_2.sh: Adjust expected result.
2750
2751 2011-10-17  Cary Coutant  <ccoutant@google.com>
2752
2753         * gold.cc: Include timer.h.
2754         (queue_middle_tasks): Stamp time.
2755         (queue_final_tasks): Likewise.
2756         * main.cc (main): Store timer in parameters.  Print timers
2757         for each pass.
2758         * parameters.cc (Parameters::Parameters): Initialize timer_.
2759         (Parameters::set_timer): New function.
2760         (set_parameters_timer): New function.
2761         * parameters.h (Parameters::set_timer): New function.
2762         (Parameters::timer): New function.
2763         (Parameters::timer_): New data member.
2764         (set_parameters_timer): New function.
2765         * timer.cc (Timer::stamp): New function.
2766         (Timer::get_pass_time): New function.
2767         * timer.h (Timer::stamp): New function.
2768         (Timer::get_pass_time): New function.
2769         (Timer::pass_times_): New data member.
2770
2771 2011-10-17  Cary Coutant  <ccoutant@google.com>
2772
2773         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2774         task for members of lib groups.
2775
2776 2011-10-17  Cary Coutant  <ccoutant@google.com>
2777
2778         PR gold/13288
2779         * fileread.cc (File_read::find_view): Add assert.
2780         (File_read::make_view): Move bounds check (replace with assert)...
2781         (File_read::find_or_make_view): ... to here.
2782
2783 2011-10-12  Cary Coutant  <ccoutant@google.com>
2784
2785         * output.cc (Output_file::open_base_file): Handle case where
2786         ::read returns less than requested size.
2787
2788 2011-10-10  Cary Coutant  <ccoutant@google.com>
2789
2790         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2791         Initialize defined_count_.
2792         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2793         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2794         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2795         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2796         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2797         * incremental.h (Sized_relobj_incr::defined_count_): New data
2798         member.
2799         (Sized_incr_dynobj::defined_count_): New data member.
2800         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2801         Return zeroes instead of internal error.
2802
2803 2011-10-10  Cary Coutant  <ccoutant@google.com>
2804
2805         PR gold/13249
2806         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2807         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2808         * output.h (class Output_reloc): Add use_plt_offset flag.
2809         (Output_reloc::type_): Adjust size of bit field.
2810         (Output_reloc::use_plt_offset_): New bit field.
2811         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2812         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2813         flag.  Adjust all callers.
2814         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2815         creating RELATIVE relocations.
2816
2817 2011-10-10  Nick Clifton  <nickc@redhat.com>
2818
2819         * po/es.po: Updated Spanish translation.
2820         * po/fi.po: Updated Finnish translation.
2821
2822 2011-10-03   Diego Novillo  <dnovillo@google.com>
2823
2824         * options.cc (parse_uint): Fix dereference of RETVAL.
2825
2826 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2827
2828         * layout.h (section_order_map_): New member.
2829         (get_section_order_map): New member function.
2830         * output.cc (Output_section::add_input_section): Check for patterns
2831         only when --section-ordering-file is specified.
2832         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2833         output_sections have been formed.
2834         * layout.cc (Layout_Layout): Initialize section_order_map_.
2835         * plugin.cc (update_section_order): Store order in order_map. Do not
2836         update the order.
2837         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2838         * testsuite/Makefile.in: Regenerate.
2839         * testsuite/plugin_section_order.c: New file.
2840         * testsuite/plugin_final_layout.cc: New file.
2841         * testsuite/plugin_final_layout.sh: New file.
2842
2843 2011-09-29  Cary Coutant  <ccoutant@google.com>
2844
2845         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2846         Check for NULL.
2847         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2848         symbols during incremental update.
2849         (Symbol_table::add_from_dynobj): Likewise.
2850
2851 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2852             Ian Lance Taylor  <iant@google.com>
2853
2854         * symtab.cc (Symbol_table::define_special_symbol): Always
2855         canonicalize version string.
2856
2857 2011-09-26  Cary Coutant  <ccoutant@google.com>
2858
2859         * gold.cc (queue_initial_tasks): Move option checks ...
2860         * options.cc (General_options::finalize): ... to here. Disable
2861         some options; make others fatal.
2862
2863 2011-09-26  Cary Coutant  <ccoutant@google.com>
2864
2865         gcc PR lto/47247
2866         * plugin.cc (get_symbols_v2): New function.
2867         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2868         (is_referenced_from_outside): New function.
2869         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2870         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2871         (get_symbols): Pass version parameter.
2872         (get_symbols_v2): New function.
2873         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2874         parameter.
2875         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2876         (onload): Add LDPT_GET_SYMBOLS_V2.
2877         (all_symbols_read_hook): Use get_symbols_v2; check for
2878         LDPR_PREVAILING_DEF_IRONLY_EXP.
2879         * testsuite/plugin_test_3.sh: Update expected results.
2880
2881 2011-09-23  Simon Baldwin  <simonb@google.com>
2882
2883         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2884         configuration options.
2885         * configure: Regenerate.
2886         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2887         * Makefile.in: Regenerate.
2888         * testsuite/Makefile.in: Regenerate.
2889
2890 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2891
2892         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2893
2894 2011-09-19  Cary Coutant  <ccoutant@google.com>
2895
2896         * incremental.cc (can_incremental_update): Fix typo in comment.
2897         * incremental.h (can_incremental_update): Likewise.
2898
2899 2011-09-18  Cary Coutant  <ccoutant@google.com>
2900
2901         * incremental.cc (can_incremental_update): New function.
2902         * incremental.h (can_incremental_update): New function.
2903         * layout.cc (Layout::init_fixed_output_section): Call it.
2904         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2905         * object.cc (Sized_relobj_file::do_layout): Call
2906         can_incremental_update.
2907
2908 2011-09-13  Cary Coutant  <ccoutant@google.com>
2909
2910         * configure.ac: Check for glibc support for gnu_indirect_function
2911         support with static linking, setting automake conditional
2912         IFUNC_STATIC.
2913         * Makefile.in: Regenerate.
2914         * configure: Regenerate.
2915
2916         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2917         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2918         for IFUNC_STATIC.
2919         * testsuite/Makefile.in: Regenerate.
2920
2921 2011-09-13  Cary Coutant  <ccoutant@google.com>
2922
2923         * incremental.cc (Sized_relobj_incr::do_layout): Call
2924         report_comdat_group for kept comdat sections.
2925         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2926         * testsuite/Makefile.in: Regenerate.
2927         * testsuite/incr_comdat_test_1.cc: New source file.
2928         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2929         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2930         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2931
2932 2011-09-13  Ian Lance Taylor  <iant@google.com>
2933
2934         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2935         variable external_symbols_offset.
2936
2937 2011-09-12  Ian Lance Taylor  <iant@google.com>
2938
2939         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2940         triggered if object has no symbols.
2941
2942 2011-09-09  David S. Miller  <davem@davemloft.net>
2943
2944         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2945         (Output_fill_debug_line::do_write): Likewise.
2946
2947 2011-08-29  Cary Coutant  <ccoutant@google.com>
2948
2949         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2950         casts to match formatting specs.
2951         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2952
2953 2011-08-26  Cary Coutant  <ccoutant@google.com>
2954
2955         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2956         remaining hole size when allocating.
2957         (Layout::make_output_section): Set fill methods for debug sections.
2958         * layout.h (Free_list::Free_list_node): Move from private to
2959         public.
2960         (Free_list::set_min_hole_size): New function.
2961         (Free_list::begin, Free_list::end): New functions.
2962         (Free_list::min_hole_): New data member.
2963         * output.cc: Include dwarf.h.
2964         (Output_fill_debug_info::do_minimum_hole_size): New function.
2965         (Output_fill_debug_info::do_write): New function.
2966         (Output_fill_debug_line::do_minimum_hole_size): New function.
2967         (Output_fill_debug_line::do_write): New function.
2968         (Output_section::Output_section): Initialize new data member.
2969         (Output_section::set_final_data_size): Ensure patch space is larger
2970         than minimum hole size.
2971         (Output_section::do_write): Fill holes in debug sections.
2972         * output.h (Output_fill): New class.
2973         (Output_fill_debug_info): New class.
2974         (Output_fill_debug_line): New class.
2975         (Output_section::set_free_space_fill): New function.
2976         (Output_section::free_space_fill_): New data member.
2977         * testsuite/Makefile.am (incremental_test_3): Add
2978         --incremental-patch option.
2979         (incremental_test_4): Likewise.
2980         (incremental_test_5): Likewise.
2981         (incremental_test_6): Likewise.
2982         (incremental_copy_test): Likewise.
2983         (incremental_common_test_1): Likewise.
2984         * testsuite/Makefile.in: Regenerate.
2985
2986 2011-08-26  Nick Clifton  <nickc@redhat.com>
2987
2988         * po/es.po: Updated Spanish translation.
2989
2990 2011-08-01  Cary Coutant  <ccoutant@google.com>
2991
2992         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2993         * gold/testsuite/Makefile.in: Regenerate.
2994         * gold/testsuite/justsyms_exec.c: New source file.
2995         * gold/testsuite/justsyms_lib.c: New source file.
2996
2997 2011-08-01  Cary Coutant  <ccoutant@google.com>
2998
2999         * layout.cc (Layout::set_segment_offsets): Don't realign text
3000         segment if -Ttext was specified.
3001         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3002         file type.
3003         * object.h (Sized_relobj_file::e_type): New function.
3004         (Sized_relobj_file::e_type_): New data member.
3005         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3006         base address for ET_EXEC files.
3007         * target.cc (Target::do_make_elf_object_implementation): Allow
3008         ET_EXEC files with --just-symbols option.
3009
3010 2011-07-28  Cary Coutant  <ccoutant@google.com>
3011
3012         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3013         Add thread_number parameter.
3014         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3015         * workqueue-threads.cc
3016         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3017         current thread if its thread number is greater than desired thread
3018         count.
3019         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3020         Add thread_number parameter.
3021         (Workqueue::should_cancel_thread): Likewise.
3022         (Workqueue::find_runnable_or_wait): Pass thread_number to
3023         should_cancel_thread.
3024         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3025         parameter.
3026
3027 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3028
3029         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3030         only after checking if it cannot be forced local.
3031         * symtab.h (is_externally_visible): Check if the symbol is not forced
3032         local.
3033
3034 2011-07-15  Ian Lance Taylor  <iant@google.com>
3035
3036         * options.h (class General_options): Add --print-output-format.
3037         Move -EL next to -EB, for  better --help output.
3038         * target-select.cc: Include <cstdio>, "options.h", and
3039         "parameters.h".
3040         (Target_selector::do_target_bfd_name): New function.
3041         (print_output_format): New function.
3042         * target-select.h (class Target_selector): Update declarations.
3043         (Target_selector::target_bfd_name): New function.
3044         (print_output_format): Declare.
3045         * main.cc: Include "target-select.h".
3046         (main): Handle --print-output-format.
3047         * gold.cc: Include "target-select.h".
3048         (queue_initial_tasks): Handle --print-output-format when there are
3049         no input files.
3050         * parameters.cc (parameters_force_valid_target): Give a better
3051         error message if -EB/-EL does not match target.
3052         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3053         function.
3054
3055 2011-07-15  Ian Lance Taylor  <iant@google.com>
3056
3057         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3058         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3059         (Output_data_plt_i386::do_write): Write address of .dynamic
3060         section to first entry in .got.plt section.
3061         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3062         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3063         Initialize layout_.
3064         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3065         section to first entry in .got.plt section.
3066         * layout.h (Layout::dynamic_section): New function.
3067
3068 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3069
3070         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3071         to claim_file call.
3072         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3073         input_section_position_, and input_section_glob_.
3074         (read_layout_from_file): Call function section_ordering_specified.
3075         * layout.h (is_section_ordering_specified): New function.
3076         (section_ordering_specified): New function.
3077         (section_ordering_specified_): New boolean member.
3078         * main.cc(main): Call load_plugins after layout object is defined.
3079         * output.cc (Output_section::add_input_section): Use
3080         function section_ordering_specified to check if section ordering is
3081         needed.
3082         * output.cc (Output_section::add_relaxed_input_section): Use
3083         function section_ordering_specified to check if section ordering is
3084         needed.
3085         (Output_section::update_section_layout): New function.
3086         (Output_section::sort_attached_input_sections): Check if input section
3087         must be reordered.
3088         * output.h (Output_section::update_section_layout): New function.
3089         * plugin.cc (get_section_count): New function.
3090         (get_section_type): New function.
3091         (get_section_name): New function.
3092         (get_section_contents): New function.
3093         (update_section_order): New function.
3094         (allow_section_ordering): New function.
3095         (Plugin::load): Add the new interfaces to the transfer vector.
3096         (Plugin_manager::load_plugins): New parameter.
3097         (Plugin_manager::all_symbols_read): New parameter.
3098         (Plugin_manager::claim_file): New parameter. Save the elf object for
3099         unclaimed objects.
3100         (Plugin_manager::get_elf_object): New function.
3101         (Plugin_manager::get_view): Change to directly use the bool to check
3102         if get_view is called from claim_file_hook.
3103         * plugin.h (input_objects): New function
3104         (Plugin__manager::load_plugins): New parameter.
3105         (Plugin_manager::claim_file): New parameter.
3106         (Plugin_manager::get_elf_object): New function.
3107         (Plugin_manager::in_claim_file_handler): New function.
3108         (Plugin_manager::in_claim_file_handler_): New member.
3109         (layout): New function.
3110         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3111         handler with an extra parameter. Make the elf object before calling
3112         claim_file handler.
3113         * testsuite/plugin_test.c (get_section_count): New function pointer.
3114         (get_section_type): New function pointer.
3115         (get_section_name): New function pointer.
3116         (get_section_contents): New function pointer.
3117         (update_section_order): New function pointer.
3118         (allow_section_ordering): New function pointer.
3119         (onload): Check if the new interfaces exist.
3120
3121 2011-07-13  Ian Lance Taylor  <iant@google.com>
3122
3123         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3124         relro section.
3125         * x86_64.cc (Target_x86_64::got_section): Likewise.
3126         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3127         (relro_now_test_SOURCES): New variable.
3128         (relro_now_test_DEPENDENCIES): New variable.
3129         (relro_now_test_LDFLAGS): New variable.
3130         (relro_now_test_LDADD): New variable.
3131         (relro_now_test.so): New target.
3132         * testsuite/Makefile.in: Rebuild.
3133
3134 2011-07-12  Ian Lance Taylor  <iant@google.com>
3135
3136         PR gold/12980
3137         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3138         GLOB_DAT relocation rather than a RELATIVE relocation for a
3139         protected symbol when creating a shared library.
3140         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3141         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3142         * testsuite/protected_main_1.cc (main): Test that protected
3143         function has same address.
3144
3145 2011-07-11  Ian Lance Taylor  <iant@google.com>
3146
3147         PR gold/12979
3148         * options.h (class General_options): Add -Bgroup.
3149         * options.cc (General_options::finalize): If -Bgroup is set,
3150         default to --unresolved-symbols=report-all.
3151         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3152         * target-reloc.h (issue_undefined_symbol_error): Handle
3153         --unresolved-symbols=report-all.
3154
3155 2011-07-08  Ian Lance Taylor  <iant@google.com>
3156
3157         PR gold/11985
3158         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3159         if linker script discards key sections.
3160         (Layout::create_dynamic_symtab): Likewise.
3161         (Layout::assign_local_dynsym_offsets): Likewise.
3162         (Layout::sized_create_version_sections): Likewise.
3163         (Layout::create_interp): Likewise.
3164         (Layout::finish_dynamic_section): Likewise.
3165         (Layout::set_dynamic_symbol_size): Likewise.
3166
3167 2011-07-08  Ian Lance Taylor  <iant@google.com>
3168
3169         PR gold/12386
3170         * options.h (class General_options): Add --unresolved-symbols.
3171         * target-reloc.h (issue_undefined_symbol_error): Check
3172         --unresolved-symbols.  Add comments.
3173
3174 2011-07-08  Ian Lance Taylor  <iant@google.com>
3175
3176         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3177         expression more complex.
3178
3179 2011-07-08  Ian Lance Taylor  <iant@google.com>
3180
3181         PR gold/11317
3182         * target-reloc.h (issue_undefined_symbol_error): New inline
3183         function, broken out of relocate_section.
3184         (relocate_section): Call issue_undefined_symbol_error.
3185         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3186         there is no TLS segment if we are about to issue an undefined
3187         symbol error.
3188         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3189
3190 2011-07-08  Ian Lance Taylor  <iant@google.com>
3191
3192         PR gold/12279
3193         * resolve.cc (Symbol_table::should_override): Add fromtype
3194         parameter.  Change all callers.  Give error when linking together
3195         TLS and non-TLS symbol.
3196         (Symbol_table::should_override_with_special): Add fromtype
3197         parameter.  Change all callers.
3198         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3199         there is no TLS segment if we have reported some errors.
3200         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3201
3202 2011-07-08  Ian Lance Taylor  <iant@google.com>
3203
3204         PR gold/12372
3205         * target.h (Target::plt_address_for_global): New function.
3206         (Target::plt_address_for_local): New function.
3207         (Target::plt_section_for_global): Remove.
3208         (Target::plt_section_for_local): Remove.
3209         (Target::do_plt_address_for_global): New virtual function.
3210         (Target::do_plt_address_for_local): New virtual function.
3211         (Target::do_plt_section_for_global): Remove.
3212         (Target::do_plt_section_for_local): Remove.
3213         (Target::register_global_plt_entry): Add Symbol_table and Layout
3214         parameters.
3215         * output.cc (Output_data_got::Got_entry::write): Use
3216         plt_address_for_global and plt_address_for_local.
3217         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3218         address of output section.
3219         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3220         got_irelative_, and irelative_count_ fields.  Update
3221         declarations.
3222         (Output_data_plt_i386::has_irelative_section): New function.
3223         (Output_data_plt_i386::entry_count): Add irelative_count_.
3224         (Output_data_plt_i386::set_final_data_size): Likewise.
3225         (class Target_i386): Add got_irelative_ and rel_irelative_
3226         fields.  Update declarations.
3227         (Target_i386::Target_i386): Initialize new fields.
3228         (Target_i386::do_plt_address_for_global): New function replacing
3229         do_plt_section_for_global.
3230         (Target_i386::do_plt_address_for_local): New function replacing
3231         do_plt_section_for_local.
3232         (Target_i386::got_section): Create got_irelative_.
3233         (Target_i386::rel_irelative_section): New function.
3234         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3235         fields.  Don't define __rel_iplt_{start,end}.
3236         (Output_data_plt_i386::add_entry): Add symtab and layout
3237         parameters.  Change all callers.  Use different PLT and GOT for
3238         IFUNC symbols.
3239         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3240         layout parameters.  Change all callers.  Use different PLT and
3241         GOT.
3242         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3243         (Output_data_plt_i386::rel_irelative): New function.
3244         (Output_data_plt_i386::address_for_global): New function.
3245         (Output_data_plt_i386::address_for_local): New function.
3246         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3247         IRELATIVE GOT when changing IFUNC GOT entries.
3248         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3249         reloc.
3250         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3251         if we didn't create an IRELATIVE GOT.
3252         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3253         plt_address_for_local.
3254         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3255         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3256         got_irelative_, and irelative_count_ fields.  Update
3257         declarations.
3258         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3259         Initialize new fields.  Remove symtab parameter.  Change all
3260         callers.
3261         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3262         irelative_count_.
3263         (Output_data_plt_x86_64::has_irelative_section): New function.
3264         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3265         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3266         fields.  Update declarations.
3267         (Target_x86_64::Target_x86_64): Initialize new fields.
3268         (Target_x86_64::do_plt_address_for_global): New function replacing
3269         do_plt_section_for_global.
3270         (Target_x86_64::do_plt_address_for_local): New function replacing
3271         do_plt_section_for_local.
3272         (Target_x86_64::got_section): Create got_irelative_.
3273         (Target_x86_64::rela_irelative_section): New function.
3274         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3275         all callers.  Don't create __rel_iplt_{start,end}.
3276         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3277         parameters.  Change all callers.  Use different PLT and GOT for
3278         IFUNC symbols.
3279         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3280         layout parameters.  Change all callers.  Use different PLT and
3281         GOT.
3282         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3283         parameters.  Change all callers.  Use different PLT and GOT for
3284         IFUNC symbols.
3285         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3286         (Output_data_plt_x86_64::rela_irelative): New function.
3287         (Output_data_plt_x86_64::address_for_global): New function.
3288         (Output_data_plt_x86_64::address_for_local): New function.
3289         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3290         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3291         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3292         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3293         parameters.
3294         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3295         reloc.
3296         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3297         symbols if we didn't create an IRELATIVE GOT.
3298         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3299         plt_address_for_local.
3300         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3301         * testsuite/ifuncvar1.c: New test file.
3302         * testsuite/ifuncvar2.c: New test file.
3303         * testsuite/ifuncvar3.c: New test file.
3304         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3305         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3306         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3307         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3308         * testsuite/Makefile.in: Rebuild.
3309
3310 2011-07-07  Cary Coutant  <ccoutant@google.com>
3311
3312         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3313         (two_file_test_1_ndebug.o): Likewise.
3314         (two_file_test_1b_ndebug.o): Likewise.
3315         (two_file_test_2_ndebug.o): Likewise.
3316         (two_file_test_main_ndebug.o): Likewise.
3317         (incremental_test_2): Link with no-debug versions.
3318
3319 2011-07-06  Cary Coutant  <ccoutant@google.com>
3320
3321         * gold/incremental.cc
3322         (Output_section_incremental_inputs::write_info_blocks): Check for
3323         hidden and internal symbols.
3324
3325 2011-07-06  Cary Coutant  <ccoutant@google.com>
3326
3327         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3328         Check disposition for startup file.
3329         (Incremental_inputs::report_command_line): Ignore
3330         --incremental-startup-unchanged option.
3331         * options.cc (General_options::parse_incremental_startup_unchanged):
3332         New function.
3333         (General_options::General_options): Initialize new data member.
3334         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3335         (General_options): Add --incremental-startup-unchanged option.
3336         (General_options::incremental_startup_disposition): New function.
3337         (General_options::incremental_startup_disposition_): New data member.
3338
3339 2011-07-06  Cary Coutant  <ccoutant@google.com>
3340
3341         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3342         input file index to Script_info ctor.
3343         (Sized_incremental_binary::do_file_has_changed): Find the
3344         command-line argument for files named in scripts.
3345         * incremental.h (Script_info::Script_info): New ctor
3346         with input file index.
3347         (Script_info::input_file_index): New function.
3348         (Script_info::input_file_index_): New data member.
3349         (Incremental_binary::get_library): Add const.
3350         (Incremental_binary::get_script_info): Add const.
3351         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3352         * testsuite/Makefile.am (incremental_test_5): New test case.
3353         (incremental_test_6): New test case.
3354         * testsuite/Makefile.in: Regenerate.
3355
3356 2011-07-06  Cary Coutant  <ccoutant@google.com>
3357
3358         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3359         debug output when command lines differ.
3360
3361 2011-07-06  Cary Coutant  <ccoutant@google.com>
3362
3363         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3364         --incremental-patch option.
3365         * layout.cc (Free_list::allocate): Extend allocation beyond original
3366         end if enabled.
3367         (Layout::make_output_section): Mark sections that should get
3368         patch space.
3369         * options.cc (parse_percent): New function.
3370         * options.h (parse_percent): New function.
3371         (DEFINE_percent): New macro.
3372         (General_options): Add --incremental-patch option.
3373         * output.cc (Output_section::Output_section): Initialize new data
3374         members.
3375         (Output_section::add_input_section): Print section name when out
3376         of patch space.
3377         (Output_section::add_output_section_data): Likewise.
3378         (Output_section::set_final_data_size): Add patch space when
3379         doing --incremental-full.
3380         (Output_section::do_reset_address_and_file_offset): Remove patch
3381         space.
3382         (Output_segment::set_section_list_addresses): Print debug output
3383         only if --incremental-update.
3384         * output.h (Output_section::set_is_patch_space_allowed): New function.
3385         (Output_section::is_patch_space_allowed_): New data member.
3386         (Output_section::patch_space_): New data member.
3387         * parameters.cc (Parameters::incremental_full): New function.
3388         * parameters.h (Parameters::incremental_full): New function
3389         * testsuite/Makefile.am (incremental_test_2): Add test for
3390         --incremental-patch option.
3391         * testsuite/Makefile.in: Regenerate.
3392         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3393         (t18): Remove function body.
3394
3395 2011-07-05  Doug Kwan  <dougkwan@google.com>
3396
3397         PR gold/12771
3398         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3399         Arm_Address type for relocation result.
3400         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3401         overflow check.
3402         (Arm_relocate_functions::abs32): Use unaligned access.
3403         (Arm_relocate_functions::rel32): Ditto.
3404         (Arm_relocate_functions::prel31): Ditto.
3405         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3406         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3407         static data relocations.
3408         * testsuite/Makefile.in: Regnerate.
3409         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3410
3411 2011-07-05  Ian Lance Taylor  <iant@google.com>
3412
3413         PR gold/12392
3414         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3415         symbols if necessary.
3416         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3417
3418 2011-07-05  Ian Lance Taylor  <iant@google.com>
3419
3420         PR gold/12952
3421         * resolve.cc (Symbol::override_base_with_special): Simply override
3422         version with special symbol version, ignoring previous version.
3423
3424 2011-07-05  Ian Lance Taylor  <iant@google.com>
3425
3426         * object.cc (Sized_relobj_file::include_section_group): Add
3427         information to comment about signature location.
3428
3429 2011-07-02  Ian Lance Taylor  <iant@google.com>
3430
3431         PR gold/12957
3432         * options.h (class General_options): Add -f and -F.
3433         * options.cc (General_options::finalize): Fatal error if -f/-F
3434         are used without -shared.
3435         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3436
3437 2011-07-02  Ian Lance Taylor  <iant@google.com>
3438
3439         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3440
3441 2011-07-01  Ian Lance Taylor  <iant@google.com>
3442
3443         PR gold/12525
3444         PR gold/12952
3445         * resolve.cc (Symbol::override_base_with_special): Don't override
3446         the version if the overriding symbol has a different name.
3447         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3448         all callers.  If we give an error about an undefined version,
3449         define the base version if necessary.
3450         * dynobj.h (class Versions): Update declaration.
3451         * testsuite/weak_alias_test_5.cc: New file.
3452         * testsuite/weak_alias_test.script: New file.
3453         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3454         and versioned_alias have the right value, and call t2.
3455         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3456         weak_alias_test_5.so.
3457         (weak_alias_test_LDADD): Likewise.
3458         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3459         * testsuite/Makefile.in: Rebuild.
3460
3461 2011-07-01  Ian Lance Taylor  <iant@google.com>
3462
3463         PR gold/12525
3464         * options.h (class General_options): Support -z notext.
3465         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3466         -Wl,-z,notext.
3467         (two_file_shared_nonpic.so): Likewise.
3468         (two_file_shared_mixed.so): Likewise.
3469         (two_file_shared_mixed_1.so): Likewise.
3470         (weak_undef_lib_nonpic.so): Likewise.
3471         (alt/weak_undef_lib_nonpic.so): Likewise.
3472         (tls_test_shared_nonpic.so): Likewise.
3473         * testsuite/Makefile.in: Rebuild.
3474
3475 2011-07-01  Ian Lance Taylor  <iant@google.com>
3476
3477         PR gold/12525
3478         * configure.ac: Test whether static linking works, setting
3479         the automake conditional HAVE_STATIC.
3480         * testsuite/Makefile.am: Disable tests using -static if
3481         HAVE_STATIC is not true.
3482         * configure, testsuite/Makefile.in: Rebuild.
3483
3484 2011-07-01  Ian Lance Taylor  <iant@google.com>
3485
3486         PR gold/12525
3487         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3488         Assert if we see DW_EH_PE_indirect.
3489         * target.h (Target::ehframe_datarel_base): New function.
3490         (Target::do_ehframe_datarel_base): New target function.
3491         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3492         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3493         function.
3494
3495 2011-07-01  Ian Lance Taylor  <iant@google.com>
3496
3497         PR gold/12571
3498         * options.h (class General_options): Add
3499         --ld-generated-unwind-info.
3500         * ehframe.cc (Fde::write): Add address parameter.  Change all
3501         callers.  If associated with PLT, fill in address and size.
3502         (Cie::set_output_offset): Only add merge mapping if there is an
3503         object.
3504         (Cie::write): Add address parameter.  Change all callers.
3505         (Eh_frame::add_ehframe_for_plt): New function.
3506         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3507         input_offset_ fields into union u_, with new plt field.
3508         (Fde::Fde): Adjust for new union field.
3509         (Fde::Fde) [Output_data version]: New constructor.
3510         (Fde::add_mapping): Only add merge mapping if there is an object.
3511         (class Cie): Update declarations.
3512         (class Eh_frame): Declare add_ehframe_for_plt.
3513         * layout.cc (Layout::layout_eh_frame): Break out code into
3514         make_eh_frame_section, and call it.
3515         (Layout::make_eh_frame_section): New function.
3516         (Layout::add_eh_frame_for_plt): New function.
3517         * layout.h (class Layout): Update declarations.
3518         * merge.cc (Merge_map::add_mapping): Add assertion.
3519         * i386.cc: Include "dwarf.h".
3520         (class Output_data_plt_i386): Make first_plt_entry,
3521         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3522         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3523         and plt_eh_frame_fde.
3524         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3525         boundary.  Call add_eh_frame_for_plt if appropriate.
3526         * x86_64.cc: Include "dwarf.h".
3527         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3528         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3529         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3530         and plt_eh_frame_fde.
3531         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3532         appropriate.
3533
3534 2011-06-29  Ian Lance Taylor  <iant@google.com>
3535
3536         PR gold/12629
3537         * object.cc (Sized_relobj_file::layout_section): Change shdr
3538         parameter to be const.
3539         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3540         out of do_layout.
3541         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3542         appropriate.  Call layout_eh_frame_section.
3543         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3544         sections.
3545         * object.h (class Sized_relobj_file): Update declarations.
3546
3547 2011-06-29  Ian Lance Taylor  <iant@google.com>
3548
3549         PR gold/12652
3550         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3551         modifier.
3552         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3553
3554 2011-06-29  Ian Lance Taylor  <iant@google.com>
3555
3556         PR gold/12675
3557         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3558         SHT_X86_64_UNWIND.
3559         * layout.cc (Layout::layout_eh_frame): Likewise.
3560
3561 2011-06-29  Ian Lance Taylor  <iant@google.com>
3562
3563         PR gold/12695
3564         * layout.cc (Layout::symtab_section_shndx): New function.
3565         * layout.h (class Layout): Declare symtab_section_shndx.
3566         * output.cc (Output_section::write_header): Call it.
3567
3568 2011-06-29  Ian Lance Taylor  <iant@google.com>
3569
3570         PR gold/12818
3571         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3572         symbols which are not used in a relocation.
3573
3574 2011-06-28  Ian Lance Taylor  <iant@google.com>
3575
3576         PR gold/12898
3577         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3578         script create indistinguishable segments.
3579         (Layout::set_segment_offsets): Use stable_sort when sorting
3580         segments.  Pass this to Compare_segments constructor.
3581         * layout.h (class Layout): Make segment_precedes non-static.
3582         (class Compare_segments): Change from struct to class.  Add
3583         layout_ field.  Add constructor.
3584         * script-sections.cc
3585         (Script_sections::attach_sections_using_phdrs_clause): Rename
3586         local orphan to is_orphan.  Don't report failure to put empty
3587         section in segment.  On attachment failure, report name of
3588         section, and attach to first PT_LOAD segment.
3589
3590 2011-06-28  Ian Lance Taylor  <iant@google.com>
3591
3592         PR gold/12934
3593         * target-select.cc (Target_selector::Target_selector): Add
3594         emulation parameter.  Change all callers.
3595         (select_target_by_bfd_name): Rename from select_target_by_name.
3596         Change all callers.
3597         (select_target_by_emulation): New function.
3598         (supported_emulation_names): New function.
3599         * target-select.h (class Target_selector): Add emulation_ field.
3600         Update declarations.
3601         (Target_selector::recognize_by_bfd_name): Rename from
3602         recognize_by_name.  Change all callers.
3603         (Target_selector::supported_bfd_names): Rename from
3604         supported_names.  Change all callers.
3605         (Target_selector::recognize_by_emulation): New function.
3606         (Target_selector::supported_emulations): New function.
3607         (Target_selector::emulation): New function.
3608         (Target_selector::do_recognize_by_bfd_name): Rename from
3609         do_recognize_by_name.  Change all callers.
3610         (Target_selector::do_supported_bfd_names): Rename from
3611         do_supported_names.  Change all callers.
3612         (Target_selector::do_recognize_by_emulation): New function.
3613         (Target_selector::do_supported_emulations): New function.
3614         (select_target_by_bfd_name): Change name in declaration.
3615         (select_target_by_emulation): Declare.
3616         (supported_emulation_names): Declare.
3617         * parameters.cc (parameters_force_valid_target): Try to find
3618         target based on emulation from -m option.
3619         * options.h (class General_options): Change doc string for -m.
3620         * options.cc (help): Print emulations.
3621         (General_options::parse_V): Likewise.
3622         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3623         Add emulation parameter.  Change all callers.
3624
3625 2011-06-28  Ian Lance Taylor  <iant@google.com>
3626
3627         * target.h (class Target): Add osabi_ field.
3628         (Target::osabi): New function.
3629         (Target::set_osabi): New function.
3630         (Target::Target): Initialize osabi_.
3631         (Target::do_adjust_elf_header): Make pure virtual.
3632         (Sized_target::do_adjust_elf_header): Declare.
3633         * target.cc (Sized_target::do_adjust_elf_header): New function.
3634         (class Sized_target): Instantiate all versions.
3635         * freebsd.h (class Target_freebsd): Remove.
3636         (Target_selector_freebsd::do_recognize): Call set_osabi on
3637         Target.
3638         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3639         (Target_selector_freebsd::set_osabi): Remove.
3640         * i386.cc (class Target_i386): Inherit from Sized_target rather
3641         than Target_freebsd.
3642         * x86_64.cc (class Target_x86_64): Likewise.
3643
3644 2011-06-28  Ian Lance Taylor  <iant@google.com>
3645
3646         * target.h (Target::can_check_for_function_pointers): Rewrite.
3647         Make non-virtual.
3648         (Target::can_icf_inline_merge_sections): Likewise.
3649         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3650         (Target::Target_info): Add can_icf_inline_merge_sections field.
3651         (Target::do_can_check_for_function_pointers): New virtual
3652         function.
3653         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3654         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3655         from can_check_for_function_pointers, move in file.
3656         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3657         section_may_have_icf_unsafe_poineters, move in file.
3658         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3659         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3660         Rename from can_check_for_function_pointers, move in file.
3661         (Target_i386::can_icf_inline_merge_sections): Remove.
3662         (Target_i386::i386_info): Initialize
3663         can_icf_inline_merge_sections.
3664         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3665         Initialize can_icf_inline_merge_sections.
3666         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3667         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3668         Rename from can_check_for_function_pointers, move in file.
3669         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3670         (Target_x86_64::x86_64_info): Initialize
3671         can_icf_inline_merge_sections.
3672         * testsuite/testfile.cc (Target_test::test_target_info):
3673         Likewise.
3674         * icf.cc (get_section_contents): Correct formatting.
3675
3676 2011-06-27  Ian Lance Taylor  <iant@google.com>
3677
3678         * symtab.cc (Symbol::versioned_name): New function.
3679         (Symbol_table::add_to_final_symtab): Use versioned_name when
3680         appropriate.
3681         (Symbol_table::sized_write_symbol): Likewise.
3682         * symtab.h (class Symbol): Declare versioned_name.
3683         * stringpool.h (class Stringpool_template): Add variant of add
3684         which takes a std::basic_string.
3685         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3686         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3687         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3688         (ver_test_12.o): New target.
3689         * testsuite/Makefile.in: Rebuild.
3690
3691 2011-06-27  Doug Kwan  <dougkwan@google.com>
3692
3693         * arm.cc (Arm_relocate_functions::thm_jump8,
3694         Arm_relocate_functions::thm_jump11): Use a wider signed
3695         type to compute offset.
3696         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3697         arm_thm_jump8.
3698         * testsuite/Makefile.in: Regenerate.
3699         * testsuite/arm_branch_in_range.sh: Check test results of
3700         arm_thm_jump11 and arm_thm_jump8.
3701         * testsuite/arm_thm_jump11.s: New test source file.
3702         * testsuite/arm_thm_jump11.t: New linker script.
3703         * testsuite/arm_thm_jump8.s: New test source file.
3704         * testsuite/arm_thm_jump8.t: New linker script.
3705
3706 2011-06-24  Ian Lance Taylor  <iant@google.com>
3707
3708         * layout.cc: Include "object.h".
3709         (ctors_sections_in_init_array): New static variable.
3710         (Layout::is_ctors_in_init_array): New function.
3711         (Layout::layout): Add entry to ctors_sections_in_init_array if
3712         appropriate.
3713         * layout.h (class Layout): Declare is_ctors_in_init_array.
3714         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3715         is_ctors_reverse_view is set.
3716         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3717         all callers.  Set is_ctors_reverse_view field of View_size.
3718         (Sized_relobj_file::reverse_words): New function.
3719         * object.h (Sized_relobj_file::View_size): Add
3720         is_ctors_reverse_view field.
3721         (class Sized_relobj_file): Update declarations.
3722         * testsuite/initpri3.c: New test.
3723         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3724         initpri3b.
3725         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3726         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3727         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3728         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3729         * testsuite/Makefile.in: Rebuild.
3730
3731 2011-06-24  Cary Coutant  <ccoutant@google.com>
3732
3733         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3734         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3735         (debug_msg_cdebug.err): New targets.
3736         * testsuite/Makefile.in: Regenerate.
3737         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3738         Fix checks for link with shared library.
3739
3740 2011-06-24  Doug Kwan  <dougkwan@google.com>
3741
3742         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3743         skip empty text sections.
3744         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3745
3746 2011-06-22  Ian Lance Taylor  <iant@google.com>
3747
3748         PR gold/12910
3749         * options.h (class General_options): Add --ctors-in-init-array.
3750         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3751         friends as SHT_PROGBITS for merging sections.
3752         (Layout::layout): Remove special handling of .init_array and
3753         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3754         and .dtors if ctors_in_init_array.
3755         (Layout::make_output_section): Force correct section types for
3756         .init_array and friends.  Don't sort if doing relocatable link,
3757         Don't sort .ctors and .dtors if ctors_in_init_array.
3758         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3759         (Layout::output_section_name): Add relobj parameter.  Change all
3760         callers.  Handle .ctors. and .dtors. in code rather than table.
3761         Handle .ctors and .dtors if ctors_in_init_array.
3762         (Layout::match_file_name): New function, moved from output.cc.
3763         * layout.h (class Layout): Update declarations.
3764         * output.cc: Include "layout.h".
3765         (Input_section_sort_entry::get_priority): New function.
3766         (Input_section_sort_entry::match_file_name): Just call
3767         Layout::match_file_name.
3768         (Output_section::Input_section_sort_init_fini_compare::operator()):
3769         Handle .ctors and .dtors.  Sort by explicit priority rather than
3770         by name.
3771         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3772         * testsuite/initpri2.c: New test.
3773         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3774         (check_PROGRAMS): Add initpri2.
3775         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3776         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3777         * configure, testsuite/Makefile.in: Rebuild.
3778
3779 2011-06-19  Ian Lance Taylor  <iant@google.com>
3780
3781         PR gold/12880
3782         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3783         .interp section to a PT_INTERP segment even if we have seen a
3784         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3785         clause in a linker script.
3786         (Layout::finalize): Don't create a .interp section if we've
3787         already create a PT_INTERP segment.
3788         (Layout::create_interp): Always call choose_output_section (revert
3789         patch of 2011-06-17).  Don't create PT_INTERP segment.
3790         * script-sections.cc
3791         (Script_sections::create_note_and_tls_segments): Add a .interp
3792         section to a PT_INTERP segment even if we have seen a
3793         --dynamic-linker option.
3794
3795 2011-06-18  Ian Lance Taylor  <iant@google.com>
3796
3797         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3798         merely because a non-PT_LOAD segment has a dynamic reloc.
3799
3800 2011-06-18  Ian Lance Taylor  <iant@google.com>
3801
3802         * layout.cc (Layout::finish_dynamic_section): Don't create
3803         DT_FLAGS entry if not needed.
3804
3805 2011-06-18  Ian Lance Taylor  <iant@google.com>
3806
3807         PR gold/12745
3808         * layout.cc (Layout::layout_eh_frame): Correct handling of
3809         writable .eh_frame section.
3810
3811 2011-06-17  Ian Lance Taylor  <iant@google.com>
3812
3813         PR gold/12893
3814         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3815         symbol is redefined with the exact same object and value.
3816
3817 2011-06-17  Ian Lance Taylor  <iant@google.com>
3818
3819         PR gold/12880
3820         * layout.h (class Layout): Add interp_segment_ field.
3821         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3822         (Layout::attach_allocated_section_to_segment): If making shared
3823         library, put .interp section in PT_INTERP segment.
3824         (Layout::finalize): Also call create_interp if -dynamic-linker
3825         option was used.
3826         (Layout::create_interp): Assert that there is no PT_INTERP
3827         segment.  If not using a SECTIONS clause, use make_output_section.
3828         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3829         * script-sections.cc
3830         (Script_sections::create_note_and_tls_segments): If making shared
3831         library, put .interp section in PT_INTERP segment.
3832
3833 2011-06-17  Ian Lance Taylor  <iant@google.com>
3834
3835         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3836         when making a shared library.
3837
3838 2011-06-17  Ian Lance Taylor  <iant@google.com>
3839
3840         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3841         parameter.  Change all callers.  Don't issue warning about PC32
3842         against locally defined symbol.
3843
3844 2011-06-16  Ian Lance Taylor  <iant@google.com>
3845
3846         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3847         occurs in same object.
3848
3849 2011-06-14  Alan Modra  <amodra@gmail.com>
3850
3851         * po/POTFILES.in: Regenerate.
3852
3853 2011-06-09  Ian Lance Taylor  <iant@google.com>
3854
3855         * script-sections.cc
3856         (Orphan_output_section::set_section_addresses): For a relocatable
3857         link set address to 0.
3858
3859 2011-06-09  Cary Coutant  <ccoutant@google.com>
3860
3861         PR gold/12804
3862         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3863         used with --compress-debug-sections.
3864         * gold/object.cc (Sized_relobj_file::do_layout): Report
3865         uncompressed size of compressed input sections.
3866
3867 2011-06-08  Cary Coutant  <ccoutant@google.com>
3868
3869         PR gold/12804
3870         * testsuite/two_file_test_2_v1.cc: Change initialization of
3871         v2 to keep it in .data.
3872
3873 2011-06-07  Cary Coutant  <ccoutant@google.com>
3874
3875         * common.cc (Symbol_table::do_allocate_commons_list): Call
3876         gold_fallback.
3877         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3878         (Errors::fallback): New function.
3879         (gold_fallback): New function.
3880         * errors.h (Errors::fallback): New function.
3881         * gold.cc (gold_exit): Change status parameter to enum; adjust
3882         all callers.
3883         (queue_initial_tasks): Call gold_fallback.
3884         * gold.h: Include cstdlib.
3885         (Exit_status): New enum type.
3886         (gold_exit): Change status parameter to enum.
3887         (gold_fallback): New function.
3888         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3889         (Layout::create_symtab_sections): Likewise.
3890         (Layout::create_shdrs): Likewise.
3891         * main.cc (main): Adjust call to gold_exit.
3892         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3893         (Output_data_got::add_got_entry_pair): Likewise.
3894         (Output_section::add_input_section): Likewise.
3895         (Output_section::add_output_section_data): Likewise.
3896         (Output_segment::set_section_list_addresses): Likewise.
3897         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3898
3899 2011-06-07  Cary Coutant  <ccoutant@google.com>
3900
3901         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3902         for incremental links.
3903         * output.cc (Output_segment::set_section_list_addresses): Remove
3904         FIXME and test for TLS or BSS.
3905
3906 2011-06-07  Cary Coutant  <ccoutant@google.com>
3907
3908         * testsuite/Makefile.am: Add incremental_copy_test,
3909         incremental_common_test_1.
3910         * testsuite/Makefile.in: Regenerate.
3911         * testsuite/common_test_1_v1.c: New source file.
3912         * testsuite/common_test_1_v2.c: New source file.
3913         * testsuite/copy_test_v1.cc: New source file.
3914
3915 2011-06-07  Cary Coutant  <ccoutant@google.com>
3916
3917         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3918         update, allocate common from bss section's free list.
3919         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3920         linker-defined symbols.
3921         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3922         Skip GOT and PLT entries that are no longer referenced.
3923         (Output_section_incremental_inputs::write_info_blocks): Mark
3924         linker-defined symbols.
3925         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3926         * output.cc (Output_section::allocate): New function.
3927         * output.h (Output_section::allocate): New function.
3928         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3929         linker-defined symbols.
3930         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3931         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3932         (Symbol::init_base_output_data): Likewise.
3933         (Symbol::init_base_output_segment): Likewise.
3934         (Symbol::init_base_constant): Likewise.
3935         (Sized_symbol::init_output_data): Likewise.
3936         (Sized_symbol::init_output_segment): Likewise.
3937         (Sized_symbol::init_constant): Likewise.
3938         (Symbol_table::do_define_in_output_data): Likewise.
3939         (Symbol_table::do_define_in_output_segment): Likewise.
3940         (Symbol_table::do_define_as_constant): Likewise.
3941         * symtab.h (Symbol::is_predefined): New function.
3942         (Symbol::init_base_output_data): Add is_predefined parameter.
3943         (Symbol::init_base_output_segment): Likewise.
3944         (Symbol::init_base_constant): Likewise.
3945         (Symbol::is_predefined_): New data member.
3946         (Sized_symbol::init_output_data): Add is_predefined parameter.
3947         (Sized_symbol::init_output_segment): Likewise.
3948         (Sized_symbol::init_constant): Likewise.
3949         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3950
3951 2011-06-07  Cary Coutant  <ccoutant@google.com>
3952
3953         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3954         instead of emit_copy_reloc.
3955         (Copy_relocs::emit_copy_reloc): Refactor.
3956         (Copy_relocs::make_copy_reloc): New function.
3957         (Copy_relocs::add_copy_reloc): Remove.
3958         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3959         section.
3960         (Copy_relocs::make_copy_reloc): New function.
3961         (Copy_relocs::add_copy_reloc): Remove.
3962         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3963         unchanged input files.
3964         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3965         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3966         Reserve BSS space for COPY relocations.
3967         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3968         (Output_section_incremental_inputs::write_info_blocks): Record
3969         whether a symbol is copied from a shared object.
3970         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3971         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3972         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3973         (Incremental_input_entry_reader::get_output_symbol_index): Add
3974         is_copy parameter.
3975         (Incremental_binary::emit_copy_relocs): New function.
3976         (Incremental_binary::do_emit_copy_relocs): New function.
3977         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3978         new data member.
3979         (Sized_incremental_binary::add_copy_reloc): New function.
3980         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3981         (Sized_incremental_binary::Copy_reloc): New struct.
3982         (Sized_incremental_binary::Copy_relocs): New typedef.
3983         (Sized_incremental_binary::copy_relocs_): New data member.
3984         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3985         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3986         * target.h (Sized_target::emit_copy_reloc): New function.
3987         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3988
3989 2011-06-02  Cary Coutant  <ccoutant@google.com>
3990
3991         PR gold/12163
3992         * gold/archive.cc (Archive::Archive): Initialize new data member.
3993         (Archive::include_all_members): Return if archive has already been
3994         included.
3995         * gold/archive.h (Archive::include_all_members_): New data member.
3996
3997 2011-06-02  Nick Clifton  <nickc@redhat.com>
3998
3999         * dynobj.h: Fix spelling mistake in comment.
4000         * output.cc: Likewise.
4001
4002 2011-05-31  Doug Kwan  <dougkwan@google.com>
4003             Asier Llano
4004
4005         PR gold/12826
4006         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4007         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4008         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4009         redundant arm_exidx_test.so.
4010         * testsuite/Makefile.in: Regenerate.
4011         (check_SCRIPTS): Add pr12826.sh
4012         (check_DATA): Add pr12826.stdout
4013         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4014         * testsuite/pr12826.sh: New file.
4015         * testsuite/pr12826_1.s: Ditto.
4016         * testsuite/pr12826_1.s: Ditto.
4017
4018 2011-05-30  Ian Lance Taylor  <iant@google.com>
4019
4020         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4021         sections.
4022
4023 2011-05-29  Ian Lance Taylor  <iant@google.com>
4024
4025         PR gold/12804
4026         * testsuite/Makefile.am: Use different file name for two_file_test
4027         temporary file for each incremental test.
4028         * testsuite/Makefile.in: Rebuild.
4029
4030 2011-05-29  Ian Lance Taylor  <iant@google.com>
4031
4032         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4033         binary input file is empty.
4034
4035 2011-05-27  Ian Lance Taylor  <iant@google.com>
4036
4037         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4038         (ver_test_9.so): Likewise.
4039         * testsuite/Makefile.in: Rebuild.
4040
4041 2011-05-26 Cary Coutant  <ccoutant@google.com>
4042
4043         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4044         * incremental.cc (Incremental_inputs::report_input_section): Fix
4045         comment, indentation.
4046         (Incremental_inputs::report_comdat_group): New function.
4047         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4048         of data for incremental input file entry.
4049         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4050         group count, COMDAT group signatures.
4051         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4052         an unchanged input file.
4053         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4054         Initialize new data member.
4055         (Incremental_object_entry::add_comdat_group): New function.
4056         (Incremental_object_entry::get_comdat_group_count): New function.
4057         (Incremental_object_entry::get_comdat_signature_key): New function.
4058         (Incremental_object_entry::groups_): New data member.
4059         (Incremental_inputs::report_comdat_group): New function.
4060         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4061         data for incremental input file entry.
4062         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4063         (Incremental_input_entry_reader::get_input_section): Adjust size of
4064         data for incremental input file entry.
4065         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4066         (Incremental_input_entry_reader::get_comdat_group_signature): New
4067         function.
4068         * object.cc (Sized_relobj::include_section_group): Report kept
4069         COMDAT groups for incremental links.
4070
4071 2011-05-24  David Meyer  <pdox@google.com>
4072
4073         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4074         with name parameter.  Add found_name parameter.
4075         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4076         * dirsearch.h (class Dirsearch): Update declaration.
4077
4078 2011-05-24  Ian Lance Taylor  <iant@google.com>
4079
4080         * archive.cc (Library_base::should_include_member): Pull in object
4081         from archive if it defines the entry symbol.
4082         * parameters.cc (Parameters::entry): New function.
4083         * parameters.h (class Parameters): Declare entry.
4084         * output.h (class Output_file_header): Remove entry_ field.
4085         * output.cc (Output_file_header::Output_file_header): Remove entry
4086         parameter.  Change all callers.
4087         (Output_file_header::entry): Use parameters->entry.
4088         * gold.cc (queue_middle_tasks): Likewise.
4089         * plugin.cc (Plugin_hook::run): Likewise.
4090
4091 2011-05-24 Cary Coutant  <ccoutant@google.com>
4092
4093         * gold.cc (queue_initial_tasks): Pass incremental base filename
4094         to Output_file::open_base_file; don't print error message.
4095         * incremental-dump.cc (main): Adjust call to
4096         Output_file::open_for_modification.
4097         * incremental-dump.cc (main): Likewise.
4098         * incremental.cc (Incremental_inputs::report_command_line):
4099         Ignore --incremental-base option when comparing command lines.
4100         Ignore parameter when given as separate argument.
4101         * options.h (class General_options): Add --incremental-base.
4102         * output.cc (Output_file::Output_file):
4103         (Output_file::open_base_file): Add base_name and writable parameters;
4104         read base file into new file; print error message here.
4105         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4106         callers.
4107         * output.h (Output_file::open_for_modification): Rename to...
4108         (Output_file::open_base_file): ...this; add base_name and
4109         writable parameters; adjust all callers.
4110         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4111         callers.
4112         * testsuite/Makefile.am (incremental_test_4): Test
4113         --incremental-base.
4114         * testsuite/Makefile.in: Regenerate.
4115
4116 2011-05-24 Cary Coutant  <ccoutant@google.com>
4117
4118         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4119         incremental_test_4.
4120         * testsuite/Makefile.in: Regenerate.
4121         * testsuite/two_file_test_1_v1.cc: New test source file.
4122         * testsuite/two_file_test_1b_v1.cc: New test source file.
4123         * testsuite/two_file_test_2_v1.cc: New test source file.
4124
4125 2011-05-24 Cary Coutant  <ccoutant@google.com>
4126
4127         * dynobj.h (Dynobj::do_dynobj): New function.
4128         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4129         flag and soname for shared objects.
4130         * incremental.cc (Incremental_inputs::report_object): Make
4131         either Incremental_object_entry or Incremental_dynobj_entry; add
4132         soname to string table.
4133         (Incremental_inputs::report_input_section): Add assertion.
4134         (Output_section_incremental_inputs::set_final_data_size): Adjust
4135         type of input file entry for shared libraries; adjust size of
4136         shared library info entry.
4137         (Output_section_incremental_inputs::write_input_files): Write
4138         as_needed flag for shared libraries.
4139         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4140         of input file entry for shared libraries; write soname.
4141         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4142         soname from incremental info.
4143         * incremental.h (enum Incremental_input_flags): Add
4144         INCREMENTAL_INPUT_AS_NEEDED.
4145         (Incremental_input_entry::Incremental_input_entry): Initialize new
4146         data member.
4147         (Incremental_input_entry::set_as_needed): New function.
4148         (Incremental_input_entry::as_needed): New function.
4149         (Incremental_input_entry::do_dynobj_entry): New function.
4150         (Incremental_input_entry::as_needed_): New data member.
4151         (Incremental_object_entry::Incremental_object_entry): Don't check
4152         for shared library.
4153         (Incremental_object_entry::do_type): Likewise.
4154         (class Incremental_dynobj_entry): New class.
4155         (Incremental_input_entry_reader::as_needed): New function.
4156         (Incremental_input_entry_reader::get_soname): New function.
4157         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4158         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4159         size of shared library info entry.
4160         * layout.cc (Layout::finish_dynamic_section): Don't test for
4161         incremental link when adding DT_NEEDED entries.
4162         * object.h (Object::Object): Initialize new data member.
4163         (Object::dynobj): New function.
4164         (Object::set_as_needed): New function.
4165         (Object::as_needed): New function.
4166         (Object::do_dynobj): New function.
4167         (Object::as_needed_): New data member.
4168
4169 2011-05-24 Cary Coutant  <ccoutant@google.com>
4170
4171         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4172         info; adjust display of GOT entries.
4173         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4174         vector of input objects; remove file_status_.
4175         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4176         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4177         got_plt reader; call target hooks to reserve GOT entries.
4178         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4179         of input file info header and GOT info entry.
4180         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4181         relocation info.
4182         (Got_plt_view_info::got_descriptor): Remove.
4183         (Got_plt_view_info::sym_index): New data member.
4184         (Got_plt_view_info::input_index): New data member.
4185         (Local_got_offset_visitor::visit): Write input file index.
4186         (Global_got_offset_visitor::visit): Write 0 for input file index.
4187         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4188         with sym_index and input_index.
4189         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4190         incremental info GOT entry; replace got_descriptor with input_index.
4191         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4192         map from input file index to object.
4193         (Sized_relobj_incr::do_layout): Replace direct data member reference
4194         with accessor function.
4195         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4196         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4197         Adjust size of input file info header.
4198         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4199         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4200         (Incremental_input_entry_reader::get_input_section): Adjust size of
4201         input file info header.
4202         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4203         of incremental info GOT entry.
4204         (Incremental_got_plt_reader::get_got_desc): Remove.
4205         (Incremental_got_plt_reader::get_got_symndx): New function.
4206         (Incremental_got_plt_reader::get_got_input_index): New function.
4207         (Sized_incremental_binary::Sized_incremental_binary): Remove
4208         file_status_; add input_objects_.
4209         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4210         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4211         (Sized_incremental_binary::file_is_unchanged): Remove.
4212         (Sized_incremental_binary::set_input_object): New function.
4213         (Sized_incremental_binary::input_object): New function.
4214         (Sized_incremental_binary::file_status_): Remove.
4215         (Sized_incremental_binary::input_objects_): New data member.
4216         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4217         references.
4218         (Sized_relobj_incr::invalid_address): Move to base class.
4219         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4220         class.
4221         (Sized_relobj_incr::do_output_section_offset): Likewise.
4222         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4223         (Sized_relobj_incr::section_offsets_): Likewise.
4224         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4225         function.
4226         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4227         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4228         with accessor function.
4229         (Sized_relobj_file::do_layout): Likewise.
4230         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4231         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4232         (Sized_relobj_file::compute_final_local_value): Replace refs to
4233         section_offsets_ with accessor function.
4234         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4235         * object.h (Relobj::Relobj): Initialize new data members.
4236         (Relobj::add_dyn_reloc): New function.
4237         (Relobj::first_dyn_reloc): New function.
4238         (Relobj::dyn_reloc_count): New function.
4239         (Relobj::first_dyn_reloc_): New data member.
4240         (Relobj::dyn_reloc_count_): New data member.
4241         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4242         references.
4243         (Sized_relobj::Address): New typedef.
4244         (Sized_relobj::invalid_address): Move here from child class.
4245         (Sized_relobj::Sized_relobj): Initialize new data members.
4246         (Sized_relobj::sized_relobj): New function.
4247         (Sized_relobj::is_output_section_offset_invalid): Move here from
4248         child class.
4249         (Sized_relobj::get_output_section_offset): Likewise.
4250         (Sized_relobj::local_has_got_offset): Likewise.
4251         (Sized_relobj::local_got_offset): Likewise.
4252         (Sized_relobj::set_local_got_offset): Likewise.
4253         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4254         (Sized_relobj::clear_got_offsets): New function.
4255         (Sized_relobj::section_offsets): Move here from child class.
4256         (Sized_relobj::do_output_section_offset): Likewise.
4257         (Sized_relobj::do_set_section_offset): Likewise.
4258         (Sized_relobj::Local_got_offsets): Likewise.
4259         (Sized_relobj::local_got_offsets_): Likewise.
4260         (Sized_relobj::section_offsets_): Likewise.
4261         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4262         references.
4263         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4264         class.
4265         (Sized_relobj_file::sized_relobj): New function
4266         (Sized_relobj_file::local_has_got_offset): Move to base class.
4267         (Sized_relobj_file::local_got_offset): Likewise.
4268         (Sized_relobj_file::set_local_got_offset): Likewise.
4269         (Sized_relobj_file::get_output_section_offset): Likewise.
4270         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4271         (Sized_relobj_file::do_output_section_offset): Likewise.
4272         (Sized_relobj_file::do_set_section_offset): Likewise.
4273         (Sized_relobj_file::Local_got_offsets): Likewise.
4274         (Sized_relobj_file::local_got_offsets_): Likewise.
4275         (Sized_relobj_file::section_offsets_): Likewise.
4276         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4277         (all constructors).
4278         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4279         (Output_reloc::get_symbol_index): Likewise.
4280         (Output_reloc::local_section_offset): Likewise.
4281         (Output_reloc::get_address): Likewise.
4282         (Output_reloc::symbol_value): Likewise.
4283         (Output_data_got::reserve_slot): Move to class definition.
4284         (Output_data_got::reserve_local): New function.
4285         (Output_data_got::reserve_slot_for_global): Remove.
4286         (Output_data_got::reserve_global): New function.
4287         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4288         (all constructors, two instantiations).
4289         (Output_reloc::get_relobj): New function (two instantiations).
4290         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4291         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4292         (Output_data_reloc::add_global): Adjust type of relobj.
4293         (Output_data_reloc::add_global_relative): Likewise.
4294         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4295         (Output_data_reloc::add_local): Likewise.
4296         (Output_data_reloc::add_local_relative): Likewise.
4297         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4298         (Output_data_reloc::add_local_section): Likewise.
4299         (Output_data_reloc::add_output_section): Likewise.
4300         (Output_data_reloc::add_absolute): Likewise.
4301         (Output_data_reloc::add_target_specific): Likewise.
4302         (Output_data_got::reserve_slot): Move definition here.
4303         (Output_data_got::reserve_local): New function.
4304         (Output_data_got::reserve_global): New function.
4305         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4306         section_offsets_ with accessor function.
4307         (Sized_relobj_file::write_sections): Likewise.
4308         (Sized_relobj_file::do_relocate_sections): Likewise.
4309         * target.h (Sized_target::reserve_local_got_entry): New function.
4310         (Sized_target::reserve_global_got_entry): New function.
4311         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4312         (Target_x86_64::reserve_global_got_entry): New function.
4313         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4314
4315 2011-05-23 Cary Coutant  <ccoutant@google.com>
4316
4317         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4318         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4319         bit when checking got_type.
4320         * incremental.cc (Sized_incremental_binary::setup_readers):
4321         Store symbol table and string table locations; initialize bit vector
4322         of file status flags.
4323         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4324         unchanged files.
4325         (Sized_incremental_binary::do_process_got_plt): New function.
4326         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4327         (Output_section_incremental_inputs::set_final_data_size): Record
4328         file index for each input file.
4329         (Output_section_incremental_inputs::write_got_plt): Store file index
4330         instead of input entry offset for each GOT entry.
4331         * incremental.h
4332         (Incremental_input_entry::Incremental_input_entry): Initialize new
4333         data member.
4334         (Incremental_input_entry::set_offset): Store file index.
4335         (Incremental_input_entry::get_file_index): New function.
4336         (Incremental_input_entry::file_index_): New data member.
4337         (Incremental_binary::process_got_plt): New function.
4338         (Incremental_binary::do_process_got_plt): New function.
4339         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4340         data members.
4341         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4342         (Sized_incremental_binary::set_file_is_unchanged): New function.
4343         (Sized_incremental_binary::file_is_unchanged): New function.
4344         (Sized_incremental_binary::do_process_got_plt): New function.
4345         (Sized_incremental_binary::file_status_): New data member.
4346         (Sized_incremental_binary::main_symtab_loc_): New data member.
4347         (Sized_incremental_binary::main_strtab_loc_): New data member.
4348         * output.cc (Output_data_got::Got_entry::write): Add case
4349         RESERVED_CODE.
4350         (Output_data_got::add_global): Call add_got_entry.
4351         (Output_data_got::add_global_plt): Likewise.
4352         (Output_data_got::add_global_with_rel): Likewise.
4353         (Output_data_got::add_global_with_rela): Likewise.
4354         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4355         (Output_data_got::add_global_pair_with_rela): Likewise.
4356         (Output_data_got::add_local): Call add_got_entry.
4357         (Output_data_got::add_local_plt): Likewise.
4358         (Output_data_got::add_local_with_rel): Likewise.
4359         (Output_data_got::add_local_with_rela): Likewise.
4360         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4361         (Output_data_got::add_local_pair_with_rela): Likewise.
4362         (Output_data_got::reserve_slot): New function.
4363         (Output_data_got::reserve_slot_for_global): New function.
4364         (Output_data_got::add_got_entry): New function.
4365         (Output_data_got::add_got_entry_pair): New function.
4366         (Output_section::add_output_section_data): Edit FIXME.
4367         * output.h
4368         (Output_section_data_build::Output_section_data_build): New
4369         constructor with size parameter.
4370         (Output_data_space::Output_data_space): Likewise.
4371         (Output_data_got::Output_data_got): Initialize new data member; new
4372         constructor with size parameter.
4373         (Output_data_got::add_constant): Call add_got_entry.
4374         (Output_data_got::reserve_slot): New function.
4375         (Output_data_got::reserve_slot_for_global): New function.
4376         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4377         (Output_data_got::add_got_entry): New function.
4378         (Output_data_got::add_got_entry_pair): New function.
4379         (Output_data_got::free_list_): New data member.
4380         * target.h (Sized_target::init_got_plt_for_update): New function.
4381         (Sized_target::register_global_plt_entry): New function.
4382         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4383         Initialize new data member; call init; add constructor with PLT count.
4384         (Output_data_plt_x86_64::init): New function.
4385         (Output_data_plt_x86_64::add_relocation): New function.
4386         (Output_data_plt_x86_64::reserve_slot): New function.
4387         (Output_data_plt_x86_64::free_list_): New data member.
4388         (Target_x86_64::init_got_plt_for_update): New function.
4389         (Target_x86_64::register_global_plt_entry): New function.
4390         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4391         incremental updates.
4392         (Output_data_plt_x86_64::add_relocation): New function.
4393         * testsuite/object_unittest.cc (Object_test): Set default options.
4394
4395 2011-05-16  Ian Lance Taylor  <iant@google.com>
4396
4397         * options.h (class General_options): Make -i a synonym for -r.
4398
4399 2011-05-16  Ian Lance Taylor  <iant@google.com>
4400
4401         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4402
4403 2011-05-10 Cary Coutant  <ccoutant@google.com>
4404
4405         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4406         strip_all (-s).
4407
4408 2011-05-06  Ian Lance Taylor  <iant@google.com>
4409
4410         * layout.cc (Layout::layout): If the output section flags change,
4411         update the ordering.
4412
4413 2011-04-25 Cary Coutant  <ccoutant@google.com>
4414
4415         * incremental-dump.cc (dump_incremental_inputs): Print local
4416         symbol info for each input file.
4417         * incremental.cc
4418         (Output_section_incremental_inputs::set_final_data_size): Add local
4419         symbol info to input file entries in incremental info.
4420         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4421         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4422         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4423         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4424         implementation.
4425         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4426         (Sized_incr_relobj::do_relocate): Write the local symbols.
4427         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4428         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4429         Adjust size of input file header.
4430         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4431         (Incremental_inputs_reader::get_local_symbol_count): New function.
4432         (Incremental_inputs_reader::get_input_section): Adjust size of input
4433         file header.
4434         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4435         (Sized_incr_relobj::This): New typedef.
4436         (Sized_incr_relobj::sym_size): New const data member.
4437         (Sized_incr_relobj::Local_symbol): New struct.
4438         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4439         (Sized_incr_relobj::do_local_symbol_offset): New function.
4440         (Sized_incr_relobj::local_symbol_count_): New data member.
4441         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4442         (Sized_incr_relobj::local_symbol_index_): New data member.
4443         (Sized_incr_relobj::local_symbol_offset_): New data member.
4444         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4445         (Sized_incr_relobj::local_symbols_): New data member.
4446         * object.h (Relobj::output_local_symbol_count): New function.
4447         (Relobj::local_symbol_offset): New function.
4448         (Relobj::do_output_local_symbol_count): New function.
4449         (Relobj::do_local_symbol_offset): New function.
4450         (Sized_relobj::do_output_local_symbol_count): New function.
4451         (Sized_relobj::do_local_symbol_offset): New function.
4452
4453 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4454
4455         * descriptors.cc (set_close_on_exec): New function.
4456         (Descriptors::open): Use set_close_on_exec.
4457         * output.cc (S_ISLNK): Define if not defined.
4458
4459 2011-04-22 Cary Coutant  <ccoutant@google.com>
4460
4461         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4462         global symbol map.
4463         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4464         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4465         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4466         relocations.
4467         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4468         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4469         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4470         * incremental.h
4471         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4472         function.
4473         (Incremental_binary::apply_incremental_relocs): New function.
4474         (Incremental_binary::do_apply_incremental_relocs): New function.
4475         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4476         data member.
4477         (Sized_incremental_binary::add_global_symbol): New function.
4478         (Sized_incremental_binary::global_symbol): New function.
4479         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4480         (Sized_incremental_binary::symbol_map_): New data member.
4481         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4482         * target.h (Sized_target::apply_relocation): New function.
4483         * target-reloc.h (apply_relocation): New function.
4484         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4485
4486 2011-04-22  Doug Kwan  <dougkwan@google.com>
4487
4488         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4489         flag of a SHT_ARM_EXIDX section.
4490         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4491         * testsuite/Makefile.in: Regenerate.
4492         * testsuite/arm_exidx_test.s: New file.
4493         * testsuite/arm_exidx_test.sh: Same.
4494
4495 2011-04-20 Cary Coutant  <ccoutant@google.com>
4496
4497         PR gold/12689
4498         * archive.h (Incremental_archive_entry::Archive_member):
4499         Initialize arg_serial_ (second constructor).
4500
4501 2011-04-17  Ian Lance Taylor  <iant@google.com>
4502
4503         * object.cc (Relocate_info::location): Simplify location string.
4504         * errors.cc (Errors::error_at_location): Don't print program
4505         name.
4506         (Errors::warning_at_location): Likewise.
4507         (Errors::undefined_symbol): Likewise.
4508         * testsuite/debug_msg.sh: Update accordingly.
4509
4510 2011-04-14 Cary Coutant  <ccoutant@google.com>
4511
4512         * gold/layout.cc (Layout::symtab_section_offset): New function.
4513         * gold/layout.h (Layout::symtab_section_offset): New function.
4514         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4515
4516 2011-04-12  Ian Lance Taylor  <iant@google.com>
4517
4518         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4519         with MREMAP_MAYMOVE.
4520         * output.h (class Output_file): Add map_is_allocated_ field.
4521         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4522         not available, provide stubs.  If mremap is not available, #define
4523         it to gold_mremap.
4524         (MREMAP_MAYMOVE): Define if not defined.
4525         (Output_file::Output_file): Initialize map_is_allocated_.
4526         (Output_file::resize): Check map_is_allocated_.
4527         (Output_file::map_anonymous): If mmap fails, use malloc.
4528         (Output_file::unmap): Don't do anything for an anonymous map.
4529         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4530         is not available, provide stubs.
4531         (File_read::View::~View): Use free rather than delete[].
4532         (File_read::make_view): Use malloc rather than new[].  If mmap
4533         fails, use malloc.
4534         (File_read::find_or_make_view): Use malloc rather than new[].
4535         * gold.h: Remove HAVE_REMAP code.
4536         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4537         exists.  Rename mremap to gold_mremap.  If mmap is not available
4538         don't do anything.
4539         * configure, config.in: Rebuild.
4540
4541 2011-04-11  Ian Lance Taylor  <iant@google.com>
4542
4543         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4544         initialize local variable v.
4545
4546 2011-04-11  Cary Coutant  <ccoutant@google.com>
4547
4548         * archive.cc (Archive::include_member): Adjust call to
4549         report_object.
4550         (Add_archive_symbols::run): Track argument serial numbers.
4551         (Lib_group::include_member): Likewise.
4552         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4553         * archive.h (Incremental_archive_entry::Archive_member):
4554         Initialize arg_serial_.
4555         (Archive_member::arg_serial_): New data member.
4556         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4557         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4558         incremental link.
4559         (Sized_dynobj::do_for_all_local_got_entries): New function.
4560         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4561         function.
4562         * fileread.cc (get_mtime): New function.
4563         * fileread.h (get_mtime): New function.
4564         * gold.cc (queue_initial_tasks): Check for incremental update.
4565         (process_incremental_input): New function.
4566         (queue_middle_tasks): Don't force valid target for incremental
4567         update.
4568         * incremental-dump.cc (find_input_containing_global): Adjust
4569         size of symbol info entry.
4570         (dump_incremental_inputs): Dump argument serial number and
4571         in_system_directory flag; bias shndx by 1; print symbol names
4572         when dumping per-file symbol lists; use new symbol info readers.
4573         * incremental.cc
4574         (Output_section_incremental_inputs:update_data_size): New function.
4575         (Sized_incremental_binary::setup_readers): Setup input readers
4576         for each input file; build maps for files added from libraries
4577         and scripts.
4578         (Sized_incremental_binary::check_input_args): New function.
4579         (Sized_incremental_binary::do_check_inputs): Build map of argument
4580         serial numbers to input arguments.
4581         (Sized_incremental_binary::do_file_has_changed): Rename
4582         do_file_is_unchanged to this; compare file modification times.
4583         (Sized_incremental_binary::do_init_layout): New function.
4584         (Sized_incremental_binary::do_reserve_layout): New function.
4585         (Sized_incremental_binary::do_get_input_reader): Remove.
4586         (Sized_incremental_binary::get_symtab_view): New function.
4587         (Incremental_checker::can_incrementally_link_output_file): Remove.
4588         (Incremental_inputs::report_command_line): Exclude --debug options.
4589         (Incremental_inputs::report_archive_begin): Add parameter; track
4590         argument serial numbers; don't put input file entry for archive
4591         before archive members.
4592         (Incremental_inputs::report_archive_end): Put input file entry
4593         for archive after archive members.
4594         (Incremental_inputs::report_object): Add parameter; track argument
4595         serial numbers and in_system_directory flag.
4596         (Incremental_inputs::report_script): Add parameter; track argument
4597         serial numbers.
4598         (Output_section_incremental_inputs::set_final_data_size): Adjust
4599         size of symbol info entry; check for forwarding symbols.
4600         (Output_section_incremental_inputs::write_input_files): Write
4601         in_system_directory flag and argument serial number.
4602         (Output_section_incremental_inputs::write_info_blocks): Map section
4603         indices between incremental info and original input file; store
4604         input section index for each symbol.
4605         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4606         change operator() to visit().
4607         (class Global_got_offset_visitor): Likewise.
4608         (class Global_symbol_visitor_got_plt):
4609         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4610         classes.
4611         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4612         (Sized_incr_relobj::do_read_symbols): New function.
4613         (Sized_incr_relobj::do_layout): New function.
4614         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4615         (Sized_incr_relobj::do_add_symbols): New function.
4616         (Sized_incr_relobj::do_should_include_member): New function.
4617         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4618         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4619         (Sized_incr_relobj::do_section_size): New function.
4620         (Sized_incr_relobj::do_section_name): New function.
4621         (Sized_incr_relobj::do_section_contents): New function.
4622         (Sized_incr_relobj::do_section_flags): New function.
4623         (Sized_incr_relobj::do_section_entsize): New function.
4624         (Sized_incr_relobj::do_section_address): New function.
4625         (Sized_incr_relobj::do_section_type): New function.
4626         (Sized_incr_relobj::do_section_link): New function.
4627         (Sized_incr_relobj::do_section_info): New function.
4628         (Sized_incr_relobj::do_section_addralign): New function.
4629         (Sized_incr_relobj::do_initialize_xindex): New function.
4630         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4631         (Sized_incr_relobj::do_read_relocs): New function.
4632         (Sized_incr_relobj::do_gc_process_relocs): New function.
4633         (Sized_incr_relobj::do_scan_relocs): New function.
4634         (Sized_incr_relobj::do_count_local_symbols): New function.
4635         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4636         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4637         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4638         (Sized_incr_relobj::do_relocate): New function.
4639         (Sized_incr_relobj::do_set_section_offset): New function.
4640         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4641         (Sized_incr_dynobj::do_read_symbols): New function.
4642         (Sized_incr_dynobj::do_layout): New function.
4643         (Sized_incr_dynobj::do_add_symbols): New function.
4644         (Sized_incr_dynobj::do_should_include_member): New function.
4645         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4646         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4647         (Sized_incr_dynobj::do_section_size): New function.
4648         (Sized_incr_dynobj::do_section_name): New function.
4649         (Sized_incr_dynobj::do_section_contents): New function.
4650         (Sized_incr_dynobj::do_section_flags): New function.
4651         (Sized_incr_dynobj::do_section_entsize): New function.
4652         (Sized_incr_dynobj::do_section_address): New function.
4653         (Sized_incr_dynobj::do_section_type): New function.
4654         (Sized_incr_dynobj::do_section_link): New function.
4655         (Sized_incr_dynobj::do_section_info): New function.
4656         (Sized_incr_dynobj::do_section_addralign): New function.
4657         (Sized_incr_dynobj::do_initialize_xindex): New function.
4658         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4659         (make_sized_incremental_object): New function.
4660         (Incremental_library::copy_unused_symbols): New function.
4661         (Incremental_library::do_for_all_unused_symbols): New function.
4662         * incremental.h (enum Incremental_input_flags): New type.
4663         (class Incremental_checker): Remove.
4664         (Incremental_input_entry::Incremental_input_entry): Add argument
4665         serial number.
4666         (Incremental_input_entry::arg_serial): New function.
4667         (Incremental_input_entry::set_is_in_system_directory): New function.
4668         (Incremental_input_entry::is_in_system_directory): New function.
4669         (Incremental_input_entry::arg_serial_): New data member.
4670         (Incremental_input_entry::is_in_system_directory_): New data member.
4671         (class Script_info): Move here from script.h.
4672         (Script_info::Script_info): Add filename parameter.
4673         (Script_info::filename): New function.
4674         (Script_info::filename_): New data member.
4675         (Incremental_script_entry::Incremental_script_entry): Add argument
4676         serial number.
4677         (Incremental_object_entry::Incremental_object_entry): Likewise.
4678         (Incremental_object_entry::add_input_section): Build list of input
4679         sections with map to original shndx.
4680         (Incremental_object_entry::get_input_section_index): New function.
4681         (Incremental_object_entry::shndx_): New data member.
4682         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4683         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4684         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4685         serial number.
4686         (Incremental_inputs::report_archive_begin): Likewise.
4687         (Incremental_inputs::report_object): Likewise.
4688         (Incremental_inputs::report_script): Likewise.
4689         (class Incremental_global_symbol_reader): New class.
4690         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4691         and store flags and input file type.
4692         (Incremental_input_entry_reader::arg_serial): New function.
4693         (Incremental_input_entry_reader::type): Extract type from flags.
4694         (Incremental_input_entry_reader::is_in_system_directory): New function.
4695         (Incremental_input_entry_reader::get_input_section_count): Call
4696         accessor function for type.
4697         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4698         function for type; adjust size of global symbol entry.
4699         (Incremental_input_entry_reader::get_global_symbol_count): Call
4700         accessor function for type.
4701         (Incremental_input_entry_reader::get_object_count): Likewise.
4702         (Incremental_input_entry_reader::get_object_offset): Likewise.
4703         (Incremental_input_entry_reader::get_member_count): Likewise.
4704         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4705         (Incremental_input_entry_reader::get_member_offset): Likewise.
4706         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4707         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4708         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4709         (Incremental_input_entry_reader::get_global_symbol_reader): New
4710         function.
4711         (Incremental_input_entry_reader::get_output_symbol_index): New
4712         function.
4713         (Incremental_input_entry_reader::type_): Remove.
4714         (Incremental_input_entry_reader::flags_): New data member.
4715         (Incremental_inputs_reader::input_file_offset): New function.
4716         (Incremental_inputs_reader::input_file_index): New function.
4717         (Incremental_inputs_reader::input_file): Call input_file_offset.
4718         (Incremental_inputs_reader::input_file_at_offset): New function.
4719         (Incremental_relocs_reader::get_r_type): Reformat.
4720         (Incremental_relocs_reader::get_r_shndx): Reformat.
4721         (Incremental_relocs_reader::get_r_offset): Reformat.
4722         (Incremental_relocs_reader::data): New function.
4723         (Incremental_binary::Incremental_binary): Initialize new data members.
4724         (Incremental_binary::check_inputs): Add cmdline parameter.
4725         (Incremental_binary::file_is_unchanged): Remove.
4726         (Input_reader::arg_serial): New function.
4727         (Input_reader::get_unused_symbol_count): New function.
4728         (Input_reader::get_unused_symbol): New function.
4729         (Input_reader::do_arg_serial): New function.
4730         (Input_reader::do_get_unused_symbol_count): New function.
4731         (Input_reader::do_get_unused_symbol): New function.
4732         (Incremental_binary::input_file_count): New function.
4733         (Incremental_binary::get_input_reader): Change signature to use
4734         index instead of filename.
4735         (Incremental_binary::file_has_changed): New function.
4736         (Incremental_binary::get_input_argument): New function.
4737         (Incremental_binary::get_library): New function.
4738         (Incremental_binary::get_script_info): New function.
4739         (Incremental_binary::init_layout): New function.
4740         (Incremental_binary::reserve_layout): New function.
4741         (Incremental_binary::output_file): New function.
4742         (Incremental_binary::do_check_inputs): New function.
4743         (Incremental_binary::do_file_is_unchanged): Remove.
4744         (Incremental_binary::do_file_has_changed): New function.
4745         (Incremental_binary::do_init_layout): New function.
4746         (Incremental_binary::do_reserve_layout): New function.
4747         (Incremental_binary::do_input_file_count): New function.
4748         (Incremental_binary::do_get_input_reader): Change signature.
4749         (Incremental_binary::input_args_map_): New data member.
4750         (Incremental_binary::library_map_): New data member.
4751         (Incremental_binary::script_map_): New data member.
4752         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4753         new data members.
4754         (Sized_incremental_binary::output_section): New function.
4755         (Sized_incremental_binary::inputs_reader): Add const.
4756         (Sized_incremental_binary::symtab_reader): Add const.
4757         (Sized_incremental_binary::relocs_reader): Add const.
4758         (Sized_incremental_binary::got_plt_reader): Add const.
4759         (Sized_incremental_binary::get_symtab_view): New function.
4760         (Sized_incremental_binary::Inputs_reader): New typedef.
4761         (Sized_incremental_binary::Input_entry_reader): New typedef.
4762         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4763         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4764         (Sized_incremental_binary::do_file_has_changed): New function.
4765         (Sized_incremental_binary::do_init_layout): New function.
4766         (Sized_incremental_binary::do_reserve_layout): New function.
4767         (Sized_input_reader::Inputs_reader): Remove.
4768         (Sized_input_reader::Input_entry_reader): Remove.
4769         (Sized_input_reader::do_arg_serial): New function.
4770         (Sized_input_reader::do_get_unused_symbol_count): New function.
4771         (Sized_input_reader::do_get_unused_symbol): New function.
4772         (Sized_incremental_binary::do_input_file_count): New function.
4773         (Sized_incremental_binary::do_get_input_reader): Change signature;
4774         use index instead of filename.
4775         (Sized_incremental_binary::section_map_): New data member.
4776         (Sized_incremental_binary::input_entry_readers_): New data member.
4777         (class Sized_incr_relobj): New class.
4778         (class Sized_incr_dynobj): New class.
4779         (make_sized_incremental_object): New function.
4780         (class Incremental_library): New class.
4781         * layout.cc (Free_list::num_lists): New static data member.
4782         (Free_list::num_nodes): New static data member.
4783         (Free_list::num_removes): New static data member.
4784         (Free_list::num_remove_visits): New static data member.
4785         (Free_list::num_allocates): New static data member.
4786         (Free_list::num_allocate_visits): New static data member.
4787         (Free_list::init): New function.
4788         (Free_list::remove): New function.
4789         (Free_list::allocate): New function.
4790         (Free_list::dump): New function.
4791         (Free_list::print_stats): New function.
4792         (Layout_task_runner::run): Resize output file for incremental updates.
4793         (Layout::Layout): Initialize new data members.
4794         (Layout::set_incremental_base): New function.
4795         (Layout::init_fixed_output_section): New function.
4796         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4797         incremental updates.
4798         (Layout::create_gold_note): Do not create gold note section for
4799         incremental updates.
4800         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4801         for incremental updates.
4802         (Layout::set_section_offsets): For incremental updates, allocate space
4803         from free list.
4804         (Layout::create_symtab_sections): Layout with offsets relative to
4805         start of section; for incremental updates, allocate space from free
4806         list.
4807         (Layout::create_shdrs): For incremental updates, allocate space from
4808         free list.
4809         (Layout::finish_dynamic_section): For incremental updates, do not
4810         check --as-needed (fixed in subsequent patch).
4811         * layout.h (class Free_list): New class.
4812         (Layout::set_incremental_base): New function.
4813         (Layout::incremental_base): New function.
4814         (Layout::init_fixed_output_section): New function.
4815         (Layout::allocate): New function.
4816         (Layout::incremental_base_): New data member.
4817         (Layout::free_list_): New data member.
4818         * main.cc (main): Print Free_list statistics.
4819         * object.cc (Relobj::finalize_incremental_relocs): Add
4820         clear_counts parameter; clear counts only when clear_counts is set.
4821         (Sized_relobj::Sized_relobj): Initialize new base class.
4822         (Sized_relobj::do_layout): Don't report special sections.
4823         (Sized_relobj::do_for_all_local_got_entries): New function.
4824         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4825         symtab_off to all symbol table offsets.
4826         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4827         * object.h (class Got_offset_list): Move to top of file.
4828         (Object::Object): Allow case where input_file == NULL.
4829         (Object::~Object): Likewise.
4830         (Object::input_file): Assert that input_file != NULL.
4831         (Object::lock): Allow case where input_file == NULL.
4832         (Object::unlock): Likewise.
4833         (Object::is_locked): Likewise.
4834         (Object::token): Likewise.
4835         (Object::release): Likewise.
4836         (Object::is_incremental): New function.
4837         (Object::get_mtime): New function.
4838         (Object::for_all_local_got_entries): New function.
4839         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4840         (Object::set_is_in_system_directory): New function.
4841         (Object::is_in_system_directory): New function.
4842         (Object::do_is_incremental): New function.
4843         (Object::do_get_mtime): New function.
4844         (Object::do_for_all_local_got_entries): New function.
4845         (Object::is_in_system_directory_): New data member.
4846         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4847         (class Sized_relobj_base): New class.
4848         (class Sized_relobj): Derive from Sized_relobj_base.
4849         (class Sized_relobj::Symbols): Redeclare from base class.
4850         (class Sized_relobj::local_got_offset_list): Remove.
4851         (class Sized_relobj::Output_sections): Redeclare from base class.
4852         (class Sized_relobj::do_for_all_local_got_entries): New function.
4853         (class Sized_relobj::write_local_symbols): Add offset parameter.
4854         (class Sized_relobj::local_symbol_offset_): Update comment.
4855         (class Sized_relobj::local_dynsym_offset_): Update comment.
4856         * options.cc (Input_arguments::add_file): Remove const.
4857         * options.h (Input_file_argument::Input_file_argument):
4858         Initialize arg_serial_ (all constructors).
4859         (Input_file_argument::set_arg_serial): New function.
4860         (Input_file_argument::arg_serial): New function.
4861         (Input_file_argument::arg_serial_): New data member.
4862         (Input_arguments::Input_arguments): Initialize file_count_.
4863         (Input_arguments::add_file): Remove const.
4864         (Input_arguments::number_of_input_files): New function.
4865         (Input_arguments::file_count_): New data member.
4866         (Command_line::number_of_input_files): Call
4867         Input_arguments::number_of_input_files.
4868         * output.cc (Output_segment_headers::Output_segment_headers):
4869         Set current size.
4870         (Output_section::Input_section::current_data_size): New function.
4871         (Output_section::Output_section): Initialize new data members.
4872         (Output_section::add_input_section): Don't do merge sections for
4873         an incremental link; allocate space from free list for an
4874         incremental update.
4875         (Output_section::add_output_section_data): Allocate space from
4876         free list for an incremental update.
4877         (Output_section::update_data_size): New function.
4878         (Output_section::set_fixed_layout): New function.
4879         (Output_section::reserve): New function.
4880         (Output_segment::set_section_addresses): Remove const.
4881         (Output_segment::set_section_list_addresses): Remove const; allocate
4882         space from free list for an incremental update.
4883         (Output_segment::set_offset): Adjust size of RELRO segment for an
4884         incremental update.
4885         * output.h (Output_data::current_data_size): Move here from
4886         child classes.
4887         (Output_data::pre_finalize_data_size): New function.
4888         (Output_data::update_data_size): New function.
4889         (Output_section_headers::update_data_size): new function.
4890         (Output_section_data_build::current_data_size): Move to Output_data.
4891         (Output_data_strtab::update_data_size): New function.
4892         (Output_section::current_data_size): Move to Output_data.
4893         (Output_section::set_fixed_layout): New function.
4894         (Output_section::has_fixed_layout): New function.
4895         (Output_section::reserve): New function.
4896         (Output_section::update_data_size): New function.
4897         (Output_section::has_fixed_layout_): New data member.
4898         (Output_section::free_list_): New data member.
4899         (Output_segment::set_section_addresses): Remove const.
4900         (Output_segment::set_section_list_addresses): Remove const.
4901         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4902         New function.
4903         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4904         New function.
4905         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4906         parameter when calling Add_symbols constructor; store argument
4907         serial number for members of a lib group.
4908         (Add_symbols::locks): Allow case where token == NULL.
4909         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4910         (Read_member::~Read_member): New function.
4911         (Read_member::is_runnable): New function.
4912         (Read_member::locks): New function.
4913         (Read_member::run): New function.
4914         (Check_script::~Check_script): New function.
4915         (Check_script::is_runnable): New function.
4916         (Check_script::locks): New function.
4917         (Check_script::run): New function.
4918         (Check_library::~Check_library): New function.
4919         (Check_library::is_runnable): New function.
4920         (Check_library::locks): New function.
4921         (Check_library::run): New function.
4922         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4923         (Add_symbols::library_): New data member.
4924         (class Read_member): New class.
4925         (class Check_script): New class.
4926         (class Check_library): New class.
4927         * reloc.cc (Read_relocs::is_runnable): Allow case where
4928         token == NULL.
4929         (Read_relocs::locks): Likewise.
4930         (Scan_relocs::locks): Likewise.
4931         (Relocate_task::locks): Likewise.
4932         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4933         to clear counters.
4934         (Sized_relobj::incremental_relocs_scan): Fix comment.
4935         (Sized_relobj::do_relocate): Pass output file offset to
4936         write_local_symbols.
4937         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4938         from class declaration.
4939         * script.cc (read_input_script): Allocate Script_info; pass
4940         argument serial number to report_script.
4941         * script.h (class Script_info): Move to incremental.h.
4942         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4943         * symtab.h (Symbol_table::add_from_incrobj): New function.
4944         (Symbol_table::set_file_offset): New function.
4945
4946 2011-04-05  Cary Coutant  <ccoutant@google.com>
4947
4948         * incremental-dump.cc (dump_incremental_inputs): Change signature
4949         to take a Sized_incremental_binary; change caller.  Use readers
4950         in Sized_incremental_binary.
4951         * incremental.cc
4952         (Sized_incremental_binary::find_incremental_inputs_sections):
4953         Rename do_find_incremental_inputs_sections to this.
4954         (Sized_incremental_binary::setup_readers): New function.
4955         (Sized_incremental_binary::do_check_inputs): Check
4956         has_incremental_info_ flag; move setup code to setup_readers;
4957         use input readers.
4958         (Sized_incremental_binary::do_file_is_unchanged): New function.
4959         (Sized_incremental_binary::do_get_input_reader): New function.
4960         * incremental.h (class Incremental_binary): Move to end of file.
4961         (Incremental_binary::file_is_unchanged): New function.
4962         (Incremental_binary::do_file_is_unchanged): New function.
4963         (Incremental_binary::Input_reader): New class.
4964         (Incremental_binary::get_input_reader): New function.
4965         (class Sized_incremental_binary): Move to end of file.
4966         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4967         input section reader classes.
4968         (Sized_incremental_binary::has_incremental_info): New function.
4969         (Sized_incremental_binary::inputs_reader): New function.
4970         (Sized_incremental_binary::symtab_reader): New function.
4971         (Sized_incremental_binary::relocs_reader): New function.
4972         (Sized_incremental_binary::got_plt_reader): New function.
4973         (Sized_incremental_binary::do_file_is_unchanged): New function.
4974         (Sized_incremental_binary::Sized_input_reader): New class.
4975         (Sized_incremental_binary::get_input_reader): New function.
4976         (Sized_incremental_binary::find_incremental_inputs_sections):
4977         Rename do_find_incremental_inputs_sections to this.
4978         (Sized_incremental_binary::setup_readers): New function.
4979         (Sized_incremental_binary::has_incremental_info_): New data member.
4980         (Sized_incremental_binary::inputs_reader_): New data member.
4981         (Sized_incremental_binary::symtab_reader_): New data member.
4982         (Sized_incremental_binary::relocs_reader_): New data member.
4983         (Sized_incremental_binary::got_plt_reader_): New data member.
4984         (Sized_incremental_binary::current_input_file_): New data member.
4985
4986 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4987
4988         PR gold/12640
4989         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4990         violation.
4991
4992 2011-03-30  Cary Coutant  <ccoutant@google.com>
4993
4994         * archive.cc (Archive::include_member): Adjust call to report_object.
4995         (Add_archive_symbols::run): Add script_info to call to
4996         report_archive_begin.
4997         (Lib_group::include_member): Adjust call to report_object.
4998         (Add_lib_group_symbols::run): Adjust call to report_object.
4999         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5000         blocks.  Add object count for script input files.
5001         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5002         script_info parameter; change all callers.
5003         (Incremental_inputs::report_object): Add script_info parameter;
5004         change all callers.
5005         (Incremental_inputs::report_script): Store backpointer to
5006         incremental info entry.
5007         (Output_section_incremental_inputs::set_final_data_size): Record
5008         additional information for scripts.
5009         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5010         * incremental.h (Incremental_script_entry::add_object): New function.
5011         (Incremental_script_entry::get_object_count): New function.
5012         (Incremental_script_entry::get_object): New function.
5013         (Incremental_script_entry::objects_): New data member; adjust
5014         constructor.
5015         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5016         (Incremental_inputs::report_object): Add script_info parameter.
5017         (Incremental_inputs_reader::get_object_count): New function.
5018         (Incremental_inputs_reader::get_object_offset): New function.
5019         * options.cc (Input_arguments::add_file): Return reference to
5020         new input argument.
5021         * options.h (Input_argument::set_script_info): New function.
5022         (Input_argument::script_info): New function.
5023         (Input_argument::script_info_): New data member; adjust all
5024         constructors.
5025         (Input_file_group::add_file): Return reference to new input argument.
5026         (Input_file_lib::add_file): Likewise.
5027         (Input_arguments::add_file): Likewise.
5028         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5029         * script.cc (Parser_closure::Parser_closure): Add script_info
5030         parameter; adjust all callers.
5031         (Parser_closure::script_info): New function.
5032         (Parser_closure::script_info_): New data member.
5033         (read_input_script): Report scripts earlier to incremental info.
5034         (script_add_file): Set script_info in Input_argument.
5035         (script_add_library): Likewise.
5036         * script.h (Script_options::Script_info): Rewrite class.
5037
5038 2011-03-29  Cary Coutant  <ccoutant@google.com>
5039
5040         * archive.cc (Library_base::should_include_member): Move
5041         method here from class Archive.
5042         (Archive::Archive): Initialize base class.
5043         (Archive::should_include_member): Move to base class.
5044         (Archive::do_for_all_unused_symbols): New function.
5045         (Add_archive_symbols::run): Remove redundant access to
5046         incremental_inputs.
5047         (Lib_group::Lib_group): Initialize base class.
5048         (Lib_group::do_filename): New function.
5049         (Lib_group::include_member): Pass pointer to Lib_group to
5050         report_object.
5051         (Lib_group::do_for_all_unused_symbols): New function.
5052         (Add_lib_group_symbols::run): Report archive information for
5053         incremental links.
5054         * archive.h (class Library_base): New base class.
5055         (class Archive): Derive from Library_base.
5056         (Archive::filename): Move to base class.
5057         (Archive::set_incremental_info): Likewise.
5058         (Archive::incremental_info): Likewise.
5059         (Archive::Should_include): Likewise.
5060         (Archive::should_include_member): Likewise.
5061         (Archive::Armap_entry): Remove.
5062         (Archive::Unused_symbol_iterator): Remove.
5063         (Archive::unused_symbols_begin): Remove.
5064         (Archive::unused_symbols_end): Remove.
5065         (Archive::do_filename): New function.
5066         (Archive::do_get_mtime): New function.
5067         (Archive::do_for_all_unused_symbols): New function.
5068         (Archive::task_): Move to base class.
5069         (Archive::incremental_info_): Likewise.
5070         (class Lib_group): Derive from Library_base.
5071         (Lib_group::do_filename): New function.
5072         (Lib_group::do_get_mtime): New function.
5073         (Lib_group::do_for_all_unused_symbols): New function.
5074         (Lib_group::task_): Move to base class.
5075         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5076         function.
5077         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5078         function.
5079         * incremental.cc (Incremental_inputs::report_archive_begin):
5080         Use Library_base; call library's get_mtime; add incremental inputs
5081         entry before members.
5082         (class Unused_symbol_visitor): New class.
5083         (Incremental_inputs::report_archive_end): Use Library_base; use
5084         visitor class to record unused symbols; don't add incremental inputs
5085         entry after members.
5086         (Incremental_inputs::report_object): Use Library_base.
5087         * incremental.h
5088         (Incremental_archive_entry::Incremental_archive_entry): Remove
5089         unused Archive parameter.
5090         (Incremental_inputs::report_archive_begin): Use Library_base.
5091         (Incremental_inputs::report_archive_end): Likewise.
5092         (Incremental_inputs::report_object): Likewise.
5093         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5094         function.
5095         * object.h (Object::for_all_global_symbols): New function.
5096         (Object::do_for_all_global_symbols): New function.
5097         (Sized_relobj::do_for_all_global_symbols): New function.
5098         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5099         function.
5100         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5101         function.
5102
5103 2011-03-27  Ian Lance Taylor  <iant@google.com>
5104
5105         * archive.cc (Archive::interpret_header): Return -1 if something
5106         goes wrong.  Change callers accordingly.
5107
5108 2011-03-25  Cary Coutant  <ccoutant@google.com>
5109
5110         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5111         * testsuite/Makefile.in: Regenerate.
5112
5113 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5114
5115         * plugin.cc (get_view): New.
5116         (Plugin::load): Pass get_view to the plugin.
5117         (Plugin_manager::get_view): New.
5118
5119 2011-03-21  Ian Lance Taylor  <iant@google.com>
5120
5121         * testsuite/final_layout.sh: Rewrite to not use dc.
5122         * testsuite/relro_test.sh: Fail if dc is not present.
5123
5124 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5125
5126         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5127         Change == to -eq.
5128         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5129         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5130         Change == to -eq.
5131         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5132         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5133
5134 2011-03-14  Ian Lance Taylor  <iant@google.com>
5135
5136         * script-sections.cc (Sort_output_sections::script_compare):
5137         Rename from is_before, change return type.
5138         (Sort_output_sections::operator()): Adjust accordingly.
5139
5140 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5141
5142         PR gold/12572
5143         * testsuite/odr_violation2.cc: Add comment to make all error line
5144         numbers double digits.
5145         * testsuite/debug_msg.sh: Adjust expected errors.
5146
5147 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5148
5149         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5150         but mark earlier ones as non-canonical
5151         (offset_to_iterator): Update search target and example
5152         (do_addr2line): Return extra lines in a vector*
5153         (format_file_lineno): Extract from do_addr2line
5154         (one_addr2line): Add vector* out-param
5155         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5156         when a lineno entry appeared last for its instruction
5157         (Dwarf_line_info): Add vector* out-param
5158         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5159         * symtab.cc (Odr_violation_compare): Include the lineno in the
5160         comparison again.
5161         (linenos_from_loc): New. Combine the canonical line for an
5162         address with its other lines.
5163         (True_if_intersect): New. Helper functor to make
5164         std::set_intersection a query.
5165         (detect_odr_violations): Compare sets of lines instead of just
5166         one line for each function. This became less deterministic, but
5167         has fewer false positives.
5168         * symtab.h: Declarations.
5169         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5170         mix an optimized and non-optimized object in the same binary
5171         (odr_violation2.so): Same.
5172         * testsuite/Makefile.in: Regenerate from Makefile.am.
5173         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5174         * testsuite/debug_msg.sh: Update line numbers and add
5175         assertions.
5176         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5177         non-optimized context.
5178         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5179         isn't inlined, and use OdrDerived in an optimized context.
5180         * testsuite/odr_header1.h: Defines OdrDerived, where
5181         optimization will change the
5182         first-instruction-in-the-destructor's file and line number.
5183         * testsuite/odr_header2.h: Defines OdrBase.
5184
5185 2011-03-09  Ian Lance Taylor  <iant@google.com>
5186
5187         * fileread.cc (File_read::clear_views): Don't delete the whole
5188         file view.
5189
5190 2011-03-08  Ian Lance Taylor  <iant@google.com>
5191
5192         PR gold/12525
5193         * fileread.cc: #include <climits>.
5194         (GOLD_IOV_MAX): Define.
5195         (File_read::read_multiple): Limit number of entries by iov_max.
5196         * fileread.h (class File_read): Always set max_readv_entries to
5197         128.
5198
5199 2011-03-07  Ian Lance Taylor  <iant@google.com>
5200
5201         PR gold/12525
5202         * options.h (class General_options): Add -dy and -dn.
5203
5204 2011-03-02  Cary Coutant  <ccoutant@google.com>
5205
5206         * testsuite/script_test_9.t: Add TLS segment.
5207
5208 2011-03-02  Simon Baldwin  <simonb@google.com>
5209
5210         * configure.ac: Add check for gnu_indirect_function support in
5211         the toolchain building binutils.
5212         * configure: Rebuild.
5213
5214 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5215
5216         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5217         plugin only symbols.
5218         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5219         in plugin files as not needed in the symbol table.
5220
5221 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5222
5223         * output.cc (Output_section::add_input_section): Delay fill
5224         generation for section ordering.
5225
5226 2011-02-09  Ian Lance Taylor  <iant@google.com>
5227
5228         PR gold/12316
5229         * object.h (class Sized_relobj): Remove clear_local_symbols.
5230         * reloc.cc (Sized_relobj::do_relocate): Don't call
5231         clear_local_symbols.
5232
5233 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5234
5235         * plugin.cc (is_visible_from_outside): Return true for symbols
5236         in the -u option.
5237
5238 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5239
5240         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5241         filename.
5242
5243 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5244
5245         * icf.h (is_section_foldable_candidate): Change type of parameter
5246         to std::string.
5247         * icf.cc (Icf::find_identical_sections): Change type of local variable
5248         section_name to be std::string.
5249         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5250
5251 2011-01-25  Ian Lance Taylor  <iant@google.com>
5252
5253         * script.cc (script_add_extern): Rewrite to use
5254         add_symbol_reference.
5255
5256 2011-01-25  Doug Kwan  <dougkwan@google.com>
5257
5258         * icf.cc (get_section_contents): Always lock section's object.
5259
5260 2011-01-24  Ian Lance Taylor  <iant@google.com>
5261
5262         * options.h (class General_options): Accept
5263         --no-detect-odr-violations.
5264
5265 2011-01-24  Ian Lance Taylor  <iant@google.com>
5266
5267         * version.cc (version_string): Bump to 1.11.
5268
5269 2011-01-24  Ian Lance Taylor  <iant@google.com>
5270
5271         * plugin.cc (class Plugin_rescan): Define new class.
5272         (Plugin_manager::claim_file): Set any_claimed_.
5273         (Plugin_manager::save_archive): New function.
5274         (Plugin_manager::save_input_group): New function.
5275         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5276         necessary.
5277         (Plugin_manager::new_undefined_symbol): New function.
5278         (Plugin_manager::rescan): New function.
5279         (Plugin_manager::rescannable_defines): New function.
5280         (Plugin_manager::add_input_file): Set any_added_.
5281         * plugin.h (class Plugin_manager): define new fields rescannable_,
5282         undefined_symbols_, any_claimed_, and any_added_.  Declare
5283         Plugin_rescan as friend.  Declare new functions.
5284         (Plugin_manager::Rescannable): Define type.
5285         (Plugin_manager::Rescannable_list): Define type.
5286         (Plugin_manager::Undefined_symbol_list): Define type.
5287         (Plugin_manager::Plugin_manager): Initialize new fields.
5288         * archive.cc (Archive::defines_symbol): New function.
5289         (Add_archive_symbols::run): Pass archive to plugins if any.
5290         * archive.h (class Archive): Declare defines_symbol.
5291         * readsyms.cc (Input_group::~Input_group): New function.
5292         (Finish_group::run): Pass input_group to plugins if any.
5293         * readsyms.h (class Input_group): Declare destructor.
5294         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5295         any.
5296
5297 2011-01-10  Ian Lance Taylor  <iant@google.com>
5298
5299         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5300         section as relro.
5301         (Layout::set_segment_offsets): Reset increase_relro before calling
5302         set_section_addresses a second time.
5303
5304 2011-01-04  Cary Coutant  <ccoutant@google.com>
5305
5306         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5307         sections before NOBITS sections.
5308
5309 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5310
5311         * version.cc (print_version): Update copyright to 2011.
5312
5313 2010-12-23  Cary Coutant  <ccoutant@google.com>
5314
5315         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5316         of OS to this->add.  Add OD parameter to second form of the function.
5317
5318 2010-12-20  Ian Lance Taylor  <iant@google.com>
5319
5320         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5321         second of two consecutive entries with same offset.
5322
5323 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5324
5325         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5326         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5327         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5328         to avoid unneeded links against $(LDADD).
5329         * testsuite/Makefile.in: Regenerate.
5330
5331 2010-12-15  Ian Lance Taylor  <iant@google.com>
5332
5333         PR gold/12324
5334         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5335         for R_X86_64_32 and R_X86_64_PC32.
5336         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5337         ver_matching_def_pic.o.
5338         (ver_matching_def_pic.o): New target.
5339
5340 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5341
5342         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5343         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5344         Move definition before File_read::View member definitions.
5345         (File_read::View::~View): Initialize and hold lock before
5346         updating current_mapped_bytes.
5347
5348 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5349
5350         * dwarf_reader.cc: Remove outdated comment.
5351         * gold-threads.cc: Fix typo in error message.
5352         * archive.cc: Fix typos in comments.
5353         * archive.h: Likewise.
5354         * arm-reloc-property.cc: Likewise.
5355         * arm-reloc-property.h: Likewise.
5356         * arm-reloc.def: Likewise.
5357         * arm.cc: Likewise.
5358         * attributes.h: Likewise.
5359         * cref.cc: Likewise.
5360         * ehframe.cc: Likewise.
5361         * fileread.h: Likewise.
5362         * gold.h: Likewise.
5363         * i386.cc: Likewise.
5364         * icf.cc: Likewise.
5365         * incremental.h: Likewise.
5366         * int_encoding.cc: Likewise.
5367         * layout.h: Likewise.
5368         * main.cc: Likewise.
5369         * merge.h: Likewise.
5370         * object.cc: Likewise.
5371         * object.h: Likewise.
5372         * options.cc: Likewise.
5373         * readsyms.cc: Likewise.
5374         * reduced_debug_output.cc: Likewise.
5375         * reloc.cc: Likewise.
5376         * script-sections.cc: Likewise.
5377         * sparc.cc: Likewise.
5378         * symtab.h: Likewise.
5379         * target-reloc.h: Likewise.
5380         * target.cc: Likewise.
5381         * target.h: Likewise.
5382         * timer.cc: Likewise.
5383         * timer.h: Likewise.
5384         * x86_64.cc: Likewise.
5385
5386 2010-12-09  Cary Coutant  <ccoutant@google.com>
5387
5388         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5389         stack.
5390         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5391         parameter; change all callers.
5392         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5393         * options.h (warn_execstack): New option.
5394
5395 2010-12-07  Doug Kwan  <dougkwan@google.com>
5396
5397         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5398         like function call relocations.
5399
5400 2010-12-07  Ian Lance Taylor  <iant@google.com>
5401
5402         * archive.cc (Archive::get_elf_object_for_member): Permit
5403         punconfigured to be NULL.
5404         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5405         (Archive::include_member): Pass NULL to get_elf_object_for_member
5406         if we searched for the archive and this is the first included
5407         object.
5408
5409 2010-12-01  Ian Lance Taylor  <iant@google.com>
5410
5411         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5412         track_relocs_type_ field.
5413         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5414         Set track_relocs_type_.
5415         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5416         contents when using RELA relocs.
5417         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5418         reloc_map_.
5419         * reloc.cc (Track_relocs::next_addend): New function.
5420         * reloc.h (class Track_relocs): Declare next_addend.
5421
5422 2010-12-01  Ian Lance Taylor  <iant@google.com>
5423
5424         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5425         virtual destructor.
5426
5427 2010-12-01  Ian Lance Taylor  <iant@google.com>
5428
5429         * README: Update compilers known to work and fail.
5430
5431 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5432
5433         * configure.in: For --enable-gold, handle value `default' instead of
5434         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5435         not the default.
5436         * configure: Regenerate.
5437
5438 2010-11-18  Doug Kwan  <dougkwan@google.com>
5439
5440         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5441         and right_alignment to be zero.  Store result alignment only if it is
5442         greater than existing alignment.
5443
5444 2010-11-16  Cary Coutant  <ccoutant@google.com>
5445
5446         PR gold/12220
5447         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5448         Check for ".zdebug_line".
5449
5450 2010-11-16  Doug Kwan  <dougkwan@google.com>
5451             Cary Coutant  <ccoutant@google.com>
5452
5453         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5454         by reference; adjust all callers.
5455         * output.cc (Output_segment::set_section_addresses): Adjust references
5456         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5457         list is empty.
5458         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5459         end at page boundary.
5460
5461 2010-11-16  Cary Coutant  <ccoutant@google.com>
5462
5463         PR gold/12220
5464         * layout.cc (Layout::choose_output_section): Transform names of
5465         compressed sections even when using a script with a SECTIONS clause.
5466         (Layout::output_section_name): Remove code to transform
5467         compressed debug section names.
5468         * output.cc (Output_section::add_input_section): Use uncompressed
5469         section size when tracking input sections.
5470
5471 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5472
5473         * symtab.h (Symbol::NON_PIC_REF): Remove.
5474         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5475         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5476         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5477         (Symbol::use_plt_offset): Take a flags argument and pass it
5478         directly to needs_dynamic_reloc.  Restrict check for undefined
5479         weak symbols to function calls.
5480         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5481         (Target_arm::Scan::global): Use it.
5482         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5483         (Target_arm::Relocate::relocate): Likewise.
5484         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5485         parameter with an r_type parameter.  Use get_reference_flags
5486         to get the flags.
5487         (Target_arm::Relocate::relocate): Update accordingly.
5488         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5489         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5490         (Target_i386::Scan::global): Likewise.
5491         (Target_i386::Relocate::relocate): Likewise.
5492         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5493         parameter with an r_type parameter.  Use get_reference_flags
5494         to get the flags.
5495         (Target_i386::Relocate::relocate): Update accordingly.
5496         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5497         (Target_powerpc::Scan::global): Use it.
5498         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5499         (Target_powerpc::Relocate::relocate): Likewise.
5500         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5501         (Target_sparc::Scan::global): Use it.
5502         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5503         (Target_sparc::Relocate::relocate): Likewise.
5504         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5505         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5506         (Target_x86_64::Scan::global): Likewise.
5507         (Target_x86_64::Relocate::relocate): Likewise.
5508
5509 2010-11-08  Doug Kwan  <dougkwan@google.com>
5510             Cary Coutant  <ccoutant@google.com>
5511
5512         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5513         (Arm_exidx_merge_section::section_contents_): New data member.
5514         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5515         (Arm_input_section::~Arm_input_section): De-allocate memory.
5516         (Arm_input_section::original_contents_): New data member.
5517         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5518         in parameters instead of calling Object::section_contents without
5519         locking.
5520         (Arm_output_section::group_section): New parameter TASK.  Pass it
5521         to callees that need locking objects.
5522         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5523         to lock EXIDX input sections.  Fix a formatting issue.  Call
5524         Arm_exidx_merged_section::build_contents to create merged section
5525         contents.
5526         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5527         to lock object of stub table owner.
5528         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5529         TEXT_SIZE to initialize data member TEXT_SIZE_.
5530         (Arm_exidx_input_section::addralign): Fix typo in comment.
5531         (Arm_exidx_input_section::text_size): New method.
5532         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5533         that require locking objects.  Lock objects before scanning for stubs
5534         and updating local symbols.
5535         (Arm_input_section<big_endian>::init): Copy contents of original
5536         input section.
5537         (Arm_input_section<big_endian>::do_write): Use saved contents of
5538         original input section instead of calling Object::section_contents
5539         without locking.
5540         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5541         size without calling Object::section_size().
5542         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5543         for size.  Allocate a buffer for merged EXIDX entries.
5544         (Arm_exidx_merged_section::build_contents): New method.
5545         (Arm_exidx_merged_section::do_write): Move merge section contents
5546         building code to Arm_exidx_merged_section::build_contetns.  Write
5547         out contetns in buffer instead of building it on the fly.
5548         (Arm_relobj::make_exidx_input_section): Also pass text section size
5549         to Arm_exidx_input_section constructor.
5550         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5551         (Arm_dynobj::do_read_symbols): Fix memory leak.
5552         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5553         * target.h: (class Task): Add forward declaration.
5554         (Target::relax): Add new parameter TASK and pass it to
5555         Target::do_relax().
5556         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5557
5558 2010-11-05  Cary Coutant  <ccoutant@google.com>
5559
5560         PR gold/10708
5561         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5562         object when reading from the file.
5563         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5564         second layout pass.
5565         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5566         when reading section contents.
5567         (get_section_contents): Likewise.
5568         (icf::find_identical_sections): Likewise.
5569         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5570         object when reading from the file.
5571         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5572         the object when doing deferred section layout.
5573
5574 2010-11-03  Nick Clifton  <nickc@redhat.com>
5575
5576         PR gold/12001
5577         * script.h (class Symbol_assignment: name): New member.  Returns
5578         the name of the symbol.
5579         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5580         Returns true if the given symbol name is on the list of
5581         assignments wating to be processed.
5582         * archive.cc (should_incldue_member): If the symbol is undefined,
5583         check to see if it is on the list of symbols pending assignment.
5584
5585 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5586
5587         * script-sections.cc (Script_sections::find_memory_region): Check
5588         for a NULL output section pointer.
5589
5590 2010-10-29  Doug Kwan  <dougkwan@google.com>
5591
5592         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5593         Output_section::add_relaxed_input_section.
5594         * output.cc (Output_section::add_relaxed_input_section): Add new
5595         arguments LAYOUT and NAME.  Set section order index.
5596         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5597         Copy section order index.
5598         * output.h (Output_section::add_relaxed_input_section): Add new
5599         arguments LAYOUT and NAME.
5600
5601 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5602
5603         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5604         NATIVE_OR_CROSS_LINKER.
5605         * testsuite/Makefile.in: Regenerate.
5606
5607 2010-10-20  Doug Kwan  <dougkwan@google.com>
5608
5609         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5610         without SHF_LINK_ORDER flags.
5611         * layout.cc (Layout::choose_output_section): Do not filter
5612         SHF_LINK_ORDER flag in a relocatable link.
5613
5614 2010-10-17  Cary Coutant  <ccoutant@google.com>
5615
5616         * output.h (Output_segment::set_section_addresses): Change function
5617         signature.  Update all callers.
5618         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5619         sections.
5620         (Output_segment::set_section_addresses): Align after last TLS
5621         section.  Add padding before last relro section instead of after.
5622
5623 2010-10-17  Doug Kwan  <dougkwan@google.com>
5624
5625         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5626         GOT output section to be writable.
5627
5628 2010-10-14  Cary Coutant  <ccoutant@google.com>
5629
5630         * debug.h (DEBUG_INCREMENTAL): New flag.
5631         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5632         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5633         mode.
5634         * incremental.cc (report_command_line): Ignore all forms of
5635         --incremental.
5636         * layout.cc (Layout::Layout): Check parameters for incremental link
5637         mode.
5638         * options.cc (General_options::parse_incremental): New function.
5639         (General_options::parse_no_incremental): New function.
5640         (General_options::parse_incremental_full): New function.
5641         (General_options::parse_incremental_update): New function.
5642         (General_options::incremental_mode_): New data member.
5643         (General_options::finalize): Check incremental_mode_.
5644         * options.h (General_options): Update help text for --incremental.
5645         Add --no-incremental, --incremental-full, --incremental-update.
5646         (General_options::Incremental_mode): New enum type.
5647         (General_options::incremental_mode): New function.
5648         (General_options::incremental_mode_): New data member.
5649         * parameters.cc (Parameters::incremental_mode_): New data member.
5650         (Parameters::set_options): Set incremental_mode_.
5651         (Parameters::set_incremental_full): New function.
5652         (Parameters::incremental): New function.
5653         (Parameters::incremental_update): New function.
5654         (set_parameters_incremental_full): New function.
5655         * parameters.h (Parameters::set_incremental_full): New function.
5656         (Parameters::incremental): New function.
5657         (Parameters::incremental_update): New function.
5658         (Parameters::incremental_mode_): New data member.
5659         (set_parameters_incremental_full): New function.
5660         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5661         incremental link mode.
5662         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5663         (Sized_relobj::do_relocate_sections): Likewise.
5664         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5665         option.
5666         * testsuite/Makefile.in: Regenerate.
5667         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5668
5669 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5670
5671         * script-sections.h (class Script_sections): Make
5672         Sections_elements typedef public.
5673         * script-sections.cc (class Sort_output_sections): Add elements_
5674         field.  Add constructor which sets it; change all callers.
5675         (Sort_output_sections::is_before): New function.
5676         (Sort_output_sections::operator()): Call is_before.
5677         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5678         conditional.
5679         * testsuite/script_test_10.sh: New test. Test script section
5680         order.
5681         * testsuite/script_test_10.t: Likewise.
5682         * testsuite/script_test_10.s: Likewise.
5683         * testsuite/Makefile.am: Wrap the cross linker tests and the
5684         common tests into NATIVE_OR_CROSS_LINKER.
5685         (check_SCRIPTS): Add script_test_10.sh.
5686         (check_DATA): Add script_test_10.stdout.
5687         (script_test_10.o, script_test_10): New targets.
5688         (script_test_10.stdout): New target.
5689         * configure, testsuite/Makefile.in: Regenerate.
5690
5691 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5692
5693         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5694         error for the deprecated relocations.
5695         (Target_arm::Scan::global): Likewise.
5696         (Target_arm::Relocate::relocate): Likewise.
5697
5698 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5699
5700         * fileread.cc (Input_file::find_file): Initialize *found_name
5701         and *namep when using the fallback search for case 4.
5702
5703 2010-10-11  Cary Coutant  <ccoutant@google.com>
5704
5705         * options.h (class General_options): Redefine -z lazy as an alias for
5706         the negation of -z now.
5707
5708 2010-10-11  Ian Lance Taylor  <iant@google.com>
5709
5710         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5711         binding.
5712
5713 2010-10-06  Nick Clifton  <nickc@redhat.com>
5714
5715         * script-sections.cc(class Memory_region): Remove
5716         current_lma_offset_ field.  Rename current_vma_offset_ to
5717         current_offset_.  Add last_section_ field.
5718         (Memory_region::get_current_vma_address): Rename to
5719         get_current_address.
5720         (Memory_region::get_current_lma_address): Delete.
5721         (Memory_region::increment_vma_offset): Rename to
5722         increment_offset.
5723         (Memory_region::increment_lma_offset): Delete.
5724         (Memory_region::attributes_compatible): New method.  Returns
5725         true if the provided section is compatible with the region.
5726         (Memory_region::get_last_section): New method.  Returns the last
5727         section to use the region.
5728         (Memory_region::set_last_section): New method.  Stores the last
5729         section to use the region.
5730         (Script_sections::block_in_region): New method.  Returns true if
5731         a block of memory is contained within a region.
5732         (Script_sections::find_memory_region): New method.  Locates a
5733         memory region to be used to set a VMA or LMA address.
5734         (Output_section_definition::set_section_addresses): Add code to
5735         check for addresses set by memory regions.
5736         (Output_segment::set_section_addresses): Remove memory region
5737         walking code.
5738         (Script_sections::create_segment): Add a warning if a header
5739         segment is created outside of any region.
5740         * script-sections.h (class Script_sections): Add prototypes for
5741         find_memory_region and block_in_region methods.
5742         * testsuite/memory_test.s: Use .long instead of .word.
5743         * testsuite/memory_test.t: Add some more output sections.
5744         * testsuite/memory_test.sh: Update expected output.
5745
5746 2010-10-02  Doug Kwan  <dougkwan@google.com>
5747
5748         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5749         defintion to symtab.h
5750         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5751         declaration to defintion.
5752
5753 2010-10-01  Nick Clifton  <nickc@redhat.com>
5754
5755         * expression.cc (eval): Replace dummy argument with NULL.
5756         (eval_maybe_dot): Check for a NULL result section pointer.
5757         (Symbol_expression::value): Likewise.
5758         (Dot_expression::value): Likewise.
5759         (BINARY_EXPRESSION): Likewise.
5760         (Max_expression::value): Likewise.
5761         (Min_expression::value): Likewise.
5762         (Absolute_expression::value): Likewise.
5763         (Addr_expression::value_from_output_section): Likewise.
5764         (Loaddddr_expression::value_from_output_section): Likewise.
5765         (Segment_start_expression::value): Likewise.
5766         * script-sections.cc
5767         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5768         argument with NULL.
5769         (Sections_elememt_dot_assignment::set_section_addresses):
5770         Likewise.
5771         (Output_data_expression::do_write_to_buffer): Likewise.
5772         (Output_section_definition::finalize_symbols): Likewise.
5773         (Output_section_definition::set_section_addresses): Likewise.
5774
5775 2010-09-30  Doug Kwan  <dougkwan@google.com>
5776
5777         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5778
5779 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5780
5781         * target.h (Target::can_icf_inline_merge_sections): New virtual
5782         function.
5783         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5784         virtual function.
5785         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5786         virtual function.
5787         * icf.cc (get_section_contents): Inline merge sections only when
5788         target allows it.
5789
5790 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5791
5792         * configure: Regenerate.
5793
5794 2010-09-17  Ian Lance Taylor  <iant@google.com>
5795
5796         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5797         * testsuite/Makefile.am (memory_test.o): New target.
5798         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5799         memory_test.t.
5800         * testsuite/Makefile.in: Rebuild.
5801
5802 2010-09-17  Doug Kwan  <dougkwan@google.com>
5803
5804         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5805         defintion if relocation uses GOT entries of the symbol.
5806         * testsuite/icf_safe_test.sh: Fix test.
5807         * testsuite/icf_safe_so_test.sh: Fix test.
5808
5809 2010-09-16  Cary Coutant  <ccoutant@google.com>
5810
5811         * script_sections.cc (class Memory_region): Remove "NULL" from
5812         vector initializations.
5813
5814 2010-09-15  Cary Coutant  <ccoutant@google.com>
5815
5816         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5817         Resolve forwarding symbols.
5818
5819 2010-09-15  Doug Kwan  <dougkwan@google.com>
5820
5821         * gold/testsuite/script_test_3.t: Add ARM special sections.
5822         * gold/testsuite/script_test_4.t: Same.
5823         * gold/testsuite/script_test_5.t: Same.
5824         * gold/testsuite/script_test_6.t: Same.
5825         * gold/testsuite/script_test_7.t: Same.
5826         * gold/testsuite/script_test_7.t: Same.
5827         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5828
5829 2010-09-14  Cary Coutant  <ccoutant@google.com>
5830
5831         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5832         (Target_x86_64::Relocate::relocate_tls): Replace check for
5833         saw_tls_block_reloc_ with test for executable section.
5834
5835 2010-09-12  Cary Coutant  <ccoutant@google.com>
5836
5837         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5838         position-independent executables to shared libraries need dynamic
5839         relocations.
5840         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5841         position-independent executables.
5842         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5843         * testsuite/Makefile.in: Regenerate.
5844
5845 2010-09-10  Nick Clifton  <nickc@redhat.com>
5846
5847         PR gold/11997
5848         * testsuite/memory_test.t: Discard any sections that are not
5849         needed.
5850
5851 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5852
5853         PR gold/11996
5854         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5855         "This::" to work around a bug in gcc 4.2.
5856
5857         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5858
5859 2010-09-09  Rafael Espindola  <espindola@google.com>
5860
5861         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5862         sections with different PF_X flags in the same segment.
5863         (Layout::find_first_load_seg): Search all segments to find the first
5864         one.
5865         * options.h (rosegment): New.
5866
5867 2010-09-08  Rafael Espindola  <espindola@google.com>
5868
5869         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5870
5871 2010-09-08  Doug Kwan  <dougkwan@google.com>
5872
5873         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5874         (Arm_relobj::do_relocate_sections): Add new parameter for output
5875         file to match the parent.
5876         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5877         of local symbols instead of input values.  Update code to track
5878         changes in gold::relocate_section.
5879         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5880         (Sized_relobj::compute_final_local_value_internal): New methods.
5881         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5882         body into private version of Sized_relobj::compute_final_local_value.
5883         Call the inline method.
5884         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5885         merged symbol value if there is one.
5886         (Symbol_value::has_output_value): New method defintiion.
5887         (Sized_relobj::Compute_final_local_value_status): New enum type.
5888         (Sized_relobj::compute_final_local_value): New methods.
5889         (Sized_relobj::compute_final_local_value_internal): New methods.
5890         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5891         and arm_cortex_a8.sh.
5892         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5893         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5894         New tests.
5895         * Makefile.in: Regenerate.
5896         * testsuite/arm_bl_out_of_range.s: Update test.
5897         * testsuite/thumb_bl_out_of_range.s: Ditto.
5898         * testsuite/thumb_blx_out_of_range.s: Ditto.
5899         * testsuite/arm_branch_out_of_range.sh: New file.
5900         * testsuite/arm_cortex_a8.sh: Ditto.
5901         * testsuite/arm_cortex_a8_b.s: Ditto.
5902         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5903         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5904         * testsuite/arm_cortex_a8_bl.s: Ditto.
5905         * testsuite/arm_cortex_a8_blx.s: Ditto.
5906         * testsuite/arm_cortex_a8_local.s: Ditto.
5907         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5908         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5909
5910 2010-09-08  Rafael Espindola  <espindola@google.com>
5911
5912         * Makefile.am (memory_test.stdout): Run readelf with -W.
5913         * Makefile.in: Regenerate.
5914         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5915         64 bit output.
5916
5917 2010-09-08  Rafael Espindola  <espindola@google.com>
5918
5919         * script-sections.cc (Script_sections::add_memory_region): Convert
5920         field precision to int.
5921         * script.cc (script_set_section_region, script_set_section_region):
5922         Convert field precision to int.
5923
5924 2010-09-08  Rafael Espindola  <espindola@google.com>
5925
5926         * arm.cc (do_finalize_sections): Create the __exidx_start and
5927         __exdix_end symbols even when the section is missing.
5928
5929 2010-09-08  Nick Clifton  <nickc@redhat.com>
5930
5931         * README: Remove claim that MEMORY is not supported.
5932         * expression.cc (script_exp_function_origin)
5933         (script_exp_function_length): Move from here to ...
5934         * script.cc: ... here.
5935         (script_set_section_region, script_add_memory)
5936         (script_parse_memory_attr, script_include_directive): New
5937         functions.
5938         * script-sections.cc
5939         (class Memory_region): New class.
5940         (class Output_section_definition): Add set_memory_region,
5941         set_section_vma, set_section_lma and get_section_name methods.
5942         (class Script_Sections): Add add_memory_region,
5943         find_memory_region, find_memory_region_origin,
5944         find_memory_region_length and set_memory_region methods.
5945         Have set_section_addresses method walk the list of set memory
5946         regions.
5947         Extend the print methos to display memory regions.
5948         * script-sections.h: Add prototypes for new methods.
5949         Add enum for MEMORY region attributes.
5950         * yyscript.y: Add support for parsing MEMORY regions.
5951         * script-c.h: Add prototypes for new functions.
5952         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5953         * testsuite/Makefile.in: Regenerate.
5954         * testsuite/memory_test.sh: New script.
5955         * testsuite/memory_test.s: New assembler source file.
5956         * testsuite/memory_test.t: New linker script.
5957
5958 2010-08-27  Doug Kwan  <dougkwan@google.com>
5959
5960         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5961         reference override an existing dynamic weak reference.
5962         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5963         * testsuite/Makefile.in: Regenerate.
5964         * testsuite/dyn_weak_ref.sh: New file.
5965         * testsuite/dyn_weak_ref_1.c: Ditto.
5966         * testsuite/dyn_weak_ref_2.c: Ditto.
5967
5968 2010-08-27  Ian Lance Taylor  <iant@google.com>
5969
5970         * incremental.h (class Incremental_input_entry): Add virtual
5971         destructor.
5972
5973 2010-08-27  Ian Lance Taylor  <iant@google.com>
5974
5975         * testsuite/start_lib_test_3.c: Mark t3 as used.
5976
5977 2010-08-27  Nick Clifton  <nickc@redhat.com>
5978
5979         * options.cc (version_script): Fix small typo in previous
5980         whitespace tidyup.
5981
5982 2010-08-25  Nick Clifton  <nickc@redhat.com>
5983
5984         * archive.cc: Formatting fixes: Remove whitespace between
5985         typename and following asterisk.  Remove whitespace between
5986         function name and opening parenthesis.
5987         * archive.h: Likewise.
5988         * arm.cc: Likewise.
5989         * attributes.cc: Likewise.
5990         * attributes.h: Likewise.
5991         * common.cc: Likewise.
5992         * copy-relocs.cc: Likewise.
5993         * dirsearch.h: Likewise.
5994         * dynobj.cc: Likewise.
5995         * ehframe.cc: Likewise.
5996         * ehframe.h: Likewise.
5997         * expression.cc: Likewise.
5998         * fileread.cc: Likewise.
5999         * fileread.h: Likewise.
6000         * gc.h: Likewise.
6001         * gold-threads.cc: Likewise.
6002         * gold.cc: Likewise.
6003         * i386.cc: Likewise.
6004         * icf.h: Likewise.
6005         * incremental-dump.cc: Likewise.
6006         * incremental.cc: Likewise.
6007         * layout.cc: Likewise.
6008         * layout.h: Likewise.
6009         * main.cc: Likewise.
6010         * merge.cc: Likewise.
6011         * merge.h: Likewise.
6012         * object.cc: Likewise.
6013         * object.h: Likewise.
6014         * options.cc: Likewise.
6015         * options.h: Likewise.
6016         * output.cc: Likewise.
6017         * output.h: Likewise.
6018         * plugin.cc: Likewise.
6019         * plugin.h: Likewise.
6020         * powerpc.cc: Likewise.
6021         * reloc.cc: Likewise.
6022         * script-c.h: Likewise.
6023         * script-sections.cc: Likewise.
6024         * script.cc: Likewise.
6025         * stringpool.cc: Likewise.
6026         * symtab.cc: Likewise.
6027         * symtab.h: Likewise.
6028         * target.cc: Likewise.
6029         * timer.cc: Likewise.
6030         * timer.h: Likewise.
6031         * version.cc: Likewise.
6032         * x86_64.cc: Likewise.
6033
6034 2010-08-24  Nick Clifton  <nickc@redhat.com>
6035
6036         PR 11899
6037         * layout.cc (segment_precedes): Sort segments by their physical
6038         addresses, if they have been set.
6039
6040 2010-08-23  Cary Coutant  <ccoutant@google.com>
6041
6042         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6043         symbols data.
6044         (Lib_group::include_member): Unlock object after deleting its
6045         symbols data.
6046         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6047         the bug fixed here.
6048
6049 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6050             Cary Coutant  <ccoutant@google.com>
6051
6052         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6053         constructor, and set_blocker.
6054         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6055         readsyms_blocker_.
6056         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6057         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6058         * testsuite/Makefile.am (start_lib_test): New test case.
6059         * testsuite/Makefile.in: Regenerate.
6060         * testsuite/start_lib_test_main.c: New file.
6061         * testsuite/start_lib_test_1.c: New file.
6062         * testsuite/start_lib_test_2.c: New file.
6063         * testsuite/start_lib_test_3.c: New file.
6064
6065 2010-08-19  Ian Lance Taylor  <iant@google.com>
6066
6067         * Makefile.in: Rebuild with automake 1.11.1.
6068         * aclocal.m4: Likewise.
6069         * testsuite/Makefile.in: Likewise.
6070
6071 2010-08-19  Ian Lance Taylor  <iant@google.com>
6072
6073         PR 10893
6074         * i386.cc (class Output_data_plt_i386): Update declarations.
6075         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6076         local_ifuncs_ fields.
6077         (Target_i386::do_plt_section_for_global): New function.
6078         (Target_i386::do_plt_section_for_local): New function.
6079         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6080         parameter; change all callers.  Initialize global_ifuncs_ and
6081         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6082         __rel_iplt_end.
6083         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6084         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6085         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6086         symbols.
6087         (Target_i386::make_plt_section): New function, broken out of
6088         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6089         (Target_i386::make_plt_entry): Call make_plt_section.
6090         (Target_i386::make_local_ifunc_plt_entry): New function.
6091         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6092         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6093         R_386_IRELATIVE to switch.
6094         (Target_i386::Scan::global): Likewise.
6095         (Target_i386::Relocate::relocate): Likewise.
6096         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6097         switch.
6098         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6099         (Target_x86_64::do_plt_section_for_global): New function.
6100         (Target_x86_64::do_plt_section_for_local): New function.
6101         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6102         parameter; change all callers.  If doing a static link define
6103         __rela_iplt_start and __rela_iplt_end.
6104         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6105         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6106         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6107         to point to .plt.
6108         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6109         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6110         switch.
6111         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6112         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6113         R_X86_64_IRELATIVE to switch.
6114         (Target_x86_64::Scan::global): Likewise.
6115         (Target_x86_64::Relocate::relocate): Likewise.
6116         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6117         switch.
6118         * target.h (class Target): Add plt_section_for_global and
6119         plt_section_for_local functions.  Add do_plt_section_for_global
6120         and do_plt_section_for_local virtual functions.
6121         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6122         clarifying comments.
6123         (Symbol::use_plt_offset): Handle IFUNC symbol.
6124         * object.cc (Sized_relobj::Sized_relobj): Initialize
6125         local_plt_offsets_.
6126         (Sized_relobj::local_has_plt_offset): New function.
6127         (Sized_relobj::local_plt_offset): New function.
6128         (Sized_relobj::set_local_plt_offset): New function.
6129         (Sized_relobj::do_count): Handle IFUNC symbol.
6130         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6131         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6132         is_ifunc_symbol functions.
6133         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6134         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6135         local_plt_offsets_ field.
6136         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6137         * output.h (class Output_section_data): Add non-const
6138         output_section function.
6139         (class Output_data_got): Update declarations.
6140         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6141         Add use_plt_offset parameter to global and local constructors.
6142         Change all callers.  Change local_sym_index_ field to 31 bits.
6143         Change GSYM_CODE and CONSTANT_CODE accordingly.
6144         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6145         doing a static link don't set sh_link field.
6146         (Output_data_got::Got_entry::write): Use PLT offset if
6147         appropriate.
6148         (Output_data_got::add_global_plt): New function.
6149         (Output_data_got::add_local_plt): New function.
6150         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6151         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6152         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6153         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6154         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6155         IFUNC conditional.
6156         * testsuite/ifunc-sel.h: New file.
6157         * testsuite/ifuncmain1.c: New file.
6158         * testsuite/ifuncmain1vis.c: New file.
6159         * testsuite/ifuncmod1.c: New file.
6160         * testsuite/ifuncdep2.c: New file.
6161         * testsuite/ifuncmain2.c: New file.
6162         * testsuite/ifuncmain3.c: New file.
6163         * testsuite/ifuncmod3.c: New file.
6164         * testsuite/ifuncmain4.c: New file.
6165         * testsuite/ifuncmain5.c: New file.
6166         * testsuite/ifuncmod5.c: New file.
6167         * testsuite/ifuncmain6pie.c: New file.
6168         * testsuite/ifuncmod6.c: New file.
6169         * testsuite/ifuncmain7.c: New file.
6170         * configure, testsuite/Makefile.in: Rebuild.
6171
6172 2010-08-18  Ian Lance Taylor  <iant@google.com>
6173
6174         * incremental.cc
6175         (Output_section_incremental_inputs::write_input_files): Add cast
6176         to avoid signed/unsigned comparison warning.
6177         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6178
6179 2010-08-12  Cary Coutant  <ccoutant@google.com>
6180
6181         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6182
6183 2010-08-13  Ian Lance Taylor  <iant@google.com>
6184
6185         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6186
6187 2010-08-12  Cary Coutant  <ccoutant@google.com>
6188             Doug Kwan  <dougkwan@google.com>
6189
6190         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6191         defintion overrides non-weak undef, remember that the original undef
6192         is not weak.
6193         * symtab.cc (Symbol_table::sized_write_global): For undef without
6194         an original weak binding, set binding to global in output.
6195         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6196         * testsuite/Makefile.in: Regenerate.
6197         * testsuite/strong_ref_weak_def.sh: New file.
6198         * testsuite/strong_ref_weak_def_1.c: Ditto.
6199         * testsuite/strong_ref_weak_def_2.c: Ditto.
6200
6201 2010-08-12  Cary Coutant  <ccoutant@google.com>
6202
6203         * testsuite/incremental_test.sh: Rewrite.
6204         * testsuite/incremental_test_1.c: Rewrite.
6205         * testsuite/incremental_test_2.c: Rewrite.
6206
6207 2010-08-12  Cary Coutant  <ccoutant@google.com>
6208
6209         * arm.cc (Target_arm::got_size): Add const.
6210         (Target_arm::got_entry_count): New function.
6211         (Target_arm::plt_entry_count): New function.
6212         (Target_arm::first_plt_entry_offset): New function.
6213         (Target_arm::plt_entry_size): New function.
6214         (Output_data_plt_arm::entry_count): New function.
6215         (Output_data_plt_arm::first_plt_entry_offset): New function.
6216         (Output_data_plt_arm::get_plt_entry_size): New function.
6217         * i386.cc (Target_i386::got_size): Add const.
6218         (Target_i386::got_entry_count): New function.
6219         (Target_i386::plt_entry_count): New function.
6220         (Target_i386::first_plt_entry_offset): New function.
6221         (Target_i386::plt_entry_size): New function.
6222         (Output_data_plt_i386::entry_count): New function.
6223         (Output_data_plt_i386::first_plt_entry_offset): New function.
6224         (Output_data_plt_i386::get_plt_entry_size): New function.
6225         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6226         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6227         * incremental.cc: Include target.h.
6228         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6229         parameter.  Adjust all callers.  Find incremental_got_plt section.
6230         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6231         section.
6232         (Output_section_incremental_inputs::set_final_data_size): Calculate
6233         size of incremental_got_plt section.
6234         (Output_section_incremental_inputs::do_write): Write the
6235         incremental_got_plt section.
6236         (Got_plt_view_info): New struct.
6237         (Local_got_offset_visitor): New class.
6238         (Global_got_offset_visitor): New class.
6239         (Global_symbol_visitor_got_plt): New class.
6240         (Output_section_incremental_inputs::write_got_plt): New function.
6241         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6242         Add parameter.  Adjust all callers.
6243         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6244         (Incremental_inputs::got_plt_section): New function.
6245         (Incremental_inputs::got_plt_section_): New data member.
6246         (Incremental_got_plt_reader): New class.
6247         * layout.cc (Layout::create_incremental_info_sections): Add the
6248         incremental_got_plt section.
6249         * object.h (Got_offset_list::get_list): New function.
6250         (Got offset_list::for_all_got_offsets): New function.
6251         (Sized_relobj::local_got_offset_list): New function.
6252         * powerpc.cc (Target_powerpc::got_size): Add const.
6253         (Target_powerpc::got_entry_count): New function.
6254         (Target_powerpc::plt_entry_count): New function.
6255         (Target_powerpc::first_plt_entry_offset): New function.
6256         (Target_powerpc::plt_entry_size): New function.
6257         (Output_data_plt_powerpc::entry_count): New function.
6258         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6259         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6260         * sparc.cc (Target_sparc::got_size): Add const.
6261         (Target_sparc::got_entry_count): New function.
6262         (Target_sparc::plt_entry_count): New function.
6263         (Target_sparc::first_plt_entry_offset): New function.
6264         (Target_sparc::plt_entry_size): New function.
6265         (Output_data_plt_sparc::entry_count): New function.
6266         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6267         (Output_data_plt_sparc::get_plt_entry_size): New function.
6268         * symtab.h (Symbol::got_offset_list): New function.
6269         (Symbol_table::for_all_symbols): New function.
6270         * target.h (Sized_target::got_entry_count): New function.
6271         (Sized_target::plt_entry_count): New function.
6272         (Sized_target::plt_entry_size): New function.
6273         * x86_64.cc (Target_x86_64::got_size): Add const.
6274         (Target_x86_64::got_entry_count): New function.
6275         (Target_x86_64::plt_entry_count): New function.
6276         (Target_x86_64::first_plt_entry_offset): New function.
6277         (Target_x86_64::plt_entry_size): New function.
6278         (Output_data_plt_x86_64::entry_count): New function.
6279         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6280         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6281
6282 2010-08-12  Cary Coutant  <ccoutant@google.com>
6283
6284         * archive.cc: Include incremental.h.
6285         (Archive::Archive): Initialize incremental_info_.
6286         (Archive::include_member): Record archive members in incremental info.
6287         (Add_archive_symbols::run): Record begin and end of an archive in
6288         incremental info.
6289         (Lib_group::include_member): Record objects in incremental info.
6290         * archive.h (Incremental_archive_entry): Forward declaration.
6291         (Archive::set_incremental_info): New member function.
6292         (Archive::incremental_info): New member function.
6293         (Archive::Unused_symbol_iterator): New class.
6294         (Archive::unused_symbols_begin): New member function.
6295         (Archive::unused_symbols_end): New member function.
6296         (Archive::incremental_info_): New data member.
6297         * incremental-dump.cc (find_input_containing_global): New function.
6298         (dump_incremental_inputs): Dump new incremental info sections.
6299         * incremental.cc: Include symtab.h.
6300         (Output_section_incremental_inputs): New class.
6301         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6302         new incremental info sections.
6303         (Sized_incremental_binary::do_check_inputs): Likewise.
6304         (Incremental_inputs::report_archive): Remove.
6305         (Incremental_inputs::report_archive_begin): New function.
6306         (Incremental_inputs::report_archive_end): New function.
6307         (Incremental_inputs::report_object): New function.
6308         (Incremental_inputs::finalize_inputs): Remove.
6309         (Incremental_inputs::report_input_section): New function.
6310         (Incremental_inputs::report_script): Rewrite.
6311         (Incremental_inputs::finalize): Do nothing but finalize string table.
6312         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6313         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6314         (Incremental_inputs::create_data_sections): New function.
6315         (Incremental_inputs::relocs_entsize): New function.
6316         (Output_section_incremental_inputs::set_final_data_size): New function.
6317         (Output_section_incremental_inputs::do_write): New function.
6318         (Output_section_incremental_inputs::write_header): New function.
6319         (Output_section_incremental_inputs::write_input_files): New function.
6320         (Output_section_incremental_inputs::write_info_blocks): New function.
6321         (Output_section_incremental_inputs::write_symtab): New function.
6322         * incremental.h (Incremental_script_entry): Forward declaration.
6323         (Incremental_object_entry): Forward declaration.
6324         (Incremental_archive_entry): Forward declaration.
6325         (Incremental_inputs): Forward declaration.
6326         (Incremental_inputs_header_data): Remove.
6327         (Incremental_inputs_header): Remove.
6328         (Incremental_inputs_header_write): Remove.
6329         (Incremental_inputs_entry_data): Remove.
6330         (Incremental_inputs_entry): Remove.
6331         (Incremental_inputs_entry_write): Remove.
6332         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6333         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6334         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6335         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6336         Likewise.
6337         (Incremental_input_entry): New class.
6338         (Incremental_script_entry): New class.
6339         (Incremental_object_entry): New class.
6340         (Incremental_archive_entry): New class.
6341         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6342         (Incremental_inputs::report_inputs): Remove.
6343         (Incremental_inputs::report_archive): Remove.
6344         (Incremental_inputs::report_archive_begin): New function.
6345         (Incremental_inputs::report_archive_end): New function.
6346         (Incremental_inputs::report_object): Change prototype.
6347         (Incremental_inputs::report_input_section): New function.
6348         (Incremental_inputs::report_script): Change prototype.
6349         (Incremental_inputs::get_reloc_count): New function.
6350         (Incremental_inputs::set_reloc_count): New function.
6351         (Incremental_inputs::create_data_sections): New function.
6352         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6353         (Incremental_inputs::inputs_section): New function.
6354         (Incremental_inputs::symtab_section): New function.
6355         (Incremental_inputs::relocs_section): New function.
6356         (Incremental_inputs::get_stringpool): Add const.
6357         (Incremental_inputs::command_line): Add const.
6358         (Incremental_inputs::inputs): Remove.
6359         (Incremental_inputs::command_line_key): New function.
6360         (Incremental_inputs::input_file_count): New function.
6361         (Incremental_inputs::input_files): New function.
6362         (Incremental_inputs::relocs_entsize): New function.
6363         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6364         (Incremental_inputs::finalize_inputs): Remove.
6365         (Incremental_inputs::Input_info): Remove.
6366         (Incremental_inputs::lock_): Remove.
6367         (Incremental_inputs::inputs_): Change type.
6368         (Incremental_inputs::inputs_map_): Remove.
6369         (Incremental_inputs::current_object_entry_): New data member.
6370         (Incremental_inputs::inputs_section_): New data member.
6371         (Incremental_inputs::symtab_section_): New data member.
6372         (Incremental_inputs::relocs_section_): New data member.
6373         (Incremental_inputs::reloc_count_): New data member.
6374         (Incremental_inputs_reader): New class.
6375         (Incremental_symtab_reader): New class.
6376         (Incremental_relocs_reader): New class.
6377         * layout.cc (Layout::finalize): Move finalization of incremental info
6378         and creation of incremental info sections to follow finalization of
6379         symbol table.  Set offsets for postprocessing sections.
6380         (Layout::create_incremental_info_sections): Call
6381         Incremental_inputs::create_data_sections.  Add incremental symtab
6382         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6383         sections to layout after input sections.
6384         * layout.h (struct Timespec): Forward declaration.
6385         (Layout::incremental_inputs): Add const.
6386         (Layout::create_incremental_info_sections): Add parameter.
6387         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6388         * object.cc: Include incremental.h.
6389         (Relobj::finalize_incremental_relocs): New function.
6390         (Sized_relobj::do_layout): Record input sections in incremental info.
6391         * object.h (Object::output_section): New function.
6392         (Object::output_section_offset): Moved from Relobj.
6393         (Object::get_incremental_reloc_base): New function.
6394         (Object::get_incremental_reloc_count): New function.
6395         (Object::do_output_section): New function.
6396         (Object::do_output_section_offset): Moved from Relobj.
6397         (Object::do_get_incremental_reloc_base): New function.
6398         (Object::do_get_incremental_reloc_count): New function.
6399         (Object::Object): Initialize new data members.
6400         (Relobj::output_section): Renamed do_output_section and moved to
6401         protected.
6402         (Relobj::output_section_offset): Moved to Object.
6403         (Relobj::do_get_incremental_reloc_base): New function.
6404         (Relobj::do_get_incremental_reloc_count): New function.
6405         (Relobj::allocate_incremental_reloc_counts): New function.
6406         (Relobj::count_incremental_reloc): New function.
6407         (Relobj::finalize_incremental_relocs): New function.
6408         (Relobj::next_incremental_reloc_index): New function.
6409         (Relobj::reloc_counts_): New data member.
6410         (Relobj::reloc_bases_): New data member.
6411         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6412         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6413         (Sized_relobj::incremental_relocs_scan): New function.
6414         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6415         (Sized_relobj::incremental_relocs_write): New function.
6416         (Sized_relobj::incremental_relocs_write_reltype): New function.
6417         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6418         incremental link.
6419         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6420         archives and object files elsewhere.
6421         (Add_symbols::run): Report object files here.
6422         (Finish_group::run): Report end of archive at end of group.
6423         * reloc.cc: Include layout.h, incremental.h.
6424         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6425         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6426         (Sized_relobj::incremental_relocs_scan): New function.
6427         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6428         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6429         (Sized_relobj::incremental_relocs_write): New function.
6430         (Sized_relobj::incremental_relocs_write_reltype): New function.
6431         * script.cc (read_input_script): Rewrite test for incremental link.
6432         Change call to Incremental_inputs::report_script.
6433         * symtab.h (Symbol_table::first_global_index): New function.
6434         (Symbol_table::output_count): New function.
6435
6436 2010-08-12  Doug Kwan  <dougkwan@google.com>
6437
6438         * arm.cc (Target_arm::merge_object_attributes): Check command line
6439         options --no-wchar-size-warning and --no-enum-size-warning.
6440         * options.h (General_options): Add ld-compatible options
6441         --no-enum-size-warning and --no-wchar-size-warning.
6442
6443 2010-08-04  Ian Lance Taylor  <iant@google.com>
6444
6445         * x86_64.cc (Target_x86_64::Scan::local): Use
6446         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6447         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6448         (Target_x86_64::Scan::global): Likewise.
6449         (Target_x86_64::Relocate::relocate): Likewise.
6450         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6451         Likewise.
6452
6453 2010-08-03  Cary Coutant  <ccoutant@google.com>
6454
6455         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6456         to reserve space in merged_strings vector. Keep total input size
6457         for stats.
6458         (Output_merge_string::do_print_merge_stats): Print total input size.
6459         * merge.h (Output_merge_string): Add input_size_ field.
6460         * stringpool.cc (Stringpool_template::string_length): Move
6461         implementations out of Stringpool_template class and place in
6462         stringpool.h.
6463         * stringpool.h (string_length): Move out of Stringpool_template.
6464
6465 2010-08-03  Ian Lance Taylor  <iant@google.com>
6466
6467         PR 11712
6468         * layout.cc (relaxation_loop_body): If address of load segment is
6469         set, adjust address to include headers if possible.
6470
6471 2010-08-03  Ian Lance Taylor  <iant@google.com>
6472
6473         * version.cc (version_string): Bump to 1.10.
6474
6475 2010-08-03  Ian Lance Taylor  <iant@google.com>
6476
6477         PR 11805
6478         * layout.h (enum Output_section_order): Define.
6479         (class Layout): Update declarations.
6480         * layout.cc (Layout::get_output_section): Add order parameter.
6481         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6482         is_first_non_relro parameters.  Change all callers.
6483         (Layout::choose_output_section): Likewise.
6484         (Layout::add_output_section_data): Likewise.
6485         (Layout::make_output_section): Likewise.  Set order.
6486         (Layout::default_section_order): New function.
6487         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6488         * output.cc (Output_section::Output_section): Initialize order_.
6489         Don't initialize deleted fields.
6490         (Output_segment::Output_segment): Don't initialize deleted
6491         fields.
6492         (Output_segment::add_output_section_to_load): New function
6493         replacing add_output_section.  Change all callers to call this or
6494         add_output_section_to_nonload.
6495         (Output_segment::add_output_section_to_nonload): New function.
6496         (Output_segment::remove_output_section): Rewrite.
6497         (Output_segment::add_initial_output_data): Likewise.
6498         (Output_segment::has_any_data_sections): Likewise.
6499         (Output_segment::is_first_section_relro): Likewise.
6500         (Output_segment::maximum_alignment): Likewise.
6501         (Output_segment::has_dynamic_reloc): New function replacing
6502         dynamic_reloc_count.  Change all callers.
6503         (Output_segment::has_dynamic_reloc_list): New function replacing
6504         dynamic_reloc_count_list.  Change all callers.
6505         (Output_segment::set_section_addresses): Rewrite.
6506         (Output_segment::set_offset): Rewrite.
6507         (Output_segment::find_first_and_last_list): Remove.
6508         (Output_segment::set_tls_offsets): Rewrite.
6509         (Output_segment::first_section_load_address): Likewise.
6510         (Output_segment::output_section_count): Likewise.
6511         (Output_segment::section_with_lowest_load_address): Likewise.
6512         (Output_segment::write_section_headers): Likewise.
6513         (Output_segment::print_sections_to_map): Likewise.
6514         * output.h (class Output_data): Remove dynamic_reloc_count_
6515         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6516         (Output_data::add_dynamic_reloc): Rewrite.
6517         (Output_data::has_dynamic_reloc): New function.
6518         (Output_data::dynamic_reloc_count): Remove.
6519         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6520         is_last_relro_, is_first_non_relro_, is_interp_,
6521         is_dynamic_linker_section_ fields.  Add order and set_order
6522         functions.  Remove is_relro_local, set_is_relro_local,
6523         is_last_relro, set_is_last_relro, is_first_non_relro,
6524         set_is_first_non_relro functions, is_interp, set_is_interp,
6525         is_dynamic_linker_section, and set_is_dynamic_linker_section
6526         functions.
6527         (class Output_segment): Change Output_data_list from std::list to
6528         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6529         output_bss_ fields.  Update declarations.
6530
6531 2010-08-02  Ian Lance Taylor  <iant@google.com>
6532
6533         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6534         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6535         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6536
6537 2010-08-02  Ian Lance Taylor  <iant@google.com>
6538
6539         PR 11855
6540         * script.cc (Script_options::Script_options): Initialize
6541         symbol_definitions_ and symbol_references_.
6542         (Script_options::add_symbol_assignment): Update
6543         symbol_definitions_ and symbol_references_.
6544         (Script_options::add_symbol_reference): New function.
6545         (script_symbol): New function.
6546         * script.h (class Script_options): Add symbol_definitions_ and
6547         symbol_references_ fields.
6548         (Script_options::referenced_const_iterator): New type.
6549         (Script_options::referenced_begin): New function.
6550         (Script_options::referenced_end): New function.
6551         (Script_options::is_referenced): New function.
6552         (Script_options::any_unreferenced): New function.
6553         * script-c.h (script_symbol): Declare.
6554         * yyscript.y (exp): Call script_symbol.
6555         * symtab.cc: Include "script.h".
6556         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6557         Change all callers.  Check symbols referenced by scripts.
6558         (Symbol_table::add_undefined_symbols_from_command_line): Add
6559         layout parameter.  Change all callers.
6560         (Symbol_table::do_add_undefined_symbols_from_command_line):
6561         Likewise.  Break out loop body.  Check symbols referenced by
6562         scripts.
6563         (Symbol_table::add_undefined_symbol_from_command_line): New
6564         function broken out of
6565         do_add_undefined_symbols_from_command_line.
6566         * symtab.h (class Symbol_table): Update declarations.
6567         * archive.cc: Include "layout.h".
6568         (Archive::should_include_member): Add layout parameter.  Change
6569         all callers.  Check for symbol mentioned in expression.
6570         * archive.h (class Archive): Update declaration.
6571         * object.cc (Sized_relobj::do_should_include_member): Add layout
6572         parameter.
6573         * object.h (Object::should_include_member): Add layout parameter.
6574         Change all callers.
6575         (Object::do_should_include_member): Add layout parameter.
6576         (class Sized_relobj): Update declaration.
6577         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6578         parameter.
6579         * dynobj.h (class Sized_dynobj): Update declaration.
6580         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6581         layout parameter.
6582         * plugin.h (class Sized_pluginobj): Update declaration.
6583
6584 2010-08-02  Ian Lance Taylor  <iant@google.com>
6585
6586         PR 11866
6587         * output.cc (Output_segment::set_offset): Search for the first and
6588         last sections rather than assuming that the list is in order.
6589         (Output_segment::find_first_and_last_list): New function.
6590         * output.h (class Output_segment): Update declarations.
6591         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6592         (relro_strip_test_SOURCES): New variable.
6593         (relro_strip_test_DEPENDENCIES): New variable.
6594         (relro_strip_test_LDFLAGS): New variable.
6595         (relro_strip_test_LDADD): New variable.
6596         (relro_strip_test.so): New target.
6597
6598 2010-08-02  Ian Lance Taylor  <iant@google.com>
6599
6600         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6601         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6602         (Target_i386::got_tlsdesc_section): New function.
6603         (Target_i386::got_section): Create space for GOT entries for
6604         TLSDESC relocations.
6605         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6606         R_386_TLS_GOTDESC.
6607         (Target_i386::Scan::global): Likewise.
6608         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6609         using TLSDESC GOT.
6610         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6611         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6612         (Target_x86_64::got_tlsdesc_section): New function.
6613         (Target_x86_64::got_section): Create space for GOT entries for
6614         TLSDESC relocations.
6615         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6616         R_386_TLS_GOTDESC.
6617         (Target_x86_64::Scan::global): Likewise.
6618         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6619         using TLSDESC GOT.
6620
6621 2010-08-02  Ian Lance Taylor  <iant@google.com>
6622
6623         * testsuite/final_layout.sh: Use dc to convert from hex to
6624         decimal.
6625
6626 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6627
6628         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6629         paramter to the call to gold::gc_process_relocs.
6630         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6631         paramter to the call to gold::gc_process_relocs.
6632         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6633         parameter to the call to gold::gc_process_relocs.
6634         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6635         template parameter to the call to gold::gc_process_relocs.
6636         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6637         paramter to the call to gold::gc_process_relocs.
6638         * gc.h (get_embedded_addend_size): New function.
6639         (gc_process_relocs): Save the size of the reloc for use by ICF.
6640         * icf.cc (get_section_contents): Get the addend from the text section
6641         for SHT_REL relocation sections.
6642         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6643         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6644         * int_encoding.h (read_from_pointer): New overloaded function.
6645         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6646         * testsuite/icf_sht_rel_addend_test.sh: New file.
6647         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6648         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6649
6650 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6651
6652         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6653         * Makefile.in: Regenerate.
6654         * testsuite/Makefile.in: Regenerate.
6655
6656 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6657
6658         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6659         * gold/testsuite/debug_msg.cc: Likewise.
6660         * gold/testsuite/odr_violation1.cc
6661         * gold/testsuite/odr_violation2.cc
6662
6663 2010-07-21  Cary Coutant  <ccoutant@google.com>
6664
6665         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6666         string, and length fields.
6667         (Output_merge_string::Merged_strings_list): New type.
6668         (Output_merge_string::Merged_strings_lists): New typedef.
6669         (Output_merge_string): Replace merged_strings_ with
6670         merged_strings_lists_.
6671         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6672         Merged_strings_list per input object and section.  Don't store pointer
6673         to the string.  Don't store length with each merged string entry.
6674         (Output_merge_string::finalize_merged_data): Loop over list of merged
6675         strings lists.  Recompute length of each merged string.
6676
6677 2010-07-15  Cary Coutant  <ccoutant@google.com>
6678
6679         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6680         here.
6681
6682 2010-07-14  Ian Lance Taylor  <iant@google.com>
6683
6684         * descriptors.cc (Descriptors::open): Report correct name in error
6685         message.
6686
6687 2010-07-13  Doug Kwan  <dougkwan@google.com>
6688
6689         * arm.cc (Arm_input_section::Arm_input_section): For a
6690         SHT_ARM_EXIDX section, always keeps the input sections.
6691         (Arm_input_section::set_exidx_section_link): New method.
6692         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6693         has_errors_ to false.
6694         (Arm_exidx_input_section::has_errors,
6695         Arm_exidx_input_section::set_has_errors): New methods.
6696         (Arm_exidx_input_section::has_errors_): New data member.
6697         (Arm_relobj::get_exidx_shndx_list): New method.
6698         (Arm_output_section::append_text_sections_to_list): Do not skip
6699         section without SHF_EXECINSTR.
6700         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6701         errors.
6702         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6703         section header.  Make error messages more verbose.  Check for
6704         a non-executable section linked to an EXIDX section.
6705         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6706         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6707         check that there is no deferred EXIDX section if we exit early.
6708         Instead of not making an EXIDX section in case of an error, make one
6709         and set the has_errors flag of it.
6710         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6711         in a relocatable link.
6712         (Target_arm::do_relax): Look for the EXIDX output section instead of
6713         assuming that it is called .ARM.exidx.
6714         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6715         section list.  Do not check for SHF_EXECINSTR section flags but
6716         skip any input section with errors.
6717         * output.cc (Output_section::Output_section): Initialize
6718         always_keeps_input_sections_ to false.
6719         (Output_section::add_input_section): Check for
6720         always_keeps_input_sections_.
6721         *  output.h (Output_section::always_keeps_input_sections,
6722         Output_section::set_always_keeps_input_sections): New methods.
6723         (Output_section::always_keeps_input_sections): New data member.
6724
6725 2010-07-13  Rafael Espindola  <espindola@google.com>
6726
6727         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6728         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6729
6730 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6731             Ian Lance Taylor  <iant@google.com>
6732
6733         * output.h (Output_section_lookup_maps::add_merge_section):
6734         Correct check of whether value was inserted.
6735         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6736         (Output_section_lookup_maps::add_relaxed_input_section):
6737         Likewise.
6738         * arm.cc (Target_arm::got_section): Remove used local os.
6739         * i386.cc (Target_i386::got_section): Likewise.
6740         * x86_64.cc (Target_x86_64::got_section): Likewise.
6741         * sparc.cc (Target_sparc::got_section): Likewise.
6742         (Target_sparc::relocate): Remove unused local have_got_offset.
6743         * powerpc.cc (Target_powerpc::relocate): Likewise.
6744
6745 2010-07-13  Ian Lance Taylor  <iant@google.com>
6746
6747         * compressed_output.cc (zlib_decompress): Fix signature in
6748         !HAVE_ZLIB_H case.
6749
6750         * archive.cc (Archive::include_member): Unlock an external member
6751         of a thin archive.  Don't bother to delete an object we know is
6752         NULL.
6753
6754 2010-07-12  Cary Coutant  <ccoutant@google.com>
6755
6756         * compressed_output.cc (zlib_decompress): New function.
6757         (get_uncompressed_size): New function.
6758         (decompress_input_section): New function.
6759         * compressed_output.h (get_uncompressed_size): New function.
6760         (decompress_input_section): New function.
6761         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6762         Handle compressed debug sections.
6763         * layout.cc (is_compressed_debug_section): New function.
6764         (Layout::output_section_name): Map compressed section names to
6765         canonical names.
6766         * layout.h (is_compressed_debug_section): New function.
6767         (is_debug_info_section): Recognize compressed debug sections.
6768         * merge.cc: Include compressed_output.h.
6769         (Output_merge_data::do_add_input_section): Handle compressed
6770         debug sections.
6771         (Output_merge_string::do_add_input_section): Handle compressed
6772         debug sections.
6773         * object.cc: Include compressed_output.h.
6774         (Sized_relobj::Sized_relobj): Initialize new data members.
6775         (build_compressed_section_map): New function.
6776         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6777         * object.h (Object::section_is_compressed): New method.
6778         (Object::do_section_is_compressed): New method.
6779         (Sized_relobj::Compressed_section_map): New type.
6780         (Sized_relobj::do_section_is_compressed): New method.
6781         (Sized_relobj::compressed_sections_): New data member.
6782         * output.cc (Output_section::add_input_section): Handle compressed
6783         debug sections.
6784         * reloc.cc: Include compressed_output.h.
6785         (Sized_relobj::write_sections): Handle compressed debug sections.
6786
6787 2010-07-08  Cary Coutant  <ccoutant@google.com>
6788
6789         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6790         weak when resolving to a dynamic def.
6791         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6792         for weak undef/dynamic def cases. Adjust callers.
6793         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6794         undef_binding_weak_.
6795         (Symbol_table::sized_write_globals): Adjust symbol binding.
6796         (Symbol_table::sized_write_symbol): Add binding parameter.
6797         * symtab.h (Symbol::set_undef_binding): New method.
6798         (Symbol::is_undef_binding_weak): New method.
6799         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6800         (Symbol_table::should_override): Add new parameter.
6801         (Symbol_table::sized_write_symbol): Add new parameter.
6802
6803         * testsuite/weak_undef_file1.cc: Add new test case.
6804         * testsuite/weak_undef_file2.cc: Fix header comment.
6805         * testsuite/weak_undef_test.cc: Add new test case.
6806
6807 2010-06-29  Doug Kwan  <dougkwan@google.com>
6808
6809         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6810         Initialize USE_SYMBOL_.
6811         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6812         definition.
6813         (Arm_reloc_property::uses_symbol_): New data member declaration.
6814         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6815         uses symbol value and symbol is undefined but not weakly undefined.
6816
6817 2010-06-28  Rafael Espindola  <espindola@google.com>
6818
6819         * plugin.cc (Plugin::load): Use dlerror.
6820
6821 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6822
6823         * symtab.cc (detect_odr_violations): When reporting an ODR
6824         violation, report an object where the symbol is defined.
6825
6826 2010-06-25  Doug Kwan  <dougkwan@google.com>
6827
6828         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6829         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6830         definition.
6831         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6832         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6833         target hook to detect function points.
6834         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6835         * icf.h (Icf::check_section_for_function_pointers): Change type of
6836         parameter SECTION_NAME to const reference to std::string.  Use
6837         target hook to determine if section may have unsafe pointers.
6838         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6839         method definition.
6840
6841 2010-06-21  Rafael Espindola  <espindola@google.com>
6842
6843         * fileread.cc (Input_file::find_fie): New
6844         (Input_file::open): Use Input_file::find_fie.
6845         * fileread.h (Input_file::find_fie): New
6846         * plugin.cc (set_extra_library_path): New.
6847         (Plugin::load): Add set_extra_library_path to the transfer vector.
6848         (Plugin_manager::set_extra_library_path): New.
6849         (Plugin_manager::add_input_file): Use the extra search path if set.
6850         (set_extra_library_path(): New.
6851         * plugin.h (Plugin_manager): Add set_extra_library_path and
6852         extra_search_path_.
6853
6854 2010-06-19  Cary Coutant  <ccoutant@google.com>
6855
6856         * layout.cc (gdb_sections): Add .debug_types.
6857         (lines_only_debug_sections): Likewise.
6858
6859 2010-06-18  Rafael Espindola  <espindola@google.com>
6860
6861         * plugin.cc (add_input_file,add_input_library)
6862         (Plugin_manager::add_input_file): Make filename arguments const.
6863         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6864         const.
6865
6866 2010-06-16  Doug Kwan  <dougkwan@google.com>
6867
6868         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6869         .ARM.attributes section if we have not merged any input
6870         attributes sections.
6871
6872 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6873
6874         * arm.cc: Allow combining objects with no EABI version
6875         information.
6876
6877 2010-06-15  Rafael Espindola  <espindola@google.com>
6878
6879         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6880
6881 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6882
6883         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6884         (struct iovec): Correct !HAVE_READV definition.
6885
6886 2010-06-10  Cary Coutant  <ccoutant@google.com>
6887
6888         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6889         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6890         reloc sections.
6891         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6892
6893         PR 11683
6894         * symtab.h (Symbol::is_placeholder): New member function.
6895         * target-reloc.h (relocate_section): Check for placeholder symbols.
6896
6897         * testsuite/Makefile.am (plugin_test_8): New test.
6898         (plugin_test_9): New test.
6899         * testsuite/Makefile.in: Regenerate.
6900
6901 2010-06-09  Nick Clifton  <nickc@redhat.com>
6902
6903         * yyscript.y (input_list_element): Allow strings prefixed with
6904         the '-' character.  Treat these as libraries.
6905         * script.cc (script_add_library): New function.  Adds a library
6906         specified by "-l<name>" found in an input script.
6907         * script-c.h: Add prototype for script_add_library.
6908
6909 2010-06-07  Doug Kwan  <dougkwan@google.com>
6910
6911         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6912         Restrict stub-group size to be within long conditional branch
6913         range when working around cortex-A8 erratum.
6914
6915 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6916
6917         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6918         #ifdef typo.
6919
6920 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6921
6922         PR gold/11658
6923         * output.cc
6924         (Output_section::Input_section_sort_entry::compare_section_ordering):
6925         Change to return non-zero correctly.
6926         (Output_section::Input_section_sort_section_order_index_compare
6927         ::operator()): Change to fix ambiguity in comparisons.
6928
6929 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6930
6931         * gold.h (is_wildcard_string): New function.
6932         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6933         (Layout::layout_eh_frame): Ditto.
6934         (Layout::find_section_order_index): New method.
6935         (Layout::read_layout_from_file): New method.
6936         * layout.h (Layout::find_section_order_index): New method.
6937         (Layout::read_layout_from_file): New method.
6938         (Layout::input_section_position_): New private member.
6939         (Layout::input_section_glob_): New private member.
6940         * main.cc (main): Call read_layout_from_file here.
6941         * options.h (--section-ordering-file): New option.
6942         * output.cc (Output_section::input_section_order_specified_): New
6943         member.
6944         (Output_section::Output_section): Initialize new member.
6945         (Output_section::add_input_section): Add new parameter.
6946         Keep input sections when --section-ordering-file is used.
6947         (Output_section::set_final_data_size): Sort input sections when
6948         section ordering file is specified.
6949         (Output_section::Input_section_sort_entry): Add new parameter.
6950         Check sorting type.
6951         (Output_section::Input_section_sort_entry::compare_section_ordering):
6952         New method.
6953         (Output_section::Input_section_sort_compare::operator()): Change to
6954         consider section_order_index.
6955         (Output_section::Input_section_sort_init_fini_compare::operator()):
6956         Change to consider section_order_index.
6957         (Output_section::Input_section_sort_section_order_index_compare
6958         ::operator()): New method.
6959         (Output_section::sort_attached_input_sections): Change to sort
6960         according to section order when specified.
6961         (Output_section::add_input_section<32, true>): Add new parameter.
6962         (Output_section::add_input_section<64, true>): Add new parameter.
6963         (Output_section::add_input_section<32, false>): Add new parameter.
6964         (Output_section::add_input_section<64, false>): Add new parameter.
6965         * output.h (Output_section::add_input_section): Add new parameter.
6966         (Output_section::input_section_order_specified): New
6967         method.
6968         (Output_section::set_input_section_order_specified): New method.
6969         (Input_section::Input_section): Initialize section_order_index_.
6970         (Input_section::section_order_index): New method.
6971         (Input_section::set_section_order_index): New method.
6972         (Input_section::section_order_index_): New member.
6973         (Input_section::Input_section_sort_section_order_index_compare): New
6974         struct.
6975         (Output_section::input_section_order_specified_): New member.
6976         * script-sections.cc (is_wildcard_string): Delete and move modified
6977         method to gold.h.
6978         (Output_section_element_input::Output_section_element_input): Modify
6979         call to is_wildcard_string.
6980         (Output_section_element_input::Input_section_pattern
6981         ::Input_section_pattern): Ditto.
6982         (Output_section_element_input::Output_section_element_input): Ditto.
6983         * testsuite/Makefile.am (final_layout): New test case.
6984         * testsuite/Makefile.in: Regenerate.
6985         * testsuite/final_layout.cc: New file.
6986         * testsuite/final_layout.sh: New file.
6987
6988 2010-06-01  Rafael Espindola  <espindola@google.com>
6989
6990         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6991
6992 2010-06-01  Rafael Espindola  <espindola@google.com>
6993
6994         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6995         visibility of symbols.
6996
6997 2010-05-27  Doug Kwan  <dougkwan@google.com>
6998
6999         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7000         from start of output section instead of address for a local symbol
7001         in a merged or relaxed section when doing a relocatable link.
7002
7003 2010-05-26  Rafael Espindola  <espindola@google.com>
7004
7005         PR 11604
7006         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7007         adding sections the garbage collector removed.
7008         * gold/testsuite/Makefile.am: Add test.
7009         * gold/testsuite/Makefile.in: Regenerate.
7010         * gold/testsuite/plugin_test_7.sh: New.
7011         * gold/testsuite/plugin_test_7_1.c: New.
7012         * gold/testsuite/plugin_test_7_2.c: New.
7013
7014 2010-05-26  Rafael Espindola  <espindola@google.com>
7015
7016         * script-sections.cc (Output_section_definition::set_section_addresses):
7017         Check for --section-start.
7018
7019 2010-05-26  Doug Kwan  <dougkwan@google.com>
7020
7021         * arm.cc (Arm_scan_relocatable_relocs): New class.
7022         (Target_arm::relocate_special_relocatable): New method.
7023         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7024         (Arm_relocate_functions::thumb_branch_common): Same.
7025         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7026         instead of Default_scan_relocatable_relocs.
7027         * target-reloc.h (relocate_for_relocatable): Let target handle
7028         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7029         * target.h (Sized_target::relocate_special_relocatable): New method.
7030
7031 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7032
7033         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7034
7035 2010-05-23  Doug Kwan  <dougkwan@google.com>
7036
7037         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7038         instead of a cast.
7039         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7040         with a direct branch, not a conditional branch, to a stub.
7041         * merge.cc (Output_merge_base::record_input_section): New method
7042         defintion.
7043         (Output_merge_data::do_add_input_section): Record input section if
7044         keeps-input-sections flag is set.
7045         (Output_merge_string::do_add_input_section): Ditto.
7046         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7047         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7048         INPUT_SECTIONS_.
7049         (Output_merge_base::keeps_input_sections,
7050         Output_merge_base::set_keeps_input_sections,
7051         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7052         method definitions.
7053         (Output_merge_base::Input_sections): New type declaration.
7054         (Output_merge_base::input_sections_begin,
7055         Output_merge_base::input_sections_end,
7056         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7057         (Output_merge_base::bool keeps_input_sections_,
7058         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7059         Output_merge_base::input_sections_): New data members.
7060         (Output_merge_data::do_set_keeps_input_sections): New method
7061         defintion.
7062         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7063         * output.cc (Output_section::Input_section::relobj): Move method
7064         defintion from class declaration to here and handle merge sections.
7065         (Output_section::Input_section::shndx): Ditto.
7066         (Output_section::Output_section): Remove initializations of removed
7067         data members and initialize new data member LOOKUP_MAPS_.
7068         (Output_section::add_input_section): Set keeps-input-sections flag
7069         for a newly created merge output section as appropriate.  Adjust code
7070         to use Output_section_lookup_maps class.
7071         (Output_section::add_relaxed_input_section): Adjst code for lookup
7072         maps code refactoring.
7073         (Output_section::add_merge_input_section): Add a new parameter
7074         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7075         class.  If adding input section to a newly created merge output
7076         section fails, remove the new merge section.
7077         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7078         Adjust code for use of the Output_section_lookup_maps class.
7079         (Output_section::find_merge_section): Ditto.
7080         (Output_section::build_lookup_maps): New method defintion.
7081         (Output_section::find_relaxed_input_section): Adjust code to use
7082         Output_section_lookup_maps class.
7083         (Output_section::get_input_sections): Export merge sections.  Adjust
7084         code to use Output_section_lookup_maps class.
7085         (Output_section:::add_script_input_section): Adjust code to use
7086         Output_section_lookup_maps class.  Update lookup maps for merge
7087         sections also.
7088         (Output_section::discard_states): Use Output_section_lookup_maps.
7089         (Output_section::restore_states): Same.
7090         * output.h (Merge_section_properties): Move class defintion out of
7091         Output_section.
7092         (Output_section_lookup_maps): New class.
7093         (Output_section::Input_section::is_merge_section): New method
7094         defintion.
7095         (Output_section::Input_section::relobj): Move defintion out of class
7096         defintion.  Declare method only.
7097         (Output_section::Input_section::shndx): Ditto.
7098         (Output_section::Input_section::output_merge_base): New method defintion.
7099         (Output_section::Input_section::u2_.pomb): New union field.
7100         (Output_section::Merge_section_by_properties_map,
7101         Output_section::Output_section_data_by_input_section_map,
7102         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7103         Remove types.
7104         (Output_section::add_merge_input_section): Add new parameter
7105         KEEPS_INPUT_SECTIONS.
7106         (Output_section::build_lookup_maps): New method declaration.
7107         (Output_section::merge_section_map_,
7108         Output_section::merge_section_by_properties_map_,
7109         Output_section::relaxed_input_section_map_,
7110         Output_section::is_relaxed_input_section_map_valid_): Remove data
7111         members.
7112         (Output_section::lookup_maps_): New data member.
7113
7114 2010-05-21  Doug Kwan  <dougkwan@google.com>
7115
7116         PR gold/11619
7117         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7118         avoid a compilation error.
7119
7120 2010-05-19  Rafael Espindola  <espindola@google.com>
7121
7122         * script-sections.cc (Output_section_definition::allocate_to_segment):
7123         Update the phdrs_list even when the output section is NULL.
7124         * testsuite/Makefile.am: Add test.
7125         * testsuite/Makefile.in: Regenerate.
7126         * testsuite/script_test_9.cc: New.
7127         * testsuite/script_test_9.sh: New.
7128         * testsuite/script_test_9.t: New.
7129
7130 2010-05-19  Doug Kwan  <dougkwan@google.com>
7131
7132         * arm.cc (Arm_input_section::original_size): New method.
7133         (Arm_input_section::do_addralign): Add a cast.
7134         (Arm_input_section::do_output_offset): Remove static cast.
7135         (Arm_input_section::original_addralign,
7136          Arm_input_section::original_size_): Change type to uint32_t.
7137         (Arm_input_section::init): Add safe casts for section alignment
7138         and size.
7139         (Arm_input_section::set_final_data_size): Do not set address and
7140         offset of stub table.
7141         (Arm_output_section::fix_exidx_coverage): Change use of of
7142         Output_section::Simple_input_section to that of
7143         Output_section::Input_section.
7144         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7145         except for the first pass.
7146         * output.cc (Output_section::get_input_sections): Change type of
7147         input_sections to std::list<Input_section>.
7148         (Output_section::add_script_input_section): Rename from
7149         Output_section::add_simple_input_section.  Change type of SIS
7150         parameter from Simple_input_section to Input_section.
7151         * output.h (Output_section::Simple_input_section): Remove class.
7152         (Output_section::Input_section): Change class visibility to public.
7153         (Output_section::Input_section::addralign): Use stored alignments
7154         for special input sections if set.
7155         (Output_section::Input_section::set_addralign): New method.
7156         (Output_section::get_input_sections): Change parameter type from
7157         list of Simple_input_section to list of Input_section.
7158         (Output_section::add_script_input_section): Rename from
7159         Output_section::add_simple_input_section. Change first parameter's
7160         type from Simple_input_section to Input_section and remove the
7161         second and third parameters.
7162         * script-sections.cc (Input_section::Input_section_list): Change
7163         type to list of Output_section::Input_section/
7164         (Input_section_info::Input_section_info): Change parameter type of
7165         INPUT_SECTION to Output_section::Input_section.
7166         (Input_section_info::input_section): Change return type.
7167         (Input_section_info::input_section_): Change type to
7168         Output_section::Input_section.
7169         (Output_section_element_input::set_section_addresses): Adjust code
7170         to use Output_section::Input_section instead of
7171         Output_section::Simple_input_section.  Adjust code for renaming
7172         of Output_section::add_simple_input_section.
7173         (Orphan_output_section::set_section_addresses): Ditto.
7174
7175 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7176
7177         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7178         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7179
7180 2010-05-18  Rafael Espindola  <espindola@google.com>
7181
7182         * options.cc (General_options::finalize): Handle -nostdlib.
7183         * options.h (nostdlib): New option.
7184         * script.cc (script_add_search_dir): Handle -nostdlib.
7185
7186 2010-05-12  Doug Kwan  <dougkwan@google.com>
7187
7188         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7189         attributes section only if there no attributes section after merging.
7190         (Target_arm::merge_object_attributes): Move value of
7191         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7192         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7193         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7194         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7195         and arm_attr_merge_7.stdout.
7196         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7197         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7198         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7199         arm_attr_merge_7b.o): New rules.
7200         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7201         arm_attr_merge_7
7202         * testsuite/Makefile.in: Regenerate.
7203         * testsuite/arm_attr_merge.sh: New file.
7204         * testsuite/arm_attr_merge_[67][ab].s: Same.
7205
7206 2010-05-05  Nick Clifton  <nickc@redhat.com>
7207
7208         * po/es.po: Updated Spanish translation.
7209
7210 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7211
7212         * Makefile.am (install-exec-local): Properly install gold as
7213         default cross linker.
7214         * Makefile.in: Regenerated.
7215
7216 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7217             Nick Clifton  <nickc@redhat.com>
7218
7219         * configure.ac (install_as_default): Define and set to false
7220         unless --enable-gold or --enable-gold=both/gold has been
7221         specified.
7222         * configure: Regenerate.
7223
7224         * Makefile.am (install-exec-local): Install the executable as
7225         'ld.gold'.  If install_as_default is true then also install it as
7226         'ld'.
7227         * Makefile.in: Regenerated.
7228
7229 2010-04-24  Ian Lance Taylor  <iant@google.com>
7230
7231         * layout.cc (Layout::layout_reloc): In relocatable link don't
7232         combine reloc sections for grouped sections.
7233
7234 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7235
7236         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7237         sections that are not ordinary to icf.
7238         * icf.cc (get_section_contents): Handle relocation pointing to section
7239         with no object or shndx information.
7240         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7241         * testsuite/Makefile.in: Regenerate.
7242         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7243         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7244
7245 2010-04-22  Ian Lance Taylor  <iant@google.com>
7246
7247         * expression.cc (Expression::Expression_eval_info): Add
7248         result_alignment_pointer field.
7249         (Expression::eval_with_dot): Add result_alignment_pointer
7250         parameter.  Change all callers.
7251         (Expression::eval_maybe_dot): Likewise.
7252         (class Binary_expression): Add alignment_pointer parameter to
7253         left_value and right_value.  Change all callers.
7254         (BINARY_EXPRESSION): Set result alignment.
7255         (class Trinary_expression): Add alignment_pointer parameter to
7256         arg2_value and arg3_value.  Change all callers.
7257         (Trinary_cond::value): Set result alignment.
7258         (Max_expression::value, Min_expression::value): Likewise.
7259         (Align_expression::value): Likewise.
7260         * script-sections.cc (class Sections_element): Add dot_alignment
7261         parameter to set_section_addresses virtual function.  Update
7262         instantiations.
7263         (class Output_section_element): Likewise.
7264         (Script_sections::create_segments): Add dot_alignment parameter.
7265         Change all callers.
7266         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7267         (Script_sections::set_phdrs_clause_addresses): Likewise.
7268         * script-sections.h: Update declarations.
7269         * script.h: Update declarations.
7270         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7271         min_p_align.
7272         * testsuite/script_test_3.t: Set large alignment.
7273         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7274         segment has expected alignment.
7275
7276 2010-04-22  Nick Clifton  <nickc@redhat.com>
7277
7278         * po/gold.pot: Updated by the Translation project.
7279         * po/vi.po: Updated Vietnamese translation.
7280
7281 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7282
7283         * testsuite/Makefile.am (check_PROGRAMS): Add
7284         icf_virtual_function_folding_test.
7285         * testsuite/Makefile.in: Regenerated.
7286
7287 2010-04-15  Andrew Haley  <aph@redhat.com>
7288
7289         * options.h (merge_exidx_entries): New option.
7290         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7291         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7292         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7293         (Target_arm::merge_exidx_entries): New function.
7294         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7295         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7296         to Arm_exidx_fixup constructor.
7297         Add new arg, merge_exidx_entries.
7298         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7299         Arm_output_section::fix_exidx_coverage.
7300
7301 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7302
7303         * icf.cc (get_section_contents): Check for preemptible functions.
7304         Ignore addend when appropriate.
7305         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7306         section folded.
7307         (add_from_relobj): Check for section folded.
7308         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7309         * symtab.h (should_add_dynsym_entry): Add new parameter.
7310         * target-reloc.h (scan_relocs): Check for section folded.
7311         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7312         Check reloc types for function pointers in shared objects.
7313         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7314         case.
7315         (icf_preemptible_functions_test): New test case.
7316         (icf_string_merge_test): New test case.
7317         * testsuite.Makefile.in: Regenerate.
7318         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7319         bar_glob.  Refactor code.
7320         * testsuite/icf_preemptible_functions_test.cc: New file.
7321         * testsuite/icf_preemptible_functions_test.sh: New file.
7322         * testsuite/icf_string_merge_test.cc: New file.
7323         * testsuite/icf_string_merge_test.sh: New file.
7324         * testsuite/icf_virtual_function_folding_test.cc: New file.
7325         * testsuite/icf_virtual_function_folding_test.sh: New file.
7326
7327 2010-04-14  Doug Kwan  <dougkwan@google.com>
7328
7329         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7330         for local symbol recounting if we remove a section due to ICF.
7331         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7332         there are no regular objects in input.
7333
7334 2010-04-13  Doug Kwan  <dougkwan@google.com>
7335
7336         * arm.cc (Arm_input_section::set_final_data_size): Compute
7337         accurate final data size instead of using current data size.
7338
7339 2010-04-09  Doug Kwan  <dougkwan@google.com>
7340
7341         * layout.cc (Layout::choose_output_section): Handle script section
7342         types.
7343         (Layout::make_output_section_for_script): Add section type parameter.
7344         Handle script section types.
7345         * layout.h (Layout::make_output_section_for_script): Add section
7346         type parameter.
7347         * output.cc (Output_section::Output_section): Initialize data member
7348         is_noload_.
7349         (Output_section::do_reset_address_and_file_offset): Do not set address
7350         to 0 if section is a NOLOAD section.
7351         * output.h (Output_section::is_noload): New method.
7352         (Output_section::set_is_noload): Ditto.
7353         (Output_section::is_noload_): New data member.
7354         * script-c.h (Script_section_type): New enum type.
7355         (struct Parser_output_section_header): Add new file section_type.
7356         * script-sections.cc (Sections_element::output_section_name): Add
7357         parameter for returning script section type.
7358         (Output_section_definition::output_section_name): Ditto.
7359         (Output_section_definition::section_type)P; New method.
7360         (Output_section_definiton::script_section_type_name): Ditto.
7361         (Output_section_definition::script_section_type_): New data member.
7362         (Output_section_definition::Output_section_definition): Initialize
7363         data member Output_section_definition::script_section_type_.
7364         (Output_section_definition::create_sections): Pass script section type
7365         to Layout::make_output_section_for_script.
7366         (Output_section_definition::output_section_name): Return script
7367         section type to caller.
7368         (Output_section_definition::set_section_address): Do not advance
7369         dot value and load address if section type is NOLOAD.  Set address
7370         of NOLOAD sections regardless of section flags.
7371         (Output_section_definition::print): Print section type if it is
7372         not SCRIPT_SECTION_TYPE_NONE.
7373         (Output_section_definition::section_type): New method.
7374         (Output_section_definition::script_section_type_name): Ditto.
7375         (Script_sections::output_section_name): Add new parameter
7376         PSECTION_TYPE for returning script section type.  Pass it to
7377         section elements.  Handle discard sections.
7378         (Sort_output_sections::operator()): Handle NOLOAD sections.
7379         * script-sections.h (Script_sections::Section_type): New enum type.
7380         (Script_sections::output_section_name): Add a new parameter for
7381         returning script section type.
7382         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7383         INFO and NOLOAD.
7384         * yyscript.y (union): Add new field SECTION_TYPE.
7385         (COPY, DSECT, INFO, NOLOAD): New tokens.
7386         (opt_address_and_section_type): Change type to output_section_header.
7387         (section_type): New non-terminal
7388         (section_header): Handle section type.
7389         (opt_address_and_section_type): Return section type value.
7390
7391 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7392
7393         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7394         * testsuite/plugin_common_test_2.c (foo): Likewise.
7395
7396 2010-04-08  Doug Kwan  <dougkwan@google.com>
7397
7398         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7399         Output_merge_data.
7400         * output.cc (Output_section::add_merge_input_section): Simplify
7401         code and return status of Output_merge_base::add_input_section.
7402         Update merge section map only if Output_merge_base::add_input_section
7403         returns true.
7404
7405 2010-04-07  Doug Kwan  <dougkwan@google.com>
7406
7407         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7408         if section is marked as containing instructions but has no mapping
7409         symbols.
7410         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7411         correct section index.
7412         (Arm_relobj::find_linked_text_section): Ditto.
7413
7414 2010-04-07  Cary Coutant  <ccoutant@google.com>
7415
7416         * archive.cc (include_member): Destroy Read_symbols_data object before
7417         releasing file.
7418         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7419         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7420         (Read_symbols_data::~Read_symbols_data) New destructor.
7421         (Section_relocs::Section_relocs) New constructor.
7422         (Section_relocs::~Section_relocs) New destructor.
7423         (Read_relocs_data::Read_relocs_data) New constructor.
7424         (Read_relocs_data::~Read_relocs_data) New destructor.
7425         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7426         pointers to NULL after deleting.
7427
7428 2010-04-07  Doug Kwan  <dougkwan@google.com>
7429
7430         * arm.cc: Replace "endianity" with "endianness" in comments.
7431         (Arm_exidx_cantunwind): Ditto.
7432         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7433         (Arm_relobj::merge_flags_and_attributes): New method.
7434         (Arm_relobj::merge_flags_and_attributes_): New data member.
7435         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7436         (Arm_relobj::scan_sections_for_stubs): Ditto.
7437         (Arm_relobj::do_read_symbols): Check to see if we really want to
7438         merge processor-specific flags and attributes.  Exit early if
7439         an object is empty except for section names and the undefined symbol.
7440         (Target_arm::do_finalize_sections): Move check for ELF format to
7441         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7442         attributes from a regular object only when we have determined that
7443         it is aapropriate.  Do not create an .ARM.attributes section in
7444         output if there is no regular input object.
7445         (Target_arm::merge_processor_specific_flags): Check
7446         --warn-mismatch before printing any error.
7447         (Target_arm::merge_object_attributes): Ditto.
7448         * gold.cc (queue_middle_tasks): Handle the case in which there is
7449         no regular object in input.
7450         * options.cc (General_options::parse_EB): New method.
7451         (General_options::parse_EL): Same.
7452         (General_options::General_options): Initialize endianness_.
7453         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7454         New options.
7455         (General_options::Endianness): New enum.
7456         (General_options::endianness): New method.
7457         (General_options::endianness_): New data member.
7458         * parameters.cc (Parameters::set_options): Check target endianness.
7459         (Parameters::set_target_once): Ditto.
7460         (Parameters::check_target_endianness): New method.
7461         (parameters_force_valid_target): If either -EL or -EB is specified,
7462         use it to define endianness of default target.
7463         * parameters.h (Parameters::check_target_endianness): New method
7464         declaration.
7465         * target.h (class Target): Change "endianity" to "endianness"
7466         in comments.
7467
7468 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7469
7470         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7471         * configure: Regenerate.
7472         * Makefile.in: Regenerate.
7473         * testsuite/Makefile.in: Regenerate.
7474
7475 2010-04-06  Cary Coutant  <ccoutant@google.com>
7476
7477         gcc PR lto/42757
7478         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7479         prevailing definitions of common symbols.
7480         * testsuite/plugin_test_6.sh: New test case.
7481         * testsuite/plugin_common_test_1.c: New test case.
7482         * testsuite/plugin_common_test_2.c: New test case.
7483         * testsuite/Makefile.am (plugin_test_6): New test case.
7484         * testsuite/Makefile.in: Regenerate.
7485
7486 2010-04-06  Nick Clifton  <nickc@redhat.com>
7487
7488         * po/vi.po: New Vietnamese translation.
7489
7490 2010-03-30  Doug Kwan  <dougkwan@google.com>
7491
7492         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7493
7494 2010-03-25  Doug Kwan  <dougkwan@google.com>
7495
7496         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7497         to avoid a conversion warning on a 32-bit host.
7498
7499 2010-03-24  Ian Lance Taylor  <iant@google.com>
7500
7501         * testsuite/script_test_3.t: Add a TLS segment.
7502         * testsuite/Makefile.am (check_PROGRAMS): Add
7503         tls_phdrs_script_test.
7504         (tls_phdrs_script_test_SOURCES): Define.
7505         (tls_phdrs_script_test_DEPENDENCIES): Define.
7506         (tls_phdrs_script_test_LDFLAGS): Define.
7507         (tls_phdrs_script_test_LDADD): Define.
7508         * testsuite/Makefile.in: Rebuild.
7509
7510 2010-03-23  Cary Coutant  <ccoutant@google.com>
7511
7512         * fileread.cc (find_or_make_view): Fix comment.
7513
7514 2010-03-23  Ian Lance Taylor  <iant@google.com>
7515
7516         * script-sections.cc (class Orphan_section_placement): Define
7517         PLACE_TLS and PLACE_TLS_BSS.
7518         (Orphan_section_placement::Orphan_section_placement): Initialize
7519         new places.
7520         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7521         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7522         (tls_script_test_SOURCES): Define.
7523         (tls_script_test_DEPENDENCIES): Define.
7524         (tls_script_test_LDFLAGS): Define.
7525         (tls_script_test_LDADD): Define.
7526         * testsuite/Makefile.in: Rebuild.
7527
7528 2010-03-22  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm.cc (Arm_relocate_functions::abs8,
7531         Arm_relocate_functions::abs16): Use correct check for overflow
7532         specified in the ARM ELF specs.
7533         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7534         target of a BLX instruction specially.
7535         (Reloc_stub::stub_type_for_reloc): Ditto.
7536         (Relocate::relocate): Use symbolic names instead of numeric relocation
7537         codes to report error.
7538         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7539         workaround.
7540         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7541         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7542         thumb2_blx_out_of_range.stdout
7543         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7544         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7545         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7546         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7547         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7548         thumb2_blx_in_range, thumb2_blx_in_range.o,
7549         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7550         thumb2_blx_out_of_range.o): New rules.
7551         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7552         thumb2_blx_in_range and thumb2_blx_out_of_range.
7553         * testsuite/Makefile.in: Regenerate.
7554         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7555         * testsuite/thumb_blx_in_range.s: New file.
7556         * testsuite/thumb_blx_out_of_range.s: New file.
7557
7558 2010-03-22  Rafael Espindola  <espindola@google.com>
7559
7560         * archive.cc (Should_include): Move to archive.h.
7561         (should_include_member): Make it a member of Archive.
7562         (Lib_group): New.
7563         (Add_lib_group_symbols): New.
7564         * archive.h: Include options.h.
7565         (Archive_member): Moved from Archive.
7566         (Should_include): Moved from archive.cc.
7567         (Lib_group): New.
7568         (Add_lib_group_symbols): New.
7569         * dynobj.cc (do_should_include_member): New.
7570         * dynobj.h (do_should_include_member): New.
7571         * gold.cc (queue_initial_tasks): Update call to queue.
7572         * main.cc (main): Print lib group stats.
7573         * object.cc (do_should_include_member): New.
7574         * object.h: Include archive.h.
7575         (Object::should_include_member): New.
7576         (Object::do_should_include_member): New.
7577         (Sized_relobj::do_should_include_member): New.
7578         * options.cc (General_options::parse_start_lib): New.
7579         (General_options::parse_end_lib): New.
7580         (Input_arguments::add_file): Handle lib groups.
7581         (Input_arguments::start_group): Check we are not in a lib.
7582         (Input_arguments::start_lib): New.
7583         (Input_arguments::end_lib): New.
7584         * options.h (General_options): Add start_lib and end_lib.
7585         (Input_argument::lib_): New.
7586         (Input_argument::lib): New.
7587         (Input_argument::is_lib): New.
7588         (Input_file_lib): New.
7589         (Input_arguments::in_lib_): New.
7590         (Input_arguments::in_lib): New.
7591         (Input_arguments::start_lib): New.
7592         (Input_arguments::end_lib_): New.
7593         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7594         in unused members as preempted.
7595         (Sized_pluginobj::do_should_include_member): New.
7596         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7597         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7598         return the blocker.
7599         (Read_symbols::do_whole_lib_group): New.
7600         (Read_symbols::do_lib_group): New.
7601         (Read_symbols::do_read_symbols): Handle lib groups.
7602         (Read_symbols::get_name): Handle lib groups.
7603         * readsyms.h (Read_symbols): Add an archive member pointer.
7604         (Read_symbols::do_whole_lib_group): New.
7605         (Read_symbols::do_lib_group): New.
7606         (Read_symbols::member_): New.
7607         * script.cc (read_input_script): Update call to queue_soon.
7608
7609 2010-03-19  Doug Kwan  <dougkwan@google.com>
7610
7611         * arm.cc (Stub_table::Stub_table): Initialize new data members
7612         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7613         (Stub_table::add_reloc_stub): Assign stub offset and update
7614         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7615         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7616         New data members.
7617         (Stub_table::update_data_size_and_addralign): Use
7618         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7619         instead of going over all reloc stubs.
7620         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7621         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7622         Stringpool_template::offset_ to size of Stringpool_char.
7623         (Stringpool_template::new_key_offset): Remove code to initialize
7624         Stringpool_template::offset_.
7625         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7626         Stringpool_template::offset_ to zero.
7627
7628 2010-03-15  Doug Kwan  <dougkwan@google.com>
7629
7630         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7631         offset_.
7632         (Stringpool_template::new_key_offset): New method.
7633         (Stringpool_template::add_string): Assign offsets when adding new
7634         strings.
7635         (Stringpool_template::set_string_offsets): Do not set string offsets
7636         when not optimizing.
7637         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7638         member size_.
7639         (Chunked_vector::clear): Clear size_.
7640         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7641         (Chunked_vector::size): Return size_.
7642         (Chunked_vector::push_back): Use size_ to find insert position.
7643         (Chunked_vector::size_): New data member.
7644         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7645         (Stringpool_template::new_key_offset): New method declaration.
7646         (Stringpool_template::offset_): New data member.
7647
7648 2010-03-15   Rafael Espindola  <espindola@google.com>
7649
7650         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7651         Add_symbols' constructor.
7652         * readsyms.h (Add_symbols): Remove the input_group member.
7653
7654 2010-03-10  Ian Lance Taylor  <iant@google.com>
7655
7656         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7657         target to ask whether a reference to a symbol requires a stack
7658         split.
7659         * target.h (Target::is_call_to_non_split): New function.
7660         (Target::do_is_call_to_non_split): Declare virtual function.
7661         * target.cc: Include "symtab.h".
7662         (Target::do_is_call_to_non_split): New function.
7663         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7664
7665 2010-03-10  Cary Coutant  <ccoutant@google.com>
7666
7667         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7668         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7669         (File_read::open[2]): Add whole_file_view_ to list of views.
7670         (File_read::make_view): Remove test of whole_file_view_.
7671         (File_read::find_or_make_view): Create whole_file_view_ if
7672         necessary.
7673         (File_read::clear_views): Replace bool parameter with enum;
7674         adjust all callers.  Don't delete views with permanent data;
7675         do delete cached views and views from archives if
7676         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7677         if clearing the corresponding view.
7678         * fileread.h (File_read::Clear_views_mode): New enum.
7679         (File_read::View::is_permanent_view): New method.
7680         (File_read::clear_views): Replace bool parameter
7681         with enum; adjust all callers.
7682         * options.h (General_options): Change keep_files_mapped option;
7683         add map_whole_files.
7684         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7685         releasing the file.
7686         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7687         the file.
7688
7689 2010-03-10  David S. Miller  <davem@davemloft.net>
7690
7691         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7692
7693 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7694
7695         * icf.cc (get_section_contents): Add '@' marker after processing the
7696         merge reloc.
7697
7698 2010-03-08  Doug Kwan  <dougkwan@google.com>
7699
7700         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7701         due to a conversion warning.
7702         (Arm_relobj::update_output_local_symbol_count): Check for local
7703         symbol with unset output index.
7704
7705 2010-03-05  Ian Lance Taylor  <iant@google.com>
7706
7707         * options.h (class General_options): Add --spare-dynamic-tags.
7708         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7709         --spare-dynamic-tags.
7710
7711 2010-03-05  Ian Lance Taylor  <iant@google.com>
7712
7713         * incremental.cc: Include "libiberty.h".
7714
7715 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7716
7717         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7718         function, is_info_ member.
7719         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7720         (Versions::Versions): Update caller.
7721         (Versions::define_base_version): Likewise.
7722         (Versions::add_def): Likewise.
7723
7724 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7725
7726         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7727         (Scan::possible_function_pointer_reloc): New function.
7728         (Scan::local_reloc_may_be_function_pointer): Change to call
7729         possible_function_pointer_reloc.
7730         (Scan::global_reloc_may_be_function_pointer): Ditto.
7731         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7732         relocations in ".data.rel.ro._ZTV" section.
7733         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7734         * testsuite/icf_safe_so_test.cc: Ditto.
7735         * testsuite/icf_safe_test.cc: Ditto.
7736         * testsuite/icf_safe_test.sh: Ditto.
7737
7738 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7739             Ian Lance Taylor  <iant@google.com>
7740
7741         * target-reloc.h (relocate_section): Check the symbol table index
7742         for -1U before setting the local symbol index.
7743         (scan_relocatable_relocs): If copying the relocation, record that
7744         the local symbol is required.
7745         * object.h (Symbol_value::is_output_symtab_index_set): New
7746         function.
7747         (Symbol_value::may_be_discarded_from_output_symtab): New
7748         function.
7749         (Symbol_value::has_output_symtab_entry): New function.
7750         (Symbol_value::needs_output_symtab_entry): Remove.
7751         (Symbol_value::output_symtab_index): Make sure the symbol index is
7752         set.
7753         (Symbol_value::set_output_symtab_index): Make sure the symbol
7754         index is not set.  Make sure the new index is valid.
7755         (Symbol_value::set_must_have_output_symtab_entry): New function.
7756         (Symbol_value::has_output_dynsym_entry): New function.
7757         (Symbol_value::set_output_dynsym_index): Make sure the new index
7758         is valid.
7759         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7760         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7761         local symbol if permitted.
7762         (Sized_relobj::do_finalize_local_symbols): Call
7763         is_output_symtab_index_set rather than needs_output_symtab_entry.
7764         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7765         rather than needs_output_symtab_entry.  Call
7766         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7767         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7768         is_output_symtab_index_set rather than needs_output_symtab_entry.
7769         * testsuite/discard_locals_relocatable_test.c: New file.
7770         * testsuite/discard_locals_test.sh: Test -r.
7771         * testsuite/Makefile.am (check_DATA): Add
7772         discard_locals_relocatable_test1.syms,
7773         discard_local_relocatable_test2.syms.
7774         (MOSTLYCLEANFILES): Likewise.  Also add
7775         discard_locals_relocatable_test1.lout and
7776         discard_locals_relocatable_test2.out.
7777         (discard_locals_relocatable_test1.syms): New target.
7778         (discard_locals_relocatable_test.o): New target.
7779         (discard_locals_relocatable_test1.out): New target.
7780         (discard_locals_relocatable_test2.syms): New target.
7781         (discard_locals_relocatable_test2.out): New target.
7782         (various): Add missing ../ld-new dependencies.
7783         * testsuite/Makefile.in: Rebuild.
7784
7785 2010-03-03  Nick Clifton  <nickc@redhat.com>
7786
7787         * po/fi.po: New Finnish translation.
7788
7789 2010-03-01  Doug Kwan  <dougkwan@google.com>
7790
7791         * layout.cc (Layout::Layout): Force section types of .init_array*,
7792         .preinit_array* and .fini_array* sections.
7793         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7794         Fix check of return value of std::string::find.().
7795         (Output_section::Input_section_sort_compare::operator()): Remove
7796         comment about .init_array.
7797         (Output_section::Input_section_sort_init_fini_compare::operator()):
7798         New method.
7799         (Output_section::sort_attached_input_sections): Handle .init_array
7800         and .fini_array specially.
7801         * output.h (Output_section::Inut_section_sort_compare): Update
7802         comment.
7803         (Output_section::Input_section_sort_init_fini_compare): New struct.
7804
7805 2010-02-26  Doug Kwan  <dougkwan@google.com>
7806
7807         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7808         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7809         * testsuite/debug_msg.sh: Avoid matching source line number for
7810         use of global variable undef_int.
7811
7812 2010-02-26  Doug Kwan  <dougkwan@google.com>
7813
7814         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7815         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7816         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7817         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7818         * options.cc (General_options::General_options): Initialize member
7819         fix_v4bx_.
7820         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7821         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7822         and rm_no_fix_v4bx.stdout
7823         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7824         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7825         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7826         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7827         and arm_no_fix_v4bx.
7828         * Makefile.in: Regenerate.
7829         * testsuite/arm_fix_v4bx.s: New file.
7830         * testsuite/arm_fix_v4bx.sh: Ditto.
7831
7832 2010-02-24  Doug Kwan  <dougkwan@google.com>
7833
7834         * arm.cc (Target_arm::got_section): Make the .got section the first
7835         non RELRO section in the data segment.
7836         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7837         suffixes of section names.
7838
7839 2010-02-24  Doug Kwan  <dougkwan@google.com>
7840
7841         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7842         flags and attributes merging if an input file is a binary file.
7843         * fileread.cc (Input_file::open): Record format of original file.
7844         * fileread.h (Input_file::Format): New enum type.
7845         (Input_file::Input_file): Initialize data member format_.
7846         (Input_file::format): New method definition.
7847         (Input_file::format_):: New data member.
7848
7849 2010-02-24  Doug Kwan  <dougkwan@google.com>
7850
7851         * arm.cc (Arm_output_data_got): New class.
7852         (ARM_TCB_SIZE): New constant
7853         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7854         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7855         If user uses a script with a SECTIONS clause, issue only a warning
7856         for a misplaced EXIDX input section.  Otherwise, issue an error.
7857         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7858         garbage collection.
7859         (Target_arm::got_mode_index_entry): Handle static linking.
7860         (Target_arm::Scan::local): Ditto.
7861         (Target_arm::Scan::global): Ditto.
7862         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7863         all incorrectly implemented relocations.
7864         (Target_arm::fix_exidx_coverage): Pass layout to
7865         Arm_output_section::fix_exidx_coverage.
7866         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7867         from ".ARM.exidx." and ".ARM.extab.".
7868
7869 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7870
7871         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7872         section if it does not already exist.
7873         * attributes.cc (Attributes_section_data::Attributes_section_data):
7874         Don't crash if size is zero.
7875
7876 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7877             Ian Lance Taylor  <iant@google.com>
7878
7879         * gold.cc (queue_middle_tasks): If no input files were opened,
7880         exit.
7881         * workqueue.h (Task_function::Task_function): Assert that there is
7882         a blocker.
7883
7884 2010-02-22  Doug Kwan  <dougkwan@google.com>
7885
7886         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7887         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7888         types to avoid warnings due to different uint64_t implementations
7889         on different hosts.
7890
7891 2010-02-21  Doug Kwan  <dougkwan@google.com>
7892
7893         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7894         handling of the maximum backward branch offset.
7895         (Arm_relocate_functions::thumb_branch_common): Ditto.
7896         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7897         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7898         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7899         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7900         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7901         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7902         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7903         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7904         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7905         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7906         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7907         thumb2_bl_out_of_range.o): New rules.
7908         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7909         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7910         thumb2_bl_out_of_range
7911         * testsuite/Makefile.in: Regenerate.
7912         * testsuite/arm_bl_in_range.s: New file.
7913         * testsuite/arm_bl_out_of_range.s: Ditto.
7914         * testsuite/arm_branch_in_range.sh: Ditto.
7915         * testsuite/arm_branch_range.t: Ditto.
7916         * testsuite/thumb2_branch_range.t: Ditto.
7917         * testsuite/thumb_bl_in_range.s: Ditto.
7918         * testsuite/thumb_bl_out_of_range.s: Ditto.
7919         * testsuite/thumb_branch_range.t: Ditto.
7920
7921 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7922
7923         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7924         Add reloc offset information.
7925         * icf.cc (get_section_contents): Change iterators to point to the new
7926         vectors. Add reloc offset information to the contents.
7927         * icf.h (Icf::Sections_reachable_info): New typedef.
7928         (Icf::Sections_reachable_list): New typedef.
7929         (Icf::Offset_info): New typedef.
7930         (Icf::Reloc_info): New struct typedef.
7931         (Icf::Reloc_info_list): New typedef.
7932         (Icf::symbol_reloc_list): Delete method.
7933         (Icf::addend_reloc_list): Delete method.
7934         (Icf::section_reloc_list): Delete method.
7935         (Icf::reloc_info_list): New method.
7936         (Icf::reloc_info_list_): New member.
7937
7938 2010-02-19  Doug Kwan  <dougkwan@google.com>
7939
7940         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7941         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7942         * arm.cc (Arm_relocation_functions): New forward declaration.
7943         (Target_arm::Target_arm): Initialize new data members
7944         got_mod_index_offset_ and tls_base_symbol_defined_.
7945         (Target_arm::Relocate::relocate_tls): New method.
7946         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7947          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7948         New methods.
7949         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7950         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7951         (Target_arm::got_mod_index_offset_,
7952         Target_arm::tls_base_symbol_defined_): New data members.
7953         (Target_arm::Scan::local, Target::Scan::global,
7954         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7955         relocations.
7956
7957 2010-02-18  Doug Kwan  <dougkwan@google.com>
7958
7959         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7960         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7961         text section as a parameter becuase some broken tools may not set
7962         the link in section header.
7963         (Target_arm::has_got_section): New method.
7964         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7965         without any mapping symbol as data only.  Remove warning.
7966         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7967         link in its section header, try to discover the link by inspecting the
7968         REL31 relocation at the beginning of the section.
7969         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7970         in error message.
7971         (Target_arm::Scan::global): Treat any reference to the symbol
7972         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7973
7974 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7975
7976         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7977         (Scan::global_reloc_may_be_function_pointer): New function.
7978         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7979         (Scan::global_reloc_may_be_function_pointer): New function.
7980         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7981         (Scan::global_reloc_may_be_function_pointer): New function.
7982         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7983         (Scan::global_reloc_may_be_function_pointer): New function.
7984         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7985         (Scan::global_reloc_may_be_function_pointer): New function.
7986         (Scan::possible_function_pointer_reloc): New function.
7987         (Target_x86_64::can_check_for_function_pointers): New function.
7988         * gc.h (gc_process_relocs): Scan relocation types to determine if
7989         function pointers were taken for targets that support it.
7990         * icf.cc (Icf::find_identical_sections): Include functions for
7991         folding in safe ICF whose pointer is not taken.
7992         * icf.h (Secn_fptr_taken_set): New typedef.
7993         (fptr_section_id_): New member.
7994         (section_has_function_pointers): New function.
7995         (set_section_has_function_pointers): New function.
7996         (check_section_for_function_pointers): New function.
7997         * options.h: Fix comment for safe ICF option.
7998         * target.h (can_check_for_function_pointers): New function.
7999         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8000         Modify icf_safe_test for X86-64.
8001         * testsuite/Makefile.in: Regenerate.
8002         * testsuite/icf_safe_so_test.cc: New file.
8003         * testsuite/icf_safe_so_test.sh: New file.
8004         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8005         (main): Change to take pointer to function kept_func_3.
8006         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8007         folding is done correctly for X86-64.
8008
8009 2010-02-12  David S. Miller  <davem@davemloft.net>
8010
8011         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8012         is_symbolless parameter.
8013         (Output_reloc<SHT_REL>::is_symbolless): New.
8014         (Output_reloc<SHT_REL>::is_symbolless_): New.
8015         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8016         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8017         (Output_reloc<SHT_RELA>::is_symbolless): New.
8018         (Output_data_reloc::add_global): Handle is_symbolless.
8019         (Output_data_reloc::add_global_relative): Likewise.
8020         (Output_data_reloc::add_local): Likewise.
8021         (Output_data_reloc::add_local_relative): Likewise.
8022         (Output_data_reloc::add_symbolless_global_addend): New.
8023         (Output_data_reloc::add_symbolless_local_addend): New.
8024         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8025         is_symbolless.
8026         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8027         instead of ->is_relative_
8028         (Output_reloc::write): Likewise.
8029         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8030         (Output_reloc::write_rel): Simplify.
8031
8032         * sparc.cc (Target_sparc::Scan::local): Use
8033         ->add_symbolless_local_addend as needed.
8034         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8035         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8036         based upon relocation offset.
8037
8038 2010-02-11  Doug Kwan  <dougkwan@google.com>
8039
8040         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8041         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8042         beginning of function.
8043         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8044         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8045         parameter is_32bit in calls to should_apply_static_reloc.
8046         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8047         (check_DATA): Add arm_abs_global.stdout.
8048         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8049         arm_abs_global.stdout): New rules.
8050         (MOSTLLYCLEANFILES): Add arm_abs_global
8051         * Makefile.in: Regenerate.
8052         * testsuite/arm_abs_global.s: New file.
8053         * testsuite/arm_abs_global.sh: Ditto.
8054         * testsuite/arm_abs_lib.s: Ditto.
8055
8056 2010-02-11  Ian Lance Taylor  <iant@google.com>
8057
8058         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8059         Read_relocs task.
8060         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8061         Allocate_commons_task first.
8062         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8063         task, rather than symtab_lock_.
8064         (Gc_process_relocs::~Gc_process_relocs): New function.
8065         (Gc_process_relocs::is_runnable): Check this_blocker_.
8066         (Gc_process_relocs::locks): Use next_blocker_ rather than
8067         blocker_.
8068         (Scan_relocs::~Scan_relocs): New function.
8069         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8070         symtab_lock_.
8071         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8072         next_blocker_.
8073         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8074         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8075         constructor accordingly.
8076         (class Gc_process_relocs): Likewise.
8077         (class Scan_relocs): Likewise.
8078         * common.h (class Allocate_commons_task): Remove symtab_lock_
8079         field, and corresponding constructor parameter.
8080         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8081         symtab_lock_.
8082         (Allocate_commons_task::locks): Likewise.
8083
8084 2010-02-11  Ian Lance Taylor  <iant@google.com>
8085
8086         * gold-threads.h (class Once): Define.
8087         (class Initialize_lock): Rewrite as child of Once.
8088         * gold-threads.cc (class Once_initialize): Define.
8089         (once_pointer_control): New static variable.
8090         (once_pointer, once_arg): New static variables.
8091         (c_run_once): New static function.
8092         (Once::Once, Once::run_once, Once::internal_run): New functions.
8093         (class Initialize_lock_once): Remove.
8094         (initialize_lock_control): Remove.
8095         (initialize_lock_pointer): Remove.
8096         (initialize_lock_once): Remove.
8097         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8098         (Initialize_lock::initialize): Rewrite.
8099         (Initialize_lock::do_run_once): New function.
8100         * archive.cc (Archive::interpret_header): Only clear name if it is
8101         not already empty.
8102         * fileread.cc: Include "gold-threads.h"
8103         (file_counts_lock): New static variable.
8104         (file_counts_initialize_lock): Likewise.
8105         (File_read::release): Only increment counts when using --stats.
8106         Use a lock around the increment.
8107         * parameters.cc (class Set_parameters_target_once): Define.
8108         (set_parameters_target_once): New static variable.
8109         (Parameters::Parameters): Move here from parameters.h.
8110         (Parameters::set_target): Rewrite.
8111         (Parameters::set_target_once): New function.
8112         (Parameters::clear_target): Move here and rewrite.
8113         * parameters.h (class Parameters): Update declarations.  Add
8114         set_parameters_target_once_ field.
8115         (Parameters::Parameters): Move to parameters.cc.
8116         (Parameters::clear_target): Likewise.
8117         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8118         task.
8119         (Start_group::~Start_group): New function.
8120         (Start_group::is_runnable): New function.
8121         (Start_group::locks, Start_group::run): New functions.
8122         (Finish_group::run): Change saw_undefined to size_t.
8123         * readsyms.h (class Start_group): Define.
8124         (class Finish_group): Change saw_undefined_ field to size_t.
8125         (Finish_group::Finish_group): Remove saw_undefined and
8126         this_blocker parameters.  Change all callers.
8127         (Finish_group::set_saw_undefined): New function.
8128         (Finish_group::set_blocker): New function.
8129         * symtab.h (class Symbol_table): Change saw_undefined to return
8130         size_t.  Change saw_undefined_ field to size_t.
8131         * target-select.cc (Set_target_once::do_run_once): New function.
8132         (Target_selector::Target_selector): Initialize set_target_once_
8133         field.  Don't initialize lock_ and initialize_lock_ fields.
8134         (Target_selector::instantiate_target): Rewrite.
8135         (Target_selector::set_target): New function.
8136         * target-select.h (class Set_target_once): Define.
8137         (class Target_selector): Update declarations.  Make
8138         Set_target_once a friend.  Remove lock_ and initialize_lock_
8139         fields.  Add set_target_once_ field.
8140
8141 2010-02-10  Ian Lance Taylor  <iant@google.com>
8142
8143         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8144         queueing any tasks.
8145         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8146         (queue_middle_tasks): Add all blockers before queueing any tasks.
8147         (queue_final_tasks): Likewise.
8148         * token.h (Task_token::add_blockers): New function.
8149         * object.h (Input_objects::number_of_relobjs): New function.
8150
8151 2010-02-10  Ian Lance Taylor  <iant@google.com>
8152
8153         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8154         shared, not if not position independent.
8155         * x86_64.cc (Relocate::relocate_tls): Likewise.
8156         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8157         (tls_pie_pic_test): New target.
8158         * testsuite/Makefile.in: Rebuild.
8159
8160         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8161         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8162         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8163         * testsuite/Makefile.in: Rebuild.
8164
8165 2010-02-09  David S. Miller  <davem@davemloft.net>
8166
8167         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8168         R_SPARC_RELATIVE using ->add_local_relative().
8169         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8170
8171         * output.h (Output_data_dynamic::add_section_size): New method
8172         that takes two Output_data objects.
8173         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8174         entry param.  Handle it in initializers.
8175         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8176         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8177         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8178         arg.
8179         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8180         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8181         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8182         for dynrel_includes_plt.
8183         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8184         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8185         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8186         before .rela.plt
8187         (Target_sparc::do_finalize_sections): Update to pass true for
8188         dynrel_includes_plt.
8189         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8190         output before .rela.plt
8191         (Target_powerpc::do_finalize_sections): Update to pass true for
8192         dynrel_includes_plt when 32-bit.
8193
8194 2010-02-08  Doug Kwan  <dougkwan@google.com>
8195
8196         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8197         method.
8198         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8199         Arm_relobj::scan_section_for_cortex_a8_stubs,
8200         Arm_relobj::do_relocation_section): Instead of calling
8201         Output_section::output_address, use faster
8202         Arm_relobj::simple_input_section_output_address.
8203
8204 2010-02-08  David S. Miller  <davem@davemloft.net>
8205
8206         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8207         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8208         relocation helper function.
8209
8210         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8211         just like R_SPARC_GOT{10,13,22}.
8212         (Target_sparc::Scan::local): Likewise.
8213         (Target_sparc::Relocate:relocate): Likewise.
8214
8215 2010-02-06  Ian Lance Taylor  <iant@google.com>
8216
8217         * configure.ac: Rewrite targetobjs duplicate removal code to use
8218         only shell constructs.
8219         * configure: Rebuild.
8220
8221 2010-02-05  Doug Kwan  <dougkwan@google.com>
8222
8223         PR 11247
8224         * arm.cc (Arm_relobj::section_is_scannable): New method.
8225         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8226         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8227
8228 2010-02-04  Doug Kwan  <dougkwan@google.com>
8229
8230         PR 11247
8231         * arm-reloc-property.cc (cstdio): Include.
8232         * configure.ac (targetobjs): Remove duplicates.
8233         * configure: Regenerate.
8234         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8235         big and little endian version for a given address size.
8236
8237 2010-02-03  Doug Kwan  <dougkwan@google.com>
8238
8239         * arm-reloc-property.cc
8240         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8241         definition.
8242         * arm-reloc-property.h
8243         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8244         New method definition.
8245         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8246         declaration.
8247         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8248         overflow to N.
8249         (GOT_PREL): Change implemented to Y.
8250         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8251         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8252         (Arm_relocate_functions::movw_abs_nc): Remove method.
8253         (Arm_relocate_functions::movt_abs): Ditto.
8254         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8255         (Arm_relocate_functions::thm_movt_abs): Ditto.
8256         (Arm_relocate_functions::movw_rel_nc): Ditto.
8257         (Arm_relocate_functions::movw_rel): Ditto.
8258         (Arm_relocate_functions::movt_rel): Ditto.
8259         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8260         (Arm_relocate_functions:thm_movw_rel): Ditto.
8261         (Arm_relocate_functions:thm_movt_rel): Ditto.
8262         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8263         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8264         New method definitions.
8265         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8266         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8267         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8268         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8269         (Target_arm::Relocate::relocate): Check for non-static or
8270         unimplemented relocation code and exit early.  Change calls to
8271         Target_arm::reloc_uses_thumb_bit and
8272         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8273         instead.  Refactor code to handle similar relocations to increase
8274         code sharing.  Remove check for unsupported relocation code in switch
8275         statement.
8276         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8277         relocation property table to find out size.  Change error message to
8278         print out the name of a relocation code instead of the numeric value.
8279         (Target_arm::scan_reloc_for_stub): Use relocation property table
8280         instead of calling Target_arm::reloc_uses_thumb_bit().
8281
8282 2010-02-02  Doug Kwan  <dougkwan@google.com>
8283
8284         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8285         types of relaxed input section.
8286
8287 2010-02-02  Doug Kwan  <dougkwan@google.com>
8288
8289         * Makefile.am (HFILES): Add arm-reloc-property.h.
8290         (DEFFILES): New.
8291         (TARGETSOURCES): Add arm-reloc-property.cc
8292         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8293         (libgold_a_SOURCES): $(DEFFILES)
8294         * Makefile.in: Regenerate.
8295         * arm-reloc-property.cc: New file.
8296         * arm-reloc-property.h: New file.
8297         * arm-reloc.def: New file.
8298         * arm.cc: Update comments.
8299         (arm-reloc-property.h): New included header.
8300         (arm_reloc_property_table): New global variable.
8301         (Target_arm::do_select_as_default_target): New method definition.
8302         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8303         arm-reloc-property to targ_extra_obj.
8304         * parameters.cc (set_parameters_target): Call
8305         Target::select_as_default_target().
8306         * target.h (Target::select_as_default_target): New method definition.
8307         (Target::do_select_as_default_target): Same.
8308
8309 2010-02-01  Doug Kwan  <dougkwan@google.com>
8310
8311         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8312         first_output_text_section_.
8313         (Arm_exidx_fixup::first_output_text_section): New method definition.
8314         (Arm_exidx_fixup::first_output_text_section_): New data member.
8315         (Arm_exidx_fixup::process_exidx_section): Record the first text
8316         output section seen.
8317         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8318         and entsize in output section header.
8319
8320 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8321
8322         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8323         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8324         (Arm_relocate_functions::thm_alu11): New Method.
8325         (Arm_relocate_functions::thm_pc8): New Method.
8326         (Arm_relocate_functions::thm_pc12): New Method.
8327         (Target_arm::Scan::local): Handle the relocations.
8328         (Target_arm::Scan::global): Likewise.
8329         (Target_arm::Relocate::relocate): Likewise.
8330         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8331
8332 2010-01-29  Doug Kwan  <dougkwan@google.com>
8333
8334         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8335         of relocation types as ld.
8336
8337 2010-01-29  Doug Kwan  <dougkwan@google.com>
8338
8339         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8340         to public.
8341         (Arm_relocate_functions::thumb_branch_common): Ditto.
8342         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8343         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8344         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8345         Arm_relocate_functions::jump24): Remove.
8346         (Target_arm::Relocate::relocate): Adjust code to call
8347         Arm_relocation_functions::arm_branch_common and
8348         Arm_relocation_functions::thumb_branch_common instead of their removed
8349         wrappers.  Merge switch-cases together to reduce source code size.
8350
8351 2010-01-29  Doug Kwan  <dougkwan@google.com>
8352
8353         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8354         output_local_symbol_count_needs_update_.
8355         (Arm_relobj::output_local_symbol_count_needs_update,
8356          Arm_relobj::set_output_local_symbol_count_needs_update,
8357          Arm_relobj::update_output_local_symbol_count): New methods.
8358         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8359         member.
8360         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8361         of pointed function as in a R_ARM_PREL31 relocation.
8362         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8363         for output local symbol count updating.
8364         (Target_arm::do_relax): Update output local symbol counts in objects
8365         if necessary.
8366         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8367
8368 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8369
8370         * arm.cc: Added support for the ARM relocations:
8371         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8372         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8373         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8374         movw_prel_nc).
8375         (Arm_relocate_functions::movw_rel): New method.
8376         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8377         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8378         thm_movw_prel_nc).
8379         (Arm_relocate_functions::thm_movw_rel): New method.
8380         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8381         thm_movt_prel).
8382         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8383         relocations.
8384         (Target_arm::Scan::global): Likewise.
8385         (Target_arm::Relocate::relocate): Likewise.
8386         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8387         Likewise.
8388
8389 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8390
8391         * arm.cc: Added support for ARM group relocations.
8392         (Target_arm::reloc_needs_sym_origin): New method.
8393         (Arm_relocate_functions::calc_grp_kn): New method.
8394         (Arm_relocate_functions::calc_grp_residual): New method.
8395         (Arm_relocate_functions::calc_grp_gn): New method.
8396         (Arm_relocate_functions::arm_grp_alu): New Method.
8397         (Arm_relocate_functions::arm_grp_ldr): New Method.
8398         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8399         (Arm_relocate_functions::arm_grp_ldc): New Method.
8400         (Target_arm::Scan::local): Handle the ARM group relocations.
8401         (Target_arm::Scan::global): Likewise.
8402         (Target_arm::Relocate::relocate): Likewise.
8403         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8404         Likewise.
8405
8406 2010-01-26  Doug Kwan  <dougkwan@google.com>
8407
8408         * arm.cc (set): Include.
8409         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8410         pointer type.
8411         (Arm_output_section::Text_section_list): New type.
8412         (Arm_output_section::append_text_sections_to_list): New method.
8413         (Arm_output_section::fix_exidx_coverage): Ditto.
8414         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8415         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8416         Relobj::set_section_offset() instead of
8417         Sized_relobj::invalidate_section_offset().
8418         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8419         parameter for section headers. Ignore relocation sections for
8420         unallocated sections and EXIDX sections.
8421         (Target_arm::fix_exidx_coverage): New method.
8422         (Target_arm::output_section_address_less_than): New type.
8423         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8424         linked text section instead of the EXIDX section.
8425         (Arm_output_section::create_stub_group): Add an assertion to check
8426         that this is not an EXIDX output section.
8427         (Arm_output_section::append_text_sections_to_list): New method.
8428         (Arm_output_section::fix_exidx_coverage): Ditto.
8429         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8430         Arm_relobj::section_needs_reloc_stub_scanning.
8431         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8432         first pass.
8433         (Target_arm::fix_exidx_coverage): New method.
8434         * object.h (Relobj::set_output_section): New method.
8435         (Sized_relobj::invalidate_section_offset): Remove method.
8436         (Sized_relobj::do_invalidate_section_offset): Remove method.
8437         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8438
8439 2010-01-25  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8442         Fix warning due to signed and unsigned comparison on a 32-bit host.
8443
8444 2010-01-22  Doug Kwan  <dougkwan@google.com>
8445
8446         * arm.cc (Target_arm::do_relax): Record an output section for section
8447         offset adjustment it contains any stub table that has changed.
8448         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8449         offsets in an output section if necessary.
8450         * output.cc (Output_section::Output_section): Initialize
8451         section_offsets_need_adjustments_.
8452         (Output_section::add_input_section_for_script): Renamed to
8453         Output_section::add_simple_input_section.
8454         (Output_section::save_states): Add a comment.
8455         (Output_section::discard_states): New method defintion.
8456         (Output_section::adjust_section_offsets): Same.
8457         * output.h (Output_section::add_input_section_for_script): Renamed to
8458         Output_section::add_simple_input_section.
8459         (Output_section::discard_states): New method declaration.
8460         (Output_section::adjust_section_offsets): Same.
8461         (Output_section::section_offsets_need_adjustment,
8462         Output_section::set_section_offsets_need_adjustment): New method
8463         definitions.
8464         (Output_section::section_offsets_need_adjustment_): New data member.
8465         * script-sections.cc
8466         (Output_section_element_input::set_section_address): Adjust code for
8467         renaming of Output_section::add_input_section_for_script.
8468         (Orphan_output_section::set_section_address): Same.
8469
8470 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8471
8472         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8473         Fix_v4bx enum values .
8474         * gold/options.h (General_options): New option definitions.
8475         (General_options::fix_v4bx): New method.
8476         (General_options::Fix_v4bx): New enum.
8477         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8478         (General_options::parse_fix_v4bx_interworking): New method.
8479
8480 2010-01-22  Doug Kwan  <dougkwan@google.com>
8481
8482         * arm.cc (Arm_exidx_fixup): New class.
8483
8484 2010-01-21  Doug Kwan  <dougkwan@google.com>
8485
8486         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8487         classes.
8488         (Arm_exidx_section_offset_map): New type.
8489
8490 2010-01-21  Doug Kwan  <dougkwan@google.com>
8491
8492         * arm.cc (Arm_exidx_input_section): New class.
8493         (Arm_relobj::exidx_input_section_by_link,
8494         Arm_relobj::exidx_input_section_by_shndx,
8495         Arm_relobj::make_exidx_input_section): New methods.
8496         (read_arm_attributes_section): Remove.
8497         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8498         information about them.
8499         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8500         to here.
8501
8502 2010-01-20  Doug Kwan  <dougkwan@google.com>
8503
8504         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8505         Input_section_specifier to Section_id.
8506         (Target_arm::new_arm_input_section: Adjust code for change of key
8507         type.
8508         (Target_arm::find_arm_input_section): Ditto.
8509         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8510         (Section_id): Remove.
8511         (Garbage_collection::Section_id_hash): Remove.
8512         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8513         (Section_id): Remove.
8514         (Icf::Section_id_hash): Remove.
8515         * object.h (Section_id, Const_section_id, Section_id_hash,
8516         Const_section_id_hash): New type definitions.
8517         * output.cc (Output_section::add_relaxed_input_section): Change to
8518         use Const_section_id instead of Input_section_specifier as key type.
8519         (Output_section::add_merge_input_section): Ditto.
8520         (Output_section::build_relaxation_map): Change to use Section_id
8521         instead of Input_section_specifier as key type.
8522         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8523         Ditto.
8524         (Output_section::convert_input_sections_to_relaxed_sections): Change
8525         to use Const_section_id instead of Input_section_specifier as key type.
8526         (Output_section::find_merge_section): Ditto.
8527         (Output_section::find_relaxed_input_section): Ditto.
8528         * output.h (Input_section_specifier): Remove class.
8529         (Output_section::Output_section_data_by_input_section_map): Change
8530         key type to Const_section_id.
8531         (Output_section::Output_relaxed_input_section_by_input_section_map):
8532         Ditto.
8533         (Output_section::Relaxation_map): Change key type to Section_id.
8534
8535 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8536
8537         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8538         (class Arm_v4bx_stub): New class.
8539         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8540         (Stub_factory::make_arm_v4bx_stub): New method.
8541         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8542         (Stub_table::empty): Handle v4bx stubs.
8543         (Stub_table::add_arm_v4bx_stub): New method.
8544         (Stub_table::find_arm_v4bx_stub): New method.
8545         (Arm_relocate_functions::v4bx): New method.
8546         (Target_arm::fix_v4bx): New method.
8547         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8548         (Stub_table::relocate_stubs): Likewise.
8549         (Stub_table::do_write): Likewise.
8550         (Stub_table::update_data_size_and_addralign): Likewise.
8551         (Stub_table::finalize_stubs):  Likewise.
8552         (Target_arm::Scan::local): Likewise.
8553         (Target_arm::Scan::global): Likewise.
8554         (Target_arm::do_finalize_sections): Likewise.
8555         (Target_arm::Relocate::relocate): Likewise.
8556         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8557         Likewise.
8558         (Target_arm::scan_reloc_for_stub): Likewise.
8559         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8560
8561 2010-01-19  Ian Lance Taylor  <iant@google.com>
8562
8563         * output.cc (Output_section_headers::do_sized_write): Write large
8564         segment count to sh_info field.
8565         (Output_file_header::do_sized_write): For large segment count,
8566         write PN_XNUM to e_phnum field.
8567
8568 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8569
8570         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8571         (Arm_relocate_functions::thm_jump8): New function.
8572         (Arm_relocate_functions::thm_jump11): New function.
8573         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8574         R_ARM_THM_JUMP11.
8575         (Target_arm::Scan::global): Likewise.
8576         (Target_arm::Relocate::relocate): Likewise.
8577         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8578         Likewise.
8579
8580 2010-01-14  Doug Kwan  <dougkwan@google.com>
8581
8582         * arm.cc (map, utility): Include headers.
8583         (Target_arm::apply_cortex_a8_workaround): New method.
8584         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8585         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8586         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8587         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8588         the --[no-]fix-cortex-a8 command line options.
8589         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8590         (Target_arm::relocate_stub): Use addend in instruction template.
8591         * options.h (DEFINE_bool): Set the user-set flag.
8592         (General_options): Add --[no-]-fix-cortex options.
8593         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8594         : Update fast look-up map after conversion.
8595
8596 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8597
8598         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8599         in the first pass of do_layout.
8600
8601 2010-01-13  Doug Kwan  <dougkwan@google.com>
8602
8603         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8604         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8605         apparent compiler problem of not folding static constant integral
8606         data members of elfcpp::Elf_sizes<32>.
8607
8608 2010-01-13  Doug Kwan  <dougkwan@google.com>
8609
8610         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8611         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8612         Arm_relobj::scan_section_for_cortex_a8_erratum,
8613         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8614         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8615         sections to scan for relocation stubs into a new method
8616         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8617         relocation and Cortex-A8 stub scanning.
8618         (Target_arm::do_relax): Force stubs to be after stubbed sections
8619         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8620         the beginning of a new relaxation pass.  Update a comment.
8621         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8622
8623 2010-01-12  Ian Lance Taylor  <iant@google.com>
8624
8625         * target-reloc.h (visibility_error): New inline function.
8626         (relocate_section): Call visibility_error.
8627         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8628         (MOSTLYCLEANFILES): Likewise.
8629         (protected_4_pic.o, protected_3.err): New targets.
8630         * testsuite/protected_4.cc: New file.
8631
8632 2010-01-12  Doug Kwan  <dougkwan@google.com>
8633
8634         * arm.cc (Cortex_a8_reloc): New class.
8635         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8636         and cortex_a8_relocs_info_.
8637         (Target_arm::fix_cortex_a8): New method definition.
8638         (Target_arm::Cortex_a8_relocs_info): New type.
8639         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8640         New data member declarations.
8641         (Target_arm::scan_reloc_for_stub): Record information about
8642         relocations for THUMB branches that might be exempted from the
8643         Cortex-A8 workaround.
8644         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8645         at the beginning of a relaxation pass.
8646
8647 2010-01-12  Doug Kwan  <dougkwan@google.com>
8648
8649         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8650         (Arm_relobj::Mapping_symbol_position,
8651          Arm_reloj::Mapping_symbol_position_less,
8652          Arm_relobj::Mapping_symbols_info): New types.
8653         (Target_arm::is_mapping_symbol_name): New method definition.
8654         (Arm_relobj::do_count_local_symbols): Save information about mapping
8655         symbols.
8656
8657 2010-01-11  Doug Kwan  <dougkwan@google.com>
8658
8659         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8660         Arm_relocate_functions::thumb32_branch_upper,
8661         Arm_relocate_functions::thumb32_branch_lower,
8662         Arm_relocate_functions::thumb32_cond_branch_offset,
8663         Arm_relocate_functions::thumb32_cond_branch_upper,
8664         Arm_relocate_functions::thumb32_cond_branch_lower,
8665         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8666         branch offset encoding.
8667         (Arm_relocate_functions::thumb_branch_common): Use new branch
8668         offset encoding methods to avoid code duplication.
8669         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8670         (Stub_addend_reader::operator()): Use new branch encoding method
8671         to avoid code duplication.
8672
8673 2010-01-11  Doug Kwan  <dougkwan@google.com>
8674
8675         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8676         (Target_arm::do_finalize_sections): Define special EXIDX section
8677         symbols only if referenced.
8678         * gc.h (Garbage_collection::add_reference): New method.
8679         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8680         code duplication.
8681
8682 2010-01-11  Ian Lance Taylor  <iant@google.com>
8683
8684         * script.cc (Version_script_info::build_expression_list_lookup):
8685         Change complaing about duplicate wildcard match from error to
8686         warning.
8687
8688         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8689         of 2009-12-30.
8690         (Version_script_info::Version_script_info): Initialize globs_,
8691         default_version_, default_is_global_, and exact_.  Don't
8692         initialize globals_ or locals_.
8693         (Version_script_info::build_lookup_tables): Build local symbols
8694         first.
8695         (Version_script_info::unquote): New function.
8696         (Version_script_info::add_exact_match): New function.
8697         (Version_script_info::build_expression_list_lookup): Remove lookup
8698         parameter.  Add is_global parameter.  Change all callers.  Handle
8699         wildcard pattern specially.  Unquote pattern.  Call
8700         add_exact_match.
8701         (Version_script_info::get_name_to_match): New function.
8702         (Version_script_info::get_symbol_version): New function.
8703         (Version_script_info::get_symbol_version_helper): Remove.
8704         (Version_script_info::check_unmatched_names): Call unquote.
8705         * script.h (class Version_script_info): Change get_symbol_version
8706         to be non-inline and add is_global parameter; change all callers.
8707         Rewrite symbol_is_local.  Update declarations.  Define struct
8708         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8709         Remove globals_ and locals_ members.  Add exact_, globs_,
8710         default_version_, is_global_.
8711         (Version_script_info::Glob): Remove pattern, add expression and
8712         is_global.  Update constructor.  Change all callers.
8713         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8714         default version.
8715         (Versions::symbol_section_contents): If a symbol is undefined, or
8716         defined in a dynamic object, set the version index to
8717         VER_NDX_LOCAL.
8718         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8719         symbol_is_local.
8720         (Symbol_table::add_from_pluginobj): Likewise.
8721         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8722
8723 2010-01-11  Doug Kwan  <dougkwan@google.com>
8724
8725         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8726         (incremental_dump_LDADD): Add linking option for libintl.
8727         * Makefile.in: Regenerate.
8728
8729 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8730
8731         PR gold/11144
8732         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8733         instead of -Ds.
8734         * testsuite/Makefile.in: Regenerated.
8735
8736 2010-01-10  Doug Kwan  <dougkwan@google.com>
8737
8738         * options.h (DEFINE_var): Use parentheses around argument varname__
8739         in macro body to avoid any unintended subsequent substitutions.
8740
8741 2010-01-10  Ian Lance Taylor  <iant@google.com>
8742
8743         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8744         candidates before doing symbol resolution.
8745
8746         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8747         ODR candidates if only one is weak.
8748
8749 2010-01-08  Ian Lance Taylor  <iant@google.com>
8750
8751         * script.cc (Version_script_info::build_expression_list_lookup):
8752         Don't warn about ambiguous version, just record the ambiguity.
8753         (Version_script_info::get_symbol_version_helper): Give error if
8754         version is ambiguous.
8755
8756 2010-01-08  Doug Kwan  <dougkwan@google.com>
8757
8758         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8759         prev_data_size_ and prev_addralign_.  Remove initializer for
8760         deleted data member has_been_changed_.
8761         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8762         to determine if the table is empty.
8763         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8764         Remove.
8765         (Stub_table::add_reloc_stub): Define method in class definition
8766         instead of just declaring it there.
8767         (Stub_table::add_cortex_a8_stub): New method definition.
8768         (Stub_table::update_data_size_and_addralign): Ditto.
8769         (Stub_table::finalize_stubs): Ditto.
8770         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8771         (Stub_table::do_addralign_): Return address alignment in the
8772         (Stub_table::do_reset_address_and_file_offset): Define method in
8773         class definition instead of declaring it there.  Set current data
8774         size to be the data size of the previous pass.
8775         (Stub_table::set_final_data_size): Use current data size as the
8776         final data size.
8777         (Stub_table::relocate_stub): Change parameter type of stub from
8778         Reloc_stub pointer to Stub pointer.
8779         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8780         (Stub_table::Cortex_a8_stub_list): New typedef.
8781         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8782          Stub_table::prev_addralign_): New data member.
8783         (Arm_relobj::Arm_relobj): Initialize data member
8784         section_has_cortex_a8_workaround_.
8785         (Arm_relobj::section_has_cortex_a8_workaround,
8786          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8787          definitions.
8788         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8789         declarations.
8790         (Target_arm::relocate_stub): Change parameter type of stub from
8791         Reloc_stub pointer to Stub pointer.
8792         (Insn_template::size, Insn_template::alignment): Handle
8793         THUMB16_SPECIAL_TYPE.
8794         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8795          Stub_table::update_data_size_and_addralign,
8796          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8797         definitions.
8798         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8799         (Stub_table::do_write): Ditto.
8800         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8801
8802 2010-01-08  Ian Lance Taylor  <iant@google.com>
8803
8804         PR 11108
8805         * symtab.h (class Symbol): Remove fields is_target_special_ and
8806         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8807         (Symbol::is_defined_in_discarded_section): New function.
8808         (Symbol::set_is_defined_in_discarded_section): New function.
8809         (Symbol::has_plt_offset): Rewrite.
8810         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8811         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8812         Don't initialize is_target_special_ or has_plt_offset_.
8813         Initialize is_defined_in_discarded_section_.
8814         (Symbol_table::add_from_relobj): If appropriate, set
8815         is_defined_in_discarded_section.
8816         * resolve.cc (Symbol::override_base_with_special): Don't test
8817         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8818         * target-reloc.h (relocate_section): Do special handling for
8819         symbols defined in discarded sections for global symbols as well
8820         as local symbols.
8821
8822 2010-01-08  Ian Lance Taylor  <iant@google.com>
8823
8824         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8825         the SHT_SYMTAB case.
8826
8827 2010-01-08  Ian Lance Taylor  <iant@google.com>
8828
8829         * object.cc (Sized_relobj::do_layout): Don't get confused if
8830         layout_eh_frame returns NULL.
8831
8832 2010-01-08  Ian Lance Taylor  <iant@google.com>
8833
8834         PR 11084
8835         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8836         dynamic symbol table, use the normal symbol table.
8837         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8838         symbol table.
8839
8840 2010-01-08  Ian Lance Taylor  <iant@google.com>
8841
8842         PR 11072
8843         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8844         sections.
8845
8846 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8847
8848         * version.cc (print_version): Change to "Copyright 2010".
8849
8850 2010-01-08  Ian Lance Taylor  <iant@google.com>
8851
8852         PR 10287
8853         PR 11063
8854         * i386.cc (class Target_i386): Change return type of plt_section
8855         to be non-const.
8856         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8857         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8858         tls_desc_rel_ field.
8859         (Output_data_plt_i386::rel_tls_desc): New function.
8860         (Target_i386::rel_tls_desc_section): New function.
8861         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8862         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8863         R_386_TLS_DESC reloc in rel_tls_desc_section.
8864         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8865         Define struct Tlsdesc_info.
8866         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8867         (Target_x86_64::do_reloc_symbol_index): New function.
8868         (Target_x86_64::add_tlsdesc_info): New function.
8869         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8870         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8871         tlsdesc_rel_ field.
8872         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8873         all callers.
8874         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8875         (Target_x86_64::rela_tlsdesc_section): New function.
8876         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8877         handling.
8878         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8879         (Target_x86_64::do_reloc_addend): New function.
8880         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8881         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8882         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8883         (Output_reloc::type): New function.
8884         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8885         (Output_reloc::is_target_specific): New function.
8886         (Output_reloc::target_arg): New function.
8887         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8888         absolute relocs and target specific relocs.
8889         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8890         add_target_specific.
8891         (class Output_data_reloc) [SHT_RELA]: Likewise.
8892         * output.cc (Output_reloc::Output_reloc): Add four new versions
8893         for absolute relocs and target specific relocs.
8894         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8895         (Output_reloc::get_symbol_index): Likewise.
8896         (Output_reloc::local_section_offset): Check that local_sym_index_
8897         is not TARGET_CODE or 0.
8898         (Output_reloc::symbol_value): Likewise.
8899         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8900         reloc.
8901         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8902         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8903         functions.
8904         * layout.cc (add_target_dynamic_tags): Use output section for
8905         DT_PLTRELSZ and DT_JMPREL.
8906
8907 2010-01-07  Ian Lance Taylor  <iant@google.com>
8908
8909         PR 11061
8910         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8911         function.
8912         (class Output_data_reloc_generic): Define.
8913         (class Output_data_reloc_base): Change base class to
8914         Output_data_reloc_generic.  Change add() method to call
8915         bump_relative_reloc_count for a relative reloc.  Remove
8916         sort_relocs_ field.
8917         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8918         to sort_relocs().
8919         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8920         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8921         appropriate.
8922         * layout.h (class Layout): Update declaration.
8923
8924 2010-01-07  Ian Lance Taylor  <iant@google.com>
8925
8926         * output.h (class Output_data): Add const version of
8927         output_section and do_output_section.
8928         (class Output_section_data): Add const version of
8929         do_output_section.
8930         (class Output_section): Likewise.
8931         * layout.cc (Layout::add_target_dynamic_tags): New function.
8932         * layout.h (class Layout): Update declarations.
8933         * arm.cc (Target_arm::do_finalize_sections): Use
8934         add_target_dynamic_tags.
8935         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8936         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8937         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8938         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8939
8940 2010-01-07  Ian Lance Taylor  <iant@google.com>
8941
8942         PR 11042
8943         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8944         object as needed.
8945
8946 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8947             Ian Lance Taylor  <iant@google.com>
8948
8949         PR 11019
8950         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8951         Xindex::read_symtab_xindex.
8952
8953 2010-01-07  Doug Kwan  <dougkwan@google.com>
8954
8955         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8956         (Insn_template::thumb16_bcond_insn): New method declaration.
8957         (Insn_template): Fix spelling.
8958         (Stub::thumb16_special): New method declaration.
8959         (Stub::do_write): Define virtual method which was previously pure
8960         virtual.
8961         (Stub::do_thumb16_special): New method declaration.
8962         (Stub::do_fixed_endian_write): New template member.
8963         (Reloc_stub::do_write): Remove.
8964         (Reloc_stub::do_fixed_endian_write): Remove.
8965         (Cortex_a8_stub): New class definition.
8966         (Stub_factory::make_cortex_a8_stub): New method definition.
8967         (Stub_factory::Stub_factory): Add missing static storage class
8968         qualifier for elf32_arm_stub_a8_veneer_blx.
8969
8970 2010-01-07  Ian Lance Taylor  <iant@google.com>
8971
8972         PR 10980
8973         * options.h (class General_options): Add --warn-unresolved-symbols
8974         and --error-unresolved-symbols.
8975         * errors.cc (Errors::undefined_symbol): Implement
8976         --warn-unresolved-symbols.
8977
8978         * options.h (class General_options): Add -z text and -z textoff.
8979         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8980
8981 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8982
8983         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8984         (Garbage_collection::cident_sections): New function.
8985         (Garbage_collection::add_cident_section): New function.
8986         (Garbage_collection::cident_sections_): New member.
8987         (gc_process_relocs): Add references to sections whose names are C
8988         identifiers.
8989         * gold.h (cident_section_start_prefix): New constant.
8990         (cident_section_stop_prefix): New constant.
8991         (is_cident): New function.
8992         * layout.cc (Layout::define_section_symbols): Replace string constants
8993         with the newly defined constants.
8994         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8995         C identifiers.
8996         * testsuite/Makefile.am: Add gc_orphan_section_test.
8997         * testsuite/Makefile.in: Regenerate.
8998         * testsuite/gc_orphan_section_test.cc: New file.
8999         * testsuite/gc_orphan_section_test.sh: New file.
9000
9001 2010-01-06  Ian Lance Taylor  <iant@google.com>
9002
9003         PR 10980
9004         * options.h (class General_options): Add --warn-shared-textrel.
9005         * layout.cc (Layout::finish_dynamic_section): Implement
9006         --warn-shared-textrel.
9007
9008         PR 10980
9009         * options.h (class General_options): Add --warn-multiple-gp.
9010
9011 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9012
9013         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9014         $(THREADSLIB) and $(LIBDL).
9015         * Makefile.in: Rebuild.
9016
9017 2010-01-06  Ian Lance Taylor  <iant@google.com>
9018
9019         PR 10980
9020         * options.cc (General_options::parse_section_start): New function.
9021         (General_options::section_start): New function.
9022         (General_options::General_options): Initialize all members.
9023         * options.h: Include <map>
9024         (class General_options): Add --section-start.  Add section_starts_
9025         member.
9026         * layout.cc (Layout::attach_allocated_section_to_segment): If
9027         --section-start was used, set the address of the segment.  Remove
9028         local sort_sections.
9029         (Layout::relaxation_loop_body): If the address of the load segment
9030         has been set by --section-start, don't use it.
9031         * output.h (Output_segment::update_flags_for_output_section): New
9032         function.
9033         * output.cc (Output_segment::add_output_section): Call
9034         update_flags_for_output_section.
9035
9036 2010-01-05  Ian Lance Taylor  <iant@google.com>
9037
9038         PR 10980
9039         * options.h (class General_options): Add --undefined-version.
9040         * script.cc (struct Version_expression): Add was_matched_by_symbol
9041         field.
9042         (Version_script_info::matched_symbol): New function.
9043         (Version_script_info::get_symbol_version_helper): Call
9044         matched_symbol.
9045         (Version_script_info::check_unmatched_names): New function.
9046         * script.h (class Version_script_info): Update declarations.
9047         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9048
9049         * options.h (class General_options): Use DEFINE_bool_alias for
9050         allow_multiple_definition.
9051         * resolve.cc (Symbol_table::should_override): Don't test
9052         allow_multiple_definition.
9053
9054         PR 10980
9055         * options.h (class General_options): Add --cref.
9056         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9057         until after printing cref table.
9058         * cref.cc: Include "symtab.h".
9059         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9060         (Cref_table_compare::operator()): New function.
9061         (Cref_inputs::gather_cref): New function.
9062         (filecol): New static const.
9063         (Cref_inputs::print_cref): New function.
9064         (Cref::print_cref): New function.
9065         * cref.h: Include <cstdio>.
9066         (class Cref): Update declarations.
9067         * mapfile.h (Mapfile::file): New function.
9068         * object.h (class Object): Define Symbols.  Declare virtual
9069         do_get_global_symbols.
9070         (Object::get_global_symbols): New function.
9071         * object.cc (Input_objects::add_object): Pass object to cref_ if
9072         --cref.
9073         (Input_objects::archive_start): Likewise.
9074         (Input_objects::archive_stop): Likewise.
9075         (Input_objects::print_cref): New function.
9076         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9077         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9078         --cref.
9079         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9080         function.
9081         * plugin.h (class Sized_pluginobj): Update declarations.
9082
9083 2010-01-05  Ian Lance Taylor  <iant@google.com>
9084
9085         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9086         to is_default_version.  Rename insdef to insdefault.
9087         (Symbol_table::add_from_relobj): Rename def to is_default_version
9088         and local to is_forced_local.
9089         (Symbol_table::add_from_pluginobj): Likewise.
9090         (Symbol_table::add_from_dynobj): Likewise.
9091         (Symbol_table::define_special_symbol): Rename insdef to
9092         insdefault.
9093
9094 2010-01-04  Ian Lance Taylor  <iant@google.com>
9095
9096         PR 10980
9097         * options.h (class General_options): Add
9098         --allow-multiple-definition and -z muldefs.
9099         * resolve.cc (Symbol_table::should_override): Don't warn about a
9100         multiple symbol definition if --allow-multiple-definition or -z
9101         muldefs.
9102
9103         PR 10980
9104         * options.h (class General_options): Add --add-needed and
9105         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9106         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9107         error if --copy-dt-needed-entries aka --add-needed is used and
9108         would cause a change in behaviour.
9109
9110         PR 10980
9111         * options.h (class General_options): Add -G as a short version of
9112         --shared.  Add no-op options -assert, -g, and -i.
9113
9114 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9115
9116         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9117         check for .text or .gnu.linkonce.t sections.
9118         * icf.cc (Icf::find_identical_sections): Ditto.
9119         Change the detection for mangled function name within the section
9120         name.
9121         * icf.h (is_section_foldable_candidate): New function.
9122
9123 2009-12-30  Ian Lance Taylor  <iant@google.com>
9124
9125         PR 10980
9126         * options.h (class General_options): Permit two dashes with
9127         --retain-symbols-file.
9128
9129 2009-12-30  Ian Lance Taylor  <iant@google.com>
9130
9131         PR 10979
9132         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9133         don't put the file header and segment headers in the text
9134         segment.
9135
9136         PR 10979
9137         * common.cc (Sort_commons::operator()): Stabilize sort when both
9138         entries are NULL.
9139         (Symbol_table::do_allocate_commons_list): When allocating common
9140         symbols, skip a symbol which is no longer common.
9141         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9142         an object before checking its type.
9143         * testsuite/common_test_2.c: New file.
9144         * testsuite/common_test_3.c: New file.
9145         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9146         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9147         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9148         (common_test_2_pic.o, common_test_2.so): New targets.
9149         (common_test_3_pic.o, common_test_3.so): New targets.
9150         * testsuite/Makefile.in: Rebuild.
9151
9152         PR 10979
9153         * script.cc (read_input_script): If we see a new SECTIONS clause,
9154         and we have added an input section, give an error.
9155         * layout.h (class Layout): Add have_added_input_section function.
9156         Add have_added_input_section_ field.
9157         * layout.cc (Layout::Layout): Initialize
9158         have_added_input_section_.
9159         (Layout::layout): Set have_added_input_section_.
9160         (Layout::layout_eh_frame): Likewise.
9161
9162 2009-12-30  Ian Lance Taylor  <iant@google.com>
9163
9164         PR 10931
9165         * options.h (class General_options): Add --sort-common option.
9166         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9167         * common.cc (Sort_common): Add sort_order parameter to
9168         constructor.  Add sort_order_ field.
9169         (Sort_commons::operator): Check sort_order_.
9170         (Symbol_table::allocate_commons): Determine the sort order.
9171         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9172         Change all callers.
9173         (Symbol_table::do_allocate_commons_list): Likewise.
9174
9175 2009-12-30  Ian Lance Taylor  <iant@google.com>
9176
9177         PR 10916
9178         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9179         symbols from this object, don't change the visibility of an
9180         undefined symbol.
9181         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9182
9183 2009-12-30  Ian Lance Taylor  <iant@google.com>
9184
9185         PR 10861
9186         * script.h (class Version_script_info): Define Language enum.
9187         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9188         new fields globals_, locals_, and is_finalized_.
9189         * script.cc: Various formatting fixes.
9190         (class Parser_closure): Change language_stack_ from a vector of
9191         std::string to one of Version_script_info::Language.  Adjust all
9192         uses accordingly.
9193         (class Lazy_demangler): Remove.
9194         (struct Version_expression): Change language from std::string to
9195         Version_script_info::Language.
9196         (Version_script_info::Version_script_info): New function.
9197         (Version_script_info::~Version_script_info): Don't call clear.
9198         (Version_script_info::finalize): New function.
9199         (Version_script_info::build_lookup_tables): New function.
9200         (Version_script_info::build_expression_list_lookup): New
9201         function.
9202         (Version_script_info::get_symbol_version_helper): Rewrite to use
9203         lookup tables.
9204         (Version_script_info::print_expression_list): Adjust to use
9205         Version_script_info::Language.
9206         (script_push_lex_into_version_mode): Check that the version script
9207         has not been finalized.
9208         (version_script_push_lang): Change language string to
9209         Version_script_info::Language.
9210         * options.cc (Command_line::version_script): New function.
9211         * options.h (class General_options): Add finalize_dynamic_list
9212         function.  Change version_script from declaration to definition.
9213         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9214         * testsuite/version_script.map: Remove duplicate def of foo.
9215         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9216         version_script.map.
9217         * testsuite/Makefile.in: Rebuild.
9218
9219 2009-12-30  Ian Lance Taylor  <iant@google.com>
9220
9221         PR 10843
9222         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9223         if the input symbol index is 0, make the output symbol index 0.
9224
9225 2009-12-30  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 10670
9228         * options.h (class General_options): Add -x/--discard-all.
9229         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9230         --discard-all.  If the local symbol needs a dynamic entry, check
9231         that before handling --discard-locals.
9232
9233 2009-12-30  Ian Lance Taylor  <iant@google.com>
9234
9235         PR 10450
9236         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9237         flags to PF_R.
9238         (Output_segment::add_output_section): Don't change the flags if
9239         the type is PT_TLS.
9240
9241         PR 10450
9242         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9243         GNU hash table if they need a dynamic value.  Otherwise, don't add
9244         them if they are defined in a dynamic object or are forced local.
9245
9246 2009-12-29  Ian Lance Taylor  <iant@google.com>
9247
9248         PR 10450
9249         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9250         .gnu.hash table for a 32-bit target.
9251
9252         PR 10450
9253         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9254         regular and a dynamic object only needs a dynamic symbol table
9255         entry if it is externally visible.
9256
9257         PR 10450
9258         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9259         constructor.  Add global_offset_table_ field.
9260         (Target_i386::got_section): Set global_offset_table_.
9261         (Target_i386::do_finalize_sections): Set global_offset_table_
9262         size.
9263         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9264         in constructor.  Add global_offset_table_ field.
9265         (Target_x86_64::got_section): Set global_offset_table_.
9266         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9267         size.
9268
9269         * layout.cc (Layout::Layout): Initialize increase_relro_.
9270         (Layout::get_output_section): Add is_relro, is_last_relro, and
9271         is_first_non_relro parameters.  Change all callers.
9272         (Layout::choose_output_section): Likewise.
9273         (Layout::add_output_section_data): Likewise.
9274         (Layout::make_output_section): Likewise.
9275         (Layout::set_segment_offsets): Clear increase_relro when using a
9276         linker script.
9277         * layout.h (class Layout): Add increase_relro method.  Add
9278         increase_relro_ field.  Update declarations.
9279         * output.cc (Output_section::Output_section): Initialize
9280         is_last_relro_ and is_first_non_relro_.
9281         (Output_segment::add_output_section): Group relro sections is
9282         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9283         (Output_segment::maximum_alignment): Remove relro handling.
9284         (Output_segment::set_section_addresses): Add increase_relro
9285         parameter.  Change all callers.  Add initial alignment to align
9286         relro sections on separate page.  Remove old relro handling.
9287         (Output_segment::set_section_list_addresses): Remove in_relro
9288         parameter.  Change all callers.
9289         (Output_segment::set_offset): Add increase parameter.  Change all
9290         callers.  Remove old relro handling.
9291         * output.h (class Output_section): Add new methods: is_last_relro,
9292         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9293         Add is_last_relro_ and is_first_non_relro_ fields.
9294         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9295         Create separate .got.plt section.  Call increase_relro.
9296         * x86_64.cc (Target_x86_64::got_section): Likewise.
9297         * testsuite/relro_script_test.t: Add .got.plt.
9298
9299         PR 10450
9300         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9301         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9302         (Layout::finalize): Call set_dynamic_symbol_size.
9303         (Layout::set_dynamic_symbol_size): New function.
9304         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9305         set_dynamic_symbol_size.
9306
9307         PR 10450
9308         * output.h (class Output_section): Add is_entsize_zero_ field.
9309         * output.cc (Output_section::Output_section): Initialize
9310         is_entsize_zero_.
9311         (Output_section::set_entsize): If two different entsizes are
9312         requested, force it to zero.
9313         (Output_section::add_input_section): Set flags for .debug_str
9314         before updating section flags.  Set entsize.
9315         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9316         and SHF_STRING if all input sections have those flags.
9317
9318 2009-12-29   Rafael Espindola  <espindola@google.com>
9319
9320         * main.cc (main): Fix the sys time reporting.
9321         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9322         reporting.
9323
9324 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9325
9326         * options.cc (General_options::parse_version): Allow -v to exit
9327         without an error if there is nothing to link.
9328
9329 2009-12-29  Ian Lance Taylor  <iant@google.com>
9330
9331         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9332         using a version of gcc before 4.1.
9333         * configure: Rebuild.
9334
9335 2009-12-28  Chris Demetriou  <cgd@google.com>
9336
9337         * attributes.cc (Output_attributes_section_data::do_write): Use
9338         std::vector::front rather than std::vector::data.
9339
9340 2009-12-28  Ian Lance Taylor  <iant@google.com>
9341
9342         * symtab.h (class Symbol_table): Add enum Defined.
9343         * resolve.cc (Symbol_table::should_override): Add defined
9344         parameter.  Change all callers.  Test whether object is NULL
9345         before calling a method on it.
9346         (Symbol_table::report_resolve_problem): Add defined parameter.
9347         Change all callers.
9348         (Symbol_table::should_override_with_special): Likewise.
9349         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9350         parameter.  Change all callers.
9351         (Symbol_table::do_define_in_output_data): Likewise.
9352         (Symbol_table::define_in_output_segment): Likewise.
9353         (Symbol_table::do_define_in_output_segment): Likewise.
9354         (Symbol_table::define_as_constant): Likewise.
9355         (Symbol_table::do_define_as_constant): Likewise.
9356         * script.h (class Symbol_assignment): Add is_defsym parameter to
9357         constructor; change all callers.
9358         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9359         parameter.  Change all callers.  Add is_defsym_ field.
9360         (class Parser_closure): Add parsing_defsym parameter to
9361         constructor; change all callers.  Add parsing_defsym accessor
9362         function.  Add parsing_defsym_ field.
9363
9364 2009-12-28  Ian Lance Taylor  <iant@google.com>
9365
9366         * gold.cc (queue_middle_tasks): Fix formatting.
9367         * object.cc (Relobj::is_section_name_included): Likewise.
9368
9369 2009-12-23  Ian Lance Taylor  <iant@google.com>
9370
9371         * i386.cc (Target_i386::do_calls_non_split): Recognize
9372         -fsplit-stack prologue for a function with a static chain.
9373         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9374         -fsplit-stack prologue when using %r11.
9375
9376 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9377
9378         * options.cc (General_options::parse_version): Make -v continue and do
9379         the link like GNU ld does.
9380
9381 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9382
9383         * Makefile.am (CCFILES): Add timer.cc.
9384         (HFILES): Add timer.h.
9385         * configure.ac: Check for sysconf and times.
9386         * main.cc: include timer.h.
9387         (main): Use Timer instead of get_run_time.
9388         * timer.cc: New.
9389         * timer.h: New.
9390         * workqueue.cc: include timer.h.
9391         (Workqueue::find_and_run_task):
9392         Report user, sys and wall time.
9393         * Makefile.in: Regenerate.
9394         * config.in: Regenerate.
9395         * configure: Regenerate.
9396
9397 2009-12-16  Doug Kwan  <dougkwan@google.com>
9398
9399         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9400         sections.
9401         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9402         relaxed input sections.
9403         * output.cc (Output_section::find_relaxed_input_section): Change
9404         return type to Output_relaxed_input_section pointer.  Adjust code
9405         for new type of relaxed_input_section_map_.
9406         * output.h (Output_section::find_relaxed_input_section): Change
9407         return type to Output_relaxed_input_section pointer.
9408         (Output_section::Output_relaxed_input_section_by_input_section_map):
9409         New type.
9410         (Output_section::relaxed_input_section_map_): Change type to
9411         Output_section::Output_relaxed_input_section_by_input_section_map.
9412         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9413         input section.
9414
9415 2009-12-15  Ian Lance Taylor  <iant@google.com>
9416
9417         * layout.cc (Layout::create_shstrtab): Only write out after input
9418         sections if we are compressing debug sections.
9419
9420 2009-12-15  Ian Lance Taylor  <iant@google.com>
9421
9422         * archive.cc (Archive::add_symbols): Only look up a symbol without
9423         a version if there is, in fact, a version.
9424
9425 2009-12-14  Ian Lance Taylor  <iant@google.com>
9426
9427         Revert -Wshadow changes, all changes from:
9428         2009-12-11  Doug Kwan  <dougkwan@google.com>
9429         2009-12-11  Nick Clifton  <nickc@redhat.com>
9430         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9431
9432 2009-12-11  Doug Kwan  <dougkwan@google.com>
9433
9434         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9435         due to -Wshadow.
9436         * attributes.cc (Object_attribute::size): Ditto.
9437         (Attributes_section_data::size): Ditto.
9438         (Attributes_section_data::Attributes_section_data): Ditto.
9439         (Output_attributes_section_data::do_write): Ditto.
9440         * attributes.h (Object_attribute::set_type): Ditto.
9441         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9442
9443 2009-12-11  Nick Clifton  <nickc@redhat.com>
9444
9445         * archive.cc: Fix shadowed variable warnings.
9446         * arm.cc: Likewise.
9447         * compressed_output.cc: Likewise.
9448         * compressed_output.h: Likewise.
9449         * configure: Likewise.
9450         * dwarf_reader.cc: Likewise.
9451         * dynobj.cc: Likewise.
9452         * dynobj.h: Likewise.
9453         * ehframe.cc: Likewise.
9454         * ehframe.h: Likewise.
9455         * errors.cc: Likewise.
9456         * expression.cc: Likewise.
9457         * fileread.cc: Likewise.
9458         * fileread.h: Likewise.
9459         * freebsd.h: Likewise.
9460         * i386.cc: Likewise.
9461         * icf.cc: Likewise.
9462         * incremental.h: Likewise.
9463         * layout.cc: Likewise.
9464         * layout.h: Likewise.
9465         * mapfile.cc: Likewise.
9466         * merge.cc: Likewise.
9467         * merge.h: Likewise.
9468         * object.cc: Likewise.
9469         * object.h: Likewise.
9470         * options.h: Likewise.
9471         * output.cc: Likewise.
9472         * output.h: Likewise.
9473         * parameters.cc: Likewise.
9474         * plugin.cc: Likewise.
9475         * powerpc.cc: Likewise.
9476         * reduced_debug_output.cc: Likewise.
9477         * reduced_debug_output.h: Likewise.
9478         * reloc.cc: Likewise.
9479         * reloc.h: Likewise.
9480         * resolve.cc: Likewise.
9481         * script-sections.cc: Likewise.
9482         * script.cc: Likewise.
9483         * script.h: Likewise.
9484         * sparc.cc: Likewise.
9485         * symtab.cc: Likewise.
9486         * symtab.h: Likewise.
9487         * target-select.cc: Likewise.
9488         * target-select.h: Likewise.
9489         * token.h: Likewise.
9490         * workqueue.cc: Likewise.
9491         * workqueue.h: Likewise.
9492         * x86_64.cc: Likewise.
9493
9494 2009-12-10  Doug Kwan  <dougkwan@google.com>
9495
9496         * arm.cc (attributes.h): New include.
9497         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9498         (Arm_relobj::~Arm_relobj): Delete object pointed by
9499         attributes_section_data_.
9500         (Arm_relobj::attributes_section_data): New method definition.
9501         (Arm_relobj::attributes_section_data_): New data member declaration.
9502         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9503         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9504         attributes_section_data_.
9505         (Arm_dynobj::attributes_section_data): New method definition.
9506         (Arm_dynobj::attributes_section_data_): New data member declaration.
9507         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9508         initialization value of may_use_blx_ to false.
9509         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9510         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9511         object attributes to compute results instead of hard-coding.
9512         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9513         Target_arm::get_secondary_compatible_arch,
9514         Target_arm::set_secondary_compatible_arch
9515         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9516         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9517         New method declarations.
9518         (Target_arm::get_aeabi_object_attribute): New method definition.
9519         (Target_arm::attributes_section_data_): New data member declaration.
9520         (read_arm_attributes_section): New template definition.
9521         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9522         (Arm_dynobj::do_read_symbols): Ditto.
9523         (Target_arm::do_finalize_sections): Merge attributes sections from
9524         input.  Check for BLX use after attributes section merging.
9525         Fix __exidx_start and __exidx_end visibility.  Create an
9526         .ARM.attributes section if necessary.
9527         (Target_arm::get_secondary_compatible_arch,
9528         Target_arm::set_secondary_compatible_arch,
9529         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9530         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9531         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9532         New method definitions.
9533
9534 2009-12-09  Ian Lance Taylor  <iant@google.com>
9535
9536         * plugin.cc (Plugin::load): Don't cast from void* to a function
9537         pointer.
9538
9539 2009-12-09  Ian Lance Taylor  <iant@google.com>
9540
9541         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9542         information fields.
9543
9544 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9545
9546         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9547         Replace two_file_shared_1.so with two_file_shared_2.so.
9548         * testsuite/Makefile.in: Regenerated.
9549
9550 2009-12-08  Doug Kwan  <dougkwan@google.com>
9551
9552         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9553         (HFILES): Add attributes.h and int_encoding.h.
9554         * Makefile.in: Regenerate.
9555         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9556         function definitions to int_encoding.cc
9557         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9558         prototypes to int_encoding.h
9559         * reduced_debug_output.cc (int_encoding.h): New include.
9560         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9561         function definitions to int_encoding.cc
9562         (insert_into_vector, read_from_pointer): Move template definitions to
9563         int_encoding.h
9564         * attributes.cc: New file.
9565         * attributes.h: New file.
9566         * int_encoding.cc: New file.
9567         * int_encoding.h: New file.
9568
9569 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9570
9571         PR gold/11055
9572         * incremental-dump.cc (dump_incremental_inputs): New.
9573         (main): Use dump_incremental_inputs.
9574
9575 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9576
9577         PR gold/10893
9578         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9579         checking elfcpp::STT_FUNC.
9580         (Target_i386::Relocate::relocate): Likewise.
9581         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9582
9583         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9584         symbols from shared libraries into normal FUNC symbols.
9585
9586         * symtab.h (Symbol): Add is_func and use it.
9587
9588 2009-12-05  Doug Kwan  <dougkwan@google.com>
9589
9590         * arm.cc (Target_arm::arm_info): Initialize new fields
9591         attributes_section and attributes_vendor.
9592         * i386.cc (Target_i386::i386_info): Same.
9593         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9594         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9595         fields attributes_section and attributes_vendor.
9596         * sparc.cc (Target_sparc::sparc_info): Same.
9597         * target.h (Target::attributes_section, Target::attributes_vendor,
9598         Target::is_attributes_section, Target::attribute_arg_type,
9599         Target::attributes_order): New method definitions.
9600         (Target::Target_info::attributes_section,
9601         Target::Target_info::attributes_vendor): New fields.
9602         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9603         virtual method definitions.
9604         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9605         attributes_section and attributes_vendor.
9606         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9607
9608 2009-12-05  Doug Kwan  <dougkwan@google.com>
9609
9610         * arm.cc: Update comments about interworking and stub generation.
9611         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9612         considered as non-PIC.
9613         (Arm_relocate_functions::base_abs): Fix formatting.
9614         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9615         of function to use GOT entry address instead of offset.
9616         (Target_arm::Scan::global): Issue an error if a symbol would need a
9617         PLT does not get one because it is untyped.  Remove code to create
9618         dynamic symbols for relative branches.
9619         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9620         takes unsigned integer instead of boolean.
9621
9622 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9623
9624         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9625         (two_file_test_LDADD): Likewise.
9626         (common_test_1_LDADD): Likewise.
9627         (exception_test_LDADD) Likewise.
9628         (weak_test_LDADD): Likewise.
9629         (many_sections_test_LDADD): Likewise.
9630         (initpri1_LDADD): Likewise.
9631         (script_test_1_LDADD): Likewise.
9632         (script_test_2_LDADD): Likewise.
9633         (justsyms_LDADD): Likewise.
9634         (binary_test_LDADD): Likewise.
9635         (large_LDADD): Likewise.
9636         * testsuite/Makefile.in: Regenerated.
9637
9638 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9639
9640         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9641         (Symbol_table::override_with_special): Likewise.
9642         (Symbol_table::add_from_object): Likewise.
9643
9644 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9645
9646         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9647         Don't set the data_offset twice.
9648
9649 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9650
9651         * testsuite/Makefile.in: Regenerate.
9652
9653 2009-12-03  Doug Kwan  <dougkwan@google.com>
9654
9655         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9656         (Target_arm::do_finalize_sections): Add parameter for symbol table
9657         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9658         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9659         parameter for symbol table pointer.
9660         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9661         an additional parameter for a pointer to symbol table.
9662         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9663         parameter for a symbol table pointer.
9664         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9665         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9666         Ditto.
9667         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9668         parameter for a symbol table pointer.
9669
9670 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9671
9672         * incremental.cc (Incremental_inputs_header)
9673         (Incremental_inputs_header_write, Incremental_inputs_entry)
9674         (Incremental_inputs_entry_write): Move ...
9675         * incremental.h (Incremental_inputs_header)
9676         (Incremental_inputs_header_write, Incremental_inputs_entry)
9677         (Incremental_inputs_entry_write): here.
9678
9679 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9680
9681         * incremental.cc (make_sized_incremental_binary): Set the target.
9682         Error if it is incompatible.
9683         * output.h (Output_file): Add filename method.
9684
9685 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9686
9687         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9688         from the get_* methods.
9689
9690 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9691
9692         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9693         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9694         Write 0 for the data_offset of scripts.
9695
9696 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9697
9698         * testsuite/Makefile.am: Add the incremental_test.sh test.
9699         * testsuite/incremental_test.sh: New.
9700         * testsuite/incremental_test_1.c: New.
9701         * testsuite/incremental_test_2.c: New.
9702
9703 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9704
9705         * incremental-dump.cc (main): Fix typos.
9706
9707 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9708
9709         PR gold/11025
9710         * incremental-dump.cc (main): Use llu to print 64 bit values.
9711
9712 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9713             H.J. Lu  <hongjiu.lu@intel.com>
9714
9715         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9716         $(LIBDL).
9717         (incremental_dump_LDADD): Likewise.
9718         * Makefile.in: Regenerated.
9719
9720 2009-11-25  Doug Kwan  <dougkwan@google.com>
9721
9722         Revert:
9723
9724         2009-11-25  Doug Kwan  <dougkwan@google.com>
9725
9726                 * arm.cc (Target_arm::Target_arm): Move method definition
9727                 outside of class definition.  Add code to handle
9728                 --target1-rel, --target1-abs and --target2= options.
9729                 (Target_arm::get_reloc_reloc_type): Change method to be
9730                 non-static and const.
9731                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9732                 New data member declaration.
9733                 (Target_arm::Scan::local, Target_arm::Scan::global,
9734                 Target_arm::Relocate::relocate,
9735                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9736                 Adjust call to Target_arm::get_real_reloc_type.
9737                 (Target_arm::get_real_reloc_type): Use command line options
9738                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9739                 * options.h (--target1-rel, --target1-abs, --target2): New
9740                 ARM-only options.
9741
9742 2009-11-25  Doug Kwan  <dougkwan@google.com>
9743
9744         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9745         class definition.  Add code to handle --target1-rel, --target1-abs
9746         and --target2= options.
9747         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9748         and const.
9749         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9750         member declaration.
9751         (Target_arm::Scan::local, Target_arm::Scan::global,
9752         Target_arm::Relocate::relocate,
9753         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9754         call to Target_arm::get_real_reloc_type.
9755         (Target_arm::get_real_reloc_type): Use command line options to
9756         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9757         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9758         options.
9759
9760 2009-11-25  Doug Kwan  <dougkwan@google.com>
9761
9762         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9763         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9764         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9765         formatting.
9766         (Arm_relocate_functions::thm_call): Replace body with a call to
9767         Arm_relocate_functions::thumb_branch_common.
9768         (Arm_relocate_functions::thm_jump24,
9769         Arm_relocate_functions::thm_xpc22): New method definitions.
9770         (Arm_relocate_functions::thumb_branch_common): New method definition.
9771         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9772         operator.
9773         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9774         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9775
9776 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9777
9778         * Makefile.am: Build incremental-dump
9779         * Makefile.in: Regenerate.
9780         * incremental-dump.cc: New.
9781         * incremental.cc (Incremental_inputs_header_data,
9782         Incremental_inputs_entry_data): Move to incremental.h
9783         * incremental.h: (Incremental_inputs_header_data,
9784         Incremental_inputs_entry_data): Move from incremental.cc
9785
9786 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9787
9788         * incremental.cc (Incremental_inputs_header,
9789         Incremental_inputs_header_write, Incremental_inputs_entry,
9790         Incremental_inputs_entry_write): Add a typedef with the data type.
9791
9792 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9793
9794         * incremental.cc (Incremental_inputs_header,
9795         Incremental_inputs_header_write, Incremental_inputs_entry,
9796         Incremental_inputs_entry_write): Update comment about which
9797         type has the filed descriptions.
9798
9799 2009-11-15  Doug Kwan  <dougkwan@google.com>
9800
9801         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9802         (Arm_relocate_functions::arm_branch_common): Change method defintion
9803         in class definition to a method declaration and update list of formal
9804         parameters.
9805         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9806         Arm_relocation_functions::jump24): Adjust call to
9807         Arm_relocate_functions::arm_branch_common.  Update list of formal
9808         parameters.
9809         (Arm_relocate_functions::xpc25): New method definition.
9810         (Arm_relocate_functions::arm_branch_common): Move method defintion
9811         out from class definition.  Use stubs for mode-switching and extending
9812         branch ranges.
9813         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9814         specially.  Change code to enable use of stubs in ARM branches.
9815
9816 2009-11-10  Doug Kwan  <dougkwan@google.com>
9817
9818         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9819         in method declaration.
9820         (Target_arm::relocate_stub): New method declaration.
9821         (Target_arm::default_target): Change to return a pointer instead of
9822         a const reference.
9823         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9824         Target_arm::default_target.
9825         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9826         method definition.
9827         (Target_arm::relocate_section): Adjust view.
9828         (Target_arm::relocate_stub): New method definition.
9829
9830 2009-11-10  Doug Kwan  <dougkwan@google.com>
9831
9832         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9833         a format warning.
9834         * incremental.cc (open_incremental_binary): Initialized local
9835         variables to avoid warnings.
9836         * object.cc (make_elf_object): Ditto.
9837         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9838         a format warning.
9839
9840 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9841
9842         PR gold/10930
9843         * testsuite/plugin_test.c: Include "config.h".
9844
9845 2009-11-09  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9848         (arm_symbol_value): Remove.
9849         (Arm_relocate_functions::arm_branch_common,
9850         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9851         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9852         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9853         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9854         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9855         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9856         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9857         Arm_relocate_functions::thm_mobw_abs_nc,
9858         Arm_relocate_functions::thm_mov_abs,
9859         Arm_relocate_functions::movw_prel_nc,
9860         Arm_relocate_functions::thm_movt_abs,
9861         Arm_relocate_functions::movt_prel,
9862         Arm_relocate_functions::thm_movw_prel_nc,
9863         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9864         (Target_arm::Relocate::relocate): Only decompose address into two
9865         parts if relocation type uses the thumb-bit and pass the actual
9866         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9867         calls to methods in Arm_relocate_functions for this change.
9868
9869 2009-11-08  Ian Lance Taylor  <iant@google.com>
9870
9871         PR 10925
9872         * reloc.cc: Instantiate
9873         Sized_relobj::initialize_input_to_output_maps and
9874         Sized_relobj:free_input_to_output_maps.
9875
9876 2009-11-06  Ian Lance Taylor  <iant@google.com>
9877
9878         PR 10876
9879         * defstd.cc (in_segment): Set only_if_ref true for "end".
9880
9881 2009-11-06  Doug Kwan  <dougkwan@google.com>
9882
9883         * arm.cc (class Reloc_stub): Correct a comment.
9884         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9885         (Target_arm::scan_section_for_stubs): New method declaration.
9886         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9887         Change methods from private to protected.
9888         (Target_arm::do_may_relax): New method definition.
9889         (Target_arm::do_relax, Target_arm::group_sections,
9890         Target_arm::scan_reloc_for_stub,
9891         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9892         (Target_arm::arm_input_section_map_): New data member declaration.
9893         (Target_arm::scan_reloc_for_stub,
9894         Target_arm::scan_reloc_section_for_stubs,
9895         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9896         Target_arm::do_relax): New method definitions.
9897
9898 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9899
9900         * configure.ac: Check for (struct stat)::st_mtim
9901         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9902         * config.in: Regenerate.
9903         * configure: Regenerate.
9904
9905 2009-11-05  Ian Lance Taylor  <iant@google.com>
9906
9907         PR 10910
9908         * output.cc (Output_segment::add_output_section): Add missing
9909         return statement.
9910
9911 2009-11-04  Ian Lance Taylor  <iant@google.com>
9912
9913         PR 10880
9914         * object.h (class Object): Add is_needed and set_is_needed
9915         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9916         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9917         defined in a dynamic object and referenced by a regular object,
9918         set is_needed for the dynamic object.
9919         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9920         if the file is marked with as_needed and it is not needed.
9921
9922 2009-11-04  Ian Lance Taylor  <iant@google.com>
9923
9924         PR 10887
9925         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9926         tags if data is discarded by linker script.
9927         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9928         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9929         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9930         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9931
9932 2009-11-04  Ian Lance Taylor  <iant@google.com>
9933
9934         * layout.cc (Layout::get_output_section): Add is_interp and
9935         is_dynamic_linker_section parameters.  Change all callers.
9936         (Layout::choose_output_section): Likewise.
9937         (Layout::make_output_section): Likewise.
9938         (Layout::add_output_section_data): Add is_dynamic_linker_section
9939         parameter.  Change all callers.
9940         * layout.h (class Layout): Update declarations.
9941         * output.h (class Output_section): Add is_interp, set_is_interp,
9942         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9943         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9944         generate_code_fills_at_write_ to a bitfield.
9945         * output.cc (Output_section::Output_sections): Initialize new
9946         fields.
9947         (Output_segment::add_output_section): Add do_sort parameter.
9948         Change all callers.
9949
9950 2009-11-03  Ian Lance Taylor  <iant@google.com>
9951
9952         PR 10860
9953         * options.h (class General_options): Add --warn-common.
9954         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9955         merging two common symbols.
9956         (Symbol_table::should_override): Handle --warn-common when merging
9957         a common symbol with a defined symbol.  Use report_resolve_problem
9958         for multiple definitions.
9959         (Symbol_table::report_resolve_problem): New function.
9960         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9961
9962 2009-11-03  Doug Kwan  <dougkwan@google.com>
9963
9964         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9965         stub_factory_.
9966         (Target_arm::stub_factory): New method definition.
9967         (Target_arm::new_arm_input_section,
9968         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9969         Target_arm::reloc_uses_thumb_bit): New method declarations.
9970         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9971         New type definitions.
9972         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9973         member declarations.
9974         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9975         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9976         New method definitions.
9977
9978 2009-11-03  Ian Lance Taylor  <iant@google.com>
9979
9980         * options.h (class General_options): Add --warn_constructors.
9981
9982 2009-11-03  Ian Lance Taylor  <iant@google.com>
9983
9984         PR 10893
9985         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9986         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9987
9988 2009-11-03  Ian Lance Taylor  <iant@google.com>
9989
9990         PR 10895
9991         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9992         --msgid-bugs-address.
9993         (install-pdf): New target.
9994         (install-data_yes): Look up one directory to find mkinstalldirs.
9995
9996 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9997
9998         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9999         tree.
10000
10001 2009-10-30  Doug Kwan  <dougkwan@google.com>
10002
10003         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10004
10005 2009-10-30  Doug Kwan  <dougkwan@google.com>
10006
10007         * arm.cc (Stub_addend_reader): New struct template definition
10008         and partial specializations.
10009         (Stub_addend_reader::operator()): New method definition for a
10010         partially specialized template.
10011
10012 2009-10-30  Doug Kwan  <dougkwan@google.com>
10013
10014         * arm.cc (Arm_relobj::processor_specific_flags): New method
10015         definition.
10016         (Arm_relobj::do_read_symbols): New method declaration.
10017         (Arm_relobj::processor_specific_flags_): New data member declaration.
10018         (Arm_dynobj): New class definition.
10019         (Target_arm::do_finalize_sections): Add input_objects parameter.
10020         (Target_arm::do_adjust_elf_header): New method declaration.
10021         (Target_arm::are_eabi_versions_compatible,
10022         (Target_arm::merge_processor_specific_flags): New method declaration.
10023         (Target_arm::do_make_elf_object): New overloaded method definitions
10024         and declaration.
10025         (Arm_relobj::do_read_symbols): New method definition.
10026         (Arm_dynobj::do_read_symbols): Ditto.
10027         (Target_arm::do_finalize_sections): Add input_objects parameters.
10028         Merge processor-specific flags from all input objects.
10029         (Target_arm::are_eabi_versions_compatible,
10030         Target_arm::merge_processor_specific_flags,
10031         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10032         New method definitions.
10033         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10034         Input_objects pointer type parameter.
10035         * layout.cc (Layout::finalize): Pass input objects to target's.
10036         finalize_sections function.
10037         * output.cc (Output_file_header::do_sized_write): Set ELF file
10038         header's processor-specific flags.
10039         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10040         Input_objects pointer type parameter.
10041         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10042         * target.h (Input_objects): New forward class declaration.
10043         (Target::processor_specific_flags,
10044         Target::are_processor_specific_flags_sect): New method definitions.
10045         (Target::finalize_sections): Add input_objects parameter.
10046         (Target::Target): Initialize processor_specific_flags_ and
10047         are_processor_specific_flags_set_.
10048         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10049         parameter.
10050         (Target::set_processor_specific_flags): New method definition.
10051         (Target::processor_specific_flags_,
10052         Target::are_processor_specific_flags_set_): New data member
10053         declarations.
10054         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10055         Input_objects pointer type parameter.
10056
10057 2009-10-30  Doug Kwan  <dougkwan@google.com>
10058
10059         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10060
10061 2009-10-28  Ian Lance Taylor  <iant@google.com>
10062
10063         * object.h (class Relobj): Drop options parameter from
10064         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10065         do_scan_relocs, do_relocate.  Change all callers.
10066         (class Sized_relobj): Drop options parameters from
10067         do_gc_process_relocs, do_scan_relocs, do_relocate,
10068         do_relocate_sections, relocate_sections, emit_relocs_scan,
10069         emit_relocs_scan_reltype.  Change all callers.
10070         (struct Relocate_info): Remove options field and all references to
10071         it.
10072         * reloc.h (class Read_relocs): Remove options constructor
10073         parameter and options_ field.  Change all callers.
10074         (class Gc_process_relocs, class Scan_relocs): Likewise.
10075         (class Relocate_task): Likewise.
10076         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10077         all callers.
10078         (scan_relocatable_relocs): Likewise.
10079         * target.h (class Sized_target): Remove options parameter from
10080         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10081         all callers.
10082         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10083         callers.
10084         * arm.cc: Update functions to remove options parameters.
10085         * i386.cc: Likewise.
10086         * powerpc.cc: Likewise.
10087         * sparc.cc: Likewise.
10088         * x86_64.cc: Likewise.
10089         * testsuite/testfile.cc: Likewise.
10090
10091 2009-10-28  Doug Kwan  <dougkwan@google.com>
10092
10093         * arm.cc (Arm_relobj): New class definition.
10094         (Arm_relobj::scan_sections_for_stubs,
10095         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10096         New method definitions.
10097
10098 2009-10-28  Cary Coutant  <ccoutant@google.com>
10099
10100         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10101         (Plugin::cleanup_done_): New member.
10102         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10103         (Plugin_manager::cleanup_done_): Remove.
10104         (Plugin_manager::add_input_file): Edit error message.
10105         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10106         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10107
10108 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10109
10110         * fileread.cc: (File_read::View::~View): Use the new
10111         data_ownership_ filed.
10112         (File_read::~File_read): Dispose the new whole_file_view_.
10113         (File_read::open): Mmap the whole file if needed.
10114         (File_read::open): Use whole_file_view_ instead of contents_.
10115         (File_read::find_view): Use whole_file_view_ if applicable.
10116         (File_read::do_read): Use whole_file_view_ instead of contents_.
10117         (File_read::make_view): Use whole_file_view_ instead of contents_,
10118         update File_read::View::View call.
10119         (File_read::find_or_make_view): Update File_read::View::View
10120         call.
10121         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10122         remove contents_
10123         (File_read::View::Data_ownership): New enum.
10124         (File_read::View::View): Replace bool mapped_ with Data_ownership
10125         argument.
10126         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10127         (File_read::View::data_ownership_): New field.
10128         (File_read::contents_): Remove (replaced by whole_file_view_).
10129         (File_read::whole_file_view_): New field.
10130         * options.h (class General_options): Add --keep-files-mapped.
10131
10132 2009-10-27  Cary Coutant  <ccoutant@google.com>
10133
10134         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10135         * testsuite/Makefile.am (plugin_test_5): New test case.
10136         * testsuite/Makefile.in: Regenerate.
10137
10138 2009-10-25  Doug Kwan  <dougkwan@google.com>
10139
10140         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10141         from private to protected to allow access by child class.
10142         (Sized_relobj::do_relocate_sections): New method declaration.
10143         (Sized_relobj::relocate_sections): Virtualize.
10144         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10145         Sized_relobj::relocate_sections.  Instantiate template explicitly
10146         for different target sizes and endianity.
10147
10148 2009-10-24  Doug Kwan  <dougkwan@google.com>
10149
10150         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10151         (Arm_input_section::as_arm_input_section): New method.
10152         (Arm_output_section): New class definition.
10153         (Arm_output_section::create_stub_group,
10154         Arm_output_section::group_sections): New method definitions.
10155
10156 2009-10-22  Doug Kwan  <dougkwan@google.com>
10157
10158         * arm.cc (Arm_input_section): New class definition.
10159         (Arm_input_section::init, Arm_input_section:do_write,
10160         Arm_input_section::set_final_data_size,
10161         Arm_input_section::do_reset_address_and_file_offset): New method
10162         definitions.
10163
10164 2009-10-21  Doug Kwan  <dougkwan@google.com>
10165
10166         * arm.cc (Stub_table, Arm_input_section): New forward class
10167         declarations.
10168         (Stub_table): New class defintion.
10169         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10170         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10171         New method definition.
10172
10173 2009-10-21  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc: Update copyright comments.
10176         (Target_arm): New forward class template declaration.
10177         (Arm_address): New type.
10178         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10179         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10180         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10181         constants.
10182         (Insn_template): Same.
10183         (DEF_STUBS): New macro.
10184         (Stub_type): New enum type.
10185         (Stub_template): New class definition.
10186         (Stub): Same.
10187         (Reloc_stub): Same.
10188         (Stub_factory): Same.
10189         (Target_arm::Target_arm): Initialize may_use_blx_ and
10190         should_force_pic_veneer_.
10191         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10192         Target_arm::should_force_pic_veneer,
10193         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10194         Target_arm::using_thumb_only, Target_arm:;default_target): New
10195         method defintions.
10196         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10197         New data member declarations.
10198         (Insn_template::size, Insn_template::alignment): New method defintions.
10199         (Stub_template::Stub_template): New method definition.
10200         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10201         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10202         (Stub_factory::Stub_factory): New method definition.
10203         * gold.h (string_hash): New template.
10204         * output.h (Input_section_specifier::hash_value): Use
10205         gold::string_hash.
10206         (Input_section_specifier::string_hash): Remove.
10207         * stringpool.cc (Stringpool_template::string_hash): Use
10208         gold::string_hash.
10209
10210 2009-10-20  Doug Kwan  <dougkwan@google.com>
10211
10212         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10213         symbols of relaxed input sections.
10214         * output.h (Output_section::find_relaxed_input_section): Make
10215         method public.
10216
10217 2009-10-16  Doug Kwan  <dougkwan@google.com>
10218
10219         * dynobj.cc (Versions::Versions): Initialize version_script_.
10220         Only insert base version symbol definition for a shared object
10221         if version script defines any version versions.
10222         (Versions::define_base_version): New method definition.
10223         (Versions::add_def): Check that base version is not needed.
10224         (Versions::add_need): Define base version lazily.
10225         * dynobj.h (Versions::define_base_version): New method declaration.
10226         (Versions::needs_base_version_): New data member declaration.
10227         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10228         (check_DATA): Add no_version_test.stdout.
10229         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10230         New make rules.
10231         * testsuite/Makefile.in: Regenerate.
10232         * testsuite/no_version_test.c: New file.
10233         * testsuite/no_version_test.sh: Ditto.
10234
10235 2009-10-16  Doug Kwan  <dougkwan@google.com>
10236
10237         * expression.cc (class Segment_start_expression): New class definition.
10238         (Segment_start_expression::value): New method definition.
10239         (script_exp_function_segment_start): Return a new
10240         Segment_start_expression.
10241         * gold/script-c.h (script_saw_segment_start_expression): New function
10242         prototype.
10243         * script-sections.cc (Script_sections::Script_sections): Initialize
10244         SAW_SEGMENT_START_EXPRESSION_ to false.
10245         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10246         and -Tbbs options to specify section addresses if given in
10247         command line and no SEGMENT_START expression is seen in a script.
10248         * script-sections.h (Script_sections::saw_segment_start_expression,
10249         Script_sections::set_saw_segment_start_expression): New method
10250         definition.
10251         (Script_sections::saw_segment_start_expression_): New data member
10252         declaration.
10253         * script.cc (script_saw_segment_start_expression): New function.
10254         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10255         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10256         script_test_7.sh and script_test_8.sh.
10257         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10258         script_test_8.stdout.
10259         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10260         (script_test_6, script_test_6.stdout, script_test_7,
10261         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10262         * Makefile.in: Regenerate.
10263         * testsuite/script_test_6.sh: New file.
10264         * testsuite/script_test_6.t: Same.
10265         * testsuite/script_test_7.sh: Same.
10266         * testsuite/script_test_7.t: Same.
10267         * testsuite/script_test_8.sh: Same.
10268
10269 2009-10-16  Doug Kwan  <dougkwan@google.com>
10270
10271         * output.cc (Output_segment::set_section_list_address): Cast
10272         expressions to unsigned long long type to avoid format warnings.
10273
10274 2009-10-15  Ian Lance Taylor  <iant@google.com>
10275
10276         * script.cc (Script_options::add_symbol_assignment): Always add a
10277         dot assignment to script_sections_.
10278         * script-sections.cc (Script_sections::add_dot_assignment):
10279         Initialize if necessary.
10280
10281         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10282         program headers with no load segment if there is a linker script.
10283
10284         * layout.cc (Layout::set_segment_offsets): Align the file offset
10285         to the segment aligment for -N or -n with no load segment.
10286         * output.cc (Output_segment::add_output_section): Don't crash if
10287         the first section is a TLS section.
10288         (Output_segment::set_section_list_addresses): Print an error
10289         message if the address moves backward in a linker script.
10290         * script-sections.cc
10291         (Output_section_element_input::set_section_addresses): Don't
10292         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10293         (Orphan_output_section::set_section_addresses): Likewise.
10294
10295 2009-10-15  Doug Kwan  <dougkwan@google.com>
10296
10297         * layout.cc (Layout::finish_dynamic_section): Generate tags
10298         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10299         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10300         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10301
10302 2009-10-14  Ian Lance Taylor  <iant@google.com>
10303
10304         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10305         fields.
10306         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10307         data_shdr fields of relinfo.
10308         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10309         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10310         R_386_TLS_LDO_32, adjust based on section flags.
10311         (Target_i386::Relocate::fix_up_ldo): Remove.
10312
10313 2009-10-13  Ian Lance Taylor  <iant@google.com>
10314
10315         Add support for -pie.
10316         * options.h (class General_options): Add -pie and
10317         --pic-executable.
10318         (General_options::output_is_position_independent): Test -pie.
10319         (General_options::output_is_executable): Return true if not shared
10320         and not relocatable.
10321         (General_options::output_is_pie): Remove.
10322         * options.cc (General_options::finalize): Reject incompatible uses
10323         of -pie.
10324         * gold.cc (queue_middle_tasks): A -pie link is not static.
10325         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10326         * symtab.cc (Symbol::final_value_is_known): Return false if
10327         output_is_position_independent.
10328         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10329         output_is_position_independent.
10330         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10331         output_is_position_independent.
10332         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10333         output_is_position_independent.
10334         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10335         two_file_pie_test.
10336         (basic_pie_test.o, basic_pie_test): New targets.
10337         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10338         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10339         (two_file_pie_test): New target.
10340         * testsuite/Makefile.in: Rebuild.
10341         * README: Remove note saying that -pie is not supported.
10342
10343 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10344
10345         * options.h (class General_options): Add -init and -fini.
10346         * layout.cc (Layout::finish_dynamic_section): Emit
10347         given init and fini functions.
10348
10349 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10350
10351         * gc.h (gc_process_relocs): Check if icf is enabled using new
10352         function.
10353         * gold.cc (queue_initial_tasks): Likewise.
10354         (queue_middle_tasks): Likewise.
10355         * object.cc (do_layout): Likewise.
10356         * symtab.cc (is_section_folded): Likewise.
10357         * main.cc (main): Likewise.
10358         * reloc.cc (Read_relocs::run): Likewise.
10359         (Sized_relobj::do_scan_relocs): Likewise.
10360         * icf.cc (is_function_ctor_or_dtor): New function.
10361         (Icf::find_identical_sections): Check if function is ctor or dtor when
10362         safe icf is chosen.
10363         * options.h (General_options::icf): Change option to be an enum.
10364         (Icf_status): New enum.
10365         (icf_enabled): New method.
10366         (icf_safe_folding): New method.
10367         (set_icf_status): New method.
10368         (icf_status_): New variable.
10369         * (options.cc) (General_options::finalize): Set icf_status_.
10370         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10371         icf_test and icf_keep_unique_test to use the --icf enum flag.
10372         * testsuite/icf_safe_test.sh: New file.
10373         * testsuite/icf_safe_test.cc: New file.
10374
10375 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10376
10377         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10378         includes to gc.h and icf.h.
10379         * arm.cc: Include gc.h.
10380         * gold.cc: Likewise.
10381         * i386.cc: Likewise.
10382         * powerpc.cc: Likewise.
10383         * sparc.cc: Likewise.
10384         * x86_64.cc: Likewise.
10385         * gc.h: Include icf.h.
10386
10387 2009-10-11  Ian Lance Taylor  <iant@google.com>
10388
10389         * plugin.cc: Include "gold.h" before other header files.
10390
10391 2009-10-10  Chris Demetriou  <cgd@google.com>
10392
10393         * options.h (Input_file_argument::Input_file_type): New enum.
10394         (Input_file_argument::is_lib_): Replace with...
10395         (Input_file_argument::type_): New member.
10396         (Input_file_argument::Input_file_argument): Take Input_file_type
10397         'type' rather than boolean 'is_lib' as second argument.
10398         (Input_file_argument::is_lib): Use type_.
10399         (Input_file_argument::is_searched_file): New function.
10400         (Input_file_argument::may_need_search): Handle is_searched_file.
10401         * options.cc (General_options::parse_library): Support -l:filename.
10402         (General_options::parse_just_symbols): Update for Input_file_argument
10403         changes.
10404         (Command_line::process): Likewise.
10405         * archive.cc (Archive::get_file_and_offset): Likewise.
10406         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10407         * script.cc (read_script_file, script_add_file): Likewise.
10408         * fileread.cc (Input_file::Input_file): Likewise.
10409         (Input_file::will_search_for): Handle is_searched_file.
10410         (Input_file::open): Likewise.
10411         * readsyms.cc (Read_symbols::get_name): Likewise.
10412         * testsuite/Makefile.am (searched_file_test): New test.
10413         * testsuite/Makefile.in: Regenerate.
10414         * testsuite/searched_file_test.cc: New file.
10415         * testsuite/searched_file_test_lib.cc: New file.
10416
10417 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10418             Ian Lance Taylor  <iant@google.com>
10419
10420         * descriptor.cc: Include <cstdio> and "binary-io.h".
10421         (Descriptors::open): Open the files in binary mode always.
10422         * script.cc (Lex::get_token): Treat \r as whitespace.
10423
10424 2009-10-09  Ian Lance Taylor  <iant@google.com>
10425
10426         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10427
10428 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10429             Ian Lance Taylor  <iant@google.com>
10430
10431         * configure.ac: Check for readv function also.
10432         * fileread.cc (readv): Define if not HAVE_READV.
10433         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10434         does not exist.
10435         * config.in: Regenerate.
10436         * configure: Regenerate.
10437
10438 2009-10-09  Doug Kwan  <dougkwan@google.com>
10439
10440         * layout.cc (Layout::make_output_section): Call target hook to make
10441         ordinary output section.
10442         (Layout::finalize): Adjust parameter list of call the
10443         Target::may_relax().
10444         * layout.h (class Layout::section_list): New method.
10445         * merge.h (Output_merge_base::entsize): Change visibility to public.
10446         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10447         New methods.
10448         (Output_merge_string::do_is_string): New method.
10449         * object.cc (Sized_relobj::do_setup): renamed from
10450         Sized_relobj::set_up.
10451         * object.h (Sized_relobj::adjust_shndx,
10452         Sized_relobj::initializ_input_to_output_maps,
10453         Sized_relobj::free_input_to_output_maps): Change visibilities to
10454         protected.
10455         (Sized_relobj::setup): Virtualize.
10456         (Sized_relobj::do_setup): New method declaration.
10457         (Sized_relobj::invalidate_section_offset,
10458         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10459         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10460         * options.cc (parse_int): New function.
10461         * options.h (parse_int): New declaration.
10462         (DEFINE_int): New macro.
10463         (stub_group_size): New option.
10464         * output.cc (Output_section::Output_section): Initialize memebers
10465         merge_section_map_, merge_section_by_properties_map_,
10466         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10467         (Output_section::add_input_section): Handled deferred code-fill
10468         generation and remove an old comment.
10469         (Output_section::add_relaxed_input_section): New method definition.
10470         (Output_section::add_merge_input_section): Use merge section by
10471         properties map to speed to search.  Update merge section maps
10472         as appropriate.
10473         (Output_section::build_relaxation_map): New method definition.
10474         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10475         Same.
10476         (Output_section::relax_input_section): Renamed to
10477         Output_section::convert_input_sections_to_relaxed_sections and change
10478         interface to take a vector of pointers to relaxed sections.
10479         (Output_section::find_merge_section,
10480         Output_section::find_relaxed_input_section): New method definitions.
10481         (Output_section::is_input_address_mapped,
10482         Output_section::output_offset, Output_section::output_address):
10483         Use output section data maps to speed up searching.
10484         (Output_section::find_starting_output_address): Add comments.
10485         (Output_section::do_write,
10486         Output_section::write_to_postprocessing_buffer): Do code-fill
10487         generation as appropriate.
10488         (Output_section::get_input_sections): Invalidate relaxed input section
10489         map.
10490         (Output_section::restore_states): Adjust type of checkpoint .
10491         Invalidate relaxed input section map.
10492         * output.h (Output_merge_base): New class declaration.
10493         (Input_section_specifier): New class defintion.
10494         (class Output_relaxed_input_section) Change base class to
10495         Output_section_data_build.
10496         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10497         base class initializer.
10498         (Output_section::add_relaxed_input_section): New method declaration.
10499         (Output_section::Input_section): Change visibility to protected.
10500         (Output_section::Input_section::relobj,
10501         Output_section::Input_section::shndx): Handle relaxed input sections.
10502         Output_section::input_sections) Change visibility to protected.  Also
10503         define overload to return a non-const pointer.
10504         (Output_section::Merge_section_properties): New class defintion.
10505         (Output_section::Merge_section_by_properties_map,
10506         Output_section::Output_section_data_by_input_section_map,
10507         Output_section::Relaxation_map): New types.
10508         (Output_section::relax_input_section): Rename method to
10509         Output_section::convert_input_sections_to_relaxed_sections and change
10510         interface to take a vector of relaxed section pointers.
10511         (Output_section::find_merge_section,
10512         Output_section::find_relaxed_input_section,
10513         Output_section::build_relaxation_map,
10514         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10515         New method declarations.
10516         (Output_section::merge_section_map_
10517         Output_section::merge_section_by_properties_map_,
10518         Output_section::relaxed_input_section_map_,
10519         Output_section::is_relaxed_input_section_map_valid_,
10520         Output_section::generate_code_fills_at_write_): New data members.
10521         * script-sections.cc
10522         (Output_section_element_input::set_section_addresses): Call
10523         current_data_size and addralign methods of relaxed input sections.
10524         (Orphan_output_section::set_section_addresses): Call current_data_size
10525         and addralign methods of relaxed input sections.
10526         * symtab.cc (Symbol_table::compute_final_value): Extract template
10527         from the body of Symbol_table::sized_finalize_symbol.
10528         (Symbol_table::sized_finalized_symbol): Call
10529         Symbol_table::compute_final_value.
10530         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10531         (Symbol_table::compute_final_value): New templated method declaration.
10532         * target.cc (Target::do_make_output_section): New method defintion.
10533         * target.h (Target::make_output_section): New method declaration.
10534         (Target::relax): Add more parameters for input objects, symbol table
10535         and layout.  Adjust call to do_relax.
10536         (Target::do_make_output_section): New method declaration.
10537         (Target::do_relax): Add parameters for input objects, symbol table
10538         and layout.
10539
10540 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10541
10542         * pread.c: Include stdio.h.
10543
10544 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10545
10546         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10547         defined.
10548
10549 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10550
10551         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10552         Change read_shndx type to unsigned int.
10553         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10554         int.
10555         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10556         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10557         Change read_shndx type to unsigned int.
10558         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10559         int.
10560         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10561         * layout.cc (Layout::create_symtab_sections): Cast the result of
10562         local_symcount * symsize to off_t in the gold_assert.
10563
10564 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10565
10566         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10567         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10568         R_ARM_BASE_ABS.
10569         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10570         (Arm_relocate_functions::thm_abs5): New function.
10571         (Arm_relocate_functions::abs12): New function.
10572         (Arm_relocate_functions::abs16): New function.
10573         (Arm_relocate_functions::base_abs): New function.
10574         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10575         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10576         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10577         R_ARM_BASE_ABS.
10578         (Scan::global): Likewise.
10579         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10580         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10581         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10582         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10583         R_ARM_BASE_ABS.
10584
10585 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10586
10587         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10588         (Arm_relocate_functions::movt_prel): New function.
10589         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10590         (Arm_relocate_functions::thm_movt_prel): New function.
10591         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10592         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10593         (Scan::global, Relocate::relocate): Likewise.
10594         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10595
10596 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10597
10598         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10599         Incremental_checker.
10600         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10601         unsigned int.
10602         (class Incremental_inputs_header): New class.
10603         (Incremental_inputs_header_writer): Edit comment.
10604         (Incremental_inputs_entry): New class.
10605         (Incremental_inputs_entry_writer): Edit comment.
10606         (Sized_incremental_binary::do_find_incremental_inputs_section):
10607         Add *strtab_shndx parameter, fill it.
10608         (Sized_incremental_binary::do_check_inputs): New method.
10609         (Incremental_checker::can_incrementally_link_output_file): Use
10610         Sized_incremental_binary::check_inputs.
10611         (Incremental_inputs::report_command_line): Save command line in
10612         command_line_.
10613         * incremental.h:
10614         (Incremental_binary::find_incremental_inputs_section): New
10615         method.
10616         (Incremental_binary::do_find_incremental_inputs_section): Add
10617         strtab_shndx parameter.
10618         (Incremental_binary::do_check_inputs): New pure virtual method.
10619         (Sized_incremental_binary::do_check_inputs): Declare.
10620         (Incremental_checker::Incremental_checker): Add incremental_inputs
10621         parameter, use it to initialize incremental_inputs_.
10622         (Incremental_checker::incremental_inputs_): New field.
10623         (Incremental_checker::command_line): New method.
10624         (Incremental_checker::inputs): New method.
10625         (Incremental_checker::command_line_): New field.
10626
10627 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10628
10629         * incremental.cc: Include <cstdarg> and "target-select.h".
10630         (vexplain_no_incremental): New function.
10631         (explain_no_incremental): New function.
10632         (Incremental_binary::error): New method.
10633         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10634         method.
10635         (make_sized_incremental_binary): New function.
10636         (open_incremental_binary): New function.
10637         (can_incrementally_link_file): Add checks if output is ELF and has
10638         inputs section.
10639         * incremental.h: Include "elfcpp_file.h" and "output.h".
10640         (Incremental_binary): New class.
10641         (Sized_incremental_binary): New class.
10642         (open_incremental_binary): Declare.
10643         * object.cc (is_elf_object): Use
10644         elfcpp::Elf_recognizer::is_elf_file.
10645         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10646         * output.h (Output_file::filesize): New method.
10647
10648 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10649
10650         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10651         New function.
10652         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10653         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10654         function.
10655         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10656         function.
10657         (Arm_relocate_functions::movw_abs_nc): New function.
10658         (Arm_relocate_functions::movt_abs): New function.
10659         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10660         (Arm_relocate_functions::thm_movt_abs): New function.
10661         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10662         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10663         (Scan::global): Likewise.
10664         (Relocate::relocate): Likewise.
10665         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10666
10667 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10668
10669         * arm.cc (Arm_relocate_functions::got_prel) New function.
10670         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10671         (Relocate::relocate): Likewise.
10672         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10673
10674 2009-10-06  Ian Lance Taylor  <iant@google.com>
10675
10676         * options.h (class General_options): Define
10677         split_stack_adjust_size parameter.
10678         * object.h (class Object): Add uses_split_stack_ and
10679         has_no_split_stack_ fields.  Add uses_split_stack and
10680         has_no_split_stack accessor functions.  Declare
10681         handle_split_stack_section.
10682         (class Reloc_symbol_changes): Define.
10683         (class Sized_relobj): Define Function_offsets.  Declare
10684         split_stack_adjust, split_stack_adjust_reltype, and
10685         find_functions.
10686         * object.cc (Object::handle_split_stack_section): New function.
10687         (Sized_relobj::do_layout): Call handle_split_stack_section.
10688         * dynobj.cc (Sized_dynobj::do_layout): Call
10689         handle_split_stack_section.
10690         * reloc.cc (Sized_relobj::relocate_sections): Call
10691         split_stack_adjust for executable sections in split_stack
10692         objects.  Pass reloc_map to relocate_section.
10693         (Sized_relobj::split_stack_adjust): New function.
10694         (Sized_relobj::split_stack_adjust_reltype): New function.
10695         (Sized_relobj::find_functions): New function.
10696         * target-reloc.h: Include "object.h".
10697         (relocate_section): Add reloc_symbol_changes parameter.  Change
10698         all callers.
10699         * target.h (class Target): Add calls_non_split method.  Declare
10700         do_calls_non_split virtual method.  Declare match_view and
10701         set_view_to_nop.
10702         * target.cc: Include "elfcpp.h".
10703         (Target::do_calls_non_split): New function.
10704         (Target::match_view): New function.
10705         (Target::set_view_to_nop): New function.
10706         * gold.cc (queue_middle_tasks): Give an error if mixing
10707         split-stack and non-split-stack objects with -r.
10708         * i386.cc (Target_i386::relocate_section): Add
10709         reloc_symbol_changes parameter.
10710         (Target_i386::do_calls_non_split): New function.
10711         * x86_64.cc (Target_x86_64::relocate_section): Add
10712         reloc_symbol_changes parameter.
10713         (Target_x86_64::do_calls_non_split): New function.
10714         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10715         parameter.
10716         * powerpc.cc (Target_powerpc::relocate_section): Add
10717         reloc_symbol_changes parameter.
10718         * sparc.cc (Target_sparc::relocate_section): Add
10719         reloc_symbol_changes parameter.
10720         * configure.ac: Call AM_CONDITIONAL for the default target.
10721         * configure: Rebuild.
10722         * testsuite/Makefile.am (TEST_AS): New variable.
10723         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10724         (check_DATA): Add split_i386 and split_x86_64 files.
10725         (SPLIT_DEFSYMS): Define.
10726         (split_i386_[1234n].o): New targets.
10727         (split_i386_[124]): New targets.
10728         (split_i386_[1234r].stdout): New targets.
10729         (split_x86_64_[1234n].o): New targets.
10730         (split_x86_64_[124]): New targets.
10731         (split_x86_64_[1234r].stdout): New targets.
10732         (MOSTLYCLEANFILES): Add new executables.
10733         * testsuite/split_i386.sh: New file.
10734         * testsuite/split_x86_64.sh: New file.
10735         * testsuite/split_i386_1.s: New file.
10736         * testsuite/split_i386_2.s: New file.
10737         * testsuite/split_i386_3.s: New file.
10738         * testsuite/split_i386_4.s: New file.
10739         * testsuite/split_i386_n.s: New file.
10740         * testsuite/split_x86_64_1.s: New file.
10741         * testsuite/split_x86_64_2.s: New file.
10742         * testsuite/split_x86_64_3.s: New file.
10743         * testsuite/split_x86_64_4.s: New file.
10744         * testsuite/split_x86_64_n.s: New file.
10745         * testsuite/testfile.cc (Target_test): Update relocation_section
10746         function.
10747         * testsuite/Makefile.in: Rebuild.
10748
10749 2009-10-06  Ian Lance Taylor  <iant@google.com>
10750
10751         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10752         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10753         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10754         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10755         the address on ldo_addrs_.
10756         (Target_i386::Relocate::fix_up_ldo): New function.
10757
10758 2009-10-06   Rafael Espindola  <espindola@google.com>
10759
10760         * plugin.cc (add_input_library): New.
10761         (Plugin::load): Add add_input_library to tv.
10762         (Plugin_manager::add_input_file): Add the is_lib argument.
10763         (add_input_file): Update call to Plugin_manager::add_input_file.
10764         (add_input_library): New.
10765         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10766
10767 2009-09-30  Doug Kwan  <dougkwan@google.com>
10768
10769         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10770         symbol and call Symbol::may_need_copy_reloc to determine if
10771         a copy reloc is needed.
10772         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10773         nocopyreloc is given in command line.
10774         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10775         given in command line.
10776         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10777         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10778         of the removed Target_i386::may_need_copy_reloc.
10779         * options.h (copyreloc): New option with default value false.
10780         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10781         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10782         instead of the removed Target_powerpc::may_need_copy_reloc.
10783         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10784         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10785         instead of the removed Target_sparc::may_need_copy_reloc.
10786         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10787         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10788         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10789         instead of the removed Target_x86_64::may_need_copy_reloc.
10790
10791 2009-09-30  Ian Lance Taylor  <iant@google.com>
10792
10793         * object.h (class Object): Remove target_ field, and target,
10794         sized_target, and set_target methods.
10795         (Object::sized_target): Remove.
10796         (class Sized_relobj): Update declarations.  Remove sized_target.
10797         * object.cc (Sized_relobj::setup): Remove target parameter.
10798         Change all callers.
10799         (Input_objects::add_object): Don't do anything with the target.
10800         (make_elf_sized_object): Add punconfigured parameter.  Change all
10801         callers.  Set or test parameter target.
10802         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10803         Change all callers.
10804         * parameters.cc (Parameters::set_target): Change parameter type to
10805         be non-const.
10806         (Parameters::default_target): Remove.
10807         (set_parameters_target): Change parameter type to be non-const.
10808         (parameters_force_valid_target): New function.
10809         (parameters_clear_target): New function.
10810         * parameters.h (class Parameters): Update declarations.  Remove
10811         default_target method.  Add sized_target and clear_target
10812         methods.  Change target_ to be non-const.
10813         (set_parameters_target): Update declaration.
10814         (parameters_force_valid_target): Declare.
10815         (parameters_clear_target): Declare.
10816         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10817         as NULL if we aren't searching.
10818         (Add_symbols::run): Don't check for compatible target.
10819         * fileread.cc (Input_file::open_binary): Call
10820         parameters_force_valid_target.
10821         * gold.cc (queue_middle_tasks): Likewise.
10822         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10823         set_target on object.
10824         * dynobj.h (class Sized_dynobj): Update declarations.
10825         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10826         make_elf_object returns NULL.
10827         (Archive::include_member): Don't check whether object target is
10828         compatible.
10829         * output.cc (Output_section::add_input_section): Get target from
10830         parameters.
10831         (Output_section::relax_input_section): Likewise.
10832         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10833         parameters.
10834         (Sized_relobj::do_scan_relocs): Likewise.
10835         (Sized_relobj::relocate_sections): Likewise.
10836         * resolve.cc (Symbol_table::resolve): Likewise.
10837         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10838         parameter.  Change all callers.
10839         (Symbol_table::add_from_object): Get target from parameters.
10840         (Symbol_table::add_from_relobj): Don't check object target.
10841         (Symbol_table::add_from_dynobj): Likewise.
10842         (Symbol_table::define_special_symbol): Get target from
10843         parameters.
10844         * symtab.h (class Symbol_table): Update declaration.
10845         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10846         parameter.  Change all callers.  Clear parameter target.
10847         (Binary_test): Test target here.
10848         * testsuite/object_unittest.cc (gold_testsuite): Remove
10849         target_test_pointer parameter.  Change all callers.
10850         (Object_test): Test target here.
10851
10852 2009-09-26  Ian Lance Taylor  <iant@google.com>
10853
10854         * testsuite/initpri1.c: Don't try to use constructor priorities if
10855         compiling with gcc before 4.3.
10856
10857 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10858
10859         * testsuite/retain_symbols_file_test.sh (check_present): Change
10860         output file name to retain_symbols_file_test.stdout.
10861         (check_absent): Likewise.
10862
10863 2009-09-18  Craig Silverstein  <csilvers@google.com>
10864
10865         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10866         * options.cc: Include <cerrno> and <fstream>.
10867         (General_options::finalize): Parse -retain-symbols-file tag.
10868         * options.h: New flag.
10869         (General_options): New method should_retain_symbol, new
10870         variable symbols_to_retain.
10871         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10872         should_retain_symbol map.
10873         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10874         * testsuite/Makefile.in: Regenerate.
10875         * testsuite/retain_symbols_file_test.sh: New file.
10876
10877 2009-09-18  Nick Clifton  <nickc@redhat.com>
10878
10879         * po/es.po: Updated Spanish translation.
10880
10881 2009-09-17  Doug Kwan  <dougkwan@google.com>
10882
10883         * debug.h (DEBUG_RELAXATION): New constant.
10884         (DEBUG_ALL): Add DEBUG_RELAXATION.
10885         (debug_string_to_enum): Add relaxation debug option.
10886         * layout.cc
10887         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10888         Layout::Relaxation_debug_check::read_sections,
10889         Layout::Relaxation_debug_check::read_sections): New method definitions.
10890         (Layout::Layout): Initialize data members
10891         record_output_section_data_from_scrips_,
10892         script_output_section_data_list_ and relaxation_debug_check_.
10893         (Layout::save_segments, Layout::restore_segments,
10894         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10895         Layout::relaxation_loop_body): New method definitions.
10896         (Layout::finalize): Support relaxation.  Move section layout code to
10897         Layout::relaxation_loop_body.
10898         (Layout::set_asection_address_from_script): Move code for orphan
10899         section placement out.
10900         (Layout::place_orphan_sections_in_script): New method definition.
10901         * layout.h (Output_segment_headers, Output_file_header):
10902         New forward class declarations.
10903         (Layout::~Layout): Define.
10904         (Layout::new_output_section_data_from_script): New method definition.
10905         (Layout::place_orphan_sections_in_script): New method declaration.
10906         (Layout::Segment_states): New type declaration.
10907         (Layout::save_segments, Layout::restore_segments,
10908         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10909         Layout::relaxation_loop_body): New method declarations.
10910         (Layout::Output_section_data_list): New type declaration.
10911         (Layout::Relaxation_debug_check): New class definition.
10912         (Layout::record_output_section_data_from_script_,
10913         Layout::script_output_section_data_list_, Layout::segment_states_,
10914         Layout::relaxation_debug_check_): New data members.
10915         * output.cc: (Output_section_headers::do_size): New method definition.
10916         (Output_section_headers::Output_section_headers): Move size
10917         computation to Output_section_headers::do_size.
10918         (Output_segment_headers::do_size): New method definition.
10919         (Output_file_header::Output_file_header): Move size computation to
10920         Output_file_header::do_size and call it.
10921         (Output_file_header::do_size): New method definition.
10922         (Output_data_group::Output_data_group): Adjust call to
10923         Output_section_data.
10924         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10925         (Output_symtab_xindex::do_write): Add array bound check.
10926         (Output_section::Input_section::print_to_mapfile): Handle
10927         RELAXED_INPUT_SECTION_CODE.
10928         (Output_section::Output_section): Initialize data member checkpoint_.
10929         (Output_section::~Output_section): Delete checkpoint object pointed
10930         by checkpoint_.
10931         (Output_section::add_input_section): Always add an Input_section if
10932         relaxing.
10933         (Output_section::add_merge_input_section): Add assert.
10934         (Output_section::relax_input_section): New method definition.
10935         (Output_section::set_final_data_size): Set load address to zero for
10936         an unallocated section.
10937         (Output_section::do_address_and_file_offset_have_reset_values):
10938         New method definition.
10939         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10940         Handle relaxed input section.
10941         (Output_section::sort_attached_input_sections): Checkpoint input
10942         section list lazily.
10943         (Output_section::get_input_sections): Change type of input_sections to
10944         list of Simple_input_section pointers.  Checkpoint input section list
10945         lazily.  Also handle relaxed input sections.
10946         (Output_section::add_input_section_for_script): Take a reference to
10947         a Simple_input_section object instead of Relobj pointer and section
10948         index as parameter.  Handle relaxed input sections.
10949         (Output_section::save_states, Output_section::restore_states): New
10950         method definitions.
10951         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10952         (Output_data::is_data_size_fixed): New method definition.
10953         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10954         if it is fixed.
10955         (Output_data::address_and_file_offset_have_reset_values): New method
10956         definition.
10957         (Output_data::do_address_and_file_offset_have_reset_values): New method
10958         definition.
10959         (Output_data::set_data_size): Check that data size is not fixed.
10960         (Output_data::fix_data_size): New method definition.
10961         (Output_data::is_data_size_fixed_): New data member.
10962         (Output_section_headers::set_final_data_size): New method definition.
10963         (Output_section_headers::do_size): New method declaration.
10964         (Output_segment_headers::set_final_data_size): New method definition.
10965         (Output_segment_headers::do_size): New method declaration.
10966         (Output_file_header::set_final_data_size)::New method definition.
10967         (Output_file_header::do_size)::New method declaration.
10968         (Output_section_data::Output_section_data): Add new parameter
10969         is_data_size_fixed and use it to fix data size.
10970         (Output_data_const::Output_data_const): Adjust call to base class
10971         constructor and fix data size.
10972         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10973         base class constructor and fix data size.
10974         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10975         base class constructor and fix data size.
10976         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10977         class constructor and fix data size.
10978         (Output_data_group::set_final_data_size): New method definition.
10979         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10980         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10981         class constructor and fix data size.
10982         (Output_relaxed_input_section): New class definition.
10983         (Output_section::Simple_input_section): New class definition.
10984         (Output_section::get_input_sections): Adjust parameter list.
10985         (Output_section::add_input_section_for_script): Same.
10986         (Output_section::save_states, Output_section::restore_states,
10987         Output_section::do_address_and_file_offset_have_reset_values,
10988         (Output_section::Input_section::Input_section): Handle
10989         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10990         Output_relaxed_input_section.
10991         (Output_section::Input_section::is_input_section,
10992         Output_section::Input_section::set_output_section): Handle relaxed
10993         input section.
10994         (Output_section::Input_section::is_relaxed_input_section,
10995         Output_section::Input_section::output_section_data,
10996         Output_section::Input_section::relaxed_input_section): New method
10997         definitions.
10998         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10999         value.
11000         (Output_section::Input_section::u1_): Update comments.
11001         (Output_section::Input_section::u2_): Add new union member poris.
11002         (Output_section::Checkpoint_output_section): New classs definition.
11003         (Output_section::relax_input_section): New method declaration.
11004         (Output_section::checkpoint_): New data member.
11005         (Output_segment): Update comments.
11006         (Output_segment::Output_segment): Un-privatize copy constructor.
11007         (Output_segment::operator=): Un-privatize.
11008         * script-sections.cc (Output_section_element::Input_section_list):
11009         Change element type to Output_section::Simple_input_section.
11010         (Output_section_element_dot_assignment::set_section_addresses):
11011         Register output section data for relaxation clean up.
11012         (Output_data_exression::Output_data_expression): Adjust call to base
11013         constructor to fix data size.
11014         (Output_section_element_data::set_section_addresses): Register
11015         Output_data_expression object for relaxation clean up.
11016         (struct Input_section_info): Replace Relobj pointer and section index
11017         pair with Output_section::Simple_input_section and Convert struct to a
11018         class.
11019         (Input_section_sorter::operator()): Adjust access to
11020         Input_section_info data member to use accessors.
11021         (Output_section_element_input::set_section_addresses): Use layout
11022         parameter.  Adjust code to use Output_section::Simple_input_section
11023         and Input_secction_info classes.  Register filler for relaxation
11024         clean up.
11025         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11026         and section index pair with Output_section::Simple_input_section
11027         class.  Adjust code accordingly.
11028         (Phdrs_element::release_segment): New method definition.
11029         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11030         segment list.
11031         (Script_sections::release_segments): New method definition.
11032         * gold/script-sections.h (Script_sections::release_segments): New
11033         method declaration.
11034         * gold/target.h (Target::may_relax, Target::relax,
11035         Target::do_may_relax, Target::do_relax): New method definitions.
11036
11037 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11038
11039         * arm.cc (has_signed_unsigned_overflow): New function.
11040         (Arm_relocate_functions::abs8): New function.
11041         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11042         (Target_arm::Scan::global): Likewise.
11043         (Target_arm::relocate::relocate): Likewise.
11044         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11045         Likewise.
11046
11047 2009-09-16  Cary Coutant  <ccoutant@google.com>
11048
11049         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11050         * testsuite/Makefile.in: Regenerate.
11051
11052 2009-09-11  Nick Clifton  <nickc@redhat.com>
11053
11054         * po/gold.pot: Updated by the Translation project.
11055
11056 2009-09-08  Cary Coutant  <ccoutant@google.com>
11057
11058         * output.cc (Output_file::open): Add execute permission to empty file.
11059         * testsuite/Makefile.am (permission_test): New test.
11060         * testsuite/Makefile.in: Regenerate.
11061
11062 2009-09-02  Ian Lance Taylor  <iant@google.com>
11063
11064         * output.cc (Output_file::resize): Call map_no_anonymous rather
11065         than map.
11066
11067 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11068
11069         * gold.cc: Include "incremental.h".
11070         (queue_initial_tasks): Call Incremental_checker methods.
11071         * incremental.cc: Include "output.h".
11072         (Incremental_checker::can_incrementally_link_output_file): New
11073         method.
11074         * incremental.h (Incremental_checker): New class.
11075
11076         * output.cc (Output_file::open_for_modification): New method.
11077         (Output_file::map_anonymous): Changed return type to bool.  Record
11078         map in base_ field.
11079         (Output_file::map_no_anonymous): New method, broken out of map.
11080         (Output_file::map): Use map_no_anonymous and map_anonymous.
11081         * output.h (class Output_file): Update declarations.
11082
11083 2009-08-24  Cary Coutant  <ccoutant@google.com>
11084
11085         * options.h (Command_line::Pre_options): New class.
11086         (Command_line::pre_options): New member.
11087         * options.cc (gold::options::ready_to_register): New variable.
11088         (One_option::register_option): Do nothing if not registering options.
11089         Assert if same short option registered twice.
11090         (General_options::General_options): Turn off option registration when
11091         done constructing.
11092         (Command_line::Pre_options::Pre_options): New constructor.
11093
11094 2009-08-24  Cary Coutant  <ccoutant@google.com>
11095
11096         * options.h (General_options::no_keep_memory): Remove incorrect
11097         short option.
11098
11099 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11100
11101         * Makefile.am (am__skiplex, am__skipyacc): New.
11102         * Makefile.in: Regenerate.
11103
11104 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11105
11106         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11107         (INCLUDES): ... this.
11108         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11109         (AM_CPPFLAGS): Renamed from ...
11110         (INCLUDE): ... this.
11111         * Makefile.in, testsuite/Makefile.in: Regenerate.
11112
11113         * Makefile.in: Regenerate.
11114         * aclocal.m4: Likewise.
11115         * config.in: Likewise.
11116         * configure: Likewise.
11117         * testsuite/Makefile.in: Likewise.
11118
11119         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11120         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11121         * Makefile.in: Regenerate.
11122         * testsuite/Makefile.in: Regenerate.
11123
11124 2009-08-19  Cary Coutant  <ccoutant@google.com>
11125
11126         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11127         symbols in shared libraries overridden by hidden or internal symbols
11128         in the main program.
11129
11130 2009-08-19  Chris Demetriou  <cgd@google.com>
11131
11132         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11133         checking source file names in error messages.
11134
11135 2009-08-18  Doug Kwan  <dougkwan@google.com>
11136
11137         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11138         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11139         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11140         an elfcpp::Ehdr as parameter.
11141         * object.cc (Object::set_target): Remove the version that looks up
11142         a target and sets it.
11143         (Sized_relobj::setup): Take a Target object instead of
11144         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11145         (make_elf_sized_object): Find target and ask target to
11146         make an ELF object.
11147         * object.h: (Object::set_target): Remove the version that looks up
11148         a target and sets it.
11149         (Sized_relobj::setup): Take a Target object instead of
11150         an elfcpp:Ehdr as parameter.
11151         * target.cc: Include dynobj.h.
11152         (Target::do_make_elf_object_implementation): New.
11153         (Target::do_make_elf_object): New.
11154         * target.h (Target::make_elf_object): New template declaration.
11155         (Target::do_make_elf_object): New method declarations.
11156         (Target::do_make_elf_object_implementation): New template declaration.
11157
11158 2009-08-14  Ian Lance Taylor  <iant@google.com>
11159
11160         * gold.h (FUNCTION_NAME): Define.
11161         (gold_unreachable): Use FUNCTION_NAME.
11162
11163 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11164
11165         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11166         symbol in the --keep-unique list is not found.
11167
11168 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11169
11170         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11171         been maked as --keep-unique.
11172         (Icf::unfold_section): New function.
11173         * icf.h (Icf::unfold_section): New function.
11174         * options.h (General_options::keep_unique): New option.
11175         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11176         * testsuite/Makefile.in: Regenerate.
11177         * testsuite/icf_keep_unique_test.sh: New file.
11178         * testsuite/icf_keep_unique_test.cc: New file.
11179
11180 2009-08-12  Cary Coutant  <ccoutant@google.com>
11181
11182         PR 10471
11183         * resolve.cc (Symbol_table::resolve): Check for references from
11184         dynamic objects to hidden and internal symbols.
11185         * testsuite/Makefile.am (hidden_test.sh): New test.
11186         * testsuite/Makefile.in: Regenerate.
11187         * testsuite/hidden_test.sh: New script.
11188         * testsuite/hidden_test_1.c: New test source.
11189         * testsuite/hidden_test_main.c: New test source.
11190
11191 2009-08-11  Doug Kwan  <dougkwan@google.com>
11192
11193         * arm.cc: Update comments.
11194         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11195         segment to locate the .ARM.exidx section if present.
11196
11197 2009-08-09  Doug Kwan  <dougkwan@google.com>
11198
11199         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11200         patch.
11201
11202 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11203         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11204         compiler warnings.
11205
11206 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11207
11208         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11209         valid tls_segment only for non-debug-section relocations.
11210         * testsuite/Makefile.am: Add gc_tls_test.
11211         * testsuite/Makefile.in: Regenerate.
11212         * testsuite/gc_tls_test.cc: New file.
11213         * testsuite/gc_tls_test.sh: New file.
11214
11215 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11216
11217         * icf.cc: New file.
11218         * icf.h: New file.
11219         * Makefile.am (CCFILES): Add icf.cc.
11220         (HFILES): Add icf.h
11221         * Makefile.in: Regenerate.
11222         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11223         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11224         section, symbol and addend information for the relocs.
11225         * gold.cc (queue_middle_tasks): Call identical code folding.
11226         * gold.h: Add defines for multimap.
11227         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11228         to the call of finalize_local_symbols.
11229         * main.cc (main): Create object of class Icf.
11230         * object.cc (Sized_relobj::do_layout): Allow this function to be
11231         called twice during icf.
11232         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11233         to sections marked as identical by icf.
11234         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11235         when available.
11236         (Sized_relobj::do_section_entsize): New function.
11237         * object.h (Object::section_entsize): New function.
11238         (Object::do_section_entsize): New pure virtual function.
11239         (Relobj::finalize_local_symbols): Add new parameter.
11240         (Relobj::do_section_entsize): New function.
11241         * options.h (General_options::icf): New option.
11242         (General_options::icf_iterations): New option.
11243         (General_options::print_icf_sections): New option.
11244         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11245         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11246         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11247         icf.
11248         * symtab.cc (Symbol_table::is_section_folded): New function.
11249         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11250         to sections marked as identical by icf.
11251         * symtab.h (Symbol_table::set_icf): New function.
11252         (Symbol_table::icf): New function.
11253         (Symbol_table::is_section_folded): New function.
11254         (Symbol_table::icf_): New data member.
11255         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11256         * testsuite/Makefile.am: Add commands to build icf_test.
11257         * testsuite/Makefile.in: Regenerate.
11258         * testsuite/icf_test.sh: New file.
11259         * testsuite/icf_test.cc: New file.
11260
11261 2009-07-24  Chris Demetriou  <cgd@google.com>
11262
11263         * layout.cc (is_compressible_debug_section): Fix incorrect
11264         comment about compressed section names.
11265
11266 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11267
11268         PR 10419
11269         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11270
11271 2009-07-16  Ian Lance Taylor  <iant@google.com>
11272
11273         PR 10400
11274         * layout.h: #include <map>.
11275         (class Kept_section): Change from struct to class.  Add accessors
11276         and setters.  Add section size to Comdat_group mapping.  Change
11277         Comdat_group to std::map.  Add is_comdat_ field.  Add
11278         linkonce_size field in union.
11279         (class Layout): Update declaration of find_or_add_kept_section.
11280         Don't declare find_kept_object.
11281         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11282         parameter.  Add object, shndx, is_comdat, and is_group_name
11283         parameters.  Change all callers.  Adjust for new Kept_section.
11284         (Layout::find_kept_object): Remove.
11285         * object.cc (Sized_relobj::include_section_group): Update use of
11286         Kept_section.  Rename secnum to shndx.  Only record
11287         Kept_comdat_section if sections are the same size.
11288         (Sized_relobj::include_linkonce_section): Update use of
11289         Kept_section.  Only record Kept_comdat_section if sections are the
11290         same size.  Set size of linkonce section.
11291         (Sized_relobj::map_to_kept_section): Update call to
11292         get_kept_comdat_section.
11293         * object.h (class Sized_relobj): Rename fields in
11294         Kept_comdat_section to drop trailing underscores; change object
11295         field to Relobj*.  Change Kept_comdat_section_table to store
11296         struct rather than pointer.
11297         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11298         Add kept_object and kept_shndx parameters.  Change all callers.
11299         (Sized_relobj::get_kept_comdat_section): Change return type to
11300         bool.  Add kept_object and kept_shndx parameters.  Change all
11301         callers.
11302         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11303         Layout::find_or_add_kept_section.
11304
11305 2009-07-09  Ian Lance Taylor  <iant@google.com>
11306
11307         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11308         Reserve space in the hash table.
11309
11310 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11311
11312         * fileread.cc (File_read::get_mtime): New method.
11313         * fileread.h (Timespec): New structure.
11314         (File_read::get_mtime): New method.
11315         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11316         Renamed from timestamp_nsec.
11317         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11318         Elf_Xword.
11319         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11320         timestamp_nsec.
11321         (Incremental_inputs::report_archive): Save mtime; style fix.
11322         (Incremental_inputs::report_obejct): Save mtime; style fix.
11323         (Incremental_inputs::report_script): Save mtime; style fix.
11324         (Incremental_inputs::finalize_inputs): Style fix.
11325         (Incremental_inputs::finalize): Style fix.
11326         (Incremental_inputs::create_input_section_data): Store inputs
11327         mtime.
11328         * incremental.h (Incremental_inputs::report_script): Add mtime
11329         argument.
11330         (Incremental_inputs::Input_info::Input_info): Intialize only one
11331         union member.
11332         (Incremental_inputs::Input_info::archive): Move to nameless
11333         union.
11334         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11335         (Incremental_inputs::Input_info::script): Move to nameless union.
11336         (Incremental_inputs::mtime): New field.
11337         * script.cc (read_input_script): Pass file mtime to
11338         Incremental_input.
11339         * script.h (Script_info::inputs): Style fix.
11340
11341 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11342
11343         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11344         instead of 32.
11345
11346 2009-06-24  Ian Lance Taylor  <iant@google.com>
11347
11348         PR 10156
11349         * layout.cc (Layout::choose_output_section): If we find an
11350         existing section, update the flags.
11351         (Layout::create_notes): New function, broken out of
11352         Layout::finalize.
11353         (Layout::finalize): Don't create note sections.
11354         (Layout::create_note): Don't crash if linker script discards
11355         section.
11356         (Layout::create_gold_note): Likewise.
11357         (Layout::create_build_id): Likewise.  Don't set
11358         after_input_sections on the section.
11359         (Layout::create_executable_stack_info): Remove target parameter.
11360         Change caller.
11361         * layout.h (class Layout): Declare create_notes.  Update
11362         declaration of create_executable_stack_info.
11363         * gold.cc (queue_middle_tasks): Call create_notes.
11364         * output.cc (Output_section::update_flags_for_input_section): Move
11365         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11366         invalid.
11367         * output.h (Output_data::mark_address_invalid): New function.
11368         (class Output_section): Only declare, not define,
11369         update_flags_for_input_section.  Remove set_flags.
11370
11371 2009-06-24  Ian Lance Taylor  <iant@google.com>
11372
11373         * script-sections.cc (Output_section_definition::
11374         set_section_addresses): Rename shadowing local load_address to
11375         laddr.
11376
11377 2009-06-24  Ian Lance Taylor  <iant@google.com>
11378
11379         PR 10244
11380         * reloc.cc (relocate_sections): Skip empty relocation sections.
11381
11382 2009-06-23  Ian Lance Taylor  <iant@google.com>
11383
11384         PR 10156
11385         * layout.cc (Layout::create_note): Use choose_output_section
11386         rather than make_output_section.
11387
11388 2009-06-23  Ian Lance Taylor  <iant@google.com>
11389
11390         PR 10237
11391         * options.cc (General_options::parse_V): Set printed_version_.
11392         (General_options::General_options): Initialize printed_version_.
11393         * options.h (class General_options): Add printed_version_ field.
11394         * gold.cc (queue_initial_tasks): If there are no input files,
11395         don't give a fatal error if we printed the version information.
11396         (queue_middle_tasks): If using -r with a shared object, give a
11397         fatal error rather than an ordinary error.
11398
11399 2009-06-23  Ian Lance Taylor  <iant@google.com>
11400
11401         PR 10219
11402         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11403         (Layout::make_output_section): Set have_stabstr_section_ if we see
11404         a .stab*str section.
11405         (Layout::finalize): Call link_stabs_sections.
11406         (Layout::link_stabs_sections): New file.
11407         * layout.h (class Layout): Add have_stabstr_section_ field.
11408         Declare link_stabs_sections.
11409
11410 2009-06-23  Doug Kwan  <dougkwan@google.com>
11411
11412         * Makefile.am (libgold_a_LIBADD): New.
11413         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11414         * Makefile.in: Regenerate.
11415         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11416         * configure: Regenerate.
11417         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11418         * fileread.cc: Include sys/state.h
11419         * gold.h: Declare memmem and strndup if found missing.
11420         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11421
11422 2009-06-23  Ian Lance Taylor  <iant@google.com>
11423
11424         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11425         * configure: Rebuild.
11426
11427 2009-06-23  Ian Lance Taylor  <iant@google.com>
11428
11429         PR 10147
11430         * object.cc (Object::section_contents): Don't try to get a view if
11431         the section has length zero.
11432         (Object::handle_gnu_warning_section): If the section is empty, use
11433         the name of the section as the warning.
11434
11435 2009-06-23  Ian Lance Taylor  <iant@google.com>
11436
11437         PR 10133
11438         * stringpool.h (class Stringpool_template): Add optimize_ field.
11439         (Stringpool_template::set_optimize): New function.
11440         * stringpool.cc (Stringpool_template::Stringpool_template):
11441         Initialize optimize_ field.
11442         (Stringpool_template::set_string_offsets): Test local optimize
11443         fild rather than parameter.
11444         * layout.cc (Layout::Layout): Call set_optimize on the section
11445         name stringpool.
11446
11447 2009-06-22  Ian Lance Taylor  <iant@google.com>
11448
11449         PR 10030
11450         * yyscript.y: Parse TARGET.
11451         * script.cc (script_set_target): New function.
11452         * script-c.h (script_set_target): Declare.
11453         * options.cc (General_options::string_to_object_format): Rename
11454         from string_to_object_format in anonymous namespace.  Change
11455         callers.
11456         * options.h (class General_options): Declare
11457         string_to_object_format.
11458
11459 2009-06-22  Ian Lance Taylor  <iant@google.com>
11460
11461         * script-sections.cc (Script_sections::create_segments): Don't put
11462         program headers in a PT_LOAD segment if -n or -N.
11463
11464 2009-06-22  Ian Lance Taylor  <iant@google.com>
11465
11466         PR 10141
11467         * options.h (class General_options): Add -z lazy and -z now.  Sort
11468         -z options into alphabetical order.
11469         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11470
11471 2009-06-21  Ian Lance Taylor  <iant@google.com>
11472
11473         * layout.cc (Layout::make_output_section): Call
11474         Target::new_output_section.
11475         (Layout::attach_allocated_section_to_segment): Put large section
11476         sections in a separate load segment with the large segment flag
11477         set.
11478         (Layout::segment_precedes): Sort large data segments after other
11479         load segments.
11480         (align_file_offset): New static function.
11481         (Layout::set_segment_offsets): Use align_file_offset.
11482         * output.h (class Output_section): Add is_small_section_ and
11483         is_large_section_ fields.
11484         (Output_section::is_small_section): New function.
11485         (Output_section::set_is_small_section):  New function.
11486         (Output_section::is_large_section): New function.
11487         (Output_section::set_is_large_section): New function.
11488         (Output_section::is_large_data_section): New function.
11489         (class Output_segment): Add is_large_data_segment_ field.
11490         (Output_segment::is_large_data_segment): New function.
11491         (Output_segment::set_is_large_data_segment): New function.
11492         * output.cc (Output_section::Output_section): Initialize new
11493         fields.
11494         (Output_segment::Output_segment): Likewise.
11495         (Output_segment::add_output_section): Add assertion that large
11496         data sections always go in large data segments.  Force small data
11497         sections to the end of the list of data sections.  Force small BSS
11498         sections to the start of the list of BSS sections.  For large BSS
11499         sections to the end of the list of BSS sections.
11500         * symtab.h (class Symbol): Declare is_common_shndx.
11501         (Symbol::is_defined): Check Symbol::is_common_shndx.
11502         (Symbol::is_common): Likewise.
11503         (class Symbol_table): Define enum Commons_section_type.  Update
11504         declarations.  Add small_commons_ and large_commons_ fields.
11505         * symtab.cc (Symbol::is_common_shndx): New function.
11506         (Symbol_table::Symbol_table): Initialize new fields.
11507         (Symbol_table::add_from_object): Put small and large common
11508         symbols in the right list.
11509         (Symbol_table::sized_finalized_symbol): Check
11510         Symbol::is_common_shndx.
11511         (Symbol_table::sized_write_globals): Likewise.
11512         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11513         common symbol lists.  Don't call do_allocate_commons_list if the
11514         list is empty.
11515         (Symbol_table::do_allocate_commons_list): Remove is_tls
11516         parameter.  Add comons_section_type parameter.  Change all
11517         callers.  Handle small and large common symbols.
11518         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11519         Symbol::is_common_shndx.
11520         * resolve.cc (symbol_to_bits): Likewise.
11521         * target.h (Target::small_common_shndx): New function.
11522         (Target::small_common_section_flags): New function.
11523         (Target::large_common_shndx): New function.
11524         (Target::large_common_section_flags): New function.
11525         (Target::new_output_section): New function.
11526         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11527         small_common_section_flags, and large_common_section_flags
11528         fields.
11529         (Target::do_new_output_section): New virtual function.
11530         * arm.cc (Target_arm::arm_info): Initialize new fields.
11531         * i386.cc (Target_i386::i386_info): Likewise.
11532         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11533         Likewise.
11534         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11535         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11536         (Target_x86_64::do_new_output_section): New function.
11537         * configure.ac: Define conditional MCMODEL_MEDIUM.
11538         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11539         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11540         (large_LDFLAGS): Define.
11541         * testsuite/large.c: New file.
11542         * testsuite/testfile.cc (Target_test::test_target_info):
11543         Initialize new fields.
11544         * configure, testsuite/Makefile.in: Rebuild.
11545
11546 2009-06-05  Doug Kwan  <dougkwan@google.com>
11547
11548         * Makefile.am (CCFILES): Add target.cc.
11549         * Makefile.in: Regenerate.
11550         * i386.cc (class Target_i386): Define new virtual method to
11551         override do_is_local_label_name in parent.
11552         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11553         local symbols if --discard-locals or -X is given.
11554         * options.h (class General_options): Declare new options
11555         '--discard-locals' and '-X' for discarding locals.
11556         * target.h (class Target): Define new methods is_local_label_name.
11557         Declare new virtual method do_is_local_label_name.
11558         * target.cc: New file.
11559         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11560         (check_SCRIPTS): Add discard_locals_test.sh.
11561         (check_DATA): Add discard_local_tests.syms.
11562         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11563         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11564         * testsuite/Makefile.in: Regenerate.
11565         * testsuite/discard_locals_test.c: New file.
11566         * testsuite/discard_locals_test.sh: Same.
11567
11568 2009-06-05  Doug Kwan  <dougkwan@google.com>
11569
11570         * object.cc (Sized_relobj::Sized_relobj): Initialize
11571         discarded_eh_frame_shndx_ to -1U.
11572         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11573         section.
11574         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11575         a discarded .eh_frame section.
11576         (Sized_relobj::do_finalize_local_symbols): Ditto.
11577         * object.h (class Sized_relobj): Declare new member
11578         discarded_eh_frame_shndx_.
11579         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11580         (local_labels_test.o, local_labels_test): New rules.
11581         * testsuite/Makefile.in: Regenerate.
11582
11583 2009-06-04  Doug Kwan  <dougkwan@google.com>
11584
11585         * layout.cc (Layout::section_name_mapping): Add mapping for
11586         special ARM sections.
11587
11588 2009-06-03  Doug Kwan  <dougkwan@google.com>
11589
11590         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11591         (utils::has_overflow): Same.
11592
11593 2009-06-03  Ian Lance Taylor  <iant@google.com>
11594
11595         * layout.cc (Layout::section_name_mapping): New array, replacing
11596         Layout::linkonce_mapping.
11597         (Layout::section_name_mapping_count): New variable, replacing
11598         Layout::linkonce_mapping_count.
11599         (Layout::linkonce_output_name): Remove.
11600         (Layout::output_section_name): Rewrite.
11601         * layout.h (class Layout): Rename Linkonce_mapping to
11602         Section_name_mapping, linkonce_mapping to section_name_mapping,
11603         linkonce_mapping_count to section_name_mapping_count.  Don't
11604         declare linkonce_output_name.
11605
11606 2009-06-03  Doug Kwan  <dougkwan@google.com>
11607
11608         * gold/arm.cc (namespace utils): New.
11609         (Target_arm::reloc_is_non_pic): Define new method.
11610         (class Arm_relocate_functions): New.
11611         (Target_arm::Relocate::relocate): Handle relocation types used by
11612         Android.
11613
11614 2009-06-03  Ian Lance Taylor  <iant@google.com>
11615
11616         * arm.cc (Target_arm::scan::global): Use || instead of |.
11617
11618 2009-06-02  Doug Kwan  <dougkwan@google.com>
11619
11620         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11621         issued_non_pic_error_.
11622         (class Target_arm::Scan): Declare new method check_non_pic.
11623         Define new method symbol_needs_plt_entry.
11624         Declare new data member issued_non_pic_error_.
11625         (class Target_arm::Relocate): Declare new method
11626         should_apply_static_reloc.
11627         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11628         (Target_arm::Scan::check_non_pic): Define new method.
11629         (Target_arm::Scan::local): Handle a small subset of reloc types used
11630         by Android.
11631         (Target_arm::Scan::local): Same.
11632         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11633
11634 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11635
11636         * incremental.cc (Incremental_inputs::report_command_line): Filter
11637         out --incremental-* options.
11638
11639 2009-05-29  Doug Kwan  <dougkwan@google.com>
11640
11641         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11642         template class.
11643         (class Target_arm): Update comment.
11644         (Target_arm::Target_arm): Initialize new data members GOT_,
11645         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11646         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11647         and Target_arm::rel_dyn_section.
11648         Declare new_enum Target_arm::Got_type.
11649         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11650         and DYNBSS_.
11651         Update commments for member do_dynsym_value.
11652         (Target_arm::got_size, Target_arm::plt_section,
11653         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11654         new methods inside class defintion.
11655         (Target_arm::got_section): Define new method.
11656         (Target_arm::rel_dyn_section): Same.
11657         (Output_data_plt_arm): New template class.
11658         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11659         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11660         (Output_data_plt_arm::add_entry): Same.
11661         (Output_data_plt_arm::first_plt_entry): Define new
11662         static data member for PLT instruction template.
11663         (Output_data_plt_arm::plt_entry): Same.
11664         (Output_data_plt_arm::do_write): Define new method.
11665         (Target_arm::make_plt_entry): Same.
11666         (Target_arm::do_finalize_sections): Same.
11667         (Target_arm::do_dynsym_value): Same.
11668
11669 2009-05-28  Doug Kwan  <dougkwan@google.com>
11670
11671         * Makefile.am (TARGETSOURCES): Add arm.cc.
11672         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11673         * Makefile.in: Regenerate.
11674         * arm.cc: New file.
11675         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11676
11677 2009-05-26  Doug Kwan  <dougkwan@google.com>
11678
11679         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11680         (General_options::check_excluded_libs): Strip off directories in
11681         archive name before matching like GNU ld does.
11682         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11683         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11684         (exclude_libs_test_LDFLAGS): Add linker option
11685         -Wl,--exclude-libs,libexclude_libs_test_3
11686         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11687         an explicit archive without using -l.
11688         (alt/libexclude_libs_test_3.a): New make rule.
11689         * testsuite/Makefile.in: Regenerate.
11690         * testsuite/exclude_libs_test.c : Declare lib3_default().
11691         (main): Call it.
11692         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11693         * exclude_libs_test_3.c: New file.
11694
11695 2009-05-26  Nick Clifton  <nickc@redhat.com>
11696
11697         * po/id.po: New Indonesian translation.
11698         * po/gold.pot: Updated template file.
11699
11700 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11701
11702         * testsuite/Makefile.am: Add -ffunction-sections to compile
11703         gc_comdat_test files.  Add -Wl,--gc-sections to build
11704         gc_comdat_test.
11705         * testsuite/Makefile.in: Regenerate.
11706         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11707
11708 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11709
11710         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11711         kept comdat section was garbage collected.
11712         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11713         * testsuite/Makefile.in: Regenerate.
11714         * testsuite/gc_comdat_test.sh: New file.
11715         * testsuite/gc_comdat_test_1.cc: New file.
11716         * testsuite/gc_comdat_test_2.cc: New file.
11717
11718 2009-05-19  Doug Kwan  <dougkwan@google.com>
11719
11720         * archive.cc (Archive::Archive): Move constructor from archive.h
11721         to here.  Initialize no_export_.
11722         (Archive::get_elf_object_for_member): Set no_export flag of object.
11723         * archive.h (Archive::Archive): Move constructor body to
11724         archive.cc.
11725         (Archive::no_export): New method.
11726         (Archive::no_export_): New field.
11727         * object.h (Object::Object): Initialize no_export_ to false.
11728         (Object::no_export, Object::set_no_export): New methods.
11729         (Object::no_export_): New field.
11730         * options.cc (General_options::parse_exclude_libs): New method.
11731         (General_options::check_excluded_libs) Same.
11732         * options.h (exclude_libs): New option.
11733         (General_options::check_excluded_libs): New method declaration.
11734         (General_options::excluded_libs_): New field.
11735         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11736         default or protected visibility if an object has no-export flag set.
11737         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11738         (check_SCRIPTS): Add exclude_libs_test.sh.
11739         (check_DATA): Add exclude_libs_test.syms.
11740         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11741         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11742         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11743         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11744         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11745         libexclude_libs_test_2.a): New rules.
11746         * testsuite/Makefile.in: Regenerate.
11747         * testsuite/exclude_libs_test.c: New file.
11748         * testsuite/exclude_libs_test.sh: Ditto.
11749         * testsuite/exclude_libs_test_1.c: Ditto.
11750         * testsuite/exclude_libs_test_2.c: Ditto.
11751
11752 2009-05-15  Ian Lance Taylor  <iant@google.com>
11753
11754         * configure.ac: Check for declarations for cases where libiberty.h
11755         checks HAVE_DECL_xxx.
11756         * configure, config.in: Rebuild.
11757
11758 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11759
11760         * gold.h (Incremental_argument_list): Remove (invalid) forward
11761         declaration.
11762         * incremental.cc (Incremental_inputs::report_achive): New method.
11763         (Incremental_inputs::report_object): New method.
11764         (Incremental_inputs::report_script): New method.
11765         (Incremental_inputs::finalize_inputs): New method.
11766         (Incremental_inputs::finalize): Call finalize_inputs().
11767         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11768         Create inputs entries.
11769         * incremental.h (Incremental_input_type): New enum.
11770         (Incremental_inputs::Incremental_input): Initialize new fields.
11771         (Incremental_inputs::report_inputs): New method.
11772         (Incremental_inputs::report_achive): New method.
11773         (Incremental_inputs::report_object): New method.
11774         (Incremental_inputs::report_script): New method.
11775         (Incremental_inputs::finalize_inputs): New method.
11776         (Incremental_inputs::Input_info): New struct.
11777         (Incremental_inputs::Input_info_map): New typedef.
11778         (Incremental_inputs::lock_): New field.
11779         (Incremental_inputs::Inputs_): New field.
11780         (Incremental_inputs::Inputs_map): New field.
11781         * main.cc (main): Call Incremental_input::report_inputs.
11782         * options.h (Input_argument_list): Typedef moved from
11783         Input_arguments.
11784         (Input_file_group::Files): Remove, use ::Input_argument_list.
11785         (Input_file_group::Input_argument_list): Remove, use
11786         ::Input_argument_list.
11787         * plugin.cc (Plugin_manager::add_input_file): Add error in
11788         incremental build.
11789         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11790         functions.
11791         * script.cc (read_input_script): Call
11792         Incremental_input::report_script.
11793         * script.h (Script_info): New class.
11794
11795 2009-04-27  Ian Lance Taylor  <iant@google.com>
11796
11797         * x86_64.cc (do_adjust_output_section): Set entsize to
11798         plt_entry_size.
11799
11800 2009-04-23  Elliott Hughes  <enh@google.com>
11801
11802         * output.cc (Output_file::close): After short writes, continue
11803         writing from the correct offset in the buffer being written.
11804
11805 2009-04-23  Chris Demetriou  <cgd@google.com>
11806
11807         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11808         * configure: Regenerate.
11809         * config.in: Regenerate.
11810         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11811         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11812
11813 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11814
11815         * incremental.cc (Incremental_inputs_header_data): Renamed from
11816         Incremental_input_header_data.
11817         (Incremental_inputs_header_data::data_size): New field.
11818         (Incremental_inputs_header_data::put_input_file_count): Renamed
11819         from input_file_count.
11820         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11821         from command_line_offset.
11822         (Incremental_inputs_header_data::put_reserved): Renamed from
11823         put_reserved.
11824         (Incremental_inputs_entry_data): Renamed from
11825         Incremental_input_entry_data.
11826         (Incremental_inputs_entry_data::data_size): New field.
11827         (Incremental_inputs::report_command_line): New method.
11828         (Incremental_inputs::finalize): New method.
11829         (Incremental_inputs::create_incremental_inputs_data): New method.
11830         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11831         * incremental.h: New file.
11832         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11833         (Layout::finalize): Create incremental inputs section in
11834         incremental builds.
11835         (Layout::create_incremental_info_sections): New method.
11836         * layout.h (Layout::incremental_inputs): New method.
11837         (Layout::create_incremental_info_sections): New method.
11838         (Layout::incremental_inputs_): New field.
11839         * main.cc (main): Notify Incremental_input of the command line.
11840
11841 2009-04-01  Ian Lance Taylor  <iant@google.com>
11842             Mikolaj Zalewski  <mikolajz@google.com>
11843
11844         * gold.h (reserve_unordered_map): Define, three versions, one for
11845         each version of Unordered_map.
11846         * layout.cc (Layout::Layout): Remove options parameter.  Add
11847         number_of_input_files parameter.  Don't initialize options_.
11848         Initialize number_of_input_files_ and resized_signatures_.  Move
11849         sections_are_attached_.
11850         (Layout::layout_group): Reserve space for group_signatures_.
11851         (Layout::find_or_add_kept_section): Change name parameter to be a
11852         reference.  Resize signatures_ map when it gets large enough.
11853         (Layout::layout_eh_frame): Use parameters->options() instead of
11854         this->options_.
11855         (Layout::make_output_section): Likewise.
11856         (Layout::attach_allocated_section_to_segment): Likewise.
11857         (Layout::finalize, Layout::create_executable_stack): Likewise.
11858         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11859         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11860         * layout.h (class Layout): Update declarations.  Remove options_
11861         field.  Add number_of_input_files_ and resized_signatures_
11862         fields.  Move sections_are_attached_ field.
11863         * main.cc (main): Pass number of input files to Layout
11864         constructor.  Don't pass options.
11865
11866 2009-03-30  Ian Lance Taylor  <iant@google.com>
11867
11868         * ffsll.c (ffsll): Correct implementation.
11869
11870 2009-03-27  Ian Lance Taylor  <iant@google.com>
11871
11872         * ffsll.c: New file.
11873         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11874         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11875         * ftruncate.c (ftruncate): Declare before definition.
11876         * mremap.c (mremap): Likewise.
11877         * pread.c (pread): Likewise.
11878         * configure, Makefile.in, config.in: Rebuild.
11879
11880         * mremap.c: New file.
11881         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11882         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11883         (mremap): Declare if HAVE_MREMAP is not defined.
11884         * configure, Makefile.in, config.in: Rebuild.
11885
11886 2009-03-27  Cary Coutant  <ccoutant@google.com>
11887
11888         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11889         position independent.
11890         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11891         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11892
11893 2009-03-24  Cary Coutant  <ccoutant@google.com>
11894
11895         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11896         an executable.
11897         (needs_dynamic_reloc): Likewise.
11898
11899 2009-03-24  Ian Lance Taylor  <iant@google.com>
11900
11901         * yyscript.y (file_cmd): Recognize EXTERN.
11902         (extern_name_list, extern_name_list_body): New nonterminals.
11903         * script.cc (script_add_extern): Define.
11904         * script-c.h (script_add_extern): Declare.
11905
11906 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11907
11908         * object.cc (is_elf_object): Define.
11909         * object.h (is_elf_object): Declare.
11910         * archive.cc (Archive::get_elf_object_for_member): Call
11911         is_elf_object.
11912         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11913
11914 2009-03-24  Elliott Hughes  <enh@google.com>
11915
11916         * output.cc (Output_file::map_anonymous): Define.
11917         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11918         try an anonymous one.  Report the size if the mmap fails.
11919         * output.h (class Output_file): Declare map_anonymous.
11920
11921 2009-03-24  Ian Lance Taylor  <iant@google.com>
11922
11923         * target-select.cc (instantiate_target): Don't acquire the lock if
11924         the instantiated_target_ field has already been set.
11925
11926 2009-03-23  Ian Lance Taylor  <iant@google.com>
11927
11928         * gold-threads.h (class Initialize_lock): Define.
11929         * gold-threads.cc (class Initialize_lock_once): Define.
11930         (initialize_lock_control): New static variable.
11931         (initialize_lock_pointer): New static variable.
11932         (initialize_lock_once): New static function.
11933         (Initialize_lock::Initialize_lock): Define.
11934         (Initialize_lock::initialize): Define.
11935         * target-select.h: Include "gold-threads.h".
11936         (class Target_selector): Add lock_ and initialize_lock_ fields.
11937         Don't define instantiate_target, just declare it.
11938         * target-select.cc (Target_selector::Target_selector): Initialize
11939         new fields.
11940         (Target_selector::instantiate_target): Define.
11941         * descriptors.h: Include "gold-threads.h".
11942         (class Descriptors): Add initialize_lock_ field.
11943         * descriptors.cc (Descriptors::Descriptors): Initialize new
11944         field.
11945         (Descriptors::open): Use initialize_lock_ field
11946         * errors.h (class Errors): Add initialize_lock_ field.
11947         * errors.cc (Errors::Errors): Initialize new field.
11948         (Errors::initialize_lock): Use initialize_lock_ field.
11949         * powerpc.cc (class Target_selector_powerpc): Remove
11950         instantiated_target_ field.  In do_recognize call
11951         instantiate_target rather than do_instantiate_target.  In
11952         do_instantiate_target just allocate a new target.
11953         * sparc.cc (class Target_selector_sparc): Likewise.
11954
11955         * freebsd.h: New file.
11956         * i386.cc: Include "freebsd.h".
11957         (Target_i386): Derive from Target_freebsd rather than
11958         Sized_target.
11959         (Target_selector_i386): Derive from Target_selector_freebsd rather
11960         than Target_selector.
11961         * x86_64.cc: Include "freebsd.h".
11962         (Target_x86_64): Derive from Target_freebsd rather than
11963         Sized_target.
11964         (Target_selector_x86_64): Derive from Target_selector_freebsd
11965         rather than Target_selector.
11966         * target.h (class Target): Add adjust_elf_header and
11967         do_adjust_elf_header.
11968         * output.cc (Output_file_header:: do_sized_write): Call target
11969         adjust_elf_header routine.
11970         * configure.tgt: Set targ_osabi.
11971         * configure.ac: Define GOLD_DEFAULT_OSABI.
11972         * parameters.cc (Parameters::default_target): Pass
11973         GOLD_DEFAULT_OSABI to select_target.
11974         * target-select.h (class Target_selector): Make instantiate_target
11975         protected rather than private.
11976         * Makefile.am (HFILES): Add freebsd.h.
11977         * configure, Makefile.in, config.in: Rebuild.
11978
11979         * merge.cc (do_add_input_section): Correct pend value.  Change
11980         message about last entry not being null terminated from error to
11981         warning.
11982
11983 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11984
11985         * incremental.cc: New file.
11986         * Makefile.am (CCFILES): Add incremental.cc.
11987         * Makefile.in: Rebuild.
11988
11989 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11990
11991         * layout.cc (Layout::output_section_name): Preserve names
11992         of '.note.' sections.
11993
11994 2009-03-19  Ian Lance Taylor  <iant@google.com>
11995
11996         * descriptors.cc (Descriptors::open): Check that the options are
11997         valid before using them.
11998
11999 2009-03-18  Ian Lance Taylor  <iant@google.com>
12000
12001         * script-sections.h: Include <list>.
12002         (class Script_sections): Change Sections_elements from std::vector
12003         to std::list.  Typedef public Elements_iterator.  Add
12004         orphan_section_placement_, data_segment_align_start_, and
12005         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12006         field.
12007         * script-sections.cc (class Orphan_section_placement): New class.
12008         (class Sections_element): Add virtual functions is_relro and
12009         orphan_section_init.  Remove virtual function place_orphan_here.
12010         (class Output_section_definition): Add is_relro and
12011         orphan_section_init.  Remove place_orphan_here.
12012         (class Orphan_output_section): Likewise.
12013         (Script_sections::Script_sections): Update for field changes.
12014         (Script_sections::data_segment_align): Set saw_data_segment_align_
12015         and data_segment_align_start_, not data_segment_align_index.
12016         (Script_sections::data_segment_relro_end): Check
12017         saw_data_segment_align_.  Use data_segment_align_start_ rather
12018         than data_segment_align_index_.
12019         (Script_sections::place_orphan): Rewrite to use
12020         Orphan_section_placement.
12021
12022 2009-03-17  Ian Lance Taylor  <iant@google.com>
12023
12024         * archive.cc (Archive::add_symbols): Check for a version attached
12025         to the symbol name in the archive map.
12026         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12027         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12028         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12029         (ver_test_11.a): New target.
12030         * testsuite/Makefile.in: Rebuild.
12031
12032         * configure.ac: Check for chsize and posix_fallocate.  Replace
12033         ftruncate.
12034         * ftruncate.c: New file, from gnulib.
12035         * output.cc (posix_fallocate): Define dummy version if not
12036         HAVE_POSIX_FALLOCATE.
12037         (Output_file::map): Call posix_fallocate rather than lseek and
12038         write.
12039         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12040         * configure, Makefile.in, config.in: Rebuild.
12041
12042 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12043
12044         * layout.h (Layout::create_note): Add section_name parameter.
12045         * layout.cc (Layout::create_note): Likewise.
12046         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12047
12048 2009-03-17  Ian Lance Taylor  <iant@google.com>
12049
12050         * descriptors.cc: Include "options.h".
12051         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12052         (Descriptors::open): Always use O_CLOEXEC when opening a new
12053         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12054         then set FD_CLOEXEC.
12055
12056         * sparc.cc (class Target_sparc): Add has_got_section.
12057         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12058         make sure we have a GOT section.
12059
12060         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12061         (Target_sparc::Scan::local): Likewise.
12062         (Target_sparc::Scan::global): Likewise.
12063         (Target_sparc::Relocate::relocate): Likewise.
12064         (Target_sparc::Relocate::relocate_tls): Likewise.
12065
12066         * symtab.cc (Symbol_table::define_default_version): New function,
12067         broken out of add_from_object.
12068         (Symbol_table::add_from_object): Call define_default_version.
12069         (Symbol_table::define_special_symbol): Add resolve_oldsym
12070         parameter.  Change all callers.  If the version for a symbol comes
12071         from a version script, resolve it with the symbol with the same
12072         name with no version.  Also add the symbol without a version if
12073         appropriate.
12074         (do_define_in_output_data): If resolving with oldsym, don't delete
12075         sym.
12076         (do_define_in_output_segment): Likewise.
12077         (do_define_as_constant): Likewise.
12078         * symtab.h (class Symbol_table): Update declarations.
12079
12080 2009-03-13  Ian Lance Taylor  <iant@google.com>
12081
12082         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12083         (Read_symbols::requeue): New function.
12084         (Read_symbols::do_read_symbols): If make_elf_object fails because
12085         the target type is not configured, and the file was searched for,
12086         issue a warning and retry with the next directory.
12087         (Add_symbols::run): If the file has an incompatible format, and
12088         it was searched for, requeue the Read_symbols task.  On error,
12089         release the object.
12090         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12091         dirindex parameter to constructor.  Change all callers.  Declare
12092         incompatible_warning and requeue.
12093         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12094         input_argument_ and input_group_ fields.  Add them to
12095         constructor.  Change all callers.
12096         (class Read_script): Add dirindex_ field.  Add it to constructor.
12097         Change all callers.
12098         * archive.cc (Archive::setup): Remove input_objects parameter.
12099         Change all callers.
12100         (Archive::get_file_and_offset): Likewise.
12101         (Archive::read_all_symbols): Likewise.
12102         (Archive::read_symbols): Likewise.
12103         (Archive::get_elf_object_for_member): Remove input_objects
12104         parameter.  Add punconfigured parameter.  Change all callers.
12105         (Archive::add_symbols): Change return type to bool.  Check return
12106         value of include_member.
12107         (Archive::include_all_members): Likewise.
12108         (Archive::include_member): Change return type to bool.  Return
12109         false if first included object has incompatible target.  Set
12110         included_member_ field.
12111         (Add_archive_symbols::run): If add_symbols returns false, requeue
12112         Read_symbols task.
12113         * archive.h (class Archive): Add included_member_ field.
12114         Initialize it in constructor.  Add input_file and searched_for
12115         methods.  Update declarations.
12116         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12117         input_argument_ fields.  Add them to constructor.  Change all
12118         callers.
12119         * script.cc: Include "target-select.h".
12120         (class Parser_closure): Add skip_on_incompatible_target_ and
12121         found_incompatible_target_ fields.  Add
12122         skip_on_incompatible_target parameter to constructor.  Change all
12123         callers.  Add methods skip_on_incompatible_target,
12124         clear_skip_on_incompatible_target, found_incompatible_target, and
12125         set_found_incompatible_target.
12126         (read_input_script): Add dirindex parameter.  Change all callers.
12127         If parser finds an incompatible target, requeue Read_symbols
12128         task.
12129         (script_set_symbol): Clear skip_on_incompatible_target in
12130         closure.
12131         (script_add_assertion, script_parse_option): Likewise.
12132         (script_start_sections, script_add_phdr): Likewise.
12133         (script_check_output_format): New function.
12134         * script.h (read_input_script): Update declaration.
12135         * script-c.h (script_check_output_format): Declare.
12136         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12137         (ignore_cmd): Remove OUTPUT_FORMAT.
12138         * fileread.cc (Input_file::Input_file): Add explicit this.
12139         (Input_file::will_search_for): New function.
12140         (Input_file::open): Add pindex parameter.  Change all callers.
12141         * fileread.h (class Input_file): Add input_file_argument method.
12142         Declare will_search_for.  Update declarations.
12143         * object.cc (make_elf_object): Add punconfigured parameter.
12144         Change all callers.
12145         * object.h (class Object): Make input_file public.  Add
12146         searched_for method.
12147         (make_elf_object): Update declaration.
12148         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12149         restart search.
12150         * dirsearch.h (class Dirsearch): Update declaration.
12151         * options.h (class General_options): Add --warn-search-mismatch.
12152         * parameters.cc (Parameters::is_compatible_target): New function.
12153         * parameters.h (class Parameters): Declare is_compatible_target.
12154         * workqueue.cc (Workqueue::add_blocker): New function.
12155         * workqueue.h (class Workqueue): Declare add_blocker.
12156
12157         * fileread.cc (Input_file::open): Remove options parameter.
12158         Change all callers.
12159         (Input_file::open_binary): Likewise.
12160         * script.cc (read_input_script): Likewise.
12161         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12162         options parameter from constructor.  Change all callers.
12163         (class Read_script): Likewise.
12164         * fileread.h (class Input_file): Update declarations.
12165         * script.h (read_input_script): Update declaration.
12166
12167 2009-03-10  Nick Clifton  <nickc@redhat.com>
12168
12169         * po/es.po: New Spanish translation.
12170
12171 2009-03-06  Cary Coutant  <ccoutant@google.com>
12172
12173         * options.cc (parse_short_option): Keep dash_z from registering itself.
12174
12175 2009-03-03  Ian Lance Taylor  <iant@google.com>
12176
12177         PR 9918
12178         * target-reloc.h (relocate_section): Pass output_section to
12179         relocate.
12180         * i386.cc (Target_i386::should_apply_static_reloc): Add
12181         output_section parameter.  Change all callers.
12182         (Target_i386::Relocate::relocate): Add output_section parameter.
12183         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12184         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12185         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12186         * testsuite/two_file_shared.sh: New script.
12187         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12188         (check_DATA): Add two_file_shared.dbg.
12189         (two_file_shared.dbg): New target.
12190         * testsuite/Makefile.in: Rebuild.
12191
12192 2009-03-01  Ian Lance Taylor  <iant@google.com>
12193
12194         * configure.ac: Check for byteswap.h.
12195         * configure: Rebuild.
12196         * config.in: Rebuild.
12197
12198 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12199
12200         * layout.cc (Layout::find_or_add_kept_section): New function.
12201         (Layout::add_comdat): Removed.
12202         * layout.h (struct Kept_section): Move out of class Layout.
12203         Remove trailing underscores from field names.  Add group_sections
12204         field.  Rename group_ field to is_group.  Change all uses.
12205         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12206         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12207         comdat_groups_ field.
12208         (Sized_relobj::include_section_group): Use
12209         find_or_add_kept_section and Kept_section::group_sections.
12210         (Sized_relobj::include_linkonce_section): Likewise.
12211         * object.cc (class Sized_relobj): Don't define Comdat_group or
12212         Comdat_group_table.  Remove find_comdat_group and
12213         add_comdat_group.  Remove comdat_groups_ field.
12214         * plugin.cc (include_comdat_group): Use
12215         Layout::find_or_add_kept_section.
12216
12217 2009-02-28  Ian Lance Taylor  <iant@google.com>
12218
12219         * README: --gc-sections and map files are now supported.  Document
12220         some build requirements.
12221
12222         PR 6992
12223         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12224         relocatable link set the value of the section symbol to zero.
12225         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12226         relocatable link don't include the section address in the local
12227         symbol value.
12228
12229 2009-02-27  Ian Lance Taylor  <iant@google.com>
12230
12231         PR 6811
12232         * options.h (class Search_directory): Add is_system_directory.
12233         (class General_options): Declare is_in_system_directory.
12234         * options.cc (get_relative_sysroot): Make static.
12235         (get_default_sysroot): Make static.
12236         (General_optoins::is_in_system_directory): New function.
12237         * fileread.cc (Input_file::is_in_system_directory): New function.
12238         * fileread.h (class Input_file): Declare is_in_system_directory.
12239         * object.h (class Object): Add is_in_system_directory.
12240         (class Input_objects): Remove system_library_directory_ field.
12241         * object.cc (Input_objects::add_object): Don't set
12242         system_library_directory_.
12243         (input_objects::found_in_system_library_directory): Remove.
12244         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12245         parameter.  Change all callers.
12246         (Symbol_table::sized_write_globals): Likewise.
12247         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12248         Call Object::is_in_system_directory.
12249         * symtab.h (class Symbol_table): Update declarations.
12250
12251         PR 5990
12252         * descriptors.h (Open_descriptor): Add is_on_stack field.
12253         * descriptors.cc (Descriptors::open): If the descriptor is on the
12254         top of the stack, remove it.  Initialize is_on_stack field.
12255         (Descriptors::release): Only add pod to stack if it is not on the
12256         stack already.
12257         (Descriptors::close_some_descriptor): Clear stack_next and
12258         is_on_stack fields.
12259
12260         PR 7091
12261         * output.cc (Output_section::find_starting_output_address): Rename
12262         from starting_output_address; add PADDR parameter; change return
12263         type.
12264         * output.h (class Output_section): Declare
12265         find_starting_output_address instead of starting_output_address.
12266         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12267         section symbol for which we can't find a merge section.
12268
12269         PR 9836
12270         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12271         hidden or internal, force the symbol to be local.
12272         * resolve.cc (Symbol::override_visibility): Define.
12273         (Symbol::override_base): Use override_visibility.
12274         (Symbol_table::resolve): Likewise.
12275         (Symbol::override_base_with_special): Likewise.
12276         (Symbol_table::override_with_special): If the visibility is hidden
12277         or internal, force the symbol to be local.
12278         * symtab.h (class Symbol): Add set_visibility and
12279         override_visibility.
12280         * testsuite/ver_test_1.sh: New file.
12281         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12282         (check_DATA): Add ver_test_1.syms.
12283         (ver_test_1.syms): New target.
12284         * testsuite/Makefile.in: Rebuild.
12285
12286 2009-02-25  Cary Coutant  <ccoutant@google.com>
12287
12288         * layout.cc (Layout::choose_output_section): Don't rename sections
12289         when using a linker script that has a SECTIONS clause.
12290         * Makefile.in: Regenerate.
12291
12292         * testsuite/Makefile.am (script_test_5.sh): New test case.
12293         * testsuite/Makefile.in: Regenerate.
12294         * testsuite/script_test_5.cc: New file.
12295         * testsuite/script_test_5.sh: New file.
12296         * testsuite/script_test_5.t: New file.
12297
12298 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12299
12300         * archive.cc (Archive::include_member): Update calls to add_symbols.
12301         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12302         the Layout argument.
12303         * dynobj.h (do_add_symbols): Add the Layout argument.
12304         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12305         Layout argument.
12306         * object.h (Object::add_symbols): Add the Layout argument.
12307         (Object::do_add_symbols): Add the Layout argument.
12308         (Sized_relobj::do_add_symbols): Add the Layout argument.
12309         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12310         Unify the two versions.
12311         (Add_plugin_symbols): Remove.
12312         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12313         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12314         (Add_plugin_symbols): Remove.
12315         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12316         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12317         (Add_symbols::run): Make it work with Pulginobj.
12318
12319 2009-02-06  Ian Lance Taylor  <iant@google.com>
12320
12321         * object.cc (Sized_relobj::do_layout): Make info message start
12322         with lower case letter.
12323
12324 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12325
12326         * binary.cc: Fix file comment.
12327
12328         * options.h (enum Incremental_disposition): Define.
12329         (class General_options): Add new options: --incremental,
12330         --incremental_changed, --incremental_unchanged,
12331         --incremental_unknown.  Add incremental_disposition_ and
12332         implicit_incremental_ fields.
12333         (General_options::incremental_disposition): New function.
12334         (class Position_dependent_options): Add incremental_disposition
12335         option.
12336         (Position_dependent_options::copy_from_options): Set incremental
12337         dispositions.
12338         * options.cc (General_options::parse_incremental_changed): New
12339         function.
12340         (General_options::parse_incremental_unchanged): New function.
12341         (General_options::parse_incremental_unknown): New function.
12342         (General_options::General_options): Initialize new fields
12343         incremental_disposition_ and implicit_incremental_.
12344         (General_options::finalize): Check for uasge of --incremental-*
12345         without --incremental.
12346
12347 2009-02-06  Chris Demetriou  <cgd@google.com>
12348
12349         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12350         pointer and to report location as the file name associated with
12351         the symbol.
12352         (gold_undefined_symbol_at_location): New function to replace the
12353         old gold_undefined_symbol functionality.
12354         * target-reloc.h (relocate_section): Update to use
12355         gold_undefined_symbol_at_location.
12356         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12357         Call gold_undefined_symbol function rather than gold_error.
12358         * errors.h (Errors::undefined_symbol): Take location as a
12359         string, rather than calculating it from a relocation.
12360         * errors.cc (Errors::fatal): Print "fatal error:" before the
12361         formatted message.
12362         (Errors::error, Errors::error_at_location): Print "error: "
12363         before the formatted message.
12364         (Errors::undefined_symbol): Take location as a string, rather
12365         than calculating it from a relocation.
12366         (gold_undefined_symbol_at_location): New function akin to
12367         old gold_undefined_symbol, calculates location from relocation.
12368         (gold_undefined_symbol): Change to take only a Symbol pointer
12369         and to report location as the file name associated with the symbol.
12370         * testsuite/debug_msg.sh: Update for changed error messages.
12371         * testsuite/undef_symbol.sh: Likewise.
12372
12373 2009-02-04  Duncan Sands  <baldrick@free.fr>
12374
12375         PR 9812
12376         * reduced_debug_output.h
12377         (Output_reduced_debug_abbrev_section::failed): Use format for
12378         gold_warning.
12379         (Output_reduced_debug_info_section::faild): Likewise.
12380
12381 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12382
12383         * script.cc (Lazy_demangler): New class.
12384         (Version_script_info::get_symbol_version_helper): Demangle a
12385         symbol only once.
12386
12387 2009-01-29  Cary Coutant  <ccoutant@google.com>
12388
12389         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12390         to __tls_get_addr.
12391         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12392
12393 2009-01-28  Ian Lance Taylor  <iant@google.com>
12394
12395         * version.cc (version_string): Bump to 1.9.
12396
12397         * gold.h: Include <cstring> and <stdint.h>.
12398         * version.cc: Include <cstdio>.
12399         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12400         warning.
12401         * reduced_debug_output.cc (insert_into_vector): Rename from
12402         Insert_into_vector; change all callers.  Use Swap_unaligned to
12403         avoid aliasing issue; remove union since it is unnecessary.
12404
12405 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12406
12407         * Makefile.am (CCFILES): Add gc.cc.
12408         (HFILES): Add gc.h.
12409         * Makefile.in: Regenerate.
12410         * gold.cc (Gc_runner): New class.
12411         (queue_initial_tasks): Call garbage collection related tasks
12412         when corresponding options are invoked.
12413         (queue_middle_gc_tasks): New function.
12414         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12415         processed early before laying out sections during garbage collection.
12416         * gold.h (queue_middle_gc_tasks): New function.
12417         (is_prefix_of): Move from "layout.cc".
12418         * i386.cc (Target_i386::gc_process_relocs): New function.
12419         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12420         * main.cc (main): Create object of class "Garbage_collection".
12421         * object.cc (Relobj::copy_symbols_data): New function.
12422         (Relobj::is_section_name_included): New function.
12423         (Sized_relobj::do_layout): Allow this function to be called twice
12424         during garbage collection and defer layout of section during the
12425         first call.
12426         * object.h (Relobj::get_symbols_data): New function.
12427         (Relobj::is_section_name_included): New function.
12428         (Relobj::copy_symbols_data): New function.
12429         (Relobj::set_symbols_data): New function.
12430         (Relobj::get_relocs_data): New function.
12431         (Relobj::set_relocs_data): New function.
12432         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12433         (Relobj::gc_process_relocs): New function.
12434         (Relobj::do_gc_process_relocs): New pure virtual function.
12435         (Relobj::sd_): New data member.
12436         (Sized_relobj::is_output_section_offset_invalid): New function.
12437         (Sized_relobj::do_gc_process_relocs): New function.
12438         * options.h (General_options::gc_sections): Modify to not be a no-op.
12439         (General_options::print_gc_sections): New option.
12440         * plugin.cc (Plugin_finish::run): Remove function call to
12441         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12442         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12443         * reloc.cc (Read_relocs::run): Add task to process relocs and
12444         determine unreferenced sections when doing garbage collection.
12445         (Gc_process_relocs): New class.
12446         (Sized_relobj::do_gc_process_relocs): New function.
12447         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12448         sections that are garbage collected.
12449         * reloc.h (Gc_process_relocs): New class.
12450         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12451         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12452         symbols whose corresponding sections are garbage collected.
12453         (Symbol_table::Symbol_table): Add new parameter for the garbage
12454         collection object.
12455         (Symbol_table::gc_mark_undef_symbols): New function.
12456         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12457         (Symbol_table::gc_mark_dyn_syms): New function.
12458         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12459         as garbage.
12460         (Symbol_table::add_from_object): Likewise.
12461         (Symbol_table::add_from_relobj): When building shared objects, do not
12462         treat externally visible symbols as garbage.
12463         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12464         table information for static and relocatable links.
12465         * symtab.h (Symbol_table::set_gc): New function.
12466         (Symbol_table::gc): New function.
12467         (Symbol_table::gc_mark_undef_symbols): New function.
12468         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12469         (Symbol_table::gc_mark_dyn_syms): New function.
12470         (Symbol_table::gc_): New data member.
12471         * target.h (Sized_target::gc_process_relocs): New pure virtual
12472         function.
12473         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12474         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12475
12476 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12477
12478         * options.h (General_options::gc_sections): Define as a no-op for now.
12479         (General_options::no_keep_memory): Ditto.
12480         (General_options::Bshareable): Define.
12481         * options.cc (General_options::finalize): Honor -Bshareable.
12482
12483 2009-01-20  Andreas Schwab  <schwab@suse.de>
12484
12485         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12486         read the value in the contents, since we don't use it.  Use the
12487         template endianness when writing.
12488         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12489
12490 2009-01-19  Andreas Schwab  <schwab@suse.de>
12491
12492         * configure.tgt (powerpc64-*): Fix targ_obj.
12493
12494 2009-01-15  Ian Lance Taylor  <iant@google.com>
12495
12496         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12497         local symbols when stripping all symbols.
12498
12499 2009-01-14  Cary Coutant  <ccoutant@google.com>
12500
12501         * output.cc (Output_reloc): Add explicit instantiations.
12502
12503 2009-01-14  Cary Coutant  <ccoutant@google.com>
12504
12505         * archive.cc (Archive::get_elf_object_for_member): Remove call
12506         to File_read::claim_for_plugin.
12507         * descriptors.cc (Descriptors::open): Remove reference to
12508         is_claimed.
12509         (Descriptors::claim_for_plugin): Remove.
12510         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12511         (Descriptors::is_claimed): Remove.
12512         (claim_descriptor_for_plugin): Remove.
12513         * fileread.cc (File_read::claim_for_plugin): Remove.
12514         * fileread.h (File_read::claim_for_plugin): Remove.
12515         (File_read::descriptor): Reopen descriptor if necessary.
12516         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12517         (Plugin_manager::all_symbols_read): Add task parameter. Change
12518         all callers.
12519         (Plugin_manager::get_input_file): New function.
12520         (Plugin_manager::release_input_file): New function.
12521         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12522         corresponding data member.
12523         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12524         and pass to base constructor. Change all callers.
12525         (get_input_file, release_input_file): New functions.
12526         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12527         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12528         (Plugin_manager::all_symbols_read): Add task parameter.
12529         (Plugin_manager::get_input_file): New function.
12530         (Plugin_manager::release_input_file): New function.
12531         (Plugin_manager::task_): New data member.
12532         (Pluginobj::Pluginobj): Add filesize parameter.
12533         (Pluginobj::filename): New function.
12534         (Pluginobj::descriptor): New function.
12535         (Pluginobj::filesize): New function.
12536         (Pluginobj::filesize_): New data member.
12537         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12538         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12539         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12540
12541         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12542         with archive libraries.
12543         * testsuite/Makefile.in: Regenerate.
12544         * testsuite/plugin_test.c (struct sym_info): New type.
12545         (get_input_file, release_input_file): New static variables.
12546         (onload): Capture new transfer vector entries.
12547         (claim_file_hook): Stop reading at end of file according to filesize.
12548         Factor out parsing of readelf output into separate function.
12549         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12550         APIs and get the source file name from the symbol table.  Convert
12551         source file name to corresponding object file name.  Print info
12552         message when adding new input files.
12553         (parse_readelf_line): New function.
12554         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12555         * testsuite/plugin_test_2.sh: Likewise.
12556         * testsuite/plugin_test_3.sh: Likewise.
12557         * testsuite/plugin_test_4.sh: New test case.
12558
12559 2009-01-07  Ian Lance Taylor  <iant@google.com>
12560
12561         * version.cc (version_string): Bump to 1.8.
12562
12563 2008-12-23  Cary Coutant  <ccoutant@google.com>
12564
12565         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12566         * plugin.cc (Plugin_manager::finish): Rename as
12567         layout_deferred_objects.  Move cleanup to separate function.
12568         (Plugin_manager::cleanup): New function.
12569         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12570         separately.
12571         * plugin.h (Plugin_manager::finish): Rename as
12572         layout_deferred_objects.
12573         (Plugin_manager::cleanup): New function.
12574         (Plugin_manager::cleanup_done): New field.
12575
12576 2008-12-23  Cary Coutant  <ccoutant@google.com>
12577
12578         * plugin.cc (is_visible_from_outside): New function.
12579         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12580         so we don't return "IR only" status for exported symbols or -r links.
12581
12582         * testsuite/Makefile.am (plugin_test_3): New test case.
12583         * testsuite/Makefile.in: Regenerate.
12584         * testsuite/plugin_test_3.sh: New file.
12585
12586 2008-12-22  Cary Coutant  <ccoutant@google.com>
12587
12588         * object.cc (Sized_relobj::layout_section): New function.
12589         (Sized_relobj::do_layout): Defer layout of input sections until after
12590         plugin has provided replacement files.
12591         (Sized_relobj::do_layout_deferred_sections): New function.
12592         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12593         (Relobj::layout_deferred_sections): New function.
12594         (Relobj::do_layout_deferred_sections): New function.
12595         (Sized_relobj::do_layout_deferred_sections): New function.
12596         (Sized_relobj::layout_section): New function.
12597         (Sized_relobj::Deferred_layout): New structure.
12598         (Sized_relobj::deferred_layout_): New field.
12599         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12600         Change all callers.  Layout deferred sections.
12601         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12602         references.
12603         (Plugin_hook::run): Move code from do_plugin_hook inline.
12604         (Plugin_hook::do_plugin_hook): Remove.
12605         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12606         (Plugin_manager::finish): Renamed, was cleanup.
12607         (Plugin_manager::should_defer_layout): New function.
12608         (Plugin_manager::add_deferred_layout_object): New function.
12609         (Plugin_manager::Deferred_layout_list): New type.
12610         (Plugin_manager::deferred_layout_objects_): New field.
12611         (Plugin_hook::do_plugin_hook): Remove.
12612
12613 2008-12-17  Ian Lance Taylor  <iant@google.com>
12614
12615         * options.h (class General_options): Add --no case for
12616         --export-dynamic.
12617
12618 2008-12-16  Cary Coutant  <ccoutant@google.com>
12619
12620         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12621         vector.
12622         (Plugin_manager::claim_file): Create plugin object even if
12623         plugin did not call the add_symbols callback.
12624         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12625         asking for more symbols than were added.
12626         * testsuite/Makefile.am (plugin_test_1): Add test case with
12627         no global symbols.
12628         (empty.syms): New target.
12629         * testsuite/Makefile.in: Regenerate.
12630         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12631         message. Don't call add_symbols if no globals.
12632         (all_symbols_read_hook): Don't provide replacement for empty
12633         claimed file.
12634
12635 2008-12-12  Ian Lance Taylor  <iant@google.com>
12636
12637         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12638         r_type == 0 for a local symbol with r_sym == 0.
12639         (scan_relocatable_relocs): Pass r_sym to
12640         local_non_section_strategy.
12641         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12642         r_sym parameter.
12643
12644         * configure.ac: Update test for TLS descriptors: they are
12645         supported as of glibc 2.9.
12646         * configure: Rebuild.
12647
12648 2008-12-11  Ian Lance Taylor  <iant@google.com>
12649
12650         PR 7091
12651         * target-reloc.h (Default_scan_relocatable_relocs): For each
12652         function, map r_type == 0 to RELOC_DISCARD.
12653
12654 2008-12-10  Cary Coutant  <ccoutant@google.com>
12655
12656         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12657         object to override a kept COMDAT group from a plugin object.
12658
12659 2008-12-09  Ian Lance Taylor  <iant@google.com>
12660
12661         PR 7088
12662         * yyscript.y (file_cmd): Handle INPUT.
12663
12664         * testsuite/initpri1.c: Change all declarations to be full
12665         prototypes by adding void, to avoid compiler warnings.
12666
12667 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12668
12669         * options.cc (General_options::parse_plugin_opt): New.
12670         (General_options::add_plugin): The argument now is just the filename.
12671         (General_options::add_plugin_option): New.
12672         * options.h (plugin_opt): New.
12673         (add_plugin): Change argument name.
12674         (add_plugin_option): New.
12675         * plugin.cc (Plugin::load): Don't parse the plugin option.
12676         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12677         (Plugin::add_option): New.
12678         (Plugin::args_): Change type.
12679         (Plugin::filename_): New.
12680         (Plugin_manager::add_plugin_option): New.
12681         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12682         * testsuite/Makefile.in: Regenerate.
12683
12684 2008-12-05  Cary Coutant  <ccoutant@google.com>
12685
12686         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12687         Handle --strip-lto-sections option.
12688         * options.h (strip_lto_sections): New option.
12689
12690 2008-12-01  Cary Coutant  <ccoutant@google.com>
12691
12692         * plugin.cc (ld_plugin_message): Change format parameter to const.
12693         Fix mismatch between new[] and delete.
12694
12695 2008-11-14  Cary Coutant  <ccoutant@google.com>
12696
12697         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12698         instead of -1U.
12699
12700 2008-11-05  Craig Silverstein  <csilvers@google.com>
12701
12702         * options.cc (General_options::parse_dynamic_list): New function.
12703         * options.h (General_options): New flags dynamic_list,
12704         dynamic_list_data, dynamic_list_cpp_new, and
12705         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12706         (General_options::in_dynamic_list): New function.
12707         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12708         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12709         (Lex::can_continue_name): Likewise.
12710         (yylex): Likewise.
12711         (read_script_file): New parameter script_options.
12712         (read_dynamic_list): New function.
12713         (Script_options::define_dynamic_list): New function.
12714         (dynamic_list_keyword_parsecodes): New variable.
12715         (dynamic_list_keywords): New variable.
12716         * script.h (Script_options::define_dynamic_list): New function
12717         prototype.
12718         (read_dynamic_list): New function prototype.
12719         * symtab.cc (strprefix): New macro.
12720         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12721         dynamic_list_data, dynamic_list_cpp_new, and
12722         dynamic_list_cpp_typeinfo.
12723         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12724         (dynamic_list_expr): New rule.
12725         (dynamic_list_nodes): Likewise.
12726         (dynamic_list_node): Likewise.
12727         * testsuite/Makefile.am (dynamic_list): New test.
12728         * testsuite/Makefile.in: Regenerated.
12729         * testsuite/dynamic_list.t: New file.
12730         * testsuite/dynamic_list.sh: New file.
12731
12732 2008-11-05  Craig Silverstein  <csilvers@google.com>
12733
12734         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12735         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12736         (t11_last): Likewise.
12737         * testsuite/ver_test_6.c (main): Likewise.
12738
12739 2008-10-07  Cary Coutant  <ccoutant@google.com>
12740
12741         * options.c (General_options::finalize): Add check for -static and
12742         -shared.
12743         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12744         is not empty.
12745
12746 2008-10-02  Cary Coutant  <ccoutant@google.com>
12747
12748         * plugin.cc (make_sized_plugin_object): Fix conditional
12749         compilation to work when not all targets are enabled.
12750
12751 2008-09-29  Cary Coutant  <ccoutant@google.com>
12752
12753         * archive.cc (Archive::get_file_and_offset): Use filename instead
12754         of name to get library path.
12755         (Archive::include_member): Unlock external member of a thin archive.
12756
12757         * testsuite/Makefile.am (TEST_AR): New variable.
12758         (thin_archive_test_1): New test.
12759         (thin_archive_test_2): New test.
12760         * testsuite/Makefile.in: Regenerate.
12761         * testsuite/thin_archive_main.cc: New file.
12762         * testsuite/thin_archive_test_1.cc: New file.
12763         * testsuite/thin_archive_test_2.cc: New file.
12764         * testsuite/thin_archive_test_3.cc: New file.
12765         * testsuite/thin_archive_test_4.cc: New file.
12766
12767 2008-09-29  Cary Coutant  <ccoutant@google.com>
12768
12769         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12770         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12771         instead of -1U.
12772         (Sized_relobj::do_finalize_local_symbols): Likewise.
12773         (Sized_relobj::map_to_kept_section): Likewise.
12774         * object.h (Sized_relobj::invalid_address): New constant.
12775         (Sized_relobj::do_output_section_offset): Check for invalid_address
12776         and return -1ULL.
12777         * output.cc (Output_reloc::local_section_offset): Use constant
12778         invalid_address instead of -1U.
12779         (Output_reloc::get_address): Likewise.
12780         (Output_section::output_address): Change -1U to -1ULL.
12781         * output.h (Output_reloc::invalid_address): New constant.
12782         * reloc.cc (Sized_relobj::write_sections): Use constant
12783         invalid_address instead of -1U.
12784         (Sized_relobj::relocate_sections): Likewise.
12785         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12786         values for merge sections.
12787         * target-reloc.h (relocate_for_relocatable): Use constant
12788         invalid_address instead of -1U.
12789
12790 2008-09-19  Cary Coutant  <ccoutant@google.com>
12791
12792         Add plugin functionality for link-time optimization (LTO).
12793         * configure.ac (plugins): Add --enable-plugins option.
12794         * configure: Regenerate.
12795         * config.in: Regenerate.
12796         * Makefile.am (LIBDL): New variable.
12797         (CCFILES): Add plugin.cc.
12798         (HFILES): Add plugin.h.
12799         (ldadd_var): Add LIBDL.
12800         * Makefile.in: Regenerate.
12801
12802         * archive.cc: Include "plugin.h".
12803         (Archive::setup): Don't preread archive symbols when using a plugin.
12804         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12805         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12806         files.
12807         (Archive::include_member): Add symbols from plugin objects.
12808         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12809         * descriptors.cc (Descriptors::open): Check for file descriptors
12810         abandoned by plugins.
12811         (Descriptors::claim_for_plugin): New function.
12812         * descriptors.h (Descriptors::claim_for_plugin): New function.
12813         (Open_descriptor::is_claimed): New field.
12814         (claim_descriptor_for_plugin): New function.
12815         * fileread.cc (File_read::claim_for_plugin): New function.
12816         * fileread.h (File_read::claim_for_plugin): New function.
12817         (File_read::descriptor): New function.
12818         * gold.cc: Include "plugin.h".
12819         (queue_initial_tasks): Add task to call plugin hooks for generating
12820         new object files.
12821         * main.cc: Include "plugin.h".
12822         (main): Load plugin libraries.
12823         * object.h (Pluginobj): Declare.
12824         (Object::pluginobj): New function.
12825         (Object::do_pluginobj): New function.
12826         (Object::set_target): New function.
12827         * options.cc: Include "plugin.h".
12828         (General_options::parse_plugin): New function.
12829         (General_options::General_options): Initialize plugins_ field.
12830         (General_options::add_plugin): New function.
12831         * options.h (Plugin_manager): Declare.
12832         (General_options): Add --plugin option.
12833         (General_options::has_plugins): New function.
12834         (General_options::plugins): New function.
12835         (General_options::add_plugin): New function.
12836         (General_options::plugins_): New field.
12837         * plugin.cc: New file.
12838         * plugin.h: New file.
12839         * readsyms.cc: Include "plugin.h".
12840         (Read_symbols::do_read_symbols): Check for archive before checking
12841         for ELF file.  Call plugin hooks to claim files.
12842         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12843         from a real object file; force override when processing replacement
12844         files.
12845         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12846         (Symbol::init_base_object): Likewise.
12847         (Symbol::init_base_output_data): Likewise.
12848         (Symbol::init_base_output_segment): Likewise.
12849         (Symbol::init_base_constant): Likewise.
12850         (Symbol::init_base_undefined): Likewise.
12851         (Symbol::output_section): Assert that object is not a plugin.
12852         (Symbol_table::add_from_pluginobj): New function.
12853         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12854         undefined.
12855         (Symbol_table::sized_write_globals): Likewise.
12856         (Symbol_table::add_from_pluginobj): Instantiate template.
12857         * symtab.h (Sized_pluginobj): Declare.
12858         (Symbol::in_real_elf): New function.
12859         (Symbol::set_in_real_elf): New function.
12860         (Symbol::in_real_elf_): New field.
12861         (Symbol_table::add_from_pluginobj): New function.
12862
12863         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12864         (LIBDL): New variable.
12865         (LDADD): Add LIBDL.
12866         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12867         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12868         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12869         (MOSTLYCLEANFILES): Likewise.
12870         * testsuite/Makefile.in: Regenerate.
12871         * testsuite/plugin_test.c: New file.
12872         * testsuite/plugin_test_1.sh: New file.
12873         * testsuite/plugin_test_2.sh: New file.
12874
12875 2008-09-16  Ian Lance Taylor  <iant@google.com>
12876
12877         * target-reloc.h (relocate_section): Check whether a symbol is
12878         defined by the ABI before reporting an undefined symbol error.
12879         * target.h (Target::is_defined_by_abi): Make parameter const.
12880         (Target::do_is_defined_by_abi): Likewise.
12881         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12882         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12883         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12884         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12885         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12886         * testsuite/Makefile.in: Rebuild.
12887
12888         * fileread.cc (make_view): Add casts to avoid warning.
12889
12890 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12891
12892         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12893         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12894
12895 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12896
12897         * options.h (General_options::output_is_executable): New.
12898         (General_options::output_is_pie): New.
12899         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12900         for shared libraries.
12901         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12902
12903 2008-09-11  Chris Demetriou  <cgd@google.com>
12904
12905         * options.h (origin): New -z option.
12906         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12907         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12908         in DT_FLAGS_1.
12909
12910 2008-09-05  Cary Coutant  <ccoutant@google.com>
12911
12912         * fileread.cc (File_read::make_view): Add check for attempt to map
12913         beyond end of file.
12914
12915 2008-09-05  Cary Coutant  <ccoutant@google.com>
12916
12917         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12918         explicit instantiations.
12919
12920 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12921
12922         PR gold/6858
12923         * options.cc (General_options::finalize): Allow undefined symbols
12924         in shlibs if linking -shared.
12925
12926         PR gold/6859
12927         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12928         symbols as not needing a dynsym entry.
12929
12930 2008-08-20  Craig Silverstein  <csilvers@google.com>
12931
12932         * fileread.cc (File_read::open): Do not lock the file unless it
12933         was successfully opened.
12934
12935 2008-08-14  Cary Coutant  <ccoutant@google.com>
12936
12937         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12938         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12939         * testsuite/tls_test.cc (struct int128): 128-bit struct
12940         for testing TLS relocs with non-zero addend.
12941         (v12): New TLS variable.
12942         (t12): New test.
12943         (t_last): Add check for v12.
12944         * testsuite/tls_test.h (t12): New function.
12945         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12946
12947 2008-08-13  Ian Lance Taylor  <iant@google.com>
12948
12949         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12950         set tls_segment_ or relro_segment_.
12951         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12952         when appropriate.
12953         * output.h (Output_section::clear_is_relro): New function.
12954         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12955         sections specially even when output_data_ is empty.
12956         (Output_segment::maximum_alignment): When first section is relro,
12957         only force alignment for PT_LOAD segments.
12958         * script.cc (script_data_segment_align): New function.
12959         (script_data_segment_relro_end): New function.
12960         * script-c.h (script_data_segment_align): Declare.
12961         (script_data_segment_relro_end): Declare.
12962         * script-sections.h (class Script_sections): Declare
12963         data_segment_align and data_segment_relro_end.  Add fields
12964         segment_align_index_ and saw_relro_end_.
12965         * script-sections.cc (class Sections_element): Add set_is_relro
12966         virtual function.  Add new bool* parameter to place_orphan_here.
12967         Add get_output_section virtual function.
12968         (class Output_section_definition): Add set_is_relro.  Add new
12969         bool* parameter to place_orphan_here.  Add get_output_section.
12970         Add is_relro_ field.
12971         (Output_section_definition::Output_section_definition): Initialize
12972         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12973         and is_relro_ fields.
12974         (Output_section_definition::place_orphan_here): Add is_relro
12975         parameter.
12976         (Output_section_definition::set_section_addresses): Set relro for
12977         output section.
12978         (Output_section_definition::alternate_constraint): Likewise.
12979         (class Orphan_output_section): Add new bool* parameter to
12980         place_orphan_here.  Add get_output_section.
12981         (Orphan_output_section::place_orphan_here): Add is_relro
12982         parameter.
12983         (Script_sections::Script_sections): Initialize
12984         data_segment_align_index_ and saw_relro_end_.
12985         (Script_sections::data_segment_align): New function.
12986         (Script_sections::data_segment_relro_end): New function.
12987         (Script_sections::place_orphan): Set or clear is_relro.
12988         (Script_sections::set_section_addresses): Force alignment of first
12989         TLS section.
12990         * yyscript.y (exp): Call script_data_segment_align and
12991         script_data_segment_relro_end.
12992         * testsuite/relro_script_test.t: New file.
12993         * testsuite/relro_test.cc (using_script): Declare.
12994         (t1, t2): Test using_script.
12995         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12996         (relro_script_test_SOURCES): Define.
12997         (relro_script_test_DEPENDENCIES): Define.
12998         (relro_script_test_LDFLAGS): Define.
12999         (relro_script_test_LDADD): Define.
13000         (relro_script_test.so): New target.
13001         * testsuite/Makefile.in: Rebuild.
13002
13003 2008-08-06  Cary Coutant <ccoutant@google.com>
13004
13005         * archive.cc (Archive::total_archives, Archive::total_members)
13006         (Archive::total_members_loaded): New variables.
13007         (Archive::setup): Add parameter.  Add option to preread
13008         archive symbols.
13009         (Archive::read_armap): Add counter.
13010         (Archive::get_file_and_offset): New function.
13011         (Archive::get_elf_object_for_member): New function.
13012         (Archive::read_all_symbols): New function.
13013         (Archive::read_symbols): New function.
13014         (Archive::add_symbols): Add counters.
13015         (Archive::include_all_members): Use armap to find members if it's
13016         already built.
13017         (Archive::include_member): Skip reading symbols if already read.
13018         Factored code into Archive::get_file_and_offset and
13019         Archive::get_elf_object_for_member.  Changed call to
13020         Mapfile::report_include_archive_member.
13021         (Archive::print_stats): New function.
13022         * archive.h: Declare Object and Read_symbols_data classes.
13023         (Archive::Archive): Add initializers for new members.
13024         (Archive::setup): Add parameter.
13025         (Archive::print_stats): New function.
13026         (Archive::total_archives, Archive::total_members)
13027         (Archive::total_members_loaded): New variables.
13028         (Archive::get_file_and_offset): New function.
13029         (Archive::get_elf_object_for_member): New function.
13030         (Archive::read_all_symbols): New function.
13031         (Archive::read_symbols): New function.
13032         (Archive::Archive_member): New class.
13033         (Archive::members_): New member.
13034         (Archive::num_members_): New member.
13035         * main.cc: Include archive.h.
13036         (main): Call Archive::print_stats.
13037         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13038         archive parameter; member_name is now the fully-decorated name.
13039         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13040         * options.h: (General_options): Add --preread-archive-symbols option.
13041         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13042         Archive::setup.
13043
13044 2008-08-04  Ian Lance Taylor  <iant@google.com>
13045
13046         * symtab.h (Symbol::use_plt_offset): New function.
13047         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13048         * powerpc.cc (Relocate::relocate): Likewise.
13049         * sparc.cc (Relocate::relocate): Likewise.
13050         * x86_64.cc (Relocate::relocate): Likewise.
13051         * testsuite/weak_plt.sh: New test.
13052         * testsuite/weak_plt_main.cc: New test.
13053         * testsuite/weak_plt_shared.cc: New test.
13054         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13055         (check_PROGRAMS): Add weak_plt.
13056         (check_DATA): Add weak_plt_shared.so.
13057         (weak_plt_main_pic.o, weak_plt): New targets.
13058         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13059         * testsuite/Makefile.in: Rebuild.
13060
13061         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13062         gcctestdir/ld.
13063         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13064         * testsuite/Makefile.in: Rebuild.
13065
13066 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13067
13068         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13069         * Makefile.in: Regenerate.
13070         * po/POTFILES.in: Regenerate.
13071
13072 2008-07-29  Ian Lance Taylor  <iant@google.com>
13073
13074         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13075         symbols before other symbols.
13076         * testsuite/script_test_2.cc (test_addr): Declare.
13077         (test_addr_alias): Declare.
13078         (main): Check that test_addr and test_addr_alias have the right
13079         values.
13080         * testsuite/script_test_2.t: Define test_addr_alias and
13081         test_addr.
13082
13083 2008-07-24  Ian Lance Taylor  <iant@google.com>
13084
13085         PR 5990
13086         * descriptors.cc: New file.
13087         * descriptors.h: New file.
13088         * gold-threads.h (class Hold_optional_lock): New class.
13089         * fileread.cc: Include "descriptors.h".
13090         (File_read::~File_read): Release descriptor rather than closing
13091         it.
13092         (File_read::open) [file]: Call open_descriptor rather than open.
13093         Set is_descriptor_opened_.
13094         (File_read::open) [memory]: Assert that descriptor is not open.
13095         (File_read::reopen_descriptor): New function.
13096         (File_read::release): Release descriptor.
13097         (File_read::do_read): Make non-const.  Reopen descriptor.
13098         (File_read::read): Make non-const.
13099         (File_read::make_view): Reopen descriptor.
13100         (File_read::do_readv): Likewise.
13101         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13102         Update declarations.
13103         * layout.cc: Include "descriptors.h".
13104         (Layout::create_build_id): Use open_descriptor rather than open.
13105         * output.cc: Include "descriptors.h".
13106         (Output_file::open): Use open_descriptor rather than open.
13107         * archive.cc (Archive::const_iterator): Change Archive to be
13108         non-const.
13109         (Archive::begin, Archive::end): Make non-const.
13110         (Archive::count_members): Likewise.
13111         * archive.h (class Archive): Update declarations.
13112         * object.h (Object::read): Make non-const.
13113         * Makefile.am (CCFILES): Add descriptors.cc.
13114         (HFILES): Add descriptors.h.
13115         * Makefile.in: Rebuild.
13116
13117         PR 6716
13118         * gold.h: Always include <clocale>.  Add Solaris workarounds
13119         following code in binutils/sysdep.h.
13120
13121         PR 6048
13122         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13123         this->eh_frame_hdr_ is NULL before using it.
13124
13125         * dynobj.cc (Versions::Versions): Update comment.
13126
13127         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13128         the base version name.
13129
13130         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13131         array size plus one.
13132         (Stringpool_template::set_string_offsets): Subtract one from key
13133         before using it as an array index.
13134         (Stringpool_template::get_offset_with_length): Likewise.
13135         (Stringpool_template::write_to_buffer): Likewise.
13136         * stringpool.h (Stringpool_template::get_offset_from_key):
13137         Likewise.
13138
13139 2008-07-23  Ian Lance Taylor  <iant@google.com>
13140
13141         PR 6658
13142         * object.h (Merged_symbol_value::value): Do our best to handle a
13143         negative addend.
13144
13145         PR 6647
13146         * script.cc (Version_script_info::get_versions): Don't add empty
13147         version tag to return value.
13148         (Version_script_info::get_symbol_version_helper): Change return
13149         type to bool.  Add pversion parameter.  Change all callers.
13150         (script_register_vers_node): Don't require a non-NULL tag.
13151         * script.h (class Version_script_info): Update declarations.
13152         (Version_script_info::get_symbol_version): Change return type to
13153         bool.  Add version parameter.  Change all callers.
13154         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13155         handling.  Handle an empty version from a version script.
13156         (Symbol_table::define_special_symbol): Likewise.
13157         * testsuite/ver_test_10.script: New file.
13158         * testsuite/ver_test_10.sh: New file.
13159         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13160         (check_DATA): Add ver_test_10.syms.
13161         (ver_test_10.syms, ver_test_10.so): New target.
13162         * testsuite/Makefile.in: Rebuild.
13163
13164 2008-07-23  Simon Baldwin  <simonb@google.com>
13165
13166         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13167         to zero for undefined symbols from dynamic libraries.
13168
13169 2008-07-23  Ian Lance Taylor  <iant@google.com>
13170
13171         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13172         Change all callers.
13173         * symtab.h (class Symbol_table): Update declaration.
13174         * testsuite/ver_test_9.cc: New file.
13175         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13176         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13177         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13178         (ver_test_9.so, ver_test_9.o): New targets.
13179         * testsuite/Makefile.in: Rebuild.
13180
13181 2008-07-22  Ian Lance Taylor  <iant@google.com>
13182
13183         * options.h (class General_options): Define --check-sections.
13184         * layout.cc (Layout::set_segment_offsets): Handle
13185         --check-sections.
13186
13187         * options.h (class General_options): Define -n/--nmagic and
13188         -N/--omagic.
13189         * options.cc (General_options::finalize): For -n/--nmagic or
13190         -N/--omagic, set -static.
13191         * layout.cc (Layout::attach_allocated_section_to_segment): If
13192         -N/--omagic, don't put read-only and read-write sections in
13193         different segments.
13194         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13195         finding a read-only segment.
13196         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13197         don't set the minimum segment alignment to the common page size,
13198         and don't set the file offset to the address modulo the page size.
13199         * script-sections.cc (Script_sections::create_segments): If
13200         -n/--omagic, don't put read-only and read-write sections in
13201         different segments.
13202
13203         * cref.cc: New file.
13204         * cref.h: New file.
13205         * options.h (class General_options): Add --print-symbol-counts.
13206         * main.cc (main): Issue defined symbol report if requested.
13207         * archive.cc (Archive::interpret_header): Make into a const member
13208         function.
13209         (Archive::add_symbols): Call Input_objects::archive_start and
13210         archive_stop.
13211         (Archive::const_iterator): Define new class.
13212         (Archive::begin, Archive::end): New functions.
13213         (Archive::include_all_members): Rewrite to use iterator.
13214         (Archive::count_members): New function.
13215         * archive.h (class Archive): Update declarations.
13216         (Archive::filename): New function.
13217         * object.cc: Include "cref.h".
13218         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13219         (Sized_relobj::do_get_global_symbol_counts): New function.
13220         (Input_objects::add_object): Add object to cross-referencer.
13221         (Input_objects::archive_start): New function.
13222         (Input_objects::archive_stop): New function.
13223         (Input_objects::print_symbol_counts): New function.
13224         * object.h: Declare Cref and Archive.
13225         (Object::get_global_symbol_counts): New function.
13226         (Object::do_get_global_symbol_counts): New pure virtual function.
13227         (class Sized_relobj): Add defined_count_ field.  Update
13228         declarations.
13229         (class Input_objects): Add cref_ field.  Update constructor.
13230         Update declarations.
13231         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13232         defined_count_.
13233         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13234         symbol counts.
13235         (Sized_dynobj::do_get_global_symbol_counts): New function.
13236         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13237         defined_count_.  Update declarations.  Define Symbols typedef.
13238         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13239         parameter.  Change all callers.
13240         (Symbol_table::add_from_dynobj): Add sympointers and defined
13241         parameters.  Change all callers.
13242         * symtab.h (class Symbol_table): Update declarations.
13243         * Makefile.am (CCFILES): Add cref.cc.
13244         (HFILES): Add cref.h.
13245         * Makefile.in: Rebuild.
13246
13247 2008-07-22  Simon Baldwin  <simonb@google.com>
13248
13249         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13250         to zero when writing undefined symbols.
13251
13252 2008-07-22  Ian Lance Taylor  <iant@google.com>
13253
13254         * output.cc (Output_section::add_input_section): Don't try to
13255         merge empty merge sections.
13256
13257 2008-07-21  Craig Silverstein  <csilvers@google.com>
13258
13259         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13260         Include symbol version in error message.
13261
13262 2008-07-20  Chris Demetriou  <cgd@google.com>
13263
13264         * configure.ac (gold_cv_c_random_seed): New configured variable.
13265         (RANDOM_SEED_CFLAGS): New substituted variable.
13266         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13267         * configure: Rebuild.
13268         * Makefile.in: Likewise.
13269         * testsuite/Makefile.in: Likewise.
13270
13271 2008-07-18  Ian Lance Taylor  <iant@google.com>
13272
13273         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13274         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13275         * testsuite/ver_test_main.cc (main): Call t4.
13276         (t4, t4_2a): Define.
13277         * testsuite/ver_test_2.cc (t4_2): Define.
13278         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13279         * testsuite/ver_test_4.cc (t4_2a): Define.
13280         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13281         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13282
13283 2008-07-17  Ian Lance Taylor  <iant@google.com>
13284
13285         * dynobj.cc (Versions::add_def): If we give an error about a
13286         missing version, go ahead and create the version anyhow.
13287
13288 2008-07-10  Ian Lance Taylor  <iant@google.com>
13289
13290         Handle output sections with more than 0x7fffffff bytes.
13291         * object.h (class Relobj): Change map_to_output_ to
13292         output_sections_, and just keep a section pointer.  Change all
13293         uses.  Move comdat group support to Sized_relobj.
13294         (Relobj::is_section_specially_mapped): Remove.
13295         (Relobj::output_section): Remove poff parameter.  Change all
13296         callers.
13297         (Relobj::output_section_offset): New function.
13298         (Relobj::set_section_offset): Rewrite.
13299         (Relobj::map_to_output): Remove.
13300         (Relobj::output_sections): New function.
13301         (Relobj::do_output_section_offset): New pure virtual function.
13302         (Relobj::do_set_section_offset): Likewise.
13303         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13304         group support from Relobj.  Update declarations.
13305         (Sized_relobj::get_output_section_offset): New function.
13306         (Sized_relobj::do_output_section_offset): New function.
13307         (Sized_relobj::do_set_section_offset): New function.
13308         * object.cc (Relobj::output_section_address): Remove.
13309         (Sized_relobj::Sized_relobj): Initialize new fields.
13310         (Sized_relobj::include_section_group): Cast find_kept_object to
13311         Sized_relobj.
13312         (Sized_relobj::include_linkonce_section): Likewise.
13313         (Sized_relobj::do_layout): Use separate arrays for output section
13314         and output offset.
13315         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13316         output_sections.
13317         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13318         output_sections and section_offsets.
13319         (Sized_relobj::write_local_symbols): Likewise.
13320         (map_to_kept_section): Compute output address directly.
13321         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13322         output_sections and section_offsets.
13323         (Sized_relobj::write_sections): Likewise.
13324         (Sized_relobj::relocate_sections): Likewise.
13325         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13326         * output.h (class Output_reloc): Update declarations.  Change
13327         u2_.relobj to Sized_relobj*.
13328         (class Output_data_reloc): Change add functions to use
13329         Sized_relobj*.
13330         * output.cc (Output_reloc::Output_reloc): Change relobj to
13331         Sized_relobj*.
13332         (Output_reloc::local_section_offset): Change return type to
13333         Elf_Addr.  Use get_output_section_offset.
13334         (Output_reloc::get_address): Likewise.
13335         (Output_section::is_input_address_mapped): Don't call
13336         is_section_specially_mapped.
13337         (Output_section::output_offset): Likewise.
13338         (Output_section::output_address): Likewise.
13339         (Output_section::starting_output_address): Likewise.
13340         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13341         parameter to Sized_relobj*.
13342         (Copy_relocs::need_copy_reloc): Likewise.
13343         (Copy_relocs::save): Likewise.
13344         * copy-relocs.h (class Copy_relocs): Update declarations.
13345         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13346         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13347         * target-reloc.h (relocate_for_relocatable): Change
13348         offset_in_output_section type to Elf_Addr.  Change code that uses
13349         it as well.
13350         * layout.cc (Layout::layout): Always set *off.
13351         * mapfile.cc (Mapfile::print_input_section): Use
13352         output_section_offset.
13353         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13354         Sized_relobj*.
13355         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13356         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13357         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13358
13359 2008-07-03  Ian Lance Taylor  <iant@google.com>
13360
13361         * layout.cc (Layout::include_section): Do not discard unrecognized
13362         SHT_STRTAB sections.
13363
13364 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13365
13366         * script.cc (Lex::can_continue_name): Make '?' allowable in
13367         version-script names.
13368         * testsuite/version_script.map: Change glob pattern to use '?'
13369
13370 2008-06-30  Manish Singh  <yosh@gimp.org>
13371
13372         PR 6585
13373         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13374         Correct typo.
13375
13376 2008-06-30  Ian Lance Taylor  <iant@google.com>
13377
13378         PR 6660
13379         PR 6682
13380         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13381         versions]: Don't try to read the value in the contents, since we
13382         don't use it.  Use the template endianness when writing.
13383
13384 2008-06-25  Cary Coutant  <ccoutant@google.com>
13385
13386         * fileread.cc (File_read::make_view): Assert on zero-length view.
13387         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13388         symbol table when there are no symbols to read.
13389
13390 2008-06-23  Craig Silverstein  <csilvers@google.com>
13391
13392         * version.cc (version_string): Bump to 1.7
13393
13394 2008-06-18  Craig Silverstein  <csilvers@google.com>
13395
13396         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13397         constant 0xFFFF to type Valtype.
13398         (Powerpc_relocate_functions::rel16_ha): Likewise.
13399
13400 2008-06-17  Ian Lance Taylor  <iant@google.com>
13401
13402         * output.h (Output_section::Input_section): Initialize p2align_ to
13403         zero for Output_section_data constructors.
13404         (Output_section::Input_section::addralign): If not an input
13405         section, return the alignment of the Output_section_data.
13406         * testsuite/copy_test.cc: New file.
13407         * testsuite/copy_test_1.cc: New file.
13408         * testsuite/copy_test_2.cc: New file.
13409         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13410         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13411         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13412         (copy_test_1_pic.o, copy_test_1.so): New targets.
13413         (copy_test_2_pic.o, copy_test_2.so): New targets.
13414         * testsuite/Makefile.in: Rebuild.
13415
13416         * script-sections.cc (Script_sections::place_orphan): Initialize
13417         local variable exact.
13418
13419 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13420
13421         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13422
13423 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13424             David S. Miller  <davem@davemloft.net>
13425
13426         * powerpc.cc: New file.
13427         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13428         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13429         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13430         * Makefile.in: Rebuild.
13431
13432 2008-06-09  Ian Lance Taylor  <iant@google.com>
13433
13434         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13435         <exception>.
13436         (throwing, orig_terminate): New static variables.
13437         (terminate_handler): New static function.
13438         (t2): Set terminate handler.
13439
13440 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13441
13442         PR 6584
13443         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13444         alignment.
13445
13446 2008-05-30  Cary Coutant  <ccoutant@google.com>
13447
13448         * archive.cc (Archive::include_all_members) Correct to step
13449         over symbol table and extended name table in thin archives.
13450
13451 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13452
13453         PR 6407
13454         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13455         calculation.
13456
13457 2008-05-28  Caleb Howe  <cshowe@google.com>
13458
13459         * reduced_debug_output.cc: New file.
13460         * reduced_debug_output.h: New file.
13461         * options.h (class General_options): Add --strip-debug-non-line.
13462         * options.cc (General_options::finalize): Add strip_debug_non_line
13463         to the strip heirarchy.
13464         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13465         fields.
13466         * layout.cc: Include "reduced_debug_output.h".
13467         (Layout::Layout): Initialize new fields.
13468         (line_only_debug_sections): New static array.
13469         (is_lines_only_debug_sections): New static inline function.
13470         (Layout::include_section): Handle --strip-debug-non-line.
13471         (Layout::make_output_section): If --strip-debug-non-line, build
13472         new output sections for .debug_abbrev and .debug_info.
13473         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13474         gold.  Warn about possible overflow.
13475         (read_signed_LEB_128): Likewise.
13476         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13477         (read_signed_LEB_128): Declare.
13478         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13479         (HFILES): Add reduced_debug_output.h.
13480         * Makefile.in: Rebuild.
13481
13482 2008-05-21  Ian Lance Taylor  <iant@google.com>
13483
13484         * mapfile.cc: New file.
13485         * mapfile.h: New file.
13486         * options.h (class General_options): Add -M/--print-map and -Map.
13487         * options.cc (General_options::finalize): Make -M equivalent to
13488         -Map -.
13489         * main.cc: Include <cstdio> and "mapfile.h".
13490         (main): Open mapfile if requested.
13491         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13492         constructor.  Change caller.
13493         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13494         (queue_middle_tasks): Likewise.
13495         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13496         declarations.
13497         * archive.cc: Include "mapfile.h".
13498         (Archive::add_symbols): Add mapfile parameter.  Change all
13499         callers.  Pass mapfile, symbol, and reason to include_member.
13500         (Archive::include_all_members): Add mapfile parameter.  Change all
13501         callers.
13502         (Archive::include_member): Add mapfile, sym, and why parameters.
13503         Change all callers.  Report inclusion to map file.
13504         * archive.h: Include "fileread.h".
13505         (class Archive): Update declarations.
13506         (Archive::file): New const method.
13507         (class Add_archive_symbols): Add mapfile_ field.  Update
13508         constructor.  Change all callers.
13509         * readsyms.h (class Read_symbols): Likewise.
13510         (class Finish_group): Likewise.
13511         (class Read_script): Likewise.
13512         * common.cc: Include "mapfile.h".
13513         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13514         all callers.
13515         (Symbol_table::do_allocate_commons): Likewise.
13516         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13517         symbol allocation to mapfile.
13518         * common.h (class Allocate_commons_task): Add mapfile_ field.
13519         Update constructor.  Change all callers.
13520         * symtab.h (class Symbol_table): Update declarations.
13521         * layout.cc: Include "mapfile.h".
13522         (Layout_task_runner::run): Print information to mapfile.
13523         (Layout::create_gold_note): Change Output_data_fixed_space to
13524         Output_data_zero_fill.
13525         (Layout::create_build_id): Likewise.
13526         (Layout::print_to_mapfile): New function.
13527         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13528         constructor.  Change caller.
13529         (class Layout): Declare print_to_mapfile.
13530         * output.cc (Output_section::Input_section::print_to_mapfile): New
13531         function.
13532         (Output_section::add_input_section): If producing a map, always
13533         add to input_sections_ list.
13534         (Output_section::do_print_to_mapfile): New function.
13535         (Output_segment::print_sections_to_mapfile): New function.
13536         (Output_segment::print_section_list_to_mapfile): New function.
13537         * output.h: Include "mapfile.h".
13538         (Output_data::print_to_mapfile): New function.
13539         (Output_data::do_print_to_mapfile): New virtual function.
13540         (Output_segment_headers::do_print_to_mapfile): New function.
13541         (Output_file_header::do_print_to_mapfile): New function.
13542         (Output_data_const::do_print_to_mapfile): New function.
13543         (class Output_data_const_buffer): Add map_name_ field.  Update
13544         constructor.  Change all callers.  Add do_print_to_mapfile
13545         function.
13546         (class Output_data_fixed_space): Likewise.
13547         (class Output_data_space): Likewise.
13548         (class Output_data_zero_fill): New class.
13549         (Output_data_strtab::do_print_to_mapfile): New function.
13550         (Output_data_reloc_base::do_print_to_mapfile): New function.
13551         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13552         (Output_data_group::do_print_to_mapfile): New function.
13553         (Output_data_got::do_print_to_mapfile): New function.
13554         (Output_data_dynamic::do_print_to_mapfile): New function.
13555         (Output_symtab_xindex::do_print_to_mapfile): New function.
13556         (class Output_section): Declare do_print_to_mapflie.  Declare
13557         print_to_mapfile in Input_section.
13558         (class Output_segment): Declare new functions.
13559         * object.h (Sized_relobj::symbol_count): New function.
13560         * script-sections.cc
13561         (Output_section_element_dot_assignment::set_section_addresses):
13562         Change Output_data_fixed_space to Output_data_zero_fill.
13563         (Output_data_expression::do_print_to_mapfile): New function.
13564         * script.cc (read_input_script): Add mapfile parameter.  Change
13565         all callers.
13566         * script.h (read_input_script): Update declaration.
13567         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13568         (Eh_frame::do_print_to_mapfile): New function.
13569         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13570         (Output_merge_string::do_print_to_mapfile): New function.
13571         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13572         function.
13573         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13574         function.
13575         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13576         function.
13577         * Makefile.am (CCFILES): Add mapfile.cc.
13578         (HFILES): Add mapfile.h.
13579         * Makefile.in: Rebuild.
13580
13581 2008-05-19  Ian Lance Taylor  <iant@google.com>
13582
13583         * options.h (class General_options): Add -z relro.
13584         * layout.cc (Layout::Layout): Initialize relro_segment_.
13585         (Layout::add_output_section_data): Return the output section.
13586         (Layout::make_output_section): Rcognize relro sections and mark
13587         them appropriately.
13588         (Layout::attach_allocated_section_to_segment): Put relro sections
13589         in a PT_GNU_RELRO segment.
13590         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13591         section as relro.
13592         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13593         PT_TLS segments.
13594         (Layout::linkonce_mapping): Map d.rel.ro.local to
13595         .data.rel.ro.local.
13596         (Layout::output_section_name): Us .data.rel.ro.local for any
13597         section which begins with that.
13598         * layout.h (class Layout): Update add_output_section_data
13599         declaration.  Add relro_segment_ field.
13600         * output.cc (Output_section::Output_section): Initialize is_relro_
13601         and is_relro_local_ fields.
13602         (Output_segment::add_output_section): Group relro sections.
13603         (Output_segment::is_first_section_relro): New function.
13604         (Output_segment::maximum_alignment): If there is a relro section,
13605         align the segment to the common page size.
13606         (Output_segment::set_section_addresses): Track whether we are
13607         looking at relro sections.  If the last section is a relro
13608         section, align to the common page size.
13609         (Output_segment::set_section_list_addresses): Add in_relro
13610         parameter.  Change all callers.  Align to the page size when
13611         moving from relro to non-relro section.
13612         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13613         segment.
13614         * output.h (class Output_section): Add is_relro_ and
13615         is_relro_local_ fields.
13616         (Output_section::is_relro): New function.
13617         (Output_section::set_is_relro): New function.
13618         (Output_section::is_relro_local): New function.
13619         (Output_section::set_is_relro_local): New function.
13620         (class Output_segment): Update declarations.
13621         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13622         * sparc.cc (Target_sparc::got_section): Likewise.
13623         * x86_64.cc (Target_x86_64::got_section): Likewise.
13624         * testsuite/relro_test_main.cc: New file.
13625         * testsuite/relro_test.cc: New file.
13626         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13627         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13628         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13629         (relro_test.so, relro_test_pic.o): New targets.
13630         * testsuite/Makefile.in: Rebuild.
13631
13632 2008-05-16  Ian Lance Taylor  <iant@google.com>
13633
13634         * output.cc (Output_segment::add_output_section): Remove front
13635         parameter.
13636         * output.h (class Output_segment): Remove
13637         add_initial_output_section and overloaded add_output_section.
13638         Update declaration of remaining add_output_section.
13639         * layout.cc (Layout::create_interp): Call add_output_section
13640         rather than add_initial_output_section.
13641         (Layout::finish_dynamic_section): Likewise.
13642
13643         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13644         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13645         know the dynamic type.
13646         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13647         field.  Initialize it in constructor.
13648         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13649         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13650         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13651         reloc.
13652
13653         * output.cc (Output_reloc::get_address): Change return type to
13654         Elf_Addr.
13655         * output.h (class Output_reloc): Update get_address declaration.
13656         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13657         for section addresses.
13658
13659 2008-05-09  Ian Lance Taylor  <iant@google.com>
13660
13661         PR 6493
13662         * gold.cc (gold_nomem): Use return value of write.
13663
13664 2008-05-08  Ian Lance Taylor  <iant@google.com>
13665
13666         * symtab.c (Symbol::init_base_output_data): Add version
13667         parameter.  Change all callers.
13668         (Symbol::init_base_output_segment): Likewise.
13669         (Symbol::init_base_constant): Likewise.
13670         (Symbol::init_base_undefined): Likewise.
13671         (Sized_symbol::init_output_data): Likewise.
13672         (Sized_symbol::init_output_segment): Likewise.
13673         (Sized_symbol::init_constant): Likewise.
13674         (Sized_symbol::init_undefined): Likewise.
13675         (Symbol_table::do_define_in_output_data): If the new symbol has a
13676         version, mark it as the default.
13677         (Symbol_table::do_define_in_output_segment): Likewise.
13678         (Symbol_table::do_define_as_constant): Likewise.
13679         * symtab.h (class Symbol): Update declarations.
13680         (class Sized_symbol): Likewise.
13681         * resolve.cc (Symbol::override_version): New function.
13682         (Symbol::override_base): Call override_version.
13683         (Symbol::override_base_with_special): Likewise.
13684         * testsuite/ver_script_8.script: New file.
13685         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13686         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13687         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13688         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13689
13690 2008-05-06  Ian Lance Taylor  <iant@google.com>
13691
13692         PR 6049
13693         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13694         functions.
13695         (class General_options): Remove existing --undefined, and add
13696         --no-undefined instead.  Add new --undefined as synonym for -u.
13697         * archive.cc (Archive::add_symbols): Check whether symbol was
13698         named with -u.
13699         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13700         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13701         all uses.  Add IS_UNDEFINED.  Update declarations to split
13702         different versions of init_base.  Declare init_base_undefined.
13703         (Symbol::is_defined): Handle IS_UNDEFINED.
13704         (Symbol::is_undefined): Likewise.
13705         (Symbol::is_weak_undefined): Call is_undefined.
13706         (Symbol::is_absolute): Handle IS_CONSTANT.
13707         (class Sized_symbol): Update declarations to split different
13708         versions of init.  Declare init_undefined.
13709         (class Symbol_table): Declare new functions.
13710         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13711         Change all callers.
13712         (Symbol::init_base_output_data): Likewise.
13713         (Symbol::init_base_output_segment): Likewise.
13714         (Symbol::init_base_constant): Likewise.
13715         (Symbol::init_base_undefined): New function.
13716         (Sized_symbol::init_object): Rename from init.  Change all
13717         callers.
13718         (Sized_symbol::init_output_data): Likewise.
13719         (Sized_symbol::init_output_segment): Likewise.
13720         (Sized_symbol::init_constant): Likewise.
13721         (Sized_symbol::init_undefined): New function.
13722         (Symbol_table::add_undefined_symbols_from_command_line): New
13723         function.
13724         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13725         function.
13726         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13727         (Symbol::output_section): Likewise.
13728         (Symbol::set_output_section): Likewise.
13729         (Symbol_table::sized_finalize_symbol): Likewise.
13730         (Symbol_table::sized_write_globals): Likewise.
13731         * resolve.cc (Symbol_table::should_override): Likewise.
13732         (Symbol::override_base_with_special): Likewise.
13733
13734         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13735         symbol, change it to have default visibility.
13736         * testsuite/protected_1.cc: New file.
13737         * testsuite/protected_2.cc: New file.
13738         * testsuite/protected_3.cc: New file.
13739         * testsuite/protected_main_1.cc: New file.
13740         * testsuite/protected_main_2.cc: New file.
13741         * testsuite/protected_main_3.cc: New file.
13742         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13743         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13744         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13745         (protected_1.so): New target.
13746         (protected_1_pic.o, protected_2_pic.o): New targets.
13747         (protected_3_pic.o): New target.
13748         (check_PROGRAMS): Add protected_2.
13749         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13750         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13751         * testsuite/Makefile.in: Rebuild.
13752
13753         * options.h (DEFINE_var): Add set_user_set_##varname__.
13754         (DEFINE_bool_alias): New macro.
13755         (class General_options): Define -Bstatic using DEFINE_bool_alias
13756         rather than DEFINE_special.  Add --undefined as an alias for -z
13757         defs.
13758         * options.cc (General_options::parse_Bstatic): Remove.
13759
13760         * options.h (class General_options): Add --fatal-warnings.
13761         * main.cc (main): Implement --fatal-warnings.
13762         * errors.h (Errors::warning_count): New function.
13763
13764         * options.h (class General_options): Add -Bsymbolic-functions.
13765         * symtab.h (Symbol::is_preemptible): Check for
13766         -Bsymbolic-functions.
13767
13768 2008-05-05  Ian Lance Taylor  <iant@google.com>
13769
13770         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13771         as noVARNAME rather than no-VARNAME.
13772         (class General_options): Add option -z combreloc.
13773         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13774         get_address.
13775         (Output_reloc::sort_before) [SHT_REL]: New function.
13776         (Output_reloc::sort_before) [SHT_RELA]: New function.
13777         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13778         Sort_relocs_comparison.
13779         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13780         parameter.  Change all callers.
13781         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13782         sort_relocs parameter.  Change all callers.
13783         * output.cc (Output_reloc::get_address): New function, broken out
13784         of write_rel.
13785         (Output_reloc::write_rel): Call it.
13786         (Output_reloc::compare): New function.
13787         (Output_data_reloc_base::do_write): Optionally sort relocs.
13788
13789         * configure.ac: If targ_extra_obj is set, link it in.
13790         * configure.tgt: Initialize all variables.
13791         (x86_64*): Set targ_extra_obj and targ_extra_size.
13792         * configure: Rebuild.
13793
13794         * object.cc (Sized_relobj::include_section_group): Adjust section
13795         indexes read from group data.  Build vector to pass to
13796         layout_group.
13797         * layout.cc (Layout::layout_group): Add flags and shndxes
13798         parameters.  Remove contents parameter.  Change caller.  Update
13799         explicit instantiations.
13800         * layout.h (class Layout): Update layout_group declaration.
13801         * output.cc (Output_data_group::Output_data_group): Add flags and
13802         input_shndxes parameters.  Remove contents parameter.  Change
13803         caller.
13804         (Output_data_group::do_write): Change input_sections_ to
13805         input_shndxes_.
13806         * output.h (class Output_data_group): Update constructor
13807         declaration.  Rename input_sections_ to input_shndxes_.
13808         * testsuite/many_sections_test.cc: Add template.
13809
13810 2008-04-30  Cary Coutant  <ccoutant@google.com>
13811
13812         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13813
13814         * layout.cc (Layout::include_section): Refactored check for debug
13815         info section.
13816         (Layout::add_comdat): Add new parameters.  Change type
13817         of signature parameter.  Add object and shndx to signatures table.
13818         (Layout::find_kept_object): New function.
13819         * layout.h: Include <cstring>.
13820         (Layout::is_debug_info_section): New function.
13821         (Layout::add_comdat): Add new parameters.
13822         (Layout::find_kept_object): New function.
13823         (Layout::Kept_section): New struct.
13824         (Layout::Signatures): Change type of map range.
13825         * object.cc (Relobj::output_section_address): New function.
13826         (Sized_relobj::include_section_group): Add new parameters.  Change
13827         calls to Layout::add_comdat.  Change to build table of kept comdat
13828         groups and table mapping discarded sections to kept sections.
13829         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13830         (Sized_relobj::do_layout): Change calls to include_section_group and
13831         include_linkonce_section.
13832         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13833         value to zero when section is discarded.
13834         (Sized_relobj::map_to_kept_section): New function.
13835         * object.h (Relobj::output_section_address): New function.
13836         (Relobj::Comdat_group): New type.
13837         (Relobj::find_comdat_group): New function.
13838         (Relobj::Comdat_group_table): New type.
13839         (Relobj::Kept_comdat_section): New type.
13840         (Relobj::Kept_comdat_section_table): New type.
13841         (Relobj::add_comdat_group): New function.
13842         (Relobj::set_kept_comdat_section): New function.
13843         (Relobj::get_kept_comdat_section): New function.
13844         (Relobj::comdat_groups_): New field.
13845         (Relobj::kept_comdat_sections_): New field.
13846         (Symbol_value::input_value): Update comment.
13847         (Sized_relobj::map_to_kept_section) New function.
13848         (Sized_relobj::include_linkonce_section): Add new parameter.
13849         * target-reloc.h (Comdat_behavior): New type.
13850         (get_comdat_behavior): New function.
13851         (relocate_section): Add code to map a discarded section to the
13852         corresponding kept section when applying a relocation.
13853
13854 2008-04-30  Craig Silverstein  <csilvers@google.com>
13855
13856         * dwarf_reader.cc (next_generation_count): New static var.
13857         (Addr2line_cache_entry): New struct.
13858         (addr2line_cache): New static var.
13859         (Dwarf_line_info::one_addr2line): Added caching.
13860         (Dwarf_line_info::clear_addr2line_cache): New function.
13861         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13862         cache-size parameter.
13863         (Dwarf_line_info::one_addr2line_cache): New function.
13864         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13865         new cache-size argument to one_addr2line(), and clear cache.
13866
13867 2008-04-28  Cary Coutant  <ccoutant@google.com>
13868
13869         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13870         R_386_PC8 relocations.
13871
13872 2008-04-23  Ian Lance Taylor  <iant@google.com>
13873
13874         * object.cc (Sized_relobj::include_section_group): Check for
13875         invalid section group.
13876
13877         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13878         header size.
13879
13880         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13881         than read for file header.
13882         * archive.cc (Archive::include_member): Likewise.
13883
13884 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13885
13886         * aclocal.m4: Regenerate.
13887         * configure: Regenerate.
13888
13889 2008-04-19  Ian Lance Taylor  <iant@google.com>
13890
13891         * version.cc (version_string): Bump to 1.6.
13892
13893         * testsuite/Makefile.am (many_sections_r_test): New target.
13894         (many_sections_r_test_SOURCES): Remove.
13895         (many_sections_r_test_DEPENDENCIES): Remove.
13896         (many_sections_r_test_LDFLAGS): Remove.
13897         (many_sections_r_test_LDADD): Remove.
13898
13899         * object.cc (Sized_relobj::do_add_symbols): Always pass
13900         local_symbol_count_ to add_from_relobj.
13901
13902         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13903         every thousand variables.
13904         * testsuite/Makefile.in: Rebuild.
13905
13906         * object.cc (Xindex::initialize_symtab_xindex): New function.
13907         (Xindex::read_symtab_xindex): New function.
13908         (Xindex::sym_xindex_to_shndx): New function.
13909         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13910         available.
13911         (Sized_relobj::do_initialize_xindex): New function.
13912         (Sized_relobj::do_read_symbols): Adjust section links.
13913         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13914         parameter.  Change all callers.
13915         (Sized_relobj::include_section_group): Adjust section links and
13916         symbol section indexes.
13917         (Sized_relobj::do_layout): Adjust section links.
13918         (Sized_relobj::do_count_local_symbols): Adjust section links and
13919         symbol section indexes.
13920         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13921         ordinary and special symbols.
13922         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13923         dynsym_xindex parameters.  Change all callers.  Adjust section
13924         links.  Use SHN_XINDEX when needed.
13925         (Sized_relobj::get_symbol_location_info): Adjust section links.
13926         Don't get fooled by special symbols.
13927         * object.h (class Xindex): Define.
13928         (class Object): Add xindex_ parameter.  Declare virtual functoin
13929         do_initialize_xindex.
13930         (Object::adjust_sym_shndx): New function.
13931         (Object::set_xindex): New protected function.
13932         (class Symbol_value): Add is_ordinary_shndx_ field.
13933         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13934         (Symbol_value::value): Assert ordinary section.
13935         (Symbol_value::initialize_input_to_output_map): Likewise.
13936         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13937         Change all callers.
13938         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13939         all callers.
13940         (class Sized_relobj): Update declarations.
13941         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13942         parameter.  Change all callers.
13943         (Sized_relobj::adjust_shndx): New function.
13944         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13945         field.
13946         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13947         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13948         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13949         (Sized_dynobj::read_dynsym_section): Adjust section links.
13950         (Sized_dynobj::read_dynamic): Likewise.
13951         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13952         section links.
13953         (Sized_dynobj::do_initialize_xindex): New function.
13954         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13955         do_initialize_xindex.
13956         (Sized_dynobj::adjust_shndx): New function.
13957         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13958         dynsym_xindex_ fields.
13959         (Layout::finalize): Add a call to set_section_indexes before
13960         creating the symtab sections.
13961         (Layout::set_section_indexes): Don't do anything if the section
13962         already has a section index.
13963         (Layout::create_symtab_sections): Add shnum parameter.  Change
13964         caller.  Create .symtab_shndx section if needed.
13965         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13966         caller.
13967         (Layout::allocated_output_section_count): New function.
13968         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13969         needed.
13970         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13971         fields.  Update declarations.
13972         (Layout::symtab_xindex): New function.
13973         (Layout::dynsym_xindex): New function.
13974         (class Write_symbols_task): Add layout_ field.
13975         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13976         Change caller.
13977         * output.cc (Output_section_headers::Output_section_headers): Add
13978         shstrtab_section parameter.  Change all callers.
13979         (Output_section_headers::do_sized_write): Store overflow values
13980         for section count and section string table section index in
13981         section header zero.
13982         (Output_file_header::do_sized_write): Check for overflow of
13983         section count and section string table section index.
13984         (Output_symtab_xindex::do_write): New function.
13985         (Output_symtab_xindex::endian_do_write): New function.
13986         * output.h (class Output_section_headers): Add shstrtab_section_.
13987         Update declarations.
13988         (class Output_symtab_xindex): Define.
13989         (Output_section::has_out_shndx): New function.
13990         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13991         field.
13992         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13993         Change all callers.
13994         (Sized_symbol::init): Likewise.
13995         (Symbol::output_section): Check for ordinary symbol.
13996         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13997         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13998         callers.
13999         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14000         Change all callers.  Simplify handling of symbols from sections
14001         not included in the link.
14002         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14003         distinction.
14004         (Weak_alias_sorter::operator()): Assert that symbols are
14005         ordinary.
14006         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14007         distinction.
14008         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14009         parameters.  Change all callers.
14010         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14011         symbol distinction.  Use SHN_XINDEX when needed.
14012         (Symbol_table::write_section_symbol): Add symtab_xindex
14013         parameter.  Change all callers.
14014         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14015         SHN_XINDEX when needed.
14016         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14017         declarations.
14018         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14019         (Symbol::is_defined): Check is_ordinary.
14020         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14021         (Symbol::is_absolute, Symbol::is_common): Likewise.
14022         (class Sized_symbol): Update declarations.
14023         (class Symbol_table): Update declarations.
14024         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14025         parameters.  Change all callers.
14026         (Sized_symbol::override): Likewise.
14027         (Symbol_table::override): Likewise.
14028         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14029         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14030         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14031         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14032         to be in an ordinary section.
14033         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14034         object and is_ordinary parameters.  Change all callers.
14035         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14036         Change all callers.  Don't add undefined or non-ordinary symbols
14037         to reloc_map_.
14038         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14039         Change all callers.
14040         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14041         declarations.
14042         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14043         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14044         (Sized_relobj::relocate_sections): Likewise.
14045         * target-reloc.h (scan_relocs): Adjust section symbol index.
14046         (scan_relocatable_relocs): Likewise.
14047         * i386.cc (Scan::local): Check for ordinary symbols.
14048         * sparc.cc (Scan::local): Likewise.
14049         * x86_64.cc (Scan::local): Likewise.
14050         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14051         to symbol_section_and_value.
14052         * testsuite/many_sections_test.cc: New file.
14053         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14054         (check_PROGRAMS): Add many_sections_test.
14055         (many_sections_test_SOURCES): Define.
14056         (many_sections_test_DEPENDENCIES): Define.
14057         (many_sections_test_LDFLAGS): Define.
14058         (BUILT_SOURCES): Add many_sections_define.h.
14059         (many_sections_define.h): New target.
14060         (BUILT_SOURCES): Add many_sections_check.h.
14061         (many_sections_check.h): New target.
14062         (check_PROGRAMS): Add many_sections_r_test.
14063         (many_sections_r_test_SOURCES): Define.
14064         (many_sections_r_test_DEPENDENCIES): Define.
14065         (many_sections_r_test_LDFLAGS): Define.
14066         (many_sections_r_test_LDADD): Define.
14067         (many_sections_r_test.o): New target.
14068         * testsuite/Makefile.in: Rebuild.
14069
14070 2008-04-17  Cary Coutant  <ccoutant@google.com>
14071
14072         * errors.cc (Errors::info): New function.
14073         (gold_info): New function.
14074         * errors.h (Errors::info): New function.
14075         * gold.h (gold_info): New function.
14076         * object.cc (Input_objects::add_object): Print trace output.
14077         * options.cc (options::parse_set): New function.
14078         (General_options::parse_wrap): Deleted.
14079         (General_options::General_options): Deleted initializer.
14080         * options.h (options::String_set): New typedef.
14081         (options::parse_set): New function.
14082         (DEFINE_set): New macro.
14083         (General_options::wrap): Changed to use DEFINE_set. Changed
14084         callers of any_wrap_symbols and is_wrap_symbol.
14085         (General_options::trace, General_options::trace_symbol):
14086         New options.
14087         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14088         (General_options::wrap_symbols_): Deleted.
14089         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14090
14091 2008-04-17  David S. Miller  <davem@davemloft.net>
14092
14093         * options.cc (General_options::parse_V): New function.
14094         * options.h: Add entries for -V and -Qy.
14095
14096 2008-04-17  Ian Lance Taylor  <iant@google.com>
14097
14098         * common.cc (Symbol_table::allocate_commons): Remove options
14099         parameter.  Change caller.
14100         (Symbol_table::do_allocate_commons): Remove options parameter.
14101         Change caller.  Just call do_allocate_commons_list twice.
14102         (Symbol_table::do_allocate_commons_list): New function, broken out
14103         of do_allocate_commons.
14104         * common.h (class Allocate_commons_task): Remove options_ field.
14105         Update constructor.
14106         * symtab.cc (Symbol_table::Symbol_table): Initialize
14107         tls_commons_.
14108         (Symbol_table::add_from_object): Put TLS common symbols on
14109         tls_commons_ list.
14110         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14111         which are IN_OUTPUT_DATA.
14112         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14113         allocate_commons and do_allocate_commons declarations.  Declare
14114         do_allocate_commons_list.
14115         * gold.cc (queue_middle_tasks): Update creation of
14116         Allocate_commons_task to not pass options.
14117         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14118         (TLS_TEST_C_FLAGS): New variable.
14119         (tls_test_c_pic.o): New target.
14120         (tls_test_shared.so): Link in tls_test_c_pic.o.
14121         (tls_test_c_pic_ie.o): New target.
14122         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14123         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14124         (tls_test_c.o): New target.
14125         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14126         (tls_pic_test_LDADD): Likewise.
14127         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14128         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14129         (tls_test_c_gnu2.o): New target.
14130         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14131         tls_test_c_gnu2.o.
14132         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14133         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14134         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14135         * testsuite/tls_test.cc: Include "config.h".
14136         (t_last): Call t11_last.
14137         * testsuite/tls_test.h (t11, t11_last): Declare.
14138         * testsuite/tls_test_c.c: New file.
14139         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14140         * configure.ac: Check for OpenMP support.
14141         * configure, config.in, Makefile.in: Rebuild.
14142         * testsuite/Makefile.in: Rebuild.
14143
14144 2008-04-16  Cary Coutant  <ccoutant@google.com>
14145
14146         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14147         (Target_i386::tls_base_symbol_defined_): New field.
14148         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14149         (Target_i386::Scan::global): Likewise.
14150         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14151         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14152         (Target_x86_64::tls_base_symbol_defined_): New field.
14153         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14154         (Target_x86_64::Scan::global): Likewise.
14155
14156 2008-04-16  Cary Coutant  <ccoutant@google.com>
14157
14158         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14159         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14160         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14161         building shared libraries.
14162         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14163         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14164         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14165         * testsuite/Makefile.in: Rebuild.
14166         * testsuite/weak_undef.h: New file.
14167         * testsuite/weak_undef_file1.cc: Add extra test cases.
14168         * testsuite/weak_undef_file2.cc: Likewise.
14169         * testsuite/weak_undef_test.cc: Likewise.
14170
14171 2008-04-16  David S. Miller  <davem@davemloft.net>
14172
14173         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14174         Add issued_non_pic_error_ field.  Declare check_non_pic.
14175         (Target_sparc::Scan::check_non_pic): New function.
14176         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14177         (Target_sparc::Scan::global): Likewise.
14178
14179         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14180         * configure: Rebuild.
14181
14182         * options.h (DEFINE_enable): New macro.
14183         (new_dtags): New enable option.
14184         (initfirst, interpose, loadfltr, nodefaultlib,
14185         nodelete, nodlopen, nodump): New -z options.
14186         * layout.cc (Layout:finish_dynamic_section): If new
14187         dtags enabled, emit DT_RUNPATH.  Also, emit a
14188         DT_FLAGS_1 containing any specified -z flags.
14189
14190 2008-04-16  Ian Lance Taylor  <iant@google.com>
14191
14192         * copy-relocs.cc: New file.
14193         * copy-relocs.h: New file.
14194         * reloc.cc: Remove Copy_relocs code.
14195         * reloc.h: Likewise.
14196         * reloc-types.h (struct Reloc_types) [both versions]: Add
14197         get_reloc_addend_noerror.
14198         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14199         variants of add_global which take an addend which must be zero.
14200         * i386.cc: Include "copy-relocs.h".
14201         (class Target_i386): Change type of copy_relocs_ to variable,
14202         update initializer.
14203         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14204         Change all callers.
14205         (Target_i386::do_finalize_sections): Change handling of
14206         copy_relocs_.
14207         * sparc.cc: Include "copy-relocs.h".
14208         (class Target_sparc): Change type of copy_relocs_ to variable,
14209         update initializer.
14210         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14211         Change all callers.
14212         (Target_sparc::do_finalize_sections): Change handling of
14213         copy_relocs_.
14214         * x86_64.cc: Include "copy-relocs.h".
14215         (class Target_x86_64): Change type of copy_relocs_ to variable,
14216         update initializer.
14217         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14218         class.  Change all callers.
14219         (Target_x86_64::do_finalize_sections): Change handling of
14220         copy_relocs_.
14221         * Makefile.am (CCFILES): Add copy-relocs.cc.
14222         (HFILES): Add copy-relocs.h.
14223
14224         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14225
14226         * testsuite/script_test_4.sh: Permit leading zeroes.
14227
14228 2008-04-15  Ian Lance Taylor  <iant@google.com>
14229
14230         * script-sections.cc (Script_sections::create_segments): Use
14231         header_size_adjustment even when there is enough room for the
14232         headers.
14233         * testsuite/script_test_4.sh: New file.
14234         * testsuite/script_test_4.t: New file.
14235         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14236         (check_DATA): Add script_test_4.stdout.
14237         (MOSTLYCLEANFILES): Likewise.
14238         (script_test_4): New target.
14239         (script_test_4.stdout): New target.
14240         * testsuite/Makefile.in: Rebuild.
14241
14242         * sparc.cc: Add definitions for Output_data_plt_sparc class
14243         constants.
14244
14245 2008-04-14  David S. Miller  <davem@davemloft.net>
14246
14247         * sparc.cc: New file.
14248         * Makefile.am (TARGETSOURCES): Add sparc.cc
14249         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14250         * configure.tgt: Document targ_extra_size and
14251         targ_extra_big_endian.  Add entries for sparc-* and
14252         sparc64-*.
14253         * configure.ac: Handle targ_extra_size and
14254         targ_extra_big_endian.
14255         * Makefile.in: Rebuild.
14256         * configure: Likewise.
14257         * po/POTFILES.in: Likewise.
14258         * po/gold.pot: Likewise.
14259
14260 2008-04-14  Ian Lance Taylor  <iant@google.com>
14261
14262         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14263         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14264         in the name/type/flags to section mapping.  Don't call
14265         allocate_output_section.
14266         (Layout::choose_output_section): Change parameter from adjust_name
14267         to is_input_section.  Don't permit input sections after sections
14268         are attached to segments.  Don't call allocate_output_section.
14269         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14270         not write_enable_output_section.
14271         (Layout::make_output_section): Don't push to
14272         unattached_section_list_ nor call attach_to_segment.  Call
14273         attach_section_to_segment if sections are attached.
14274         (Layout::attach_sections_to_segments): New function.
14275         (Layout::attach_section_to_segment): New function.
14276         (Layout::attach_allocated_section_to_segment): Rename from
14277         attach_to_segment.  Remove flags parameter.
14278         (Layout::allocate_output_section): Remove function.
14279         (Layout::write_enable_output_section): Remove function.
14280         * layout.h (class Layout): Update for above changes.  Add new
14281         field sections_are_attached_.
14282         * output.h (Output_section::update_flags_for_input_section): New
14283         function.
14284         * output.cc (Output_section::add_input_section): Call
14285         update_flags_for_input_section.
14286         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14287
14288 2008-04-11  Cary Coutant  <ccoutant@google.com>
14289
14290         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14291         thought unnecessary.
14292         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14293
14294 2008-04-11  Ian Lance Taylor  <iant@google.com>
14295
14296         * output.h (class Output_section_data): Remove inline definition
14297         of set_addralign.
14298         * output.cc (Output_section_data::set_addralign): New function.
14299
14300 2008-04-11  Cary Coutant  <ccoutant@google.com>
14301
14302         Add support for TLS descriptors for i386 and x86_64.
14303         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14304         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14305         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14306         GOT_TYPE_TLS_DESC.
14307         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14308         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14309         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14310         relocations.
14311         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14312         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14313         Fix problem with initial-exec relocations.
14314         (Target_i386::Relocate::relocate_tls): Likewise.
14315         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14316         relaxation.
14317         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14318         support for section-plus-offset dynamic table entries.
14319         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14320         (Output_data_dynamic::Dynamic_entry): Add support for
14321         section-plus-offset dynamic table entries.
14322         (Output_data_dynamic::Classification): Likewise.
14323         (Output_data_dynamic::classification_): Renamed offset_.
14324         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14325         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14326         (Target_x86_64::make_plt_section): New function.
14327         (Target_x86_64::reserve_tlsdesc_entries): New function.
14328         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14329         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14330         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14331         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14332         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14333         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14334         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14335         add extra PLT entry for TLS descriptors.
14336         (Output_data_plt_x86_64::got_): New field.
14337         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14338         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14339         fields.
14340         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14341         descriptors.
14342         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14343         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14344         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14345         R_386_TLS_DESC_CALL relocations.
14346         (Target_x86_64::Scan::global): Likewise.
14347         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14348         for TLS descriptors.
14349         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14350         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14351         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14352         GD-to-IE relaxation.
14353         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14354         and TLS_DESCRIPTORS.
14355         * Makefile.in: Rebuild.
14356         * configure: Rebuild.
14357         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14358         (tls_test_shared2.so): New target.
14359         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14360         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14361         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14362         (tls_shared_gd_to_ie_test_LDADD): New variable.
14363         (tls_shared_gnu2_gd_to_ie_test): New target.
14364         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14365         New targets.
14366         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14367         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14368         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14369         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14370         (tls_shared_gnu2_test): New target.
14371         (tls_test_gnu2_shared.so): New target.
14372         (tls_shared_gnu2_test_SOURCES): New variable.
14373         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14374         (tls_shared_gnu2_test_LDFLAGS): New variable.
14375         (tls_shared_gnu2_test_LDADD): New variable.
14376         * testsuite/Makefile.in: Rebuild.
14377         * testsuite/Makefile.
14378
14379 2008-04-11  Ian Lance Taylor  <iant@google.com>
14380
14381         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14382         justsyms.t.
14383         * testsuite/Makefile.in: Rebuild.
14384
14385         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14386         long.
14387         * testsuite/script_test_2.cc (main): Adjust test.
14388
14389 2008-04-11  David S. Miller  <davem@davemloft.net>
14390             Ian Lance Taylor  <iant@google.com>
14391
14392         * options.h (General_options): Add entries for '-Y' and
14393         '-relax'.
14394         * options.cc (General_options:finalize): If -Y was used, add those
14395         entries to the library path instead of the default "/lib" and
14396         "/usr/lib".
14397
14398 2008-04-11  David S. Miller  <davem@davemloft.net>
14399
14400         * testsuite/justsyms.t: Start at 0x100.
14401         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14402         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14403         long.
14404         * testsuite/script_test_2.cc: Adjust string and section length
14405         checks.
14406
14407 2008-04-09  Ian Lance Taylor  <iant@google.com>
14408
14409         PR gold/5996
14410         * script-sections.cc (Sections_element::allocate_to_segment): Add
14411         orphan parameter.
14412         (Output_section_definition::allocate_to_segment): Likewise.
14413         (Orphan_output_section::allocate_to_segment): Likewise.
14414         (Script_sections::attach_sections_using_phdrs_clause): Don't
14415         propagate non-PT_LOAD segments to orphan sections.
14416         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14417         readelf rather than objdump.
14418         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14419         .interp section and PT_INTERP segment are the same size.
14420         * testsuite/Makefile.in: Rebuild.
14421
14422         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14423         aliases for symbols defined in the same object.
14424         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14425         (weak_alias_test_SOURCES): New variable.
14426         (weak_alias_test_DEPENDENCIES): New variable.
14427         (weak_alias_test_LDFLAGS): New variable.
14428         (weak_alias_test_LDADD): New variable.
14429         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14430         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14431         (weak_alias_test_3.o): New target.
14432         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14433         * testsuite/weak_alias_test_main.cc: New file.
14434         * testsuite/weak_alias_test_1.cc: New file.
14435         * testsuite/weak_alias_test_2.cc: New file.
14436         * testsuite/weak_alias_test_3.cc: New file.
14437
14438 2008-04-08  Ian Lance Taylor  <iant@google.com>
14439
14440         * options.h (class General_options): Add --noinhibit-exec option.
14441         * main.cc (main): Check --noinhibit-exec.
14442
14443         * options.h (class General_options): Define --wrap as a special
14444         option.  Add wrap_symbols_ field.
14445         (General_options::any_wrap_symbols): New function.
14446         (General_options::is_wrap_symbol): New function.
14447         * options.cc (General_options::parse_wrap): New function.
14448         (General_options::General_options): Initialize wrap_symbols_.
14449         * symtab.cc (Symbol_table::wrap_symbol): New function.
14450         (Symbol_table::add_from_object): Handle --wrap.
14451         * symtab.h (class Symbol_table): Declare wrap_symbol.
14452         * target.h (Target::wrap_char): New function.
14453         (Target::Target_info): Add wrap_char field.
14454         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14455         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14456         * testsuite/testfile.cc (Target_test::test_target_info):
14457         Likewise.
14458
14459         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14460         there is one.
14461
14462         * layout.h (class Layout): Add added_eh_frame_data_ field.
14463         * layout.cc (Layout::Layout): Initialize new field.
14464         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14465         output section until we find a section we merged successfully.
14466         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14467         that the size be non-zero.
14468
14469         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14470         qualifier.
14471
14472 2008-04-08  Craig Silverstein  <csilvers@google.com>
14473
14474         * configure.ac: Export new conditional variable HAVE_ZLIB.
14475         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14476         on HAVE_ZLIB.
14477         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14478         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14479
14480 2008-04-07  Ian Lance Taylor  <iant@google.com>
14481
14482         * version.cc (version_string): Set to "1.5".
14483
14484         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14485         Add issued_non_pic_error_ field.  Declare check_non_pic.
14486         (Target_x86_64::Scan::check_non_pic): New function.
14487         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14488         (Target_x86_64::Scan::global): Likewise.
14489
14490         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14491         addend parameter.  Change caller.  Handle merge sections.
14492         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14493         Address to Addend.  Don't add in the result of
14494         local_section_offset, pass down the addend and use the returned
14495         value.
14496         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14497         Update declarations of local_section_offset and symbol_value.
14498         * testsuite/two_file_test_1.cc (t18): New function.
14499         * testsuite/two_file_test_2.cc (f18): New function.
14500         * testsuite/two_file_test_main.cc (main): Call t18.
14501         * testsuite/two_file_test.h (t18, f18): Declare.
14502
14503         * configure.ac: Don't test for objdump, c++filt, or readelf.
14504         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14505         conditionals.
14506         (TEST_READELF): New variable.
14507         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14508         (check_PROGRAMS): Add two_file_strip_test.
14509         (two_file_strip_test): New target.
14510         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14511         (two_file_same_shared_strip_test_SOURCES): New variable.
14512         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14513         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14514         (two_file_same_shared_strip_test_LDADD): New variable.
14515         (two_file_shared_strip.so): New target.
14516         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14517         (ver_test_5.syms, ver_test_7.syms): Likewise.
14518         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14519         (strip_test_3.stdout): Use TEST_OBJDUMP.
14520         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14521
14522 2008-04-04  Cary Coutant  <ccoutant@google.com>
14523
14524         * symtab.h (Symbol::is_weak_undefined): New function.
14525         (Symbol::is_strong_undefined): New function.
14526         (Symbol::is_absolute): New function.
14527         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14528         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14529         absolute symbols.
14530         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14531         (weak_undef_test): New target.
14532         * testsuite/Makefile.in: Rebuild.
14533         * testsuite/weak_undef_file1.cc: New file.
14534         * testsuite/weak_undef_file2.cc: New file.
14535         * testsuite/weak_undef_test.cc: New file.
14536
14537 2008-04-03  Craig Silverstein  <csilvers@google.com>
14538
14539         * compressed_output.h (class Output_compressed_section): Use
14540         unsigned buffer.
14541         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14542         add zlib header.
14543         (zlib_compressed_suffix): Removed.
14544         (Output_compressed_section::set_final_data_size): Use unsigned
14545         buffers.
14546         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14547         Fix linker invocation.
14548         (flagstest_o_specialfile_and_compress_debug_sections):
14549         Likewise.
14550         * testsuite/Makefile.in: Regenerated.
14551
14552 2008-04-02  David S. Miller  <davem@davemloft.net>
14553
14554         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14555         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14556
14557 2008-04-02  Craig Silverstein  <csilvers@google.com>
14558
14559         * TODO: New file.
14560
14561 2008-04-02  Ian Lance Taylor  <iant@google.com>
14562
14563         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14564         parameters.  Update for new key type to views_.  Change all
14565         callers.
14566         (File_read::read): Adjust for byteshift in returned view.
14567         (File_read::add_view): New function, broken out of
14568         find_and_make_view.
14569         (File_read::make_view): New function, broken out of
14570         find_and_make_view.
14571         (File_read::find_or_make_view): Add offset and aligned
14572         parameters.  Rewrite accordingly.  Change all callers.
14573         (File_read::get_view): Add offset and aligned parameters.  Adjust
14574         for byteshift in return value.
14575         (File_read::get_lasting_view): Likewise.
14576         * fileread.h (class File_read): Update declarations.
14577         (class File_read::View): Add byteshift_ field.  Add byteshift to
14578         constructor.  Add byteshift method.
14579         * archive.h (Archive::clear_uncached_views): New function.
14580         (Archive::get_view): Add aligned parameter.  Change all callers.
14581         * object.h (Object::get_view): Add aligned parameter.  Change all
14582         callers.
14583         (Object::get_lasting_view): Likewise.
14584
14585         * fileread.cc (File_read::release): Don't call clear_views if
14586         there are multiple objects.
14587         * fileread.h (File_read::clear_uncached_views): New function.
14588         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14589         on the archive.
14590
14591 2008-03-31  Cary Coutant  <ccoutant@google.com>
14592
14593         Add thin archive support.
14594         * archive.cc (Archive::armagt): New const.
14595         (Archive::setup): Remove task parameter and calls to unlock.
14596         (Archive::unlock_nested_archives): New function.
14597         (Archive::read_header): Add nested_off parameter. Change
14598         all callers.
14599         (Archive::interpret_header): Likewise.
14600         (Archive::include_all_members): Change to handle thin
14601         archives.
14602         (Archive::include_member): Likewise.
14603         * archive.h (Archive::Archive): Add new parameters and
14604         initializers.
14605         (Archive::armagt): New const.
14606         (Archive::setup): Remove task parameter.
14607         (Archive::unlock_nested_archives): New function.
14608         (Archive::read_header): Add nested_off parameter.
14609         (Archive::interpret_header): Likewise.
14610         (Archive::Nested_archive_table): New typedef.
14611         (Archive::is_thin_archive_): New field.
14612         (Archive::nested_archives_): New field.
14613         (Archive::options_): New field.
14614         (Archive::dirpath_): New field.
14615         (Archive::task_): New field.
14616         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14617         for thin archives.  Pass additional parameters to
14618         Archive::Archive.  Unlock the archive file after calling
14619         Archive::setup.
14620
14621 2008-03-29  Ian Lance Taylor  <iant@google.com>
14622
14623         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14624         version symbol to be local.
14625         * testsuite/ver_test_4.sh: New file.
14626         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14627         (check_DATA): Add ver_test_4.syms.
14628         (ver_test_4.syms): New target.
14629         * testsuite/Makefile.in: Rebuild.
14630
14631         * output.cc
14632         (Output_section::Input_section_sort_entry::has_priority): New
14633         function.
14634         (Output_section::Input_section_sort_entry::match_file_name): New
14635         function.
14636         (Output_section::Input_section_sort_entry::match_section_name):
14637         Remove.
14638         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14639         Remove.
14640         (Output_section::Input_section_sort_entry::match_section_file):
14641         Remove.
14642         (Output_section::Input_section_sort_compare::operator()): Rewrite
14643         using new Input_section_sort_entry functions.  Sort crtbegin and
14644         crtend first.  Sort sections with no priority before sections with
14645         a priority.
14646         * testsuite/initpri1.c (d3): Check j != 4.
14647         (cd5): New constructor/destructor function.
14648         (main): Check j != 2.
14649
14650         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14651         new symbol when resolving, don't call set_is_default.
14652         * testsuite/ver_test_7.cc: New file.
14653         * testsuite/ver_test_7.sh: New file.
14654         * testsuite/Makefile.am (ver_test_7.so): New target.
14655         (ver_test_7.o): New target.
14656         (check_SCRIPTS): Add ver_test_7.sh.
14657         (check_DATA): Add ver_test_7.syms.
14658         (ver_test_7.syms): New target.
14659
14660 2008-03-28  Ian Lance Taylor  <iant@google.com>
14661
14662         * layout.cc (Layout::layout): If we see an input section with a
14663         name that needs sorting, set the must_sort flag for the output
14664         section.
14665         (Layout::make_output_section): If the name of the output section
14666         indicates that it might require sorting, set the may_sort flag.
14667         * output.h (Output_section::may_sort_attached_input_sections): New
14668         function.
14669         (Output_section::set_may_sort_attached_input_sections): New
14670         function.
14671         (Output_section::must_sort_attached_input_sections): New
14672         function.
14673         (Output_section::set_must_sort_attached_input_sections): New
14674         function.
14675         (class Output_section): Declare Input_section_sort_entry.  Define
14676         Input_section_sort_compare.  Declare
14677         sort_attached_input_sections.  Add new fields:
14678         may_sort_attached_input_sections_,
14679         must_sort_attached_input_sections_,
14680         attached_input_sections_are_sorted_.
14681         * output.cc (Output_section::Output_section): Initialize new
14682         fields.
14683         (Output_section::add_input_section): Add an entry to
14684         input_sections_ if may_sort or must_sort are true.
14685         (Output_section::set_final_data_size): Call
14686         sort_attached_input_sections if necessary.
14687         (Output_section::Input_section_sort_entry): Define new class.
14688         (Output_section::Input_section_sort_compare::operator()): New
14689         function.
14690         (Output_section::sort_attached_input_sections): New function.
14691         * configure.ac: Check whether the compiler supports constructor
14692         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14693         * testsuite/initpri1.c: New file.
14694         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14695         CONSTRUCTOR_PRIORITY.
14696         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14697         (initpri1_LDFLAGS): New variable.
14698         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14699
14700 2008-03-27  Ian Lance Taylor  <iant@google.com>
14701
14702         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14703         * testsuite/common_test_1.c: New file.
14704         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14705         (common_test_1_SOURCES): New variable.
14706         (common_test_1_DEPENDENCIES): New variable.
14707         (common_test_1_LDFLAGS): New variable.
14708
14709         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14710         and commons_ correctly when NAME/VERSION does not override
14711         NAME/NULL.
14712         * testsuite/ver_test_6.c: New file.
14713         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14714         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14715         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14716
14717 2008-03-26  Ian Lance Taylor  <iant@google.com>
14718
14719         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14720         of an undefined symbol from a version script.
14721         * testsuite/Makefile.am (ver_test_5.so): New target.
14722         (ver_test_5.o): New target.
14723         (check_SCRIPTS): Add ver_test_5.sh.
14724         (check_DATA): Add ver_test_5.syms.
14725         (ver_test_5.syms): New target.
14726         * testsuite/ver_test_5.cc: New file.
14727         * testsuite/ver_test_5.script: New file.
14728         * testsuite/ver_test_5.sh: New file.
14729         * Makefile.in, testsuite/Makefile.in: Rebuild.
14730
14731         PR gold/5986
14732         Fix problems building gold with gcc 4.3.0.
14733         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14734         (gold_error_at_location, gold_warning_at_location): Use it.
14735         * configure.ac: Check whether we can compile and use a template
14736         function with a printf attribute.
14737         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14738         when jumping over bytes.
14739         * object.cc: Instantiate Object::read_section_data.
14740         * debug.h: Include <cstring>
14741         * dwarf_reader.cc: Include <algorithm>
14742         * main.cc: Include <cstring>.
14743         * options.cc: Include <cstring>.
14744         * output.cc: Include <cstring>.
14745         * script.cc: Include <cstring>.
14746         * script.h: Include <string>.
14747         * symtab.cc: Include <cstring> and <algorithm>.
14748         * target-select.cc: Include <cstring>.
14749         * version.cc: Include <string>.
14750         * testsuite/testmain.cc: Include <cstdlib>.
14751         * configure, config.in: Rebuild.
14752
14753 2008-03-25  Ian Lance Taylor  <iant@google.com>
14754
14755         * options.cc: Include "../bfd/bfdver.h".
14756         (options::help): Print bug reporting address.
14757
14758         * version.cc (print_version): Adjust output for current value of
14759         BFD_VERSION_STRING.
14760
14761         * NEWS: New file.
14762
14763         * options.cc (options::help): Print list of supported targets.
14764         * target-select.h: Include <vector>.
14765         (class Target_selector): Make machine_, size_, and is_big_endian_
14766         fields const.  Add bfd_name_ and instantiated_target_ fields.
14767         (Target_selector::Target_selector): Add bfd_name parameter.
14768         (Target_selector::recognize): Make non-virtual, call
14769         do_recognize.
14770         (Target_selector::recognize_by_name): Make non-virtual, call
14771         do_recognize_by_name.
14772         (Target_selector::supported_names): New function.
14773         (Target_selector::bfd_name): New function.
14774         (Target_selector::do_instantiate_target): New pure virtual
14775         function.
14776         (Target_selector::do_recognize): New virtual function.
14777         (Target_selector::do_recognize_by_name): New virtual function.
14778         (Target_selector::instantiate_target): New private function.
14779         (supported_target_names): Declare.
14780         * target-select.cc (Target_selector::Target_selector): Update for
14781         new parameter and fields.
14782         (select_target_by_name): Check that the name matches before
14783         calling recognize_by_name.
14784         (supported_target_names): New function.
14785         * i386.cc (class Target_selector_i386): Update Target_selector
14786         constructor call.  Remove recognize and recognize_by_name.  Add
14787         do_instantiate_target.
14788         * x86_64.cc (class Target_selector_x86_64): Likewise.
14789         * testsuite/testfile.cc (class Target_selector_test): Update for
14790         changes to Target_selector.
14791
14792         * README: Rewrite, with some notes on unsupported features.
14793
14794 2008-03-24  Cary Coutant  <ccoutant@google.com>
14795
14796         * i386.cc (Target_i386::Got_type): New enum declaration.
14797         (Target_i386::Scan::local): Updated callers of Output_data_got
14798         member functions.
14799         (Target_i386::Scan::global): Likewise.
14800         (Target_i386::Relocate::relocate): Likewise.
14801         (Target_i386::Relocate::relocate_tls): Likewise.
14802         * object.h (Got_offset_list): New class.
14803         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14804         (Sized_relobj::local_got_offset): Likewise.
14805         (Sized_relobj::set_local_got_offset): Likewise.
14806         (Sized_relobj::local_has_tls_got_offset): Removed.
14807         (Sized_relobj::local_tls_got_offset): Removed.
14808         (Sized_relobj::set_local_tls_got_offset): Removed.
14809         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14810         * output.cc (Output_data_got::add_global): Added got_type parameter.
14811         (Output_data_got::add_global_with_rel): Likewise.
14812         (Output_data_got::add_global_with_rela): Likewise.
14813         (Output_data_got::add_global_pair_with_rel): New function.
14814         (Output_data_got::add_global_pair_with_rela): New function.
14815         (Output_data_got::add_local): Added got_type parameter.
14816         (Output_data_got::add_local_with_rel): Likewise.
14817         (Output_data_got::add_local_with_rela): Likewise.
14818         (Output_data_got::add_local_pair_with_rel): New function.
14819         (Output_data_got::add_local_pair_with_rela): New function.
14820         (Output_data_got::add_global_tls): Removed.
14821         (Output_data_got::add_global_tls_with_rel): Removed.
14822         (Output_data_got::add_global_tls_with_rela): Removed.
14823         (Output_data_got::add_local_tls): Removed.
14824         (Output_data_got::add_local_tls_with_rel): Removed.
14825         (Output_data_got::add_local_tls_with_rela): Removed.
14826         * output.h (Output_data_got::add_global): Added got_type parameter.
14827         (Output_data_got::add_global_with_rel): Likewise.
14828         (Output_data_got::add_global_with_rela): Likewise.
14829         (Output_data_got::add_global_pair_with_rel): New function.
14830         (Output_data_got::add_global_pair_with_rela): New function.
14831         (Output_data_got::add_local): Added got_type parameter.
14832         (Output_data_got::add_local_with_rel): Likewise.
14833         (Output_data_got::add_local_with_rela): Likewise.
14834         (Output_data_got::add_local_pair_with_rel): New function.
14835         (Output_data_got::add_local_pair_with_rela): New function.
14836         (Output_data_got::add_global_tls): Removed.
14837         (Output_data_got::add_global_tls_with_rel): Removed.
14838         (Output_data_got::add_global_tls_with_rela): Removed.
14839         (Output_data_got::add_local_tls): Removed.
14840         (Output_data_got::add_local_tls_with_rel): Removed.
14841         (Output_data_got::add_local_tls_with_rela): Removed.
14842         * resolve.cc (Symbol::override_base_with_special): Removed
14843         reference to has_got_offset_ field.
14844         * symtab.cc (Symbol::init_fields): Replaced initialization
14845         of got_offset_ with got_offsets_.  Removed initialization
14846         of has_got_offset_
14847         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14848         (Symbol::got_offset): Likewise.
14849         (Symbol::set_got_offset): Likewise.
14850         (Symbol::has_tls_got_offset): Removed.
14851         (Symbol::tls_got_offset): Removed.
14852         (Symbol::set_tls_got_offset): Removed.
14853         (Symbol::got_offset_): Removed.
14854         (Symbol::tls_mod_got_offset_): Removed.
14855         (Symbol::tls_pair_got_offset_): Removed.
14856         (Symbol::got_offsets_): New field.
14857         (Symbol::has_got_offset): Removed.
14858         (Symbol::has_tls_mod_got_offset): Removed.
14859         (Symbol::has_tls_pair_got_offset): Removed.
14860         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14861         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14862         member functions.
14863         (Target_x86_64::Scan::global): Likewise.
14864         (Target_x86_64::Relocate::relocate): Likewise.
14865         (Target_x86_64::Relocate::relocate_tls): Likewise.
14866
14867 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14868
14869         * yyscript.y: Fix spelling error in comment.
14870
14871 2008-03-24  Ian Lance Taylor  <iant@google.com>
14872
14873         * options.h (class General_options): Define build_id option.
14874         * layout.h (class Layout): Declare write_build_id, create_note,
14875         create_build_id.  Add build_id_note_ member.
14876         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14877         "libiberty.h", "md5.h", "sha1.h".
14878         (Layout::Layout): Initialize eh_frame_data_,
14879         eh_frame_hdr_section_, and build_id_note_.
14880         (Layout::finalize): Call create_build_id.
14881         (Layout::create_note): New function, broken out of
14882         Layout::create_gold_note.
14883         (Layout::create_gold_note): Call create_note.
14884         (Layout::create_build_id): New function.
14885         (Layout::write_build_id): New function.
14886         (Close_task_runner::run): Call write_build_id.
14887
14888         * x86_64.cc: Correct license to GPLv3.
14889
14890 2008-03-23  Ian Lance Taylor  <iant@google.com>
14891
14892         * options.cc: Include "demangle.h".
14893         (parse_optional_string): New function.
14894         (parse_long_option): Handle takes_optional_argument.
14895         (parse_short_option): Update dash_z initializer.  Handle
14896         takes_optional_argument.
14897         (General_options::General_options): Initialize do_demangle_.
14898         (General_options::finalize): Set do_demangle_.  Handle demangling
14899         style.
14900         * options.h (parse_optional_string): Declare.
14901         (struct One_option): Add optional_arg field.  Update constructor.
14902         Update call constructor calls.  Add takes_optional_argument
14903         function.
14904         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14905         (DEFINE_optional_string): Define.
14906         (General_options::demangle): Change from DEFINE_bool to
14907         DEFINE_optional_string.
14908         (General_options::no_demangle): New function.
14909         (General_options::do_demangle): New function.
14910         (General_options::set_do_demangle): New function.
14911         (General_options::execstack_status_): Move definition to end of
14912         class definition.
14913         (General_options::static_): Likewise.
14914         (General_options::do_demangle_): New field.
14915         * object.cc (big_endian>::get_symbol_location_info): Call
14916         Options::do_demangle, not Options::demangle.
14917         * symtab.cc (demangle): Likewise.
14918
14919 2008-03-22  Ian Lance Taylor  <iant@google.com>
14920
14921         * gold.h: Include <cstddef> and <sys/types.h>
14922         * options.h: Include <cstring>.
14923
14924 2008-03-21  Ian Lance Taylor  <iant@google.com>
14925
14926         * Added source code to GNU binutils.
14927 \f
14928 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14929
14930 Copying and distribution of this file, with or without modification,
14931 are permitted in any medium without royalty provided the copyright
14932 notice and this notice are preserved.
14933
14934 Local Variables:
14935 mode: change-log
14936 left-margin: 8
14937 fill-column: 74
14938 version-control: never
14939 End: