gold/
[external/binutils.git] / gold / ChangeLog
1 2013-08-07  Cary Coutant  <ccoutant@google.com>
2
3         Revert support for v2 DWP files:
4
5         2013-03-01  Cary Coutant  <ccoutant@google.com>
6
7             Add dwp support for v2 DWARF package file format.
8             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
9             tu_length parameter.  Adjust all callers.
10             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
11             * dwp.cc: Include dwarf.h.
12             (Section_bounds): New struct type.
13             (Unit_set): New struct type.
14             (Dwo_file::Dwo_file): Initialize new data member.
15             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
16             Combine and rename to...
17             (Dwo_file::read_unit_index): ...this.
18             (Dwo_file::sized_read_compunit_index)
19             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
20             (Dwo_file::sized_read_unit_index): ...this.
21             (Dwo_file::copy_section): Remove section_name, is_str_offsets
22             parameters; add section_id parameter.
23             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
24             (Dwo_file::add_unit_set): ...this.
25             (Dwo_file::shndx_map_): Remove.
26             (Dwo_file::sect_offsets_): New data member.
27             (Dwp_output_file::Dwp_output_file): Initialize new data members.
28             (Dwp_output_file::add_section): Rename to...
29             (Dwp_output_file::add_contribution): ...this.
30             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
31             (Dwp_output_file::add_tu_set): Likewise.
32             (Dwp_output_file::Contribution): New type.
33             (Dwp_output_file::Section::contributions): New data member.
34             (Dwp_output_file::Cu_or_tu_set): Remove.
35             (Dwp_output_file::Section::Section): New ctor.
36             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
37             (Dwp_output_file::Dwp_index::Section_table): New type.
38             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
39             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
40             parameter.
41             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
42             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
43             (Dwp_output_file::Dwp_index::section_table): New member function.
44             (Dwp_output_file::Dwp_index::section_table_end): New member function.
45             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
46             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
47             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
48             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
49             (Dwp_output_file::Dwp_index::section_table_): New data member.
50             (Dwp_output_file::Dwp_index::section_mask_): New data member.
51             (Dwp_output_file::add_output_section): New member function.
52             (Dwp_output_file::write_new_section): New member function.
53             (Dwp_output_file::write_contributions): New member function.
54             (Dwp_output_file::section_id_map_): New data member.
55             (class Dwo_id_info_reader): Remove.
56             (class Unit_reader): New class.
57             (get_dwarf_section_name): New function.
58             (Dwo_file::read_executable): Adjust initializations of class data.
59             (Dwo_file::read): Add support for v2 package file format.
60             (Dwo_file::read_unit_index): Likewise.
61             (Dwo_file::sized_read_unit_index): Likewise.
62             (Dwo_file::copy_section): Likewise.
63             (Dwo_file::add_unit_set): Likewise.
64             (Dwp_output_file::add_output_section): Likewise.
65             (Dwp_output_file::add_contribution): Likewise.
66             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
67             for empty slot.
68             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
69             file format.
70             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
71             slot.
72             (Dwp_output_file::initialize): Remove unused function.
73             (Dwp_output_file::finalize): Add support for v2 package file format.
74             (Dwp_output_file::write_index): Likewise.
75             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
76             function prototype.
77
78 2013-07-31  Cary Coutant  <ccoutant@google.com>
79
80         * object.cc (Sized_relobj::do_output_section_address): New function.
81         (Sized_relobj): Instantiate explicitly.
82         * object.h (Object::output_section_address): New function.
83         (Object::do_output_section_address): New function.
84         (Sized_relobj::do_output_section_address): New function.
85         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
86
87 2013-07-30  Cary Coutant  <ccoutant@google.com>
88             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
89
90         * parameters.cc (Parameters::entry): Return target-specific entry
91         symbol name.
92         * target.h (Target::entry_symbol_name): New function.
93         (Target_info::entry_symbol_name): New data member.
94
95         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
96         * i386.cc (Target_i386::i386_info): Likewise.
97         (Target_i386_nacl::i386_nacl_info): Likewise.
98         * sparc.cc (Target_sparc::sparc_info): Likewise.
99         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
100         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
101         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
102         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
103
104 2013-07-22  Sterling Augustine  <saugustine@google.com>
105
106         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
107         Convert parameter shndx to local variable. Add parameters symtab
108         and symtab_size.  Scan over section names.  Find relocation
109         section corresponding to current section.  Create and initialize
110         reloc_mapper_ and reloc_type_.
111         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
112         unit_length to off_t.  Initialize member unit_length_.  Fill in field
113         cu_offset_.
114         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
115         Initialize new fields unit_length_ and cu_offset_.
116         (Dwarf_pubnames_table::read_section): Update prototype.
117         (Dwarf_pubnames_table::cu_offset): New member function.
118         (Dwarf_pubnames_table::subsection_size): Likewise.
119         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
120         New fields.
121         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
122         member functions public.
123         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
124         Update comment.  Rework logic.  Move repeated parts to...
125         (Gdb_index_info_reader::read_pubtable): ...here. New function.
126         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
127         pubtypes_table_, and stmt_list_offset.
128         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
129         Gdb_index::find_pubtype_offset,
130         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
131         (Gdb_index::pubnames_read): Update prototype and rework logic.
132         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
133         Forward declare.
134         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
135         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
136         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
137         Gdb_index::map_pubtable_to_dies):
138         Declare functions.
139         (Gdb_index::pubnames_read): Update declaration.
140         (Gdb_index::Pubname_offset_map): New type.
141         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
142         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
143         Gdb_index::stmt_list_offset): Declare.
144         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
145         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
146         Gdb_index::pubtypes_offset_): Remove.
147
148 2013-07-19  Roland McGrath  <mcgrathr@google.com>
149
150         * options.h (General_options): Add -Trodata-segment option.
151         * parameters.cc (Parameters::check_rodata_segment): New function.
152         (Parameters::set_target_once): Call it.
153         * parameters.h (Parameters): Declare it (private member function).
154         * layout.cc (load_seg_unusable_for_headers): New function, broken
155         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
156         then validate rodata segment rather than text segment.
157         (relaxation_loop_body): Call that.
158         (is_text_segment): New function.  Don't admit a non-executable
159         segment if TARGET->isolate_execinstr().
160         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
161
162 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
163
164         PR gold/15070
165         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
166         * nacl.h (Sniff_file::View::View): Request aligned view.
167
168 2013-07-11  Cary Coutant  <ccoutant@google.com>
169
170         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
171         correct BRLT entry size.
172
173 2013-07-03  Alan Modra  <amodra@gmail.com>
174
175         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
176         comment.
177
178 2013-07-01  Cary Coutant  <ccoutant@google.com>
179
180         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
181         reloc_type_.
182         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
183         (Dwarf_ranges_table::lookup_reloc): New function.
184         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
185         reloc_type_.
186         (Dwarf_ranges_table::lookup_reloc): New function.
187         (Dwarf_ranges_table::reloc_type_): New data member.
188
189 2013-06-27  Jing Yu  <jingyu@google.com>
190
191         PR gold/15662
192         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
193         function.
194         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
195         (Target_powerpc::do_relax): Call the above.
196
197 2013-06-27  Cary Coutant  <ccoutant@google.com>
198
199         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
200         on garbage collected .opd section.
201
202 2013-06-27  Alan Modra  <amodra@gmail.com>
203
204         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
205         is non-zero.
206         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
207         (Target_powerpc::do_function_location): Likewise for loc->shndx.
208
209 2013-06-14  Cary Coutant  <ccoutant@google.com>
210
211         * resolve.cc (Symbol::override_base): Don't override st_type
212         from plugin placeholder symbols.
213         (Symbol_table::resolve): Likewise.
214         (Symbol_table::should_override): Don't complain about TLS mismatch
215         if the TO symbol is a plugin placeholder.
216         * testsuite/Makefile.am (plugin_test_tls): New test.
217         * testsuite/Makefile.in: Regenerate.
218         * testsuite/plugin_test_tls.sh: New test script.
219         * testsuite/two_file_test_2_tls.cc: New test source.
220         * testsuite/two_file_test_tls.cc: New test source.
221
222 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
223
224         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
225         the maximum segment alignment is larger than the page size.
226         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
227         correctly aligns the symbols with large alignemnt.
228         * testsuite/Makefile.in: Regenerate.
229         * testsuite/large_symbol_alignment.cc: New file.
230
231 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
232             Sriraman Tallam  <tmsriram@google.com>
233
234         * options.h (sort_section): New option.
235         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
236         Rename from Input_section_sort_section_name_special_ordering_compare.
237         (Input_section_sort_section_name_compare): New struct.
238         * output.cc (Output_section::Input_section_sort_section_name_compare::
239         operator()): New function.
240         (Output_section::sort_attached_input_sections): Use new sort function
241         for .text if --sort-section=name is specified.
242         * layout.cc (Layout::make_output_section):
243         Add sorting by name when --sort-section=name is specified.
244         * testsuite/Makefile.am (text_section_grouping): Test option
245         --sort-section=name.
246         * testsuite/Makefile.in: Regenerate.
247         * testsuite/section_sorting_name.cc: New file.
248         * testsuite/section_sorting_name.sh: New file.
249
250 2013-05-21  Cary Coutant  <ccoutant@google.com>
251
252         * symtab.h (Symbol::is_cxx_vtable): New function.
253         * target-reloc.h (relocate_section): Check for vtable symbol.
254         * testsuite/Makefile.am (missing_key_func.sh): New test case.
255         * testsuite/Makefile.in: Regenerate.
256         * testsuite/missing_key_func.cc: New test source.
257         * testsuite/missing_key_func.sh: New test script.
258
259 2013-05-21  Cary Coutant  <ccoutant@google.com>
260
261         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
262         type of enclosing symbol.
263         (Relocate_info::location): Check symbol type when describing symbol.
264         * object.h (Symbol_location_info): Remove unused line_number;
265         add enclosing_symbol_type.
266         * testsuite/debug_msg.sh: Adjust expected output.
267
268 2013-05-13  Cary Coutant  <ccoutant@google.com>
269
270         * configure.ac: Export DEFAULT_TARGET.
271         * configure: Regenerate.
272         * Makefile.in: Regenerate.
273         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
274         * testsuite/Makefile.in: Regenerate.
275         * testsuite/debug_msg.sh: Delete duplicate tests.
276         Don't check undef_int error message match for powerpc where the
277         source file and line number aren't available.
278
279 2013-05-10  Roland McGrath  <mcgrathr@google.com>
280
281         * options.h (General_options): Add --rosegment-gap option.
282         * options.cc (finalize): --rosegment-gap implies --rosegment.
283         * layout.cc (set_segment_offsets): Let user option override
284         target->rosegment_gap().
285
286 2013-05-10  Roland McGrath  <mcgrathr@google.com>
287
288         * options.h (General_options): Remove leading space from help
289         messages for -nostdlib and --rosegment.
290
291 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
292
293         PR ld/15365
294         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
295
296 2013-05-03  Alan Modra  <amodra@gmail.com>
297
298         * merge.cc (Output_merge_string::do_add_input_section): Correct
299         scan for number of strings.  Rename vars to avoid shadowing.
300         Include missing terminator in input_size_.
301
302 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
303
304         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
305         Restore empty string handling.
306
307 2013-05-01  Cary Coutant  <ccoutant@google.com>
308
309         * stringpool.cc (Stringpool_template::new_key_offset): Fix
310         uninitialized warning.
311
312 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
313
314         * output.cc (Output_section::add_merge_input_section): Allow
315         to merge sections if the alignment is more than character size.
316         * merge.h (Output_merge_string::Output_merge_string): Remove
317         assert.
318         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
319         only not-null strings. Check the alignment of strings.
320         * stringpool.h
321         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
322         alignment as the argument.
323         (Stringpool_template<Stringpool_char>::addralign_): New class member.
324         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
325         Align non-zero length strings according to the addralign_.
326         (Stringpool_template<Stringpool_char>::set_string_offsets):
327         Updating offsets according to the given alignment.
328         * testsuite/Makefile.am (text_section_grouping): Test if string
329         literals are getting merged.
330         * testsuite/Makefile.in: Regenerate.
331         * testsuite/merge_string_literals_1.c: New file.
332         * testsuite/merge_string_literals_2.c: Ditto.
333         * testsuite/merge_string_literals.sh: Ditto.
334
335 2013-04-26  Ian Lance Taylor  <iant@google.com>
336
337         * target-reloc.h (relocate_section): If the reloc offset is out of
338         range, pass VIEW as NULL to relocate.relocate.
339         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
340         * i386.cc (Target_i386::Relocate::relocate): Likewise.
341         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
342         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
343         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
344         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
345
346 2013-04-26  Geoff Pike  <gpike@chromium.org>
347
348         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
349         * layout.cc (Hash_task): New class.
350         (Layout::queue_build_id_tasks): New function.
351         (Layout::write_build_id): Handle single-thread portion of build ID
352         computation.  (In some cases, all of it is single-threaded.)  Replace
353         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
354         functionality in fewer lines of code.
355         * layout.h (Layout::queue_build_id_tasks): New function declaration.
356         * options.h (General_options): make "--build-id" default to tree
357         rather than sha1.  Add two new options related to --build-id=tree:
358         --build-id-chunk-size-for-treehash and
359         --build-id-min-file-size-for-treehash.
360         * Makefile.am: add testing of --build-id=tree and related new options
361         (these tests will be invoked by "make check").
362         * Makefile.in: Regenerate.
363
364 2013-04-25  Alan Modra  <amodra@gmail.com>
365
366         * configure.tgt: Add powerpcle and powerpc64le.
367
368 2013-04-22  Alan Modra  <amodra@gmail.com>
369
370         PR gold/15355
371         * layout.cc (Layout::segment_precedes): Allow more than one
372         segment with the same type and flags.
373
374 2013-04-15  Cary Coutant  <ccoutant@google.com>
375
376         * layout.cc (Layout::set_relocatable_section_offsets): Don't
377         allocate space in file for BSS sections.
378
379 2013-04-15  Cary Coutant  <ccoutant@google.com>
380
381         * script-sections.cc (Orphan_output_section): Reset address
382         to zero after each orphaned section for relocatable links.
383
384 2013-04-15  Cary Coutant  <ccoutant@google.com>
385
386         * symtab.cc (Symbol_table::sized_write_globals): Subtract
387         section starting address for relocatable link.
388         * testsuite/Makefile.am (script_test_11): New test.
389         * testsuite/Makefile.in: Regenerate.
390         * testsuite/script_test_11.c: New source file.
391         * testsuite/script_test_11.t: New linker script.
392
393 2013-04-13  Alan Modra  <amodra@gmail.com>
394
395         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
396         owner when sections are not adjacent and exceed group size.
397         (Target_powerpc::group_sections): Handle corner case.
398         (Target_powerpc::Branch_info::make_stub): Handle case where
399         stub table doesn't exist due to branches in non-exec sections.
400         (Target_powerpc::Relocate::relocate): Likewise.
401
402 2013-04-11  Alan Modra  <amodra@gmail.com>
403
404         PR gold/15354
405         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
406         .branch_lt to match bfd ld.  Adjust comments throughout file.
407
408 2013-04-04  Ian Lance Taylor  <iant@google.com>
409
410         GCC PR c++/56840
411         * object.cc (do_layout_deferred_sections): Handle .eh_frame
412         sections before checking whether they are included in the link.
413
414 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
415
416         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
417         object before calling the plugin claim_file handler.  Pass the elf
418         object of the archive to the plugin. Delete the elf object if the
419         plugin claims the file.
420
421 2013-03-21  Alan Modra  <amodra@gmail.com>
422
423         * layout.cc (Layout::set_segment_offsets): Accept writable .text
424         segment when omagic.
425
426 2013-03-21  Alan Modra  <amodra@gmail.com>
427
428         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
429         comparison warning.
430         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
431         uninitialized" warning.
432
433 2013-03-20  Alan Modra  <amodra@gmail.com>
434
435         * symtab.h (Symbol::clear_version): New function.
436         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
437         is_needed by weak references.  Clear version for symbols defined
438         in as-needed objects that are not needed.
439
440 2013-03-15  Alan Modra  <amodra@gmail.com>
441
442         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
443         static and public.  Add report_err param.  Return false for data refs.
444         (Target_powerpc::rela_dyn_section): New overloaded function.
445         (Target_powerpc::plt_, iplt_): Elucidate.
446         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
447         (Output_data_plt_powerpc::do_write): Don't write .iplt.
448         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
449         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
450         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
451         push_branch and make_plt_entry for ifunc syms when
452         reloc_needs_plt_for_ifunc.
453         (Target_powerpc::Relocate::relocate): Don't use plt entry value
454         for ifunc unless reloc_needs_plt_for_ifunc.
455
456 2013-03-15  Alan Modra  <amodra@gmail.com>
457
458         * gc.h (gc_process_relocs): Don't look through function descriptors.
459         * icf.cc (get_section_contents): Do so here instead.
460
461 2013-03-13  Alan Modra  <amodra@gmail.com>
462
463         * powerpc.cc (is_branch_reloc): Forward declare.
464         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
465         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
466         false for 64-bit, true for 32-bit non-branch relocs.
467         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
468         * testsuite/Makefile.am (icf_test): Use linker map file instead of
469         nm output.
470         (icf_safe_test): Generate linker map file as well as nm output.
471         (icf_safe_so_test): Likewise.
472         * testsuite/Makefile.in: Regenerate.
473         * testsuite/icf_test.sh: Parse linker map file to determine
474         section folding.
475         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
476         * testsuite/icf_safe_so_test.sh: Likewise.
477         (X86_32_or_ARM_specific_safe_fold): Merge into..
478         (arch_specific_safe_fold): ..this.
479         (X86_64_specific_safe_fold): Delete unused function.
480
481 2013-03-12  Alan Modra  <amodra@gmail.com>
482
483         * gc.h (gc_process_relocs): Look through function descriptors
484         to determine shndx, symvalue and addend used by ICF.  Tidy
485         variable duplication.
486
487 2013-03-11  Alan Modra  <amodra@gmail.com>
488
489         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
490         * layout.cc (Layout_task_runner::run): ..to here.
491         * symtab.h (struct Symbol_location): Extract from..
492         (class Symbol_table): ..here.
493         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
494         * target.h (class Target): Add function_location and
495         do_function_location functions.
496         (class Sized_target): Add do_function_location.
497         * object.h (class Sized_relobj_file): Move find_shdr..
498         (class Object): ..to here.
499         * object.cc: Likewise.  Update to suit.  Instantiate.
500         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
501         * powerpc.cc (class Powerpc_dynobj): New.
502         (Target_powerpc::do_function_location): New function.
503         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
504         (Powerpc_dynobj::do_read_symbols): New function.
505         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
506
507 2013-03-08  Ian Lance Taylor  <iant@google.com>
508
509         * options.cc (General_options::string_to_object_format): Accept
510         "default".
511
512 2013-03-08  Alan Modra  <amodra@gmail.com>
513
514         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
515         pointer to Post_fde.
516         (struct Post_fde): Move definition to here..
517         * ehframe.cc (struct Post_fde): ..from here.
518         (Cie::write): Don't alloc Post_fde.
519         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
520
521 2013-03-07  Alan Modra  <amodra@gmail.com>
522
523         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
524         relocation referencing .LC0.
525         * testsuite/discard_locals_test.sh: Remove FIXMEs.
526
527 2013-03-07  Alan Modra  <amodra@gmail.com>
528
529         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
530         always_inline.  Add assembly for powerpc to avoid GOT.
531
532 2013-03-07  Alan Modra  <amodra@gmail.com>
533
534         * testsuite/script_test_10.sh: Don't test .bss section
535         header number.
536
537 2013-03-06  Alan Modra  <amodra@gmail.com>
538
539         * powerpc.cc (class Powerpc_relobj): Move some member functions.
540         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
541         all callers.  Handle folded sections.
542         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
543         to Powerpc_relobj.
544         (Global_symbol_visitor_opd::operator()): Likewise.
545
546 2013-03-04  Alan Modra  <amodra@gmail.com>
547
548         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
549         * testsuite/Makefile.in: Regenerate.
550
551 2013-03-01  Cary Coutant  <ccoutant@google.com>
552
553         Add dwp support for v2 DWARF package file format.
554         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
555         tu_length parameter.  Adjust all callers.
556         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
557         * dwp.cc: Include dwarf.h.
558         (Section_bounds): New struct type.
559         (Unit_set): New struct type.
560         (Dwo_file::Dwo_file): Initialize new data member.
561         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
562         Combine and rename to...
563         (Dwo_file::read_unit_index): ...this.
564         (Dwo_file::sized_read_compunit_index)
565         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
566         (Dwo_file::sized_read_unit_index): ...this.
567         (Dwo_file::copy_section): Remove section_name, is_str_offsets
568         parameters; add section_id parameter.
569         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
570         (Dwo_file::add_unit_set): ...this.
571         (Dwo_file::shndx_map_): Remove.
572         (Dwo_file::sect_offsets_): New data member.
573         (Dwp_output_file::Dwp_output_file): Initialize new data members.
574         (Dwp_output_file::add_section): Rename to...
575         (Dwp_output_file::add_contribution): ...this.
576         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
577         (Dwp_output_file::add_tu_set): Likewise.
578         (Dwp_output_file::Contribution): New type.
579         (Dwp_output_file::Section::contributions): New data member.
580         (Dwp_output_file::Cu_or_tu_set): Remove.
581         (Dwp_output_file::Section::Section): New ctor.
582         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
583         (Dwp_output_file::Dwp_index::Section_table): New type.
584         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
585         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
586         parameter.
587         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
588         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
589         (Dwp_output_file::Dwp_index::section_table): New member function.
590         (Dwp_output_file::Dwp_index::section_table_end): New member function.
591         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
592         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
593         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
594         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
595         (Dwp_output_file::Dwp_index::section_table_): New data member.
596         (Dwp_output_file::Dwp_index::section_mask_): New data member.
597         (Dwp_output_file::add_output_section): New member function.
598         (Dwp_output_file::write_new_section): New member function.
599         (Dwp_output_file::write_contributions): New member function.
600         (Dwp_output_file::section_id_map_): New data member.
601         (class Dwo_id_info_reader): Remove.
602         (class Unit_reader): New class.
603         (get_dwarf_section_name): New function.
604         (Dwo_file::read_executable): Adjust initializations of class data.
605         (Dwo_file::read): Add support for v2 package file format.
606         (Dwo_file::read_unit_index): Likewise.
607         (Dwo_file::sized_read_unit_index): Likewise.
608         (Dwo_file::copy_section): Likewise.
609         (Dwo_file::add_unit_set): Likewise.
610         (Dwp_output_file::add_output_section): Likewise.
611         (Dwp_output_file::add_contribution): Likewise.
612         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
613         for empty slot.
614         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
615         file format.
616         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
617         slot.
618         (Dwp_output_file::initialize): Remove unused function.
619         (Dwp_output_file::finalize): Add support for v2 package file format.
620         (Dwp_output_file::write_index): Likewise.
621         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
622         function prototype.
623
624 2013-03-01  Cary Coutant  <ccoutant@google.com>
625
626         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
627         function into class definition in header file.
628         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
629         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
630         New function.
631         (Dwarf_info_reader::check_buffer): Move here from .cc file.
632
633 2013-02-28  Alan Modra  <amodra@gmail.com>
634
635         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
636         * target.cc (Target::do_plt_fde_location): New function.
637         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
638         accessor function, and constructor param.
639         (struct Post_fde, Post_fdes): Declare.
640         (Cie::write): Add post_fdes param.
641         * ehframe.cc (Fde::write): Use plt_fde_location.
642         (struct Post_fde): Define.
643         (Cie::write): Stash FDEs added post merge mapping.
644         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
645         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
646         (Eh_frame::do_sized_write): Arrange to write post map FDES after
647         other FDEs.
648         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
649         (Target_powerpc::has_glink): New function.
650         (Target_powerpc::do_relax): Add eh_frame info for stubs.
651         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
652         glink_eh_frame_fde_32, default_fde): New data.
653         (Stub_table::eh_frame_added_): New var.
654         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
655         Make const.
656         (Stub_table::add_eh_frame): New function.
657         (Output_data_glink::add_eh_frame): New function.
658         (Target_powerpc::make_glink_section): Call add_eh_frame.
659
660 2013-02-15  Ian Lance Taylor  <iant@google.com>
661
662         * options.h (DEFINE_uint64_alias): Define.
663         (class General_options): Add -Ttext-segment as an alias for
664         -Ttext.
665
666 2013-02-15  Alan Modra  <amodra@gmail.com>
667
668         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
669         (Stub_table::do_write): ..here, two places.
670         (Stub_table::plt_call_size): Use it here too.
671
672 2013-02-11  Ian Lance Taylor  <iant@google.com>
673
674         * descriptors.cc (Descriptors::close_all): New function.
675         * descriptors.h (class Descriptors): Declare close_all.
676         (close_all_descriptors): New inline function.
677         * plugin.cc: Include "descriptors.h".
678         (Plugin_manager::cleanup): Call close_all_descriptors.
679
680 2013-02-06  Alan Modra  <amodra@gmail.com>
681
682         * README: Update coding style link.
683
684 2013-01-28  Cary Coutant  <ccoutant@google.com>
685
686         * dwp.cc (File_list): New typedef.
687         (Dwo_name_info_reader): New class.
688         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
689         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
690         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
691         (Dwo_file::read_executable): New function.
692         (Dwo_file::read): Move common setup code to ...
693         (Dwo_file::make_object): ... here.
694         (dwp_options): Add --exec/-e.
695         (usage): Likewise.
696         (main): Likewise.
697
698 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
699
700         * layout.cc (Layout::layout): Check for option text_reorder.
701         (Layout::make_output_section): Ditto.
702         * options.h (text_reorder): New option.
703         * output.cc (Input_section_sort_compare): Remove special ordering
704         of section names.
705         (Output_section::
706          Input_section_sort_section_name_special_ordering_compare::
707          operator()): New function.
708         (Output_section::sort_attached_input_sections): Use new sort function
709         for .text.
710         * output.h (Input_section_sort_section_name_special_ordering_compare):
711         New struct.
712         * testsuite/Makefile.am (text_section_grouping): Test option
713         --no-text-reorder
714         * testsuite/Makefile.in: Regenerate.
715         * testsuite/text_section_grouping.sh: Check order of functions without
716         default text reordering.
717
718 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
719
720         * options.h (General_options): Change default to true for new_dtags.
721
722 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
723
724         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
725         when enable_new_dtags is false.  Only add DT_RUNPATH when
726         enable_new_dtags is true.
727
728 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
729
730         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
731         used in declaration and definition consistent.
732         (Target_powerpc::symval_for_branch): Ditto.
733
734 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
735
736         * testsuite/plugin_final_layout.cc: Fix comment.
737
738 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
739
740         * layout.cc (Layout::layout): Do not do default sorting for
741         text sections when section ordering is specified.
742         (make_output_section): Ditto.
743         * testsuite/plugin_final_layout.cc: Name the function sections
744         to catch reordering issues.
745
746 2013-01-15  Alan Modra  <amodra@gmail.com>
747
748         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
749         plt-thread-safe.
750
751 2013-01-15  Alan Modra  <amodra@gmail.com>
752
753         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
754         * testsuite/Makefile.in: Regenerate.
755
756 2013-01-14  Alan Modra  <amodra@gmail.com>
757
758         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
759         * testsuite/Makefile.in: Regenerate.
760
761 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
762
763         PR bfd/14430
764         Fix mingw gold build with plugins enabled
765         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
766         * configure.ac: Export DLOPEN_LIBS and add headers check.
767         * plugin.cc: Handle non-dlfcn case.
768         * Makefile.in: Regenerate.
769         * config.in: Regenerate.
770         * configure: Regenerate.
771         * testsuite/Makefile.in: Regenerate.
772
773 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
774
775         * output.h (sort_attached_input_sections): Change to be public.
776         * script-sections.cc
777         (Output_section_definition::set_section_addresses): Sort
778         attached input sections according to section order before linker
779         script assigns section addresses.
780         (Orphan_output_section::set_section_addresses): Sort
781         attached input sections according to section order before linker
782         script assigns section addresses.
783         * Makefile.am (final_layout.sh): Use a simple linker script to
784         check if section ordering still works.
785         * Makefile.in: Regenerate.
786
787 2013-01-09  Ben Cheng  <bccheng@google.com>
788
789         * arm.cc (Target_arm::attributes_accept_div): New function.
790         (Target_arm::attributes_forbid_div): New function.
791         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
792         attribute using the same new functions as what bfd/elf32_arm.c
793         does.
794
795 2013-01-07  Cary Coutant  <ccoutant@google.com>
796
797         PR gold/14993
798         * output.cc (Output_section::add_input_section): For incremental
799         updates, don't track input sections that are allocated from patch
800         space.
801
802 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
803             Ian Lance Taylor  <iant@google.com>
804
805         PR gold/14897
806         * configure.ac (--enable-ld): Removed.
807         (install_as_default): Set to yes only for --enable-gold=default
808         or --disable-ld.
809         * configure: Regenerated.
810
811 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
812
813         * options.h (General_options): Add -fuse-ld= for GCC linker
814         option compatibility.
815
816 2013-01-04  Cary Coutant  <ccoutant@google.com>
817
818         * configure.ac: Fix typo restoring CXXFLAGS.
819         * configure: Regenerate.
820
821 2013-01-04  Cary Coutant  <ccoutant@google.com>
822
823         * testsuite/Makefile.am (CXXLINK_S): New macro.
824         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
825         * testsuite/Makefile.in: Regenerate.
826
827 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
828
829         * version.cc (print_version): Update copyright year to 2013.
830
831 2012-12-20  Ian Lance Taylor  <iant@google.com>
832
833         * layout.cc (Layout::special_ordering_of_input_section): New
834         function.
835         (Layout::layout): If input section requires special ordering, must
836         sort input sections.
837         (Layout::make_output_section): May sort .text input sections.
838         (Layout::is_section_name_prefix_grouped): Remove.
839         * layout.h (class Layout): Declare
840         special_ordering_of_input_section.  Don't declare
841         is_section_name_prefix_grouped.
842         * output.cc (Output_section::add_input_section): Revert last
843         change.
844         (Output_section::Input_section_sort::match_file_name): Don't crash
845         if called on output section data.
846         (Output_section::Input_section_sort_compare): Sort based on
847         special ordering.
848         (Output_section::Input_section_sort_section_order_index_compare):
849         Revert last patch.
850         (Output_section::sort_attached_input_sections): Likewise.
851
852 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
853
854         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
855         * layout.h (Layout::is_section_name_prefix_grouped): New function.
856         * output.cc (Output_section::add_input_section): Check if section
857         name contains special prefix.  Keep input sections to sort such
858         sections.
859         (Output_section::Input_section_sort_section_order_index_compare
860          ::operator()): Group sections according to prefixes.
861         (Output_section::sort_attached_input_sections): Add condition to
862         Input_section_entry constructor call.
863         * testsuite/Makefile.am (text_section_grouping): New test.
864         * testsuite/Makefile.in: Regenerate.
865         * testsuite/text_section_grouping.cc: New file.
866         * testsuite/text_section_grouping.sh: New file.
867
868 2012-12-17  Nick Clifton  <nickc@redhat.com>
869
870         * Makefile.am: Add copyright notice.
871         * NEWS: Likewise.
872         * README: Likewise.
873         * configure.ac: Likewise.
874         * ftruncate.c: Likewise.
875         * Makefile.in: Regenerate.
876
877 2012-12-14  Cary Coutant  <ccoutant@google.com>
878
879         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
880         --no-as-needed flag.
881         (exception_separate_shared_12_test): Likewise.
882         (incremental_copy_test): Likewise.
883         * testsuite/Makefile.in: Regenerate.
884
885 2012-12-14  Cary Coutant  <ccoutant@google.com>
886
887         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
888         (Dwp_output_file::Dwp_index::enter_set): Add assert.
889
890 2012-12-12  Alan Modra  <amodra@gmail.com>
891
892         * powerpc.cc (class Track_tls): New.
893         (class Relocate, class Scan): Inherit Track_tls.
894         (Target_powerpc::Scan::local, global): Track tls optimization
895         and avoid creating plt entry for __tls_get_addr if all uses
896         are optimized away.
897         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
898
899 2012-12-12  Alan Modra  <amodra@gmail.com>
900
901         * options.h (General_options): Add --toc-sort/--no-toc-sort.
902         Replace no_toc_optimize with toc_optimize.
903         * output.h (Output_section::input_sections): Provide non-const variant.
904         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
905         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
906         accessors.
907         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
908         (class Sort_toc_sections): New.
909         (Target_powerpc::do_finalize_sections): Sort toc sections.
910         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
911
912 2012-12-10  Roland McGrath  <mcgrathr@google.com>
913
914         * testsuite/binary_unittest.cc (read_all): New function.
915         (Sized_binary_test): Use it instead of ::read.
916         * fileread.cc (do_read): Don't assume pread always reads the whole
917         amount in a single call.
918
919 2012-12-10  Alan Modra  <amodra@gmail.com>
920
921         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
922         Set EM_PPC64 or EM_PPC here.
923         (Target_selector_powerpc::do_recognize): Delete.
924
925 2012-12-10  Alan Modra  <amodra@gmail.com>
926
927         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
928         stub_table_.
929         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
930
931 2012-12-07  Roland McGrath  <mcgrathr@google.com>
932
933         * testsuite/binary_unittest.cc (Sized_binary_test):
934         Use open_descriptor rather than ::open.
935
936 2012-12-07  Alan Modra  <amodra@gmail.com>
937
938         * powerpc.cc (Stub_table::do_write): Delete redundant Address
939         typedef and invalid_address constant.
940         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
941         instantiate constants.
942
943 2012-12-06  Roland McGrath  <mcgrathr@google.com>
944
945         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
946         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
947         * aclocal.m4: Regenerate.
948         * configure: Regenerate.
949         * Makefile.in: Regenerate.
950         * testsuite/Makefile.in: Regenerate.
951
952 2012-12-07  Alan Modra  <amodra@gmail.com>
953
954         * options.h (General_options): Add no_toc_optimize.
955         * powerpc.cc (ok_lo_toc_insn): New function.
956         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
957
958 2012-12-06  Alan Modra  <amodra@gmail.com>
959
960         * options.h (General_options): Add plt_align, plt_static_chain,
961         plt_thread_safe.  Update stub_group_size help text.
962         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
963         for new plt_thread_safe_ var.
964         (use_plt_offset): Correct comments.
965         (Target_powerpc::do_relax): Look for thread creation symbols to
966         determine default plt_thread_safe value.  Clear plt call stubs
967         as well as branch stubs each iteration.
968         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
969         insn constants.
970         (l, hi, ha, write_insn): Move earlier.
971         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
972         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
973         plt stubs too.
974         (Stub_table::update_size): Adjust.
975         (Stub_table::prev_size, set_prev_size): Delete.
976         (Stub_table::stub_align): Let --plt-align affect result.
977         (Stub_table::plt_call_size): Calculate sizes for various stubs.
978         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
979         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
980         (Stub_table::do_write): Support more stub variants.
981
982 2012-12-04  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
985         (Target_powerpc::do_define_standard_symbols): New function.
986
987 2012-12-03  Alan Modra  <amodra@gmail.com>
988
989         * output.h: Formatting, whitespace.
990
991 2012-12-03  Alan Modra  <amodra@gmail.com>
992
993         * layout.h (Layout::get_executable_sections): Declare.
994         * layout.cc (Layout::get_executable_sections): New function.
995         * arm.cc (Target_arm::group_sections): Use it.
996         (Arm_output_section::group_sections): Delete now redundant test.
997         * output.cc (Output_reloc::Output_reloc): Add is_relative.
998         param to handle relative relocs.
999         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1000         (Output_data_reloc::add_absolute): Adjust.
1001         (Output_data_reloc::add_relative): New function.
1002         (Output_data::reset_data_size): New function.
1003         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1004         (Output_section::set_addralign): New function.
1005         (Output_section::checkpoint_set_addralign): New function.
1006         (Output_section::clear_section_offsets_need_adjustment): New function.
1007         (Output_section::input_sections): Make public.
1008         * powerpc.cc (class Output_data_brlt_powerpc): New.
1009         (class Stub_table, class Stub_control): New.
1010         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1011         stub_table_, set_stub_table, stub_table): New vectors and accessor
1012         functions.
1013         (Target_powerpc::do_may_relax, do_relax, push_branch,
1014         new_stub_table, stub_tables, brlt_section, group_sections,
1015         add_branch_lookup_table, find_branch_lookup_table,
1016         write_branch_lookup_table, make_brlt_section): New functions.
1017         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1018         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1019         branch_info_): New vars.
1020         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1021         make call stubs here.
1022         (Output_data_glink): Remove all call stub handling from this class.
1023         (Target_powerpc::Scan::local, global): Save interesting branch
1024         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1025         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1026         functions on final link.
1027         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1028         Handle long branch destinations too.
1029         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1030         do_plt_address_for_local): Adjust lookup of plt call stubs.
1031
1032 2012-11-30  Alan Modra  <amodra@gmail.com>
1033
1034         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1035         relocs against protected symbols when building 32-bit shared libs.
1036
1037 2012-11-30  Alan Modra  <amodra@gmail.com>
1038
1039         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1040         param.  Call got_section() to make .got.  Update all callers
1041         and their callers and so on.
1042
1043 2012-11-30  Alan Modra  <amodra@gmail.com>
1044
1045         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1046         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1047         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1048         value if it already exists.
1049
1050 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1051
1052         PR gold/14858
1053         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1054
1055 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1056
1057         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1058         than bfc instruction for data sandboxing.
1059
1060 2012-11-08  Alan Modra  <amodra@gmail.com>
1061
1062         * po/POTFILES.in: Regenerate.
1063
1064 2012-11-05  Alan Modra  <amodra@gmail.com>
1065
1066         * configure.ac: Apply 2012-09-10 change to config.in here.
1067         * configure: Regenerate.
1068
1069 2012-11-05  Alan Modra  <amodra@gmail.com>
1070
1071         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1072         (struct Opd_ent): Use "Address" rather than "Offset".
1073         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1074         (Target_powerpc::got_section): Make public.
1075         (Target_powerpc::scan_relocs): Move code setting symbols..
1076         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1077         Create _SDA_BASE_ only when referenced.
1078
1079 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1080
1081         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1082         from last change.
1083
1084 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1085
1086         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1087         for offset_in_output_section parameter.
1088         (Sized_target::relocate_special_relocatable): Likewise.
1089         * arm.cc (Target_arm::relocate_relocs): Likewise.
1090         (Target_arm::relocate_special_relocatable): Likewise.
1091         * i386.cc (Target_i386::relocate_relocs): Likewise.
1092         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1093         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1094         * target-reloc.h (relocate_relocs): Likewise.
1095         * testsuite/testfile.cc (Target_test): Likewise.
1096         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1097         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1098
1099         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1100         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1101
1102         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1103         parameter, which is unused in the [!F_SETFD] case.
1104
1105         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1106         SYMNDX to off_t before comparing it to this->data_size().
1107         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1108         * incremental.cc (Output_section_incremental_inputs::do_write):
1109         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1110
1111         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1112
1113 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1114
1115         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1116         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1117         in EABI_VER5.
1118
1119 2012-10-29  Cary Coutant  <ccoutant@google.com>
1120
1121         * dwp.cc (usage): Add file and exit status parameters;
1122         add --help and --version options.
1123         (print_version): New function.
1124         (main): Add --help and --version options.
1125
1126 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1127
1128         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1129         final_layout_sequence.txt.
1130         * testsuite/Makefile.in: Regenerated.
1131
1132 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1133
1134         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1135         COMPILE generated by automake.
1136         (LINK1): Likewise.
1137         (CXXCOMPILE1): Likewise.
1138         (CXXLINK1): Likewise.
1139         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1140         (LINK): Likewise.
1141         (CXXCOMPILE): Likewise.
1142         (CXXLINK): Likewise.
1143         * testsuite/Makefile.in: Regenerated.
1144
1145 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1146
1147         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1148         on bad fwrite return.
1149
1150 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1151
1152         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1153         on val.
1154
1155 2012-10-23  Cary Coutant  <ccoutant@google.com>
1156
1157         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1158         * testsuite/Makefile.in: Regenerate.
1159         * testsuite/dwp_test.h: New source file.
1160         * testsuite/dwp_test_1.cc: New source file.
1161         * testsuite/dwp_test_1.s: New source file.
1162         * testsuite/dwp_test_1.sh: New source file.
1163         * testsuite/dwp_test_1b.cc: New source file.
1164         * testsuite/dwp_test_1b.s: New source file.
1165         * testsuite/dwp_test_2.cc: New source file.
1166         * testsuite/dwp_test_2.s: New source file.
1167         * testsuite/dwp_test_2.sh: New source file.
1168         * testsuite/dwp_test_main.cc: New source file.
1169         * testsuite/dwp_test_main.s: New source file.
1170
1171 2012-10-23  Cary Coutant  <ccoutant@google.com>
1172
1173         * dwp.h: New header file.
1174         * dwp.cc: New source file.
1175         * gold.h: Move shared declarations to system.h.
1176         * system.h: New header file.
1177         * Makefile.am: Add dwp.
1178         * Makefile.in: Regenerate.
1179
1180 2012-10-23  Cary Coutant  <ccoutant@google.com>
1181
1182         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1183         Dwarf_info_reader::read_from_pointer.
1184         (Dwarf_pubnames_table::read_header): Likewise.
1185         (Dwarf_pubnames_table::next_name): Likewise.
1186         (Dwarf_die::read_attributes): Likewise.
1187         (Dwarf_die::skip_attributes): Likewise.
1188         (Dwarf_info_reader::read_from_pointer): New function template.
1189         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1190         (Dwarf_pubnames_table): Likewise.
1191         (Dwarf_info_reader::read_from_pointer): New function template.
1192         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1193         Dwarf_pubnames_table ctor.
1194
1195 2012-10-23  Cary Coutant  <ccoutant@google.com>
1196
1197         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1198         abbrev_shndx.
1199         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1200         abbrev_shndx_.
1201         (Dwarf_info_reader::set_abbrev_shndx): New method.
1202         (Dwarf_info_reader::abbrev_shndx_): New data member.
1203
1204 2012-10-23  Cary Coutant  <ccoutant@google.com>
1205
1206         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1207         from object, not parameters.
1208         (Dwarf_info_reader::parse): Likewise.
1209         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1210         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1211         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1212         methods.
1213
1214 2012-10-23  Cary Coutant  <ccoutant@google.com>
1215
1216         * fileread.cc (Input_file::Input_file): New constructor.
1217         * fileread.h (class Input_file): Add new constructor.
1218
1219 2012-10-18  Alan Modra  <amodra@gmail.com>
1220
1221         PR gold/14727
1222         * object.cc (Relobj::is_section_name_included): Also match
1223         .sdata personality section.
1224
1225 2012-10-18  Alan Modra  <amodra@gmail.com>
1226
1227         * target-reloc.h (class Default_comdat_behavior): New, package up..
1228         (get_comdat_behaviour): ..this.
1229         (relocate_section): Add Relocate_comdat_behavior template arg,
1230         adjust code to suit.
1231         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1232         (Target_arm::scan_reloc_section): Likewise.
1233         * i386.cc (Target_i386::relocate_section): Likewise.
1234         * sparc.cc (Target_sparc::relocate_section): Likewise.
1235         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1236         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1237         * powerpc.cc (class Relocate_comdat_behavior): New.
1238         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1239         gold::relocate_section with new template arg.
1240
1241 2012-10-18  Alan Modra  <amodra@gmail.com>
1242
1243         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1244         dynamic relocs for GOT_TPREL got entries, without symbol if
1245         resolving locally.
1246         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1247         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1248         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1249
1250 2012-10-17  Alan Modra  <amodra@gmail.com>
1251
1252         PR gold/14726
1253         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1254
1255 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1256
1257         * layout.cc (Layout::include_section): Keep sections marked
1258         SHF_EXCLUDE when doing relocatable links.
1259
1260 2012-10-16  Alan Modra  <amodra@gmail.com>
1261
1262         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1263         (Target_powerpc::do_finalize_sections): Call it.
1264         (Output_data_save_res): New class and supporting functions.
1265         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1266         normal symbols defined in object files.
1267
1268 2012-10-12  Alan Modra  <amodra@gmail.com>
1269
1270         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1271         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1272         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1273         section if scan_opd_relocs not yet called.
1274         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1275
1276 2012-10-12  Alan Modra  <amodra@gmail.com>
1277
1278         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1279         add_local_ifunc_entry): Revert last change.
1280         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1281
1282 2012-10-05  Alan Modra  <amodra@gmail.com>
1283
1284         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1285         do_plt_address_for_global): New functions.
1286         (Output_data_got_powerpc::do_write): Don't segfault when linking
1287         statically.
1288         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1289         add_local_ifunc_entry): Return true on adding entry..
1290         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1291         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1292         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1293         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1294         set up symbols here.
1295         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1296         syms here.  Do so even when no .iplt.  Don't segfault when linking
1297         statically.
1298         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1299         new variants without reloc param.
1300         (Glink_sym_ent::Glink_sym_ent): Likewise.
1301         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1302         reloc when refs will resolve to plt call stub.
1303         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1304         R_PPC_PLTREL24 to resolve locally.
1305         (Target_powerpc::Scan::global): Correct ifunc handling.
1306         (Target_powerpc::Relocate::relocate): Correct local sym glink
1307         lookup.  Don't destroy "value" when we have a plt call stub,
1308         and when checking plt call validity.
1309         (Target_powerpc::do_dynsym_value): Simplify.
1310
1311 2012-10-05  Alan Modra  <amodra@gmail.com>
1312
1313         * i386.cc (Output_data_plt_i386::address_for_global,
1314         address_for_local): Add plt offset to returned value.  Adjust uses.
1315         * sparc.cc (Output_data_plt_sparc::address_for_global,
1316         address_for_local): Likewise.
1317         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1318         address_for_local): Likewise.
1319         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1320         address_for_local): Likewise.
1321         * target.h (Target::plt_address_for_global, plt_address_for_local):
1322         Update comment.
1323         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1324         (Output_data_got::Got_entry::write): Nor here.
1325         * output.h: Comment fix.
1326
1327 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1328
1329         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1330         global_offset_table_ value for larget got.
1331         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1332
1333 2012-09-29  Alan Modra  <amodra@gmail.com>
1334
1335         * powerpc.cc (Target_powerpc::iplt_): New output section.
1336         (Target_powerpc::iplt_section, make_iplt_section,
1337         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1338         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1339         Target_powerpc::plt_entry_count): Count iplt entries too.
1340         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1341         reloc section in constructor.  New params.
1342         (Target_powerpc::make_plt_section): Create reloc section here instead.
1343         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1344         functions.
1345         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1346         (Output_data_glink::add_entry, find_entry): New functions to
1347         deal with local syms.
1348         (Glink_sym_ent): Add support for local syms.
1349         (Output_data_glink::do_write): Handle ifunc plt entries.
1350         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1351         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1352         (Target_powerpc::Relocate::relocate): Likewise.
1353         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1354
1355 2012-09-25  Alan Modra  <amodra@gmail.com>
1356
1357         * object.h (Sized_relobj_file::adjust_local_symbol,
1358         do_adjust_local_symbol): New functions.
1359         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1360         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1361         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1362         and irregular opd entry spacing.
1363         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1364         (Global_symbol_visitor_opd): New functor.
1365         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1366         on deleted opd entries.
1367
1368 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1369
1370         * tilegx.cc: New file.
1371         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1372         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1373         * configure.tgt: Add entries for tilegx*.
1374         * configure.ac: Likewise.
1375         * Makefile.in: Rebuild.
1376         * configure: Likewise.
1377         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1378         tilegx.
1379
1380 2012-09-13  Alan Modra  <amodra@gmail.com>
1381
1382         * target-reloc.h (scan_relocs): Call scan.local for relocs
1383         against symbols in discarded sections.  Pass is_discarded
1384         param.
1385         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1386         Add is_discarded param.
1387         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1388         is_discarded to flag opd entry as discarded.  Don't emit dyn
1389         relocs on such entries.
1390         (Target_powerpc::Scan::global): Similarly detect and handle
1391         such opd entries.
1392         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1393         opd_ent_.  Update all uses.
1394         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1395         (Target_powerpc::relocate_section): Zero out discarded opd
1396         entry relocs.
1397
1398 2012-09-12  Ian Lance Taylor  <iant@google.com>
1399
1400         PR gold/14570
1401         * output.cc: Rename Output_data_got template parameter from size
1402         to got_size for all functions.  Compile all variants of
1403         Output_data_got.
1404         (Output_data_got::Got_entry::write): Correct use of size for
1405         symbol value.  Use local_is_tls rather than casting to
1406         Sized_relobj_file.
1407         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1408         (class Sized_relobj_file): Add do_local_is_tls.
1409         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1410
1411 2012-09-11  Alan Modra  <amodra@gmail.com>
1412
1413         PR gold/14566
1414         * layout.cc (Layout::set_segment_offsets): When using
1415         common-page-size alignment, ensure we are on a new max-page-size
1416         page.
1417         * output.cc (Output_segment::set_section_addresses): Use
1418         abi_pagesize, not common_pagesize for relro boundary.
1419         (Output_segment::set_offset): Likewise.
1420
1421 2012-09-11  Alan Modra  <amodra@gmail.com>
1422
1423         * output.h (Output_data_got::add_global_tls, add_local_tls,
1424         add_local_tls_pair): New functions.
1425         (Output_data_got::add_local_pair_with_rel): Remove second
1426         reloc param.  Expand comment.
1427         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1428         use_plt_or_tls_offset_, similarly for constructor param.
1429         (Output_data_got::Got_entry::write): Add got_index param.
1430         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1431         add_local_tls_pair): New functions.
1432         (Output_data_got::Got_entry::write): Handle tls symbols
1433         with use_plt_or_tls_offset_ set specially.
1434         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1435         (Output_data_got::do_write): Replace iterator with index, pass
1436         index to entry write function.
1437         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1438         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1439         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1440         call.
1441         * i386.cc (Target_i386::Scan::local): Likewise.
1442         * sparc.cc (Target_sparc::Scan::local): Likewise.
1443         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1444         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1445         do_tls_offset_for_global): New functions.
1446         (Target_powerpc::Scan::local): Correct TLS relocations and got
1447         entry values.
1448         (Target_powerpc::Scan::global): Don't emit unnecessary
1449         dynamic relocations on TLS GOT entries.
1450
1451 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1452
1453         * config.in: Disable sanity check for kfreebsd.
1454
1455 2012-09-10  Sterling Augustine  <saugustine@google.com>
1456
1457         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1458         (Gdb_index::pubtypes_read): New parameter.
1459         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1460         to calls.
1461         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1462         pubtypes_object_.
1463
1464 2012-09-09  Alan Modra  <amodra@gmail.com>
1465
1466         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1467         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1468         * gc.h (gc_process_relocs): Call target gc_add_reference.
1469         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1470         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1471         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1472         unnecessary cast.
1473         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1474         to cater for when we don't need code offset.  Update use.
1475         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1476         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1477         set_opd_valid): New functions.
1478         (Target_powerpc::do_gc_add_reference): New function.
1479         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1480         stashed refs.
1481         (Target_powerpc::do_gc_mark_symbol): New function.
1482
1483 2012-09-06  Cary Coutant  <ccoutant@google.com>
1484
1485         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1486         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1487         (Dwarf_die::skip_attributes): Likewise.
1488         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1489         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1490         (main): Call it.
1491         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1492
1493 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1494
1495         * testsuite/script_test_3.t: Add .got.plt output section
1496         statement.
1497         * testsuite/script_test_4.t: Likewise.
1498
1499 2012-09-05  Alan Modra  <amodra@gmail.com>
1500
1501         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1502         update all uses and lose "enum" when using type.
1503
1504 2012-09-05  Alan Modra  <amodra@gmail.com>
1505
1506         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1507         * configure: Regenerate.
1508         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1509         (plugin_final_layout.stdout): Likewise.
1510         (memory_test): Set page sizes to 0x1000.
1511         * testsuite/Makefile.in: Regenerate.
1512         * testsuite/discard_locals_test.sh: Add FIXME comment.
1513         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1514         * testsuite/pr14265.t: Add .got output section statement.
1515         * testsuite/script_test_2.t: Likewise.
1516         * testsuite/script_test_3.t: Likewise.
1517         * testsuite/script_test_4.t: Likewise.
1518         * testsuite/script_test_5.t: Likewise.
1519         * testsuite/script_test_6.t: Likewise.
1520         * testsuite/script_test_7.t: Likewise.
1521         * testsuite/script_test_9.t: Likewise.
1522
1523 2012-09-05  Alan Modra  <amodra@gmail.com>
1524
1525         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1526         (Powerpc_relocate_functions::Status): New typedef.
1527         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1528         (Target_powerpc::Scan::local): Handle REL64.
1529         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1530         for REL32 and REL64.
1531         (Target_powerpc::symval_for_branch): New function, extracted from..
1532         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1533         checks.  Report overflow errors.
1534
1535 2012-09-05  Alan Modra  <amodra@gmail.com>
1536
1537         * object.h (Sized_relobj_file::emit_relocs): Delete.
1538         (Sized_relobj_file::emit_relocs_reltype): Delete.
1539         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1540         relocate_relocs for --emit-relocs.
1541         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1542         * output.h: Update comment.
1543         (Output_segment::first_section): New function.
1544         (Output_segment::first_section_load_address): Use first_section.
1545         * output.cc (Output_segment::first_section): New function extracted..
1546         (Output_segment::first_section_load_address): ..from here.  Delete.
1547         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1548         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1549         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1550         adjust call to target.h function.
1551         * i386.cc (Target_i386): Likewise.
1552         * sparc.cc (Target_sparc): Likewise.
1553         * x86_64.cc (Target_x86_64): Likewise.
1554         * powerpc.cc (Target_powerpc): Likewise.
1555         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1556         first tls section has section symbol for optimised local dynamic
1557         output relocs.
1558         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1559         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1560         optimised tls code.
1561         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1562         Rename to relocate_relocs.  Update error message.
1563
1564 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1565
1566         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1567         --just-symbols.
1568
1569 2012-08-31  Alan Modra  <amodra@gmail.com>
1570
1571         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1572         (Powerpc_relobj::toc_base_offset): New stub function.
1573         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1574         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1575         (Target_powerpc::Relocate::enum skip_tls): New.
1576         (Target_powerpc::call_tls_get_addr_): New var.
1577         (Target_powerpc::is_branch_reloc): Move to file scope.
1578         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1579         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1580         New functions.
1581         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1582         (powerpc_info): Correct common_pagesize for ppc64.
1583         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1584         (Powerpc_relocate_functions): Add overflow check enums and functions.
1585         Add non-shift version of rela, rela_ua.  Delete all rel public
1586         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1587         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1588         addr16_ha3, addr14 functions.
1589         (Output_data_got_powerpc::add_constant_pair): New function.
1590         (Output_data_got_powerpc::got_base_offset): Likewise.
1591         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1592         (instruction constants): Sort, add some more.
1593         (Output_data_glink::do_write): Add and use Address typedef.  Use
1594         object->toc_base_offset() stub for 64-bit.
1595         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1596         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1597         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1598         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1599         Always treat .opd relocs as against locally defined symbol.
1600         Correct condition for RELATIVE relocs.
1601         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1602         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1603         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1604         calculations.  Handle TLS relocs, and more.  Add overflow
1605         checking and adjust for Powerpc_relocate_functions changes.
1606         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1607         Reinstate --emit-relocs code with FIXME.
1608
1609 2012-08-30  Alan Modra  <amodra@gmail.com>
1610
1611         * layout.cc (Layout::set_segment_offsets): Set p_align to
1612         abi_pagesize, not common_pagesize.
1613         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1614         to determine whether file header can go in segment.
1615
1616 2012-08-30  Alan Modra  <amodra@gmail.com>
1617
1618         * output.h (Output_reloc::Output_reloc <output section>): Add
1619         is_relative param.  Adjust calls.
1620         (Output_reloc::add_output_section_relative): New functions.
1621         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1622         is_relative.
1623         (Output_reloc::symbol_value): Handle SECTION_CODE.
1624
1625 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1626
1627         * gold.cc (queue_middle_tasks): Call layout again when unique
1628         segments for sections is desired.
1629         * layout.cc (Layout::Layout): Initialize new members.
1630         (Layout::get_output_section_flags): New function.
1631         (Layout::choose_output_section): Call get_output_section_flags.
1632         (Layout::layout): Make output section for mapping to a unique segment.
1633         (Layout::insert_section_segment_map): New function.
1634         (Layout::attach_allocated_section_to_segment): Make unique segment for
1635         output sections marked so.
1636         (Layout::segment_precedes): Check for unique segments when sorting.
1637         * layout.h (Layout::Unique_segment_info): New struct.
1638         (Layout::Section_segment_map): New typedef.
1639         (Layout::insert_section_segment_map): New function.
1640         (Layout::get_output_section_flags): New function.
1641         (Layout::is_unique_segment_for_sections_specified): New function.
1642         (Layout::set_unique_segment_for_sections_specified): New function.
1643         (Layout::unique_segment_for_sections_specified_): New member.
1644         (Layout::section_segment_map_): New member.
1645         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1646         Rename is_gc_pass_one to is_pass_one.
1647         Rename is_gc_pass_two to is_pass_two.
1648         Rename is_gc_or_icf to is_two_pass.
1649         Check for which pass based on whether symbols data is present.
1650         Make it two pass when unique segments for sections is desired.
1651         * output.cc (Output_section::Output_section): Initialize new
1652         members.
1653         * output.h (Output_section::is_unique_segment): New function.
1654         (Output_section::set_is_unique_segment): New function.
1655         (Output_section::is_unique_segment_): New member.
1656         (Output_section::extra_segment_flags): New function.
1657         (Output_section::set_extra_segment_flags): New function.
1658         (Output_section::extra_segment_flags_): New member.
1659         (Output_section::segment_alignment): New function.
1660         (Output_section::set_segment_alignment): New function.
1661         (Output_section::segment_alignment_): New member.
1662         (Output_segment::Output_segment): Initialize is_unique_segment_.
1663         (Output_segment::is_unique_segment): New function.
1664         (Output_segment::set_is_unique_segment): New function.
1665         (Output_segment::is_unique_segment_): New member.
1666         * plugin.cc (allow_unique_segment_for_sections): New function.
1667         (unique_segment_for_sections): New function.
1668         (Plugin::load): Add new functions to transfer vector.
1669         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1670         * Makefile.in: Regenerate.
1671         * testsuite/plugin_final_layout.sh: Check if unique segment
1672         functionality works.
1673         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1674         are available.
1675         (allow_unique_segment_for_sections): New global.
1676         (unique_segment_for_sections): New global.
1677         (claim_file_hook): Call allow_unique_segment_for_sections.
1678         (all_symbols_read_hook): Call unique_segment_for_sections.
1679
1680 2012-08-22  Cary Coutant  <ccoutant@google.com>
1681
1682         * layout.cc (Layout::include_section): Don't assert on GROUP
1683         sections with --emit-relocs.
1684
1685 2012-08-21  Cary Coutant  <ccoutant@google.com>
1686
1687         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1688         if --export-dynamic-symbol names an undef symbol.
1689
1690 2012-08-18  Alan Modra  <amodra@gmail.com>
1691
1692         * powerpc.cc: Formatting and white space.
1693         (Powerpc_relobj): Rename got2_section_ to special_.
1694         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1695         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1696         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1697         (Target_powerpc): Add Address typedef and invalid_address.  Use
1698         throughout.
1699         (Target_powerpc::is_branch_reloc): New function.
1700         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1701         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1702         for dst_mask, value and addend.
1703         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1704         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1705         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1706         uint16_t for 24-bit offset.  Use get_output_section_offset and
1707         check return.
1708         (Target_powerpc::Scan::local): Handle more relocs.
1709         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1710         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1711         Plug in toc restoring insn after plt calls.  Translate branches
1712         to function descriptor symbols to corresponding entry point.
1713         (Target_powerpc::relocate_for_relocatable): Check return from
1714         get_output_section_offset.
1715         * symtab.h: Comment typo.
1716
1717 2012-08-14  Ian Lance Taylor  <iant@google.com>
1718
1719         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1720         unsupported_relocal_local to call unsupported_reloc_global.
1721
1722 2012-08-14  Nick Clifton  <nickc@redhat.com>
1723
1724         PR ld/14265
1725         * script-sections.cc (Sections_element::output_section_name): Add
1726         keep return parameter.
1727         (Output_section_element::match_name): Add keep return parameter.
1728         Return the value of the keep_ member.
1729         * script-sections.h (class Output_section): Update
1730         output_section_name prototype.
1731         * layout.cc (Layout::keep_input_section): New public member
1732         function.
1733         (Layout::choose_output_section): Pass keep parameter to
1734         output_section_name.
1735         * layout.h (class Layout): Add keep_input_section.
1736         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1737         sections.
1738         * testsuite/Makefile.am: Add a test.
1739         * testsuite/Makefile.in: Regenerate.
1740         * testsuite/pr14265.c: Source file for the test.
1741         * testsuite/pr14265.t: Linker script for the test.
1742         * testsuite/pr14265.sh: Shell script for the test.
1743
1744 2012-08-14  Alan Modra  <amodra@gmail.com>
1745
1746         * target.h (Target::output_section_name): New function.
1747         (Target::do_output_section_name): New function.
1748         * layout.cc (Layout::choose_output_section): Call the above.
1749         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1750
1751 2012-08-14  Alan Modra  <amodra@gmail.com>
1752
1753         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1754         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1755         for replace_constant call.
1756         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1757         (Output_data_glink::do_print_to_mapfile): New function.
1758         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1759         (Target_powerpc::Relocate::relocate): Likewise.
1760
1761 2012-08-14  Alan Modra  <amodra@gmail.com>
1762
1763         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1764         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1765         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1766         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1767         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1768         here.
1769         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1770         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1771         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1772         here.
1773         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1774         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1775
1776 2012-08-12  Alan Modra  <amodra@gmail.com>
1777
1778         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1779         (glink insn constants): Use uint32_t.
1780         (Output_data_glink::add_entry): Use insert, not [] operator.
1781
1782 2012-08-11  Alan Modra  <amodra@gmail.com>
1783
1784         * object.h (Sized_relobj_file::find_shdr): New function.
1785         (Sized_relobj_file::find_special_sections): New function.
1786         * object.cc (Sized_relobj_file::find_shdr): New function.
1787         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1788         (Sized_relobj_file::find_special_sections): New function, split out..
1789         (Sized_relobj_file::do_read_symbols): ..from here.
1790         * output.h (Output_data_got::replace_constant): New function.
1791         (Output_data_got::num_entries): New function.
1792         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1793         (Output_data_got::got_offset): Protected rather than private.
1794         (Output_data_got::replace_got_entry): New function.
1795         * output.cc (Output_data_got::replace_got_entry): New function.
1796         * powerpc.cc (class Powerpc_relobj): New.
1797         (class Powerpc_relocate_functions): Delete all psymval variants or
1798         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1799         Implement _ha functions using corresponding _hi function.
1800         (Powerpc_relobj::find_special_sections): New function.
1801         (Target_powerpc::do_make_elf_object): New function.
1802         (class Output_data_got_powerpc): New.
1803         (class Output_data_glink): New.
1804         (class Powerpc_scan_relocatable_reloc): New.
1805         Many more changes througout file.
1806
1807 2012-08-09  Nick Clifton  <nickc@redhat.com>
1808
1809         * po/vi.po: Updated Vietnamese translation.
1810
1811 2012-08-07  Ian Lance Taylor  <iant@google.com>
1812
1813         * layout.cc (Layout::add_target_dynamic_tags): If
1814         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1815         plt_rel.
1816
1817 2012-07-30  Nick Clifton  <nickc@redhat.com>
1818
1819         * po/gold.pot: Updated template.
1820         * po/es.po: Updated Spanish translation.
1821
1822 2012-07-18  Cary Coutant  <ccoutant@google.com>
1823
1824         PR gold/14344
1825         * configure.ac: Add check for -gpubnames support.
1826         * configure: Regenerate.
1827         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1828         support; force -gno-pubnames.
1829         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1830         support.
1831         (gdb_index_test_4): New test.
1832         * testsuite/Makefile.in: Regenerate.
1833         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1834         * testsuite/gdb_index_test_2.sh: Likewise.
1835         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1836         * testsuite/gdb_index_test_4.sh: New script.
1837         * testsuite/gdb_index_test_comm.sh: New script with common code;
1838         don't look for space after colon.
1839
1840 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1841
1842         * gold.cc (queue_middle_tasks): Update function order only after
1843         deferred objects due to plugins are processed.
1844
1845 2012-07-11  Ian Lance Taylor  <iant@google.com>
1846
1847         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1848         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1849         (Target_arm::scan_reloc_for_stub): Likewise.
1850         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1851         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1852         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1853         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1854         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1855
1856 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1857             Ian Lance Taylor  <iant@google.com>
1858
1859         PR gold/14309
1860         * configure.ac: Test whether std::tr1::hash<off_t> works.
1861         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1862         needed.
1863         * output.h (class Output_fill): Add virtual destructor.
1864         * configure, config.in: Rebuild.
1865
1866 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1867
1868         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1869
1870 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1871
1872         * plugin.cc (Plugin::load): Handle position independent executables.
1873
1874 2012-06-06  Cary Coutant  <ccoutant@google.com>
1875
1876         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1877         add .debug_macro.
1878         (lines_only_debug_sections): Likewise.
1879         (gdb_fast_lookup_sections): New static array.
1880         (is_gdb_debug_section): Rename formal parameter.
1881         (is_lines_only_debug_section): Likewise.
1882         (is_gdb_fast_lookup_section): New function.
1883         (Layout::include_section): Check for ".zdebug_" prefix; pass
1884         section name suffix to is_gdb_debug_section, et al.; check for
1885         fast-lookup sections when building .gdb_index.
1886         * options.h (--strip-debug-gdb): Update GDB version number.
1887
1888 2012-06-06  Cary Coutant  <ccoutant@google.com>
1889
1890         * configure.ac: Add check for fallocate.
1891         * configure: Regenerate.
1892         * config.in: Regenerate.
1893
1894         * options.h (class General_options): Add --mmap-output-file and
1895         --posix-fallocate options.
1896         * output.cc: (posix_fallocate): Remove; replace with...
1897         (gold_fallocate): New function.
1898         (Output_file::map_no_anonymous): Call gold_fallocate.
1899         (Output_file::map): Check --mmap-output-file option.
1900
1901 2012-06-05  Jing Yu  <jingyu@google.com>
1902
1903         * gold.h (textdomain): Add do {} to empty while(0).
1904         (bindtextdomain): Likewise.
1905
1906 2012-06-04  Cary Coutant  <ccoutant@google.com>
1907
1908         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1909         has_dynsym_index.
1910
1911 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1912
1913         * symtab.cc (Symbol_table::define_special_symbol):
1914         Initialize *poldsym to prevent uninitialized variable errors.
1915
1916 2012-05-23  Cary Coutant  <ccoutant@google.com>
1917
1918         * layout.cc (Layout::section_name_mapping): Add rules to handle
1919         exact match on .data.rel.ro.local or .data.rel.ro.
1920         (Layout::output_section_name): Check for exact matches.
1921
1922 2012-05-23  Cary Coutant  <ccoutant@google.com>
1923
1924         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1925         more carefully.
1926
1927 2012-05-22  Cary Coutant  <ccoutant@google.com>
1928
1929         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1930         object before exporting symbol.
1931
1932 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1933
1934         * testsuite/tls_test.cc: Include "config.h" first.
1935         * testsuite/tls_test_c.c: Likewise.
1936
1937 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1938             Nick Clifton  <nickc@redhat.com>
1939
1940         PR 14072
1941         * configure.in: Add check that sysdep.h has been included before
1942         any system header files.
1943         * configure: Regenerate.
1944         * config.in: Regenerate.
1945
1946 2012-05-14  Cary Coutant  <ccoutant@google.com>
1947
1948         * layout.cc (Layout::make_output_section): Mark .tdata section
1949         as RELRO.
1950         * testsuite/relro_test.cc: Add a TLS variable.
1951
1952 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1953
1954         PR gold/14091
1955         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1956         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1957         R_X86_64_64.
1958
1959 2012-05-08  Cary Coutant  <ccoutant@google.com>
1960
1961         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1962         (lines_only_debug_sections): Likewise.
1963
1964 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1965
1966         * nacl.cc: New file.
1967         * nacl.h: New file.
1968         * Makefile.am (CCFILES, HFILES): Add them.
1969         * Makefile.in: Regenerate.
1970         * i386.cc (Output_data_plt_i386_nacl): New class.
1971         (Output_data_plt_i386_nacl_exec): New class.
1972         (Output_data_plt_i386_nacl_dyn): New class.
1973         (Target_i386_nacl): New class.
1974         (Target_selector_i386_nacl): New class.
1975         (target_selector_i386): Use it instead of Target_selector_i386.
1976         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1977         (Target_x86_64_nacl): New class.
1978         (Target_selector_x86_64_nacl): New class.
1979         (target_selector_x86_64, target_selector_x32): Use it instead of
1980         Target_selector_x86_64.
1981         * arm.cc (Output_data_plt_arm_nacl): New class.
1982         (Target_arm_nacl): New class.
1983         (Target_selector_arm_nacl): New class.
1984         (target_selector_arm, target_selector_armbe): Use it instead of
1985         Target_selector_arm.
1986
1987         * target-select.cc (select_target): Take new Input_file* and off_t
1988         arguments, pass them on to recognize method of selector.
1989         * object.cc (make_elf_sized_object): Update caller.
1990         * parameters.cc (parameters_force_valid_target): Likewise.
1991         * incremental.cc (make_sized_incremental_binary): Likewise.
1992         * target-select.h: Update decl.
1993         (Target_selector::recognize): Take new Input_file* argument,
1994         pass it on to do_recognize.
1995         (Target_selector::do_recognize): Take new Input_file* argument.
1996         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1997         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1998         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1999         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2000
2001         * target.h (Target::Target_info): New members isolate_execinstr
2002         and rosegment_gap.
2003         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2004         * arm.cc (Target_arm::arm_info): Update initializer.
2005         * i386.cc (Target_i386::i386_info): Likewise.
2006         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2007         * sparc.cc (Target_sparc::sparc_info): Likewise.
2008         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2009         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2010         * layout.cc (Layout::attach_allocated_section_to_segment):
2011         Take new const Target* argument.  If target->isolate_execinstr(), act
2012         like --rosegment.
2013         (Layout::find_first_load_seg): Take new const Target* argument;
2014         if target->isolate_execinstr(), reject PF_X segments.
2015         (Layout::relaxation_loop_body): Update caller.
2016         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2017         reset file offset to zero when we hit LOAD_SEG, and then do a second
2018         loop over the segments before LOAD_SEG to reassign offsets after
2019         addresses have been determined.  Handle target->rosegment_gap().
2020         (Layout::attach_section_to_segment): Take new const Target* argument;
2021         pass it to attach_allocated_section_to_segment.
2022         (Layout::make_output_section): Update caller.
2023         (Layout::attach_sections_to_segments): Take new const Target* argument;
2024         pass it to attach_section_to_segment.
2025         * gold.cc (queue_middle_tasks): Update caller.
2026         * layout.h (Layout): Update method decls with new arguments.
2027
2028         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2029         Target_info pointer to use.
2030         (Target_arm::do_make_data_plt): New virtual method.
2031         (Target_arm::make_data_plt): New method that calls it.
2032         (Target_arm::make_plt_entry): Use it.
2033         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2034         for the section alignment.
2035         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2036         method.
2037         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2038         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2039         method.
2040         (Output_data_plt_arm::get_plt_entry_size): Call it.
2041         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2042         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2043         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2044         method.
2045         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2046         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2047         method instead of sizeof(plt_entry).
2048         (Output_data_plt_arm::add_entry): Likewise.
2049         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2050         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2051         than static method.
2052         (Target_arm::plt_entry_size): Likewise.
2053         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2054         Move to ...
2055         (Output_data_plt_arm_standard): ... here, new class.
2056         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2057         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2058         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2059
2060         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2061         Take additional argument for the PLT entry size.
2062         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2063         Use get_plt_entry_size method rather than plt_entry_size variable.
2064         (Output_data_plt_x86_64::reserve_slot): Likewise.
2065         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2066         (Output_data_plt_x86_64::add_entry): Likewise.
2067         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2068         (Output_data_plt_x86_64::address_for_global): Likewise.
2069         (Output_data_plt_x86_64::address_for_local): Likewise.
2070         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2071         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2072         Make method non-static.
2073         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2074         method.
2075         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2076         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2077         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2078         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2079         virtual method.
2080         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2081         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2082         virtual method.
2083         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2084         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2085         virtual method.
2086         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2087         (Output_data_plt_x86_64::plt_entry_size)
2088         (Output_data_plt_x86_64::first_plt_entry)
2089         (Output_data_plt_x86_64::plt_entry)
2090         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2091         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2092         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2093         (Output_data_plt_x86_64_standard): ... here, new class.
2094         (Target_x86_64::Target_x86_64): Take optional argument for the
2095         Target_info pointer to use.
2096         (Target_x86_64::do_make_data_plt): New virtual method.
2097         (Target_x86_64::make_data_plt): New method to call it.
2098         (Target_x86_64::init_got_plt_for_update): Use that.
2099         Call this->plt_->add_eh_frame method here.
2100         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2101         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2102         rather than static method.
2103         (Target_x86_64::plt_entry_size): Likewise.
2104         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2105         rather than plt_entry_size variable.  Move guts of PLT filling to...
2106         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2107         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2108         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2109
2110         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2111         additional argument for the section alignment.
2112         Don't do add_eh_frame_for_plt here.
2113         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2114         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2115         variable.
2116         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2117         method.
2118         (Output_data_plt_i386::get_plt_entry_size): Call it.
2119         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2120         (Output_data_plt_i386::add_eh_frame): New method to call it.
2121         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2122         method.
2123         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2124         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2125         method.
2126         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2127         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2128         method instead of plt_entry_size.
2129         (Output_data_plt_i386::plt_entry_size)
2130         (Output_data_plt_i386::plt_eh_frame_fde_size)
2131         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2132         (Output_data_plt_i386_standard): ... here, new class.
2133         (Output_data_plt_i386_exec): New class.
2134         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2135         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2136         (Output_data_plt_i386::exec_plt_entry): Move to ...
2137         (Output_data_plt_i386_exec::plt_entry): ... here.
2138         (Output_data_plt_i386_dyn): New class.
2139         (Output_data_plt_i386::first_plt_entry): Move to ...
2140         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2141         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2142         (Output_data_plt_i386_dyn::plt_entry): ... here.
2143         (Target_i386::Target_i386): Take optional argument for the Target_info
2144         pointer to use.
2145         (Target_i386::do_make_data_plt): New virtual method.
2146         (Target_i386::make_data_plt): New method to call it.
2147         (Target_i386::make_plt_section): Use that.
2148         Call this->plt_->add_eh_frame method here.
2149         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2150         rather than plt_entry_size variable.
2151         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2152         (Output_data_plt_i386::address_for_local): Likewise.
2153         (Output_data_plt_i386::do_write): Likewise.
2154         Move guts of PLT filling to...
2155         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2156         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2157         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2158         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2159
2160 2012-05-01  Cary Coutant  <ccoutant@google.com>
2161
2162         * dwarf_reader.cc (Dwarf_die::read_attributes)
2163         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2164         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2165         * reduced_debug_output.cc
2166         (Output_reduced_debug_info_section::get_die_end): Remove
2167         DW_FORM_GNU_ref_index.  Add default case.
2168
2169 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2170
2171         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2172         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2173         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2174         DW_AT_high_pc as offset from DW_AT_low_pc.
2175
2176         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2177         * testsuite/Makefile.in: Regenerate.
2178         * testsuite/gdb_index_test_3.c: New test source file.
2179         * testsuite/gdb_index_test_3.sh: New test source file.
2180
2181 2012-04-25  Ian Lance Taylor  <iant@google.com>
2182
2183         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2184         pointer.
2185         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2186         as a class, not a struct.
2187         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2188         (Target_arm::apply_cortex_a8_workaround): Likewise.
2189         * gc.h: Declare Reloc_types as a struct, not a class.
2190         * object.h: Declare Symbols_data as a struct.
2191         * reloc.h: Declare Read_relocs_data as a struct.
2192         * target.h: Declare Relocate_info as a struct.
2193
2194 2012-04-24  David S. Miller  <davem@davemloft.net>
2195
2196         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2197         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2198         and R_SPARC_WPLT30.
2199
2200 2012-04-24  Cary Coutant  <ccoutant@google.com>
2201
2202         * incremental-dump.cc (find_input_containing_global): Replace
2203         magic number with symbolic constant.
2204         (dump_incremental_inputs): Update version number.
2205         * incremental.cc (Output_section_incremental_inputs): Update version
2206         number; import symbolic constants from Incremental_inputs_reader.
2207         (Incremental_inputs::create_data_sections): Align relocations
2208         section correctly for 64-bit targets.
2209         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2210         constants; add padding.
2211         (Output_section_incremental_inputs::write_header): Add assert for
2212         header_size.
2213         (Output_section_incremental_inputs::write_input_files): Add assert
2214         for input_entry_size.
2215         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2216         add assert for object_info_size, input_section_entry_size,
2217         global_sym_entry_size.
2218         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2219         for data structure sizes; use them.
2220         (Incremental_input_entry_reader): Import symbolic constants from
2221         Incremental_inputs_reader; use them.
2222
2223 2012-04-23  David S. Miller  <davem@davemloft.net>
2224
2225         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2226         and elf_flags_set_.
2227         (Target_sparc::Target_sparc): Initialize new fields.
2228         (Target_sparc::do_make_elf_object): New function.
2229         (Target_sparc::do_adjust_elf_header): New function.
2230
2231 2012-04-23  Cary Coutant  <ccoutant@google.com>
2232
2233         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2234         CU range table of gdb index.
2235
2236 2012-04-20  David S. Miller  <davem@davemloft.net>
2237
2238         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2239         instead of false.
2240
2241 2012-04-16  David S. Miller  <davem@davemloft.net>
2242
2243         * sparc.cc (Target_sparc::got_address): New function.
2244         (Sparc_relocate_functions::gdop_hix22): New function.
2245         (Sparc_relocate_functions::gdop_lox10): New function.
2246         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2247         relocs.
2248         (Target_sparc::Scan::local): Likewise if the global symbol is not
2249         preemptible and is not IFUNC.
2250         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2251         transformations for local and non-preemptible non-IFUNC global
2252         symbols.
2253
2254         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2255         writing out 64-bit part of ranges.
2256
2257         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2258         -fpic and -fpie respectively.
2259         * Makefile.in: Regenerate.
2260
2261         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2262         (Target_sparc::Target_sparc): Initialize new field.
2263         (Target_sparc::do_plt_section_for_global): New function.
2264         (Target_sparc::do_plt_section_for_local): New function.
2265         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2266         (Target_sparc::make_plt_section): New function, broken out of
2267         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2268         (Target_sparc::make_plt_entry): Call make_plt_section.
2269         (Target_sparc::make_local_ifunc_plt_entry): New function.
2270         (Target_sparc::rela_ifunc_section): New function.
2271         (Target_sparc::plt_section): Remove const.
2272         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2273         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2274         and ifunc_count_ fields.
2275         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2276         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2277         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2278         (Output_data_plt_sparc::rela_ifunc): New function.
2279         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2280         (Output_data_plt_sparc::has_ifunc_section): New function.
2281         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2282         (Output_data_plt_sparc::address_for_global): New function.
2283         (Output_data_plt_sparc::address_for_local): New function.
2284         (Output_data_plt_sparc::plt_index_to_offset): New function.
2285         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2286         and entry_count.
2287         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2288         entry_count.
2289         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2290         R_SPARC_JMP_IREL to switch.
2291         (Target_sparc::Scan::check_non_pic): Likewise.
2292         (Target_sparc::Scan::local): Handle IFUNC symbols.
2293         (Target_sparc::Scan::local): Likewise.
2294         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2295         and plt_address_for_local.
2296         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2297         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2298
2299         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2300         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2301         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2302         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2303         global relocs too.
2304         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2305         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2306         calls.
2307         * sparc.cc (Target_sparc::Scan::global): Likewise.
2308         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2309
2310 2012-04-16  Cary Coutant  <ccoutant@google.com>
2311
2312         * archive.cc (Library_base::should_include_member): Check for
2313         --export-dynamic-symbol.
2314         * options.h (class General_options): Add --export-dynamic-symbol.
2315         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2316         --export-dynamic-symbol.
2317         (Symbol_table::gc_mark_undef_symbols): Likewise.
2318         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2319
2320 2012-04-12  David S. Miller  <davem@davemloft.net>
2321
2322         * sparc.cc (Reloc::wdisp10): New relocation method.
2323         (Reloc::h34): Likewise.
2324         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2325         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2326         R_SPARC_WDISP10.
2327         (Target_sparc::Scan::local): Likewise.
2328         (Target_sparc::Scan::global): Likewise.
2329         (Target_sparc::Relocate::relocate): Likewise.
2330
2331 2012-04-09  Cary Coutant  <ccoutant@google.com>
2332
2333         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2334         low_pc == 0.
2335
2336 2012-04-06  Ian Lance Taylor  <iant@google.com>
2337
2338         * timer.cc: #include <unistd.h>.
2339
2340 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2341
2342         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2343         * config.in: Regenerate.
2344         * configure: Regenerate.
2345
2346 2012-04-05  Nick Clifton  <nickc@redhat.com>
2347
2348         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2349         (AM_LC_MESSAGES): Add.
2350         * aclocal.m4: Regenerate.
2351         * config.in: Regenerate.
2352         * configure: Regenerate.
2353
2354 2012-03-21  Cary Coutant  <ccoutant@google.com>
2355
2356         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2357         * Makefile.in: Regenerate.
2358         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2359         (Sized_elf_reloc_mapper::symbol_section): New function.
2360         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2361         (make_elf_reloc_mapper): New function.
2362         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2363         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2364         (Dwarf_abbrev_table::do_get_abbrev): New function.
2365         (Dwarf_ranges_table::read_ranges_table): New function.
2366         (Dwarf_ranges_table::read_range_list): New function.
2367         (Dwarf_pubnames_table::read_section): New function.
2368         (Dwarf_pubnames_table::read_header): New function.
2369         (Dwarf_pubnames_table::next_name): New function.
2370         (Dwarf_die::Dwarf_die): New function.
2371         (Dwarf_die::read_attributes): New function.
2372         (Dwarf_die::skip_attributes): New function.
2373         (Dwarf_die::set_name): New function.
2374         (Dwarf_die::set_linkage_name): New function.
2375         (Dwarf_die::attribute): New function.
2376         (Dwarf_die::string_attribute): New function.
2377         (Dwarf_die::int_attribute): New function.
2378         (Dwarf_die::uint_attribute): New function.
2379         (Dwarf_die::ref_attribute): New function.
2380         (Dwarf_die::child_offset): New function.
2381         (Dwarf_die::sibling_offset): New function.
2382         (Dwarf_info_reader::check_buffer): New function.
2383         (Dwarf_info_reader::parse): New function.
2384         (Dwarf_info_reader::do_parse): New function.
2385         (Dwarf_info_reader::do_read_string_table): New function.
2386         (Dwarf_info_reader::lookup_reloc): New function.
2387         (Dwarf_info_reader::get_string): New function.
2388         (Dwarf_info_reader::visit_compilation_unit): New function.
2389         (Dwarf_info_reader::visit_type_unit): New function.
2390         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2391         Sized_elf_reloc_mapper.
2392         (Sized_dwarf_line_info::symbol_section): Remove function.
2393         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2394         (Sized_dwarf_line_info::read_line_mappings): Remove object
2395         parameter, adjust callers.
2396         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2397         * dwarf_reader.h: Include <sys/types.h>.
2398         (class Track_relocs): Remove forward declaration.
2399         (class Elf_reloc_mapper): New class.
2400         (class Sized_elf_reloc_mapper): New class.
2401         (class Dwarf_abbrev_table): New class.
2402         (class Dwarf_range_list): New class.
2403         (class Dwarf_ranges_table): New class.
2404         (class Dwarf_pubnames_table): New class.
2405         (class Dwarf_die): New class.
2406         (class Dwarf_info_reader): New class.
2407         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2408         (Sized_dwarf_line_info::symbol_section): Remove member function.
2409         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2410         base class.
2411         * gdb-index.cc: New source file.
2412         * gdb-index.h: New source file.
2413         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2414         and .debug_types sections, call Layout::add_to_gdb_index.
2415         (Sized_relobj_incr::do_section_name): Implement.
2416         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2417         return type; Implement.
2418         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2419         return type.
2420         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2421         parameter list and return type.
2422         (Sized_incr_dynobj::do_section_contents): Likewise.
2423         * layout.cc: Include gdb-index.h.
2424         (Layout::Layout): Initialize gdb_index_data_.
2425         (Layout::init_fixed_output_section): Check for .gdb_index section.
2426         (Layout::add_to_gdb_index): New function. Instantiate.
2427         * layout.h: Add forward declaration for class Gdb_index.
2428         (Layout::add_to_gdb_index): New member function.
2429         (Layout::gdb_index_data_): New data member.
2430         * main.cc: Include gdb-index.h.
2431         (main): Print statistics for gdb index.
2432         * object.cc (Object::section_contents): Move code into
2433         do_section_contents.
2434         (need_decompressed_section): Check for sections needed when building
2435         gdb index.
2436         (build_compressed_section_map): Likewise.
2437         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2438         gdb index.
2439         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2440         sections; call Layout::add_to_gdb_index.
2441         (Sized_relobj_file::do_decompressed_section_contents): Call
2442         do_section_contents directly.
2443         * object.h (Object::do_section_contents): Adjust parameter list and
2444         return type.
2445         (Object::do_decompressed_section_contents): Call do_section_contents
2446         directly.
2447         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2448         return type.
2449         * options.h (class General_options): Add --gdb-index option.
2450         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2451         list and return type.
2452         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2453         * reloc.h (Track_relocs::checkpoint): New function.
2454         (Track_relocs::reset): New function.
2455
2456         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2457         New test cases.
2458         * testsuite/Makefile.in: Regenerate.
2459         * testsuite/gdb_index_test.cc: New test source file.
2460         * testsuite/gdb_index_test_1.sh: New test source file.
2461         * testsuite/gdb_index_test_2.sh: New test source file.
2462
2463 2012-03-19  Doug Kwan  <dougkwan@google.com>
2464
2465         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2466         (Target_arm::do_finalize_sections): Remove code which defines
2467         __exidx_start and __exidx_end.  Make symbol table parameter
2468         anonymous as it is not used.
2469         * gold.cc (queue_middle_tasks): Call target hook to define any
2470         target-specific symbols.
2471         * target.h (Target::define_standard_symbols): New method.
2472         (Target::do_define_standard_symbols): Same.
2473         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2474         * testsuite/Makefile.in: Regenerate.
2475         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2476         and __exidx_end.
2477         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2478         relocations are generated for __exidx_start and __exidx_end.
2479
2480 2012-03-16  Doug Kwan  <dougkwan@google.com>
2481
2482         * testsuite/Makefile.am: Disable test initpri3b.
2483         * testsuite/Makefile.in: Regenerate.
2484
2485 2012-03-15  Doug Kwan  <dougkwan@google.com>
2486
2487         * arm.cc (Target_arm::got_section): Make .got section read-only
2488         if -z now is given.
2489
2490 2012-03-15  Ian Lance Taylor  <iant@google.com>
2491
2492         PR gold/13850
2493         * layout.cc (Layout::make_output_section): Correctly mark
2494         SHT_INIT_ARRAY, et. al., as relro.
2495
2496 2012-03-14  Doug Kwan  <dougkwan@google.com>
2497
2498         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2499         dynamic relocations for protected symbols in shared objects.
2500
2501 2012-03-13  Ian Lance Taylor  <iant@google.com>
2502
2503         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2504         keep the larger alignment.
2505
2506 2012-03-12  Cary Coutant  <ccoutant@google.com>
2507
2508         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2509         handling of DW_LNE_define_file.
2510
2511 2012-03-12  Cary Coutant  <ccoutant@google.com>
2512
2513         * reduced_debug_output.cc
2514         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2515         codes to switch.
2516
2517 2012-02-29  Cary Coutant  <ccoutant@google.com>
2518
2519         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2520
2521 2012-02-29  Cary Coutant  <ccoutant@google.com>
2522
2523         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2524         Call Object::decompressed_section_contents.
2525         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2526         New dtor.
2527         (Sized_dwarf_line_info::buffer_start_): New data member.
2528         * merge.cc (Output_merge_data::do_add_input_section): Call
2529         Object::decompressed_section_contents.
2530         (Output_merge_string::do_add_input_section): Likewise.
2531         * object.cc (need_decompressed_section): New function.
2532         (build_compressed_section_map): Decompress sections needed later.
2533         (Sized_relobj_file::do_decompressed_section_contents): New function.
2534         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2535         * object.h (Object::decompressed_section_contents): New function.
2536         (Object::discard_decompressed_sections): New function.
2537         (Object::do_decompressed_section_contents): New function.
2538         (Object::do_discard_decompressed_sections): New function.
2539         (Compressed_section_info): New type.
2540         (Compressed_section_map): Include decompressed section contents.
2541         (Sized_relobj_file::do_decompressed_section_contents): New function.
2542         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2543
2544 2012-02-16  Cary Coutant  <ccoutant@google.com>
2545
2546         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2547         * testsuite/Makefile.in: Regenerate.
2548
2549 2012-02-14  Cary Coutant  <ccoutant@google.com>
2550
2551         * options.cc (General_options::finalize): Disallow -pie and -static.
2552
2553 2012-02-03  Doug Kwan  <dougkwan@google.com>
2554
2555         * arm.cc (Arm_relocate_functions::abs8,
2556         Arm_relocate_functions::abs16): Use
2557         Bits::has_signed_unsigned_overflow32.
2558         (Arm_relocate_functions::thm_abs8): Correct range of
2559         overflow check.
2560         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2561         in assertions.
2562
2563 2012-02-02  Doug Kwan  <dougkwan@google.com>
2564
2565         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2566         position independent outputs, not just shared objects.
2567
2568 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2569
2570         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2571         * configure: Regenerated.
2572
2573 2012-01-27  Ian Lance Taylor  <iant@google.com>
2574
2575         * reloc.h (Bits): New class with static functions, copied from
2576         namespace utils in arm.cc.
2577         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2578         instead.
2579
2580 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2581
2582         * incremental.cc (write_info_blocks): Correct relocation offset.
2583
2584 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2585
2586         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2587         (Relocate::tls_gd_to_le): Likewise.
2588
2589 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2590
2591         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2592
2593 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2594
2595         * configure.ac: Check if -mcmodel=medium works.
2596         * configure: Regenerated.
2597
2598 2012-01-24  Cary Coutant  <ccoutant@google.com>
2599
2600         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2601         definition and ...
2602         (read_unsigned_LEB_128_x): ... this new function.
2603         (read_signed_LEB_128): Replaced with inline definition and ...
2604         (read_signed_LEB_128_x): ... this new function.
2605         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2606         (read_unsigned_LEB_128): Add inline definition.
2607         (read_signed_LEB_128_x): New function.
2608         (read_signed_LEB_128): Add inline definition.
2609         * testsuite/Makefile.am (leb128_unittest): New unit test.
2610         * testsuite/Makefile.in: Regenerate.
2611         * testsuite/leb128_unittest.cc: New unit test.
2612
2613 2012-01-23  Ian Lance Taylor  <iant@google.com>
2614
2615         PR gold/13617
2616         * i386.cc (Target_i386::do_code_fill): When using a jmp
2617         instruction, pad with nop instructions.
2618         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2619
2620 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2621
2622         * x86_64.cc (gc_process_relocs): Add typename on types used in
2623         template.
2624         (scan_relocs): Likewise.
2625         (relocate_section): Likewise.
2626         (apply_relocation): Likewise.
2627
2628 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2629
2630         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2631         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2632         under x32.
2633
2634 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2635
2636         * x86_64.cc: Initial support for x32.
2637
2638 2012-01-03  Cary Coutant  <ccoutant@google.com>
2639
2640         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2641         Use abstract base class for GOT.
2642         * gold/output.h (class Output_data_got_base): New abstract base class.
2643         (class Output_data_got): Derive from new base class, adjust ctors.
2644         (Output_data_got::reserve_slot): Make virtual; rename to
2645         do_reserve_slot; Adjust callers.
2646         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2647         pointer to abstract base class.
2648         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2649
2650 2011-12-18  Ian Lance Taylor  <iant@google.com>
2651
2652         * object.h (Relobj::local_symbol_value): New function.
2653         (Relobj::local_plt_offset): New function.
2654         (Relobj::local_has_got_offset): New function.
2655         (Relobj::local_got_offset): New function.
2656         (Relobj::set_local_got_offset): New function.
2657         (Relobj::do_local_symbol_value): New pure virtual function.
2658         (Relobj::do_local_plt_offset): Likewise.
2659         (Relobj::do_local_has_got_offset): Likewise.
2660         (Relobj::do_local_got_offset): Likewise.
2661         (Relobj::do_set_local_got_offset): Likewise.
2662         (Sized_relobj::do_local_has_got_offset): Rename from
2663         local_has_got_offset.
2664         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2665         (Sized_relobj::do_set_local_got_offset): Rename from
2666         set_local_got_offset.
2667         (Sized_relobj_file::do_local_plt_offset): Rename from
2668         local_plt_offset.
2669         (Sized_relobj_file::do_local_symbol_value): New function.
2670         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2671         local_plt_offset.
2672         * output.cc (Output_data_got::Got_entry::write): Change object to
2673         Relobj.  Use local_symbol_value.
2674         (Output_data_got::add_global_with_rel): Change rel_dyn to
2675         Output_data_reloc_generic*.  Use add_global_generic.
2676         (Output_data_got::add_global_with_rela): Remove.  Change all
2677         callers to use add_global_with_rel.
2678         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2679         Output_data_reloc_generic*.  Use add_global_generic.
2680         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2681         callers to use add_global_pair_with_rel.
2682         (Output_data_got::add_local): Change object to Relobj*.
2683         (Output_data_got::add_local_plt): Likewise.
2684         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2685         change rel_dyn to Output_data_reloc_generic*.  Use
2686         add_local_generic.
2687         (Output_data_got::add_local_with_rela): Remove.  Change all
2688         callers to use all_local_with_rel.
2689         (Output_data_got::add_local_pair_with_rel): Change object to
2690         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2691         add_output_section_generic.
2692         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2693         callers to use add_local_pair_with_rel.
2694         (Output_data_got::reserve_local): Change object to Relobj*.
2695         * output.h: (class Output_data_reloc_generic): Add pure virtual
2696         declarations for add_global_generic, add_local_generic,
2697         add_output_section_generic.
2698         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2699         functions for Output_data_reloc_generic.  Update declarations for
2700         changes listed in output.cc.
2701         (class Output_data_got): Change template parameter to got_size.
2702         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2703         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2704         function.
2705         (Sized_relobj_incr::do_local_plt_offset): New function.
2706         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2707         add_global_generic.
2708
2709 2011-12-17  Cary Coutant  <ccoutant@google.com>
2710
2711         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2712         * resolve.cc (Symbol_table::resolve): Likewise.
2713         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2714         arrays.
2715         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2716
2717 2011-12-16  Ian Lance Taylor  <iant@google.com>
2718
2719         * output.h (Output_data_reloc_generic::add): Only call
2720         add_dynamic_reloc if this is a dynamic reloc section.
2721
2722 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2723
2724         PR gold/13505
2725         * target-reloc.h (apply_relocation): Replace <64, false> with
2726         <size, big_endian>.
2727
2728 2011-11-25  Nick Clifton  <nickc@redhat.com>
2729
2730         * po/it.po: New Italian translation.
2731
2732 2011-11-17  Sterling Augustine  <saugustine@google.com>
2733
2734         * script.cc (script_include_directive): Implement.
2735         (read_script_file): New local variables name and search_path. Update
2736         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2737         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2738         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2739
2740 2011-11-11  Sterling Augustine  <saugustine@google.com>
2741
2742         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2743         (file_or_sections_cmd): Likewise.
2744
2745 2011-11-11  Doug Kwan  <dougkwan@google.com>
2746
2747         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2748         if --just-symbols is given.
2749
2750 2011-11-10  Doug Kwan  <dougkwan@google.com>
2751
2752         PR gold/13362
2753         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2754         when processing data relocs.
2755         * reloc.h (Relocate_functions::rel_unaligned): New method.
2756         (Relocate_functions::pcrel_unaligned): Ditto.
2757         (Relocate_functions::rel32_unaligned): Ditto.
2758         (Relocate_functions::pcrel32_unaligned): Ditto.
2759
2760 2011-11-09  Doug Kwan  <dougkwan@google.com>
2761
2762         PR gold/13362
2763         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2764         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2765         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2766         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2767         (Relocate_functions::rel_unaligned): New.
2768         (Relocate_functions::rel32_unaligned): New.
2769         * target-reloc.h (relocate_for_relocatable): Add code to handle
2770         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2771         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2772         arm_unaligned_reloc_r): New targets.
2773         * testsuite/Makefile.in: Regenerate.
2774         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2775         linking.
2776
2777 2011-11-02  Ian Lance Taylor  <iant@google.com>
2778
2779         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2780         NATIVE_LINKER.
2781         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2782         * options.cc (General_options::finalize): Use library search path
2783         from configure script if specified.  If not native and no sysroot,
2784         only search TOOLLIBDIR.
2785         * options.h (Search_directory::Search_directory): Change name to
2786         const std::string&.
2787         (General_options::add_to_library_path_with_sysroot): Change arg to
2788         const std::string&.
2789         * configure, Makefile.in, config.in: Rebuild.
2790
2791 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2792
2793         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2794         we are working around the ARM1176 Erratum.
2795         * options.h (General_options::fix_arm1176): Add option.
2796         * testsuite/Makefile.am: Add testcases, and keep current ones
2797         working.
2798         * testsuite/Makefile.in: Regenerate.
2799         * testsuite/arm_fix_1176.s: New file.
2800         * testsuite/arm_fix_1176.sh: Likewise.
2801
2802 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2803
2804         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2805         may_use_blx_.
2806         (Target_arm::may_use_blx): Remove method.
2807         (Target_arm::set_may_use_blx): Likewise.
2808         (Target_arm::may_use_v4t_interworking): New method.
2809         (Target_arm::may_use_v5t_interworking): Likewise.
2810         (Target_arm::may_use_blx_): Remove member variable.
2811         (Arm_relocate_functions::arm_branch_common): Check for v5T
2812         interworking.
2813         (Arm_relocate_functions::thumb_branch_common): Likewise.
2814         (Reloc_stub::stub_type_for_reloc): Likewise.
2815         (Target_arm::do_finalize_sections): Correct interworking checks.
2816         * testsuite/Makefile.am: Add new tests.
2817         * testsuite/Makefile.in: Regenerate.
2818         * testsuite/arm_farcall_arm_arm.s: New test.
2819         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2820         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2821         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2822         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2823         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2824         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2825         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2826
2827 2011-10-31  Cary Coutant  <ccoutant@google.com>
2828
2829         PR gold/13023
2830         * expression.cc (Expression::eval_with_dot): Add
2831         is_section_dot_assignment parameter.
2832         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2833         absolute and assigning to dot within a section.
2834         * script-sections.cc
2835         (Output_section_element_assignment::set_section_addresses): Pass
2836         dot_section to set_if_absolute.
2837         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2838         as is_section_dot_assignment flag to eval_with_dot.
2839         (Output_section_element_dot_assignment::set_section_addresses):
2840         Likewise.
2841         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2842         parameter.  Also set value if relative to dot_section; set the
2843         symbol's output_section.
2844         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2845         parameter.  Adjust all callers.
2846         (Expression::eval_maybe_dot): Likewise.
2847         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2848         Adjust all callers.
2849         * testsuite/script_test_2.t: Test assignment of an absolute value
2850         to dot within an output section element.
2851
2852 2011-10-31  Cary Coutant  <ccoutant@google.com>
2853
2854         * options.h (class General_options): Add --[no-]gnu-unique options.
2855         * symtab.cc (Symbol_table::sized_write_globals): Convert
2856         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2857
2858 2011-10-31  Cary Coutant  <ccoutant@google.com>
2859
2860         PR gold/13359
2861         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2862         unnecessary assertion.
2863         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2864
2865 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2866
2867         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2868         gc_mark_symbol.
2869         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2870         gc_mark_symbol.
2871         Change to just keep the section associated with symbol.
2872         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2873         they are externally visible and --export-dynamic is turned on.
2874         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2875
2876 2011-10-19  Ian Lance Taylor  <iant@google.com>
2877
2878         PR gold/13163
2879         * script-sections.cc
2880         (Output_section_element_dot_assignment::needs_output_section): New
2881         function.
2882
2883 2011-10-19  Ian Lance Taylor  <iant@google.com>
2884
2885         PR gold/13204
2886         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2887         --section-start option was seen.
2888         * options.h (General_options::any_section_start): New function.
2889
2890 2011-10-18  David S. Miller  <davem@davemloft.net>
2891
2892         PR binutils/13301
2893         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2894         member to track relocation locations that have moved during TLS
2895         reloc optimizations.
2896         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2897         (Target_sparc::Relocate::relocate): Adjust view down by 4
2898         bytes if it matches reloc_adjust_addr_.
2899         (Target_sparc::Relocate::relocate_tls): Always move the
2900         __tls_get_addr call delay slot instruction forward 4 bytes when
2901         performing relaxation.
2902
2903 2011-10-18  Cary Coutant  <ccoutant@google.com>
2904
2905         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2906         (Output_file::map_no_anonymous): Check for non-zero
2907         return code from posix_fallocate.
2908
2909 2011-10-17  Cary Coutant  <ccoutant@google.com>
2910
2911         PR gold/13245
2912         * plugin.cc (is_visible_from_outside): Check for symbols
2913         referenced from dynamic objects.
2914         * resolve.cc (Symbol_table::resolve): Don't count references
2915         from dynamic objects as references from real ELF files.
2916         * testsuite/plugin_test_2.sh: Adjust expected result.
2917
2918 2011-10-17  Cary Coutant  <ccoutant@google.com>
2919
2920         * gold.cc: Include timer.h.
2921         (queue_middle_tasks): Stamp time.
2922         (queue_final_tasks): Likewise.
2923         * main.cc (main): Store timer in parameters.  Print timers
2924         for each pass.
2925         * parameters.cc (Parameters::Parameters): Initialize timer_.
2926         (Parameters::set_timer): New function.
2927         (set_parameters_timer): New function.
2928         * parameters.h (Parameters::set_timer): New function.
2929         (Parameters::timer): New function.
2930         (Parameters::timer_): New data member.
2931         (set_parameters_timer): New function.
2932         * timer.cc (Timer::stamp): New function.
2933         (Timer::get_pass_time): New function.
2934         * timer.h (Timer::stamp): New function.
2935         (Timer::get_pass_time): New function.
2936         (Timer::pass_times_): New data member.
2937
2938 2011-10-17  Cary Coutant  <ccoutant@google.com>
2939
2940         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2941         task for members of lib groups.
2942
2943 2011-10-17  Cary Coutant  <ccoutant@google.com>
2944
2945         PR gold/13288
2946         * fileread.cc (File_read::find_view): Add assert.
2947         (File_read::make_view): Move bounds check (replace with assert)...
2948         (File_read::find_or_make_view): ... to here.
2949
2950 2011-10-12  Cary Coutant  <ccoutant@google.com>
2951
2952         * output.cc (Output_file::open_base_file): Handle case where
2953         ::read returns less than requested size.
2954
2955 2011-10-10  Cary Coutant  <ccoutant@google.com>
2956
2957         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2958         Initialize defined_count_.
2959         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2960         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2961         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2962         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2963         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2964         * incremental.h (Sized_relobj_incr::defined_count_): New data
2965         member.
2966         (Sized_incr_dynobj::defined_count_): New data member.
2967         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2968         Return zeroes instead of internal error.
2969
2970 2011-10-10  Cary Coutant  <ccoutant@google.com>
2971
2972         PR gold/13249
2973         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2974         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2975         * output.h (class Output_reloc): Add use_plt_offset flag.
2976         (Output_reloc::type_): Adjust size of bit field.
2977         (Output_reloc::use_plt_offset_): New bit field.
2978         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2979         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2980         flag.  Adjust all callers.
2981         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2982         creating RELATIVE relocations.
2983
2984 2011-10-10  Nick Clifton  <nickc@redhat.com>
2985
2986         * po/es.po: Updated Spanish translation.
2987         * po/fi.po: Updated Finnish translation.
2988
2989 2011-10-03   Diego Novillo  <dnovillo@google.com>
2990
2991         * options.cc (parse_uint): Fix dereference of RETVAL.
2992
2993 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2994
2995         * layout.h (section_order_map_): New member.
2996         (get_section_order_map): New member function.
2997         * output.cc (Output_section::add_input_section): Check for patterns
2998         only when --section-ordering-file is specified.
2999         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3000         output_sections have been formed.
3001         * layout.cc (Layout_Layout): Initialize section_order_map_.
3002         * plugin.cc (update_section_order): Store order in order_map. Do not
3003         update the order.
3004         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3005         * testsuite/Makefile.in: Regenerate.
3006         * testsuite/plugin_section_order.c: New file.
3007         * testsuite/plugin_final_layout.cc: New file.
3008         * testsuite/plugin_final_layout.sh: New file.
3009
3010 2011-09-29  Cary Coutant  <ccoutant@google.com>
3011
3012         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3013         Check for NULL.
3014         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3015         symbols during incremental update.
3016         (Symbol_table::add_from_dynobj): Likewise.
3017
3018 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3019             Ian Lance Taylor  <iant@google.com>
3020
3021         * symtab.cc (Symbol_table::define_special_symbol): Always
3022         canonicalize version string.
3023
3024 2011-09-26  Cary Coutant  <ccoutant@google.com>
3025
3026         * gold.cc (queue_initial_tasks): Move option checks ...
3027         * options.cc (General_options::finalize): ... to here. Disable
3028         some options; make others fatal.
3029
3030 2011-09-26  Cary Coutant  <ccoutant@google.com>
3031
3032         gcc PR lto/47247
3033         * plugin.cc (get_symbols_v2): New function.
3034         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3035         (is_referenced_from_outside): New function.
3036         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3037         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3038         (get_symbols): Pass version parameter.
3039         (get_symbols_v2): New function.
3040         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3041         parameter.
3042         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3043         (onload): Add LDPT_GET_SYMBOLS_V2.
3044         (all_symbols_read_hook): Use get_symbols_v2; check for
3045         LDPR_PREVAILING_DEF_IRONLY_EXP.
3046         * testsuite/plugin_test_3.sh: Update expected results.
3047
3048 2011-09-23  Simon Baldwin  <simonb@google.com>
3049
3050         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3051         configuration options.
3052         * configure: Regenerate.
3053         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3054         * Makefile.in: Regenerate.
3055         * testsuite/Makefile.in: Regenerate.
3056
3057 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3058
3059         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3060
3061 2011-09-19  Cary Coutant  <ccoutant@google.com>
3062
3063         * incremental.cc (can_incremental_update): Fix typo in comment.
3064         * incremental.h (can_incremental_update): Likewise.
3065
3066 2011-09-18  Cary Coutant  <ccoutant@google.com>
3067
3068         * incremental.cc (can_incremental_update): New function.
3069         * incremental.h (can_incremental_update): New function.
3070         * layout.cc (Layout::init_fixed_output_section): Call it.
3071         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3072         * object.cc (Sized_relobj_file::do_layout): Call
3073         can_incremental_update.
3074
3075 2011-09-13  Cary Coutant  <ccoutant@google.com>
3076
3077         * configure.ac: Check for glibc support for gnu_indirect_function
3078         support with static linking, setting automake conditional
3079         IFUNC_STATIC.
3080         * Makefile.in: Regenerate.
3081         * configure: Regenerate.
3082
3083         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3084         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3085         for IFUNC_STATIC.
3086         * testsuite/Makefile.in: Regenerate.
3087
3088 2011-09-13  Cary Coutant  <ccoutant@google.com>
3089
3090         * incremental.cc (Sized_relobj_incr::do_layout): Call
3091         report_comdat_group for kept comdat sections.
3092         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3093         * testsuite/Makefile.in: Regenerate.
3094         * testsuite/incr_comdat_test_1.cc: New source file.
3095         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3096         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3097         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3098
3099 2011-09-13  Ian Lance Taylor  <iant@google.com>
3100
3101         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3102         variable external_symbols_offset.
3103
3104 2011-09-12  Ian Lance Taylor  <iant@google.com>
3105
3106         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3107         triggered if object has no symbols.
3108
3109 2011-09-09  David S. Miller  <davem@davemloft.net>
3110
3111         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3112         (Output_fill_debug_line::do_write): Likewise.
3113
3114 2011-08-29  Cary Coutant  <ccoutant@google.com>
3115
3116         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3117         casts to match formatting specs.
3118         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3119
3120 2011-08-26  Cary Coutant  <ccoutant@google.com>
3121
3122         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3123         remaining hole size when allocating.
3124         (Layout::make_output_section): Set fill methods for debug sections.
3125         * layout.h (Free_list::Free_list_node): Move from private to
3126         public.
3127         (Free_list::set_min_hole_size): New function.
3128         (Free_list::begin, Free_list::end): New functions.
3129         (Free_list::min_hole_): New data member.
3130         * output.cc: Include dwarf.h.
3131         (Output_fill_debug_info::do_minimum_hole_size): New function.
3132         (Output_fill_debug_info::do_write): New function.
3133         (Output_fill_debug_line::do_minimum_hole_size): New function.
3134         (Output_fill_debug_line::do_write): New function.
3135         (Output_section::Output_section): Initialize new data member.
3136         (Output_section::set_final_data_size): Ensure patch space is larger
3137         than minimum hole size.
3138         (Output_section::do_write): Fill holes in debug sections.
3139         * output.h (Output_fill): New class.
3140         (Output_fill_debug_info): New class.
3141         (Output_fill_debug_line): New class.
3142         (Output_section::set_free_space_fill): New function.
3143         (Output_section::free_space_fill_): New data member.
3144         * testsuite/Makefile.am (incremental_test_3): Add
3145         --incremental-patch option.
3146         (incremental_test_4): Likewise.
3147         (incremental_test_5): Likewise.
3148         (incremental_test_6): Likewise.
3149         (incremental_copy_test): Likewise.
3150         (incremental_common_test_1): Likewise.
3151         * testsuite/Makefile.in: Regenerate.
3152
3153 2011-08-26  Nick Clifton  <nickc@redhat.com>
3154
3155         * po/es.po: Updated Spanish translation.
3156
3157 2011-08-01  Cary Coutant  <ccoutant@google.com>
3158
3159         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3160         * gold/testsuite/Makefile.in: Regenerate.
3161         * gold/testsuite/justsyms_exec.c: New source file.
3162         * gold/testsuite/justsyms_lib.c: New source file.
3163
3164 2011-08-01  Cary Coutant  <ccoutant@google.com>
3165
3166         * layout.cc (Layout::set_segment_offsets): Don't realign text
3167         segment if -Ttext was specified.
3168         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3169         file type.
3170         * object.h (Sized_relobj_file::e_type): New function.
3171         (Sized_relobj_file::e_type_): New data member.
3172         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3173         base address for ET_EXEC files.
3174         * target.cc (Target::do_make_elf_object_implementation): Allow
3175         ET_EXEC files with --just-symbols option.
3176
3177 2011-07-28  Cary Coutant  <ccoutant@google.com>
3178
3179         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3180         Add thread_number parameter.
3181         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3182         * workqueue-threads.cc
3183         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3184         current thread if its thread number is greater than desired thread
3185         count.
3186         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3187         Add thread_number parameter.
3188         (Workqueue::should_cancel_thread): Likewise.
3189         (Workqueue::find_runnable_or_wait): Pass thread_number to
3190         should_cancel_thread.
3191         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3192         parameter.
3193
3194 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3195
3196         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3197         only after checking if it cannot be forced local.
3198         * symtab.h (is_externally_visible): Check if the symbol is not forced
3199         local.
3200
3201 2011-07-15  Ian Lance Taylor  <iant@google.com>
3202
3203         * options.h (class General_options): Add --print-output-format.
3204         Move -EL next to -EB, for  better --help output.
3205         * target-select.cc: Include <cstdio>, "options.h", and
3206         "parameters.h".
3207         (Target_selector::do_target_bfd_name): New function.
3208         (print_output_format): New function.
3209         * target-select.h (class Target_selector): Update declarations.
3210         (Target_selector::target_bfd_name): New function.
3211         (print_output_format): Declare.
3212         * main.cc: Include "target-select.h".
3213         (main): Handle --print-output-format.
3214         * gold.cc: Include "target-select.h".
3215         (queue_initial_tasks): Handle --print-output-format when there are
3216         no input files.
3217         * parameters.cc (parameters_force_valid_target): Give a better
3218         error message if -EB/-EL does not match target.
3219         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3220         function.
3221
3222 2011-07-15  Ian Lance Taylor  <iant@google.com>
3223
3224         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3225         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3226         (Output_data_plt_i386::do_write): Write address of .dynamic
3227         section to first entry in .got.plt section.
3228         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3229         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3230         Initialize layout_.
3231         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3232         section to first entry in .got.plt section.
3233         * layout.h (Layout::dynamic_section): New function.
3234
3235 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3236
3237         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3238         to claim_file call.
3239         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3240         input_section_position_, and input_section_glob_.
3241         (read_layout_from_file): Call function section_ordering_specified.
3242         * layout.h (is_section_ordering_specified): New function.
3243         (section_ordering_specified): New function.
3244         (section_ordering_specified_): New boolean member.
3245         * main.cc(main): Call load_plugins after layout object is defined.
3246         * output.cc (Output_section::add_input_section): Use
3247         function section_ordering_specified to check if section ordering is
3248         needed.
3249         * output.cc (Output_section::add_relaxed_input_section): Use
3250         function section_ordering_specified to check if section ordering is
3251         needed.
3252         (Output_section::update_section_layout): New function.
3253         (Output_section::sort_attached_input_sections): Check if input section
3254         must be reordered.
3255         * output.h (Output_section::update_section_layout): New function.
3256         * plugin.cc (get_section_count): New function.
3257         (get_section_type): New function.
3258         (get_section_name): New function.
3259         (get_section_contents): New function.
3260         (update_section_order): New function.
3261         (allow_section_ordering): New function.
3262         (Plugin::load): Add the new interfaces to the transfer vector.
3263         (Plugin_manager::load_plugins): New parameter.
3264         (Plugin_manager::all_symbols_read): New parameter.
3265         (Plugin_manager::claim_file): New parameter. Save the elf object for
3266         unclaimed objects.
3267         (Plugin_manager::get_elf_object): New function.
3268         (Plugin_manager::get_view): Change to directly use the bool to check
3269         if get_view is called from claim_file_hook.
3270         * plugin.h (input_objects): New function
3271         (Plugin__manager::load_plugins): New parameter.
3272         (Plugin_manager::claim_file): New parameter.
3273         (Plugin_manager::get_elf_object): New function.
3274         (Plugin_manager::in_claim_file_handler): New function.
3275         (Plugin_manager::in_claim_file_handler_): New member.
3276         (layout): New function.
3277         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3278         handler with an extra parameter. Make the elf object before calling
3279         claim_file handler.
3280         * testsuite/plugin_test.c (get_section_count): New function pointer.
3281         (get_section_type): New function pointer.
3282         (get_section_name): New function pointer.
3283         (get_section_contents): New function pointer.
3284         (update_section_order): New function pointer.
3285         (allow_section_ordering): New function pointer.
3286         (onload): Check if the new interfaces exist.
3287
3288 2011-07-13  Ian Lance Taylor  <iant@google.com>
3289
3290         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3291         relro section.
3292         * x86_64.cc (Target_x86_64::got_section): Likewise.
3293         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3294         (relro_now_test_SOURCES): New variable.
3295         (relro_now_test_DEPENDENCIES): New variable.
3296         (relro_now_test_LDFLAGS): New variable.
3297         (relro_now_test_LDADD): New variable.
3298         (relro_now_test.so): New target.
3299         * testsuite/Makefile.in: Rebuild.
3300
3301 2011-07-12  Ian Lance Taylor  <iant@google.com>
3302
3303         PR gold/12980
3304         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3305         GLOB_DAT relocation rather than a RELATIVE relocation for a
3306         protected symbol when creating a shared library.
3307         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3308         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3309         * testsuite/protected_main_1.cc (main): Test that protected
3310         function has same address.
3311
3312 2011-07-11  Ian Lance Taylor  <iant@google.com>
3313
3314         PR gold/12979
3315         * options.h (class General_options): Add -Bgroup.
3316         * options.cc (General_options::finalize): If -Bgroup is set,
3317         default to --unresolved-symbols=report-all.
3318         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3319         * target-reloc.h (issue_undefined_symbol_error): Handle
3320         --unresolved-symbols=report-all.
3321
3322 2011-07-08  Ian Lance Taylor  <iant@google.com>
3323
3324         PR gold/11985
3325         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3326         if linker script discards key sections.
3327         (Layout::create_dynamic_symtab): Likewise.
3328         (Layout::assign_local_dynsym_offsets): Likewise.
3329         (Layout::sized_create_version_sections): Likewise.
3330         (Layout::create_interp): Likewise.
3331         (Layout::finish_dynamic_section): Likewise.
3332         (Layout::set_dynamic_symbol_size): Likewise.
3333
3334 2011-07-08  Ian Lance Taylor  <iant@google.com>
3335
3336         PR gold/12386
3337         * options.h (class General_options): Add --unresolved-symbols.
3338         * target-reloc.h (issue_undefined_symbol_error): Check
3339         --unresolved-symbols.  Add comments.
3340
3341 2011-07-08  Ian Lance Taylor  <iant@google.com>
3342
3343         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3344         expression more complex.
3345
3346 2011-07-08  Ian Lance Taylor  <iant@google.com>
3347
3348         PR gold/11317
3349         * target-reloc.h (issue_undefined_symbol_error): New inline
3350         function, broken out of relocate_section.
3351         (relocate_section): Call issue_undefined_symbol_error.
3352         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3353         there is no TLS segment if we are about to issue an undefined
3354         symbol error.
3355         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3356
3357 2011-07-08  Ian Lance Taylor  <iant@google.com>
3358
3359         PR gold/12279
3360         * resolve.cc (Symbol_table::should_override): Add fromtype
3361         parameter.  Change all callers.  Give error when linking together
3362         TLS and non-TLS symbol.
3363         (Symbol_table::should_override_with_special): Add fromtype
3364         parameter.  Change all callers.
3365         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3366         there is no TLS segment if we have reported some errors.
3367         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3368
3369 2011-07-08  Ian Lance Taylor  <iant@google.com>
3370
3371         PR gold/12372
3372         * target.h (Target::plt_address_for_global): New function.
3373         (Target::plt_address_for_local): New function.
3374         (Target::plt_section_for_global): Remove.
3375         (Target::plt_section_for_local): Remove.
3376         (Target::do_plt_address_for_global): New virtual function.
3377         (Target::do_plt_address_for_local): New virtual function.
3378         (Target::do_plt_section_for_global): Remove.
3379         (Target::do_plt_section_for_local): Remove.
3380         (Target::register_global_plt_entry): Add Symbol_table and Layout
3381         parameters.
3382         * output.cc (Output_data_got::Got_entry::write): Use
3383         plt_address_for_global and plt_address_for_local.
3384         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3385         address of output section.
3386         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3387         got_irelative_, and irelative_count_ fields.  Update
3388         declarations.
3389         (Output_data_plt_i386::has_irelative_section): New function.
3390         (Output_data_plt_i386::entry_count): Add irelative_count_.
3391         (Output_data_plt_i386::set_final_data_size): Likewise.
3392         (class Target_i386): Add got_irelative_ and rel_irelative_
3393         fields.  Update declarations.
3394         (Target_i386::Target_i386): Initialize new fields.
3395         (Target_i386::do_plt_address_for_global): New function replacing
3396         do_plt_section_for_global.
3397         (Target_i386::do_plt_address_for_local): New function replacing
3398         do_plt_section_for_local.
3399         (Target_i386::got_section): Create got_irelative_.
3400         (Target_i386::rel_irelative_section): New function.
3401         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3402         fields.  Don't define __rel_iplt_{start,end}.
3403         (Output_data_plt_i386::add_entry): Add symtab and layout
3404         parameters.  Change all callers.  Use different PLT and GOT for
3405         IFUNC symbols.
3406         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3407         layout parameters.  Change all callers.  Use different PLT and
3408         GOT.
3409         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3410         (Output_data_plt_i386::rel_irelative): New function.
3411         (Output_data_plt_i386::address_for_global): New function.
3412         (Output_data_plt_i386::address_for_local): New function.
3413         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3414         IRELATIVE GOT when changing IFUNC GOT entries.
3415         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3416         reloc.
3417         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3418         if we didn't create an IRELATIVE GOT.
3419         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3420         plt_address_for_local.
3421         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3422         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3423         got_irelative_, and irelative_count_ fields.  Update
3424         declarations.
3425         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3426         Initialize new fields.  Remove symtab parameter.  Change all
3427         callers.
3428         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3429         irelative_count_.
3430         (Output_data_plt_x86_64::has_irelative_section): New function.
3431         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3432         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3433         fields.  Update declarations.
3434         (Target_x86_64::Target_x86_64): Initialize new fields.
3435         (Target_x86_64::do_plt_address_for_global): New function replacing
3436         do_plt_section_for_global.
3437         (Target_x86_64::do_plt_address_for_local): New function replacing
3438         do_plt_section_for_local.
3439         (Target_x86_64::got_section): Create got_irelative_.
3440         (Target_x86_64::rela_irelative_section): New function.
3441         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3442         all callers.  Don't create __rel_iplt_{start,end}.
3443         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3444         parameters.  Change all callers.  Use different PLT and GOT for
3445         IFUNC symbols.
3446         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3447         layout parameters.  Change all callers.  Use different PLT and
3448         GOT.
3449         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3450         parameters.  Change all callers.  Use different PLT and GOT for
3451         IFUNC symbols.
3452         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3453         (Output_data_plt_x86_64::rela_irelative): New function.
3454         (Output_data_plt_x86_64::address_for_global): New function.
3455         (Output_data_plt_x86_64::address_for_local): New function.
3456         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3457         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3458         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3459         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3460         parameters.
3461         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3462         reloc.
3463         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3464         symbols if we didn't create an IRELATIVE GOT.
3465         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3466         plt_address_for_local.
3467         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3468         * testsuite/ifuncvar1.c: New test file.
3469         * testsuite/ifuncvar2.c: New test file.
3470         * testsuite/ifuncvar3.c: New test file.
3471         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3472         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3473         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3474         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3475         * testsuite/Makefile.in: Rebuild.
3476
3477 2011-07-07  Cary Coutant  <ccoutant@google.com>
3478
3479         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3480         (two_file_test_1_ndebug.o): Likewise.
3481         (two_file_test_1b_ndebug.o): Likewise.
3482         (two_file_test_2_ndebug.o): Likewise.
3483         (two_file_test_main_ndebug.o): Likewise.
3484         (incremental_test_2): Link with no-debug versions.
3485
3486 2011-07-06  Cary Coutant  <ccoutant@google.com>
3487
3488         * gold/incremental.cc
3489         (Output_section_incremental_inputs::write_info_blocks): Check for
3490         hidden and internal symbols.
3491
3492 2011-07-06  Cary Coutant  <ccoutant@google.com>
3493
3494         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3495         Check disposition for startup file.
3496         (Incremental_inputs::report_command_line): Ignore
3497         --incremental-startup-unchanged option.
3498         * options.cc (General_options::parse_incremental_startup_unchanged):
3499         New function.
3500         (General_options::General_options): Initialize new data member.
3501         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3502         (General_options): Add --incremental-startup-unchanged option.
3503         (General_options::incremental_startup_disposition): New function.
3504         (General_options::incremental_startup_disposition_): New data member.
3505
3506 2011-07-06  Cary Coutant  <ccoutant@google.com>
3507
3508         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3509         input file index to Script_info ctor.
3510         (Sized_incremental_binary::do_file_has_changed): Find the
3511         command-line argument for files named in scripts.
3512         * incremental.h (Script_info::Script_info): New ctor
3513         with input file index.
3514         (Script_info::input_file_index): New function.
3515         (Script_info::input_file_index_): New data member.
3516         (Incremental_binary::get_library): Add const.
3517         (Incremental_binary::get_script_info): Add const.
3518         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3519         * testsuite/Makefile.am (incremental_test_5): New test case.
3520         (incremental_test_6): New test case.
3521         * testsuite/Makefile.in: Regenerate.
3522
3523 2011-07-06  Cary Coutant  <ccoutant@google.com>
3524
3525         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3526         debug output when command lines differ.
3527
3528 2011-07-06  Cary Coutant  <ccoutant@google.com>
3529
3530         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3531         --incremental-patch option.
3532         * layout.cc (Free_list::allocate): Extend allocation beyond original
3533         end if enabled.
3534         (Layout::make_output_section): Mark sections that should get
3535         patch space.
3536         * options.cc (parse_percent): New function.
3537         * options.h (parse_percent): New function.
3538         (DEFINE_percent): New macro.
3539         (General_options): Add --incremental-patch option.
3540         * output.cc (Output_section::Output_section): Initialize new data
3541         members.
3542         (Output_section::add_input_section): Print section name when out
3543         of patch space.
3544         (Output_section::add_output_section_data): Likewise.
3545         (Output_section::set_final_data_size): Add patch space when
3546         doing --incremental-full.
3547         (Output_section::do_reset_address_and_file_offset): Remove patch
3548         space.
3549         (Output_segment::set_section_list_addresses): Print debug output
3550         only if --incremental-update.
3551         * output.h (Output_section::set_is_patch_space_allowed): New function.
3552         (Output_section::is_patch_space_allowed_): New data member.
3553         (Output_section::patch_space_): New data member.
3554         * parameters.cc (Parameters::incremental_full): New function.
3555         * parameters.h (Parameters::incremental_full): New function
3556         * testsuite/Makefile.am (incremental_test_2): Add test for
3557         --incremental-patch option.
3558         * testsuite/Makefile.in: Regenerate.
3559         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3560         (t18): Remove function body.
3561
3562 2011-07-05  Doug Kwan  <dougkwan@google.com>
3563
3564         PR gold/12771
3565         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3566         Arm_Address type for relocation result.
3567         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3568         overflow check.
3569         (Arm_relocate_functions::abs32): Use unaligned access.
3570         (Arm_relocate_functions::rel32): Ditto.
3571         (Arm_relocate_functions::prel31): Ditto.
3572         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3573         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3574         static data relocations.
3575         * testsuite/Makefile.in: Regnerate.
3576         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3577
3578 2011-07-05  Ian Lance Taylor  <iant@google.com>
3579
3580         PR gold/12392
3581         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3582         symbols if necessary.
3583         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3584
3585 2011-07-05  Ian Lance Taylor  <iant@google.com>
3586
3587         PR gold/12952
3588         * resolve.cc (Symbol::override_base_with_special): Simply override
3589         version with special symbol version, ignoring previous version.
3590
3591 2011-07-05  Ian Lance Taylor  <iant@google.com>
3592
3593         * object.cc (Sized_relobj_file::include_section_group): Add
3594         information to comment about signature location.
3595
3596 2011-07-02  Ian Lance Taylor  <iant@google.com>
3597
3598         PR gold/12957
3599         * options.h (class General_options): Add -f and -F.
3600         * options.cc (General_options::finalize): Fatal error if -f/-F
3601         are used without -shared.
3602         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3603
3604 2011-07-02  Ian Lance Taylor  <iant@google.com>
3605
3606         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3607
3608 2011-07-01  Ian Lance Taylor  <iant@google.com>
3609
3610         PR gold/12525
3611         PR gold/12952
3612         * resolve.cc (Symbol::override_base_with_special): Don't override
3613         the version if the overriding symbol has a different name.
3614         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3615         all callers.  If we give an error about an undefined version,
3616         define the base version if necessary.
3617         * dynobj.h (class Versions): Update declaration.
3618         * testsuite/weak_alias_test_5.cc: New file.
3619         * testsuite/weak_alias_test.script: New file.
3620         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3621         and versioned_alias have the right value, and call t2.
3622         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3623         weak_alias_test_5.so.
3624         (weak_alias_test_LDADD): Likewise.
3625         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3626         * testsuite/Makefile.in: Rebuild.
3627
3628 2011-07-01  Ian Lance Taylor  <iant@google.com>
3629
3630         PR gold/12525
3631         * options.h (class General_options): Support -z notext.
3632         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3633         -Wl,-z,notext.
3634         (two_file_shared_nonpic.so): Likewise.
3635         (two_file_shared_mixed.so): Likewise.
3636         (two_file_shared_mixed_1.so): Likewise.
3637         (weak_undef_lib_nonpic.so): Likewise.
3638         (alt/weak_undef_lib_nonpic.so): Likewise.
3639         (tls_test_shared_nonpic.so): Likewise.
3640         * testsuite/Makefile.in: Rebuild.
3641
3642 2011-07-01  Ian Lance Taylor  <iant@google.com>
3643
3644         PR gold/12525
3645         * configure.ac: Test whether static linking works, setting
3646         the automake conditional HAVE_STATIC.
3647         * testsuite/Makefile.am: Disable tests using -static if
3648         HAVE_STATIC is not true.
3649         * configure, testsuite/Makefile.in: Rebuild.
3650
3651 2011-07-01  Ian Lance Taylor  <iant@google.com>
3652
3653         PR gold/12525
3654         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3655         Assert if we see DW_EH_PE_indirect.
3656         * target.h (Target::ehframe_datarel_base): New function.
3657         (Target::do_ehframe_datarel_base): New target function.
3658         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3659         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3660         function.
3661
3662 2011-07-01  Ian Lance Taylor  <iant@google.com>
3663
3664         PR gold/12571
3665         * options.h (class General_options): Add
3666         --ld-generated-unwind-info.
3667         * ehframe.cc (Fde::write): Add address parameter.  Change all
3668         callers.  If associated with PLT, fill in address and size.
3669         (Cie::set_output_offset): Only add merge mapping if there is an
3670         object.
3671         (Cie::write): Add address parameter.  Change all callers.
3672         (Eh_frame::add_ehframe_for_plt): New function.
3673         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3674         input_offset_ fields into union u_, with new plt field.
3675         (Fde::Fde): Adjust for new union field.
3676         (Fde::Fde) [Output_data version]: New constructor.
3677         (Fde::add_mapping): Only add merge mapping if there is an object.
3678         (class Cie): Update declarations.
3679         (class Eh_frame): Declare add_ehframe_for_plt.
3680         * layout.cc (Layout::layout_eh_frame): Break out code into
3681         make_eh_frame_section, and call it.
3682         (Layout::make_eh_frame_section): New function.
3683         (Layout::add_eh_frame_for_plt): New function.
3684         * layout.h (class Layout): Update declarations.
3685         * merge.cc (Merge_map::add_mapping): Add assertion.
3686         * i386.cc: Include "dwarf.h".
3687         (class Output_data_plt_i386): Make first_plt_entry,
3688         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3689         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3690         and plt_eh_frame_fde.
3691         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3692         boundary.  Call add_eh_frame_for_plt if appropriate.
3693         * x86_64.cc: Include "dwarf.h".
3694         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3695         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3696         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3697         and plt_eh_frame_fde.
3698         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3699         appropriate.
3700
3701 2011-06-29  Ian Lance Taylor  <iant@google.com>
3702
3703         PR gold/12629
3704         * object.cc (Sized_relobj_file::layout_section): Change shdr
3705         parameter to be const.
3706         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3707         out of do_layout.
3708         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3709         appropriate.  Call layout_eh_frame_section.
3710         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3711         sections.
3712         * object.h (class Sized_relobj_file): Update declarations.
3713
3714 2011-06-29  Ian Lance Taylor  <iant@google.com>
3715
3716         PR gold/12652
3717         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3718         modifier.
3719         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3720
3721 2011-06-29  Ian Lance Taylor  <iant@google.com>
3722
3723         PR gold/12675
3724         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3725         SHT_X86_64_UNWIND.
3726         * layout.cc (Layout::layout_eh_frame): Likewise.
3727
3728 2011-06-29  Ian Lance Taylor  <iant@google.com>
3729
3730         PR gold/12695
3731         * layout.cc (Layout::symtab_section_shndx): New function.
3732         * layout.h (class Layout): Declare symtab_section_shndx.
3733         * output.cc (Output_section::write_header): Call it.
3734
3735 2011-06-29  Ian Lance Taylor  <iant@google.com>
3736
3737         PR gold/12818
3738         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3739         symbols which are not used in a relocation.
3740
3741 2011-06-28  Ian Lance Taylor  <iant@google.com>
3742
3743         PR gold/12898
3744         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3745         script create indistinguishable segments.
3746         (Layout::set_segment_offsets): Use stable_sort when sorting
3747         segments.  Pass this to Compare_segments constructor.
3748         * layout.h (class Layout): Make segment_precedes non-static.
3749         (class Compare_segments): Change from struct to class.  Add
3750         layout_ field.  Add constructor.
3751         * script-sections.cc
3752         (Script_sections::attach_sections_using_phdrs_clause): Rename
3753         local orphan to is_orphan.  Don't report failure to put empty
3754         section in segment.  On attachment failure, report name of
3755         section, and attach to first PT_LOAD segment.
3756
3757 2011-06-28  Ian Lance Taylor  <iant@google.com>
3758
3759         PR gold/12934
3760         * target-select.cc (Target_selector::Target_selector): Add
3761         emulation parameter.  Change all callers.
3762         (select_target_by_bfd_name): Rename from select_target_by_name.
3763         Change all callers.
3764         (select_target_by_emulation): New function.
3765         (supported_emulation_names): New function.
3766         * target-select.h (class Target_selector): Add emulation_ field.
3767         Update declarations.
3768         (Target_selector::recognize_by_bfd_name): Rename from
3769         recognize_by_name.  Change all callers.
3770         (Target_selector::supported_bfd_names): Rename from
3771         supported_names.  Change all callers.
3772         (Target_selector::recognize_by_emulation): New function.
3773         (Target_selector::supported_emulations): New function.
3774         (Target_selector::emulation): New function.
3775         (Target_selector::do_recognize_by_bfd_name): Rename from
3776         do_recognize_by_name.  Change all callers.
3777         (Target_selector::do_supported_bfd_names): Rename from
3778         do_supported_names.  Change all callers.
3779         (Target_selector::do_recognize_by_emulation): New function.
3780         (Target_selector::do_supported_emulations): New function.
3781         (select_target_by_bfd_name): Change name in declaration.
3782         (select_target_by_emulation): Declare.
3783         (supported_emulation_names): Declare.
3784         * parameters.cc (parameters_force_valid_target): Try to find
3785         target based on emulation from -m option.
3786         * options.h (class General_options): Change doc string for -m.
3787         * options.cc (help): Print emulations.
3788         (General_options::parse_V): Likewise.
3789         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3790         Add emulation parameter.  Change all callers.
3791
3792 2011-06-28  Ian Lance Taylor  <iant@google.com>
3793
3794         * target.h (class Target): Add osabi_ field.
3795         (Target::osabi): New function.
3796         (Target::set_osabi): New function.
3797         (Target::Target): Initialize osabi_.
3798         (Target::do_adjust_elf_header): Make pure virtual.
3799         (Sized_target::do_adjust_elf_header): Declare.
3800         * target.cc (Sized_target::do_adjust_elf_header): New function.
3801         (class Sized_target): Instantiate all versions.
3802         * freebsd.h (class Target_freebsd): Remove.
3803         (Target_selector_freebsd::do_recognize): Call set_osabi on
3804         Target.
3805         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3806         (Target_selector_freebsd::set_osabi): Remove.
3807         * i386.cc (class Target_i386): Inherit from Sized_target rather
3808         than Target_freebsd.
3809         * x86_64.cc (class Target_x86_64): Likewise.
3810
3811 2011-06-28  Ian Lance Taylor  <iant@google.com>
3812
3813         * target.h (Target::can_check_for_function_pointers): Rewrite.
3814         Make non-virtual.
3815         (Target::can_icf_inline_merge_sections): Likewise.
3816         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3817         (Target::Target_info): Add can_icf_inline_merge_sections field.
3818         (Target::do_can_check_for_function_pointers): New virtual
3819         function.
3820         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3821         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3822         from can_check_for_function_pointers, move in file.
3823         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3824         section_may_have_icf_unsafe_poineters, move in file.
3825         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3826         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3827         Rename from can_check_for_function_pointers, move in file.
3828         (Target_i386::can_icf_inline_merge_sections): Remove.
3829         (Target_i386::i386_info): Initialize
3830         can_icf_inline_merge_sections.
3831         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3832         Initialize can_icf_inline_merge_sections.
3833         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3834         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3835         Rename from can_check_for_function_pointers, move in file.
3836         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3837         (Target_x86_64::x86_64_info): Initialize
3838         can_icf_inline_merge_sections.
3839         * testsuite/testfile.cc (Target_test::test_target_info):
3840         Likewise.
3841         * icf.cc (get_section_contents): Correct formatting.
3842
3843 2011-06-27  Ian Lance Taylor  <iant@google.com>
3844
3845         * symtab.cc (Symbol::versioned_name): New function.
3846         (Symbol_table::add_to_final_symtab): Use versioned_name when
3847         appropriate.
3848         (Symbol_table::sized_write_symbol): Likewise.
3849         * symtab.h (class Symbol): Declare versioned_name.
3850         * stringpool.h (class Stringpool_template): Add variant of add
3851         which takes a std::basic_string.
3852         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3853         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3854         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3855         (ver_test_12.o): New target.
3856         * testsuite/Makefile.in: Rebuild.
3857
3858 2011-06-27  Doug Kwan  <dougkwan@google.com>
3859
3860         * arm.cc (Arm_relocate_functions::thm_jump8,
3861         Arm_relocate_functions::thm_jump11): Use a wider signed
3862         type to compute offset.
3863         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3864         arm_thm_jump8.
3865         * testsuite/Makefile.in: Regenerate.
3866         * testsuite/arm_branch_in_range.sh: Check test results of
3867         arm_thm_jump11 and arm_thm_jump8.
3868         * testsuite/arm_thm_jump11.s: New test source file.
3869         * testsuite/arm_thm_jump11.t: New linker script.
3870         * testsuite/arm_thm_jump8.s: New test source file.
3871         * testsuite/arm_thm_jump8.t: New linker script.
3872
3873 2011-06-24  Ian Lance Taylor  <iant@google.com>
3874
3875         * layout.cc: Include "object.h".
3876         (ctors_sections_in_init_array): New static variable.
3877         (Layout::is_ctors_in_init_array): New function.
3878         (Layout::layout): Add entry to ctors_sections_in_init_array if
3879         appropriate.
3880         * layout.h (class Layout): Declare is_ctors_in_init_array.
3881         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3882         is_ctors_reverse_view is set.
3883         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3884         all callers.  Set is_ctors_reverse_view field of View_size.
3885         (Sized_relobj_file::reverse_words): New function.
3886         * object.h (Sized_relobj_file::View_size): Add
3887         is_ctors_reverse_view field.
3888         (class Sized_relobj_file): Update declarations.
3889         * testsuite/initpri3.c: New test.
3890         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3891         initpri3b.
3892         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3893         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3894         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3895         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3896         * testsuite/Makefile.in: Rebuild.
3897
3898 2011-06-24  Cary Coutant  <ccoutant@google.com>
3899
3900         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3901         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3902         (debug_msg_cdebug.err): New targets.
3903         * testsuite/Makefile.in: Regenerate.
3904         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3905         Fix checks for link with shared library.
3906
3907 2011-06-24  Doug Kwan  <dougkwan@google.com>
3908
3909         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3910         skip empty text sections.
3911         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3912
3913 2011-06-22  Ian Lance Taylor  <iant@google.com>
3914
3915         PR gold/12910
3916         * options.h (class General_options): Add --ctors-in-init-array.
3917         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3918         friends as SHT_PROGBITS for merging sections.
3919         (Layout::layout): Remove special handling of .init_array and
3920         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3921         and .dtors if ctors_in_init_array.
3922         (Layout::make_output_section): Force correct section types for
3923         .init_array and friends.  Don't sort if doing relocatable link,
3924         Don't sort .ctors and .dtors if ctors_in_init_array.
3925         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3926         (Layout::output_section_name): Add relobj parameter.  Change all
3927         callers.  Handle .ctors. and .dtors. in code rather than table.
3928         Handle .ctors and .dtors if ctors_in_init_array.
3929         (Layout::match_file_name): New function, moved from output.cc.
3930         * layout.h (class Layout): Update declarations.
3931         * output.cc: Include "layout.h".
3932         (Input_section_sort_entry::get_priority): New function.
3933         (Input_section_sort_entry::match_file_name): Just call
3934         Layout::match_file_name.
3935         (Output_section::Input_section_sort_init_fini_compare::operator()):
3936         Handle .ctors and .dtors.  Sort by explicit priority rather than
3937         by name.
3938         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3939         * testsuite/initpri2.c: New test.
3940         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3941         (check_PROGRAMS): Add initpri2.
3942         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3943         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3944         * configure, testsuite/Makefile.in: Rebuild.
3945
3946 2011-06-19  Ian Lance Taylor  <iant@google.com>
3947
3948         PR gold/12880
3949         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3950         .interp section to a PT_INTERP segment even if we have seen a
3951         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3952         clause in a linker script.
3953         (Layout::finalize): Don't create a .interp section if we've
3954         already create a PT_INTERP segment.
3955         (Layout::create_interp): Always call choose_output_section (revert
3956         patch of 2011-06-17).  Don't create PT_INTERP segment.
3957         * script-sections.cc
3958         (Script_sections::create_note_and_tls_segments): Add a .interp
3959         section to a PT_INTERP segment even if we have seen a
3960         --dynamic-linker option.
3961
3962 2011-06-18  Ian Lance Taylor  <iant@google.com>
3963
3964         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3965         merely because a non-PT_LOAD segment has a dynamic reloc.
3966
3967 2011-06-18  Ian Lance Taylor  <iant@google.com>
3968
3969         * layout.cc (Layout::finish_dynamic_section): Don't create
3970         DT_FLAGS entry if not needed.
3971
3972 2011-06-18  Ian Lance Taylor  <iant@google.com>
3973
3974         PR gold/12745
3975         * layout.cc (Layout::layout_eh_frame): Correct handling of
3976         writable .eh_frame section.
3977
3978 2011-06-17  Ian Lance Taylor  <iant@google.com>
3979
3980         PR gold/12893
3981         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3982         symbol is redefined with the exact same object and value.
3983
3984 2011-06-17  Ian Lance Taylor  <iant@google.com>
3985
3986         PR gold/12880
3987         * layout.h (class Layout): Add interp_segment_ field.
3988         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3989         (Layout::attach_allocated_section_to_segment): If making shared
3990         library, put .interp section in PT_INTERP segment.
3991         (Layout::finalize): Also call create_interp if -dynamic-linker
3992         option was used.
3993         (Layout::create_interp): Assert that there is no PT_INTERP
3994         segment.  If not using a SECTIONS clause, use make_output_section.
3995         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3996         * script-sections.cc
3997         (Script_sections::create_note_and_tls_segments): If making shared
3998         library, put .interp section in PT_INTERP segment.
3999
4000 2011-06-17  Ian Lance Taylor  <iant@google.com>
4001
4002         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4003         when making a shared library.
4004
4005 2011-06-17  Ian Lance Taylor  <iant@google.com>
4006
4007         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4008         parameter.  Change all callers.  Don't issue warning about PC32
4009         against locally defined symbol.
4010
4011 2011-06-16  Ian Lance Taylor  <iant@google.com>
4012
4013         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4014         occurs in same object.
4015
4016 2011-06-14  Alan Modra  <amodra@gmail.com>
4017
4018         * po/POTFILES.in: Regenerate.
4019
4020 2011-06-09  Ian Lance Taylor  <iant@google.com>
4021
4022         * script-sections.cc
4023         (Orphan_output_section::set_section_addresses): For a relocatable
4024         link set address to 0.
4025
4026 2011-06-09  Cary Coutant  <ccoutant@google.com>
4027
4028         PR gold/12804
4029         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4030         used with --compress-debug-sections.
4031         * gold/object.cc (Sized_relobj_file::do_layout): Report
4032         uncompressed size of compressed input sections.
4033
4034 2011-06-08  Cary Coutant  <ccoutant@google.com>
4035
4036         PR gold/12804
4037         * testsuite/two_file_test_2_v1.cc: Change initialization of
4038         v2 to keep it in .data.
4039
4040 2011-06-07  Cary Coutant  <ccoutant@google.com>
4041
4042         * common.cc (Symbol_table::do_allocate_commons_list): Call
4043         gold_fallback.
4044         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4045         (Errors::fallback): New function.
4046         (gold_fallback): New function.
4047         * errors.h (Errors::fallback): New function.
4048         * gold.cc (gold_exit): Change status parameter to enum; adjust
4049         all callers.
4050         (queue_initial_tasks): Call gold_fallback.
4051         * gold.h: Include cstdlib.
4052         (Exit_status): New enum type.
4053         (gold_exit): Change status parameter to enum.
4054         (gold_fallback): New function.
4055         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4056         (Layout::create_symtab_sections): Likewise.
4057         (Layout::create_shdrs): Likewise.
4058         * main.cc (main): Adjust call to gold_exit.
4059         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4060         (Output_data_got::add_got_entry_pair): Likewise.
4061         (Output_section::add_input_section): Likewise.
4062         (Output_section::add_output_section_data): Likewise.
4063         (Output_segment::set_section_list_addresses): Likewise.
4064         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4065
4066 2011-06-07  Cary Coutant  <ccoutant@google.com>
4067
4068         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4069         for incremental links.
4070         * output.cc (Output_segment::set_section_list_addresses): Remove
4071         FIXME and test for TLS or BSS.
4072
4073 2011-06-07  Cary Coutant  <ccoutant@google.com>
4074
4075         * testsuite/Makefile.am: Add incremental_copy_test,
4076         incremental_common_test_1.
4077         * testsuite/Makefile.in: Regenerate.
4078         * testsuite/common_test_1_v1.c: New source file.
4079         * testsuite/common_test_1_v2.c: New source file.
4080         * testsuite/copy_test_v1.cc: New source file.
4081
4082 2011-06-07  Cary Coutant  <ccoutant@google.com>
4083
4084         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4085         update, allocate common from bss section's free list.
4086         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4087         linker-defined symbols.
4088         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4089         Skip GOT and PLT entries that are no longer referenced.
4090         (Output_section_incremental_inputs::write_info_blocks): Mark
4091         linker-defined symbols.
4092         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4093         * output.cc (Output_section::allocate): New function.
4094         * output.h (Output_section::allocate): New function.
4095         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4096         linker-defined symbols.
4097         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4098         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4099         (Symbol::init_base_output_data): Likewise.
4100         (Symbol::init_base_output_segment): Likewise.
4101         (Symbol::init_base_constant): Likewise.
4102         (Sized_symbol::init_output_data): Likewise.
4103         (Sized_symbol::init_output_segment): Likewise.
4104         (Sized_symbol::init_constant): Likewise.
4105         (Symbol_table::do_define_in_output_data): Likewise.
4106         (Symbol_table::do_define_in_output_segment): Likewise.
4107         (Symbol_table::do_define_as_constant): Likewise.
4108         * symtab.h (Symbol::is_predefined): New function.
4109         (Symbol::init_base_output_data): Add is_predefined parameter.
4110         (Symbol::init_base_output_segment): Likewise.
4111         (Symbol::init_base_constant): Likewise.
4112         (Symbol::is_predefined_): New data member.
4113         (Sized_symbol::init_output_data): Add is_predefined parameter.
4114         (Sized_symbol::init_output_segment): Likewise.
4115         (Sized_symbol::init_constant): Likewise.
4116         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4117
4118 2011-06-07  Cary Coutant  <ccoutant@google.com>
4119
4120         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4121         instead of emit_copy_reloc.
4122         (Copy_relocs::emit_copy_reloc): Refactor.
4123         (Copy_relocs::make_copy_reloc): New function.
4124         (Copy_relocs::add_copy_reloc): Remove.
4125         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4126         section.
4127         (Copy_relocs::make_copy_reloc): New function.
4128         (Copy_relocs::add_copy_reloc): Remove.
4129         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4130         unchanged input files.
4131         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4132         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4133         Reserve BSS space for COPY relocations.
4134         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4135         (Output_section_incremental_inputs::write_info_blocks): Record
4136         whether a symbol is copied from a shared object.
4137         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4138         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4139         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4140         (Incremental_input_entry_reader::get_output_symbol_index): Add
4141         is_copy parameter.
4142         (Incremental_binary::emit_copy_relocs): New function.
4143         (Incremental_binary::do_emit_copy_relocs): New function.
4144         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4145         new data member.
4146         (Sized_incremental_binary::add_copy_reloc): New function.
4147         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4148         (Sized_incremental_binary::Copy_reloc): New struct.
4149         (Sized_incremental_binary::Copy_relocs): New typedef.
4150         (Sized_incremental_binary::copy_relocs_): New data member.
4151         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4152         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4153         * target.h (Sized_target::emit_copy_reloc): New function.
4154         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4155
4156 2011-06-02  Cary Coutant  <ccoutant@google.com>
4157
4158         PR gold/12163
4159         * gold/archive.cc (Archive::Archive): Initialize new data member.
4160         (Archive::include_all_members): Return if archive has already been
4161         included.
4162         * gold/archive.h (Archive::include_all_members_): New data member.
4163
4164 2011-06-02  Nick Clifton  <nickc@redhat.com>
4165
4166         * dynobj.h: Fix spelling mistake in comment.
4167         * output.cc: Likewise.
4168
4169 2011-05-31  Doug Kwan  <dougkwan@google.com>
4170             Asier Llano
4171
4172         PR gold/12826
4173         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4174         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4175         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4176         redundant arm_exidx_test.so.
4177         * testsuite/Makefile.in: Regenerate.
4178         (check_SCRIPTS): Add pr12826.sh
4179         (check_DATA): Add pr12826.stdout
4180         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4181         * testsuite/pr12826.sh: New file.
4182         * testsuite/pr12826_1.s: Ditto.
4183         * testsuite/pr12826_1.s: Ditto.
4184
4185 2011-05-30  Ian Lance Taylor  <iant@google.com>
4186
4187         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4188         sections.
4189
4190 2011-05-29  Ian Lance Taylor  <iant@google.com>
4191
4192         PR gold/12804
4193         * testsuite/Makefile.am: Use different file name for two_file_test
4194         temporary file for each incremental test.
4195         * testsuite/Makefile.in: Rebuild.
4196
4197 2011-05-29  Ian Lance Taylor  <iant@google.com>
4198
4199         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4200         binary input file is empty.
4201
4202 2011-05-27  Ian Lance Taylor  <iant@google.com>
4203
4204         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4205         (ver_test_9.so): Likewise.
4206         * testsuite/Makefile.in: Rebuild.
4207
4208 2011-05-26 Cary Coutant  <ccoutant@google.com>
4209
4210         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4211         * incremental.cc (Incremental_inputs::report_input_section): Fix
4212         comment, indentation.
4213         (Incremental_inputs::report_comdat_group): New function.
4214         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4215         of data for incremental input file entry.
4216         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4217         group count, COMDAT group signatures.
4218         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4219         an unchanged input file.
4220         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4221         Initialize new data member.
4222         (Incremental_object_entry::add_comdat_group): New function.
4223         (Incremental_object_entry::get_comdat_group_count): New function.
4224         (Incremental_object_entry::get_comdat_signature_key): New function.
4225         (Incremental_object_entry::groups_): New data member.
4226         (Incremental_inputs::report_comdat_group): New function.
4227         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4228         data for incremental input file entry.
4229         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4230         (Incremental_input_entry_reader::get_input_section): Adjust size of
4231         data for incremental input file entry.
4232         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4233         (Incremental_input_entry_reader::get_comdat_group_signature): New
4234         function.
4235         * object.cc (Sized_relobj::include_section_group): Report kept
4236         COMDAT groups for incremental links.
4237
4238 2011-05-24  David Meyer  <pdox@google.com>
4239
4240         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4241         with name parameter.  Add found_name parameter.
4242         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4243         * dirsearch.h (class Dirsearch): Update declaration.
4244
4245 2011-05-24  Ian Lance Taylor  <iant@google.com>
4246
4247         * archive.cc (Library_base::should_include_member): Pull in object
4248         from archive if it defines the entry symbol.
4249         * parameters.cc (Parameters::entry): New function.
4250         * parameters.h (class Parameters): Declare entry.
4251         * output.h (class Output_file_header): Remove entry_ field.
4252         * output.cc (Output_file_header::Output_file_header): Remove entry
4253         parameter.  Change all callers.
4254         (Output_file_header::entry): Use parameters->entry.
4255         * gold.cc (queue_middle_tasks): Likewise.
4256         * plugin.cc (Plugin_hook::run): Likewise.
4257
4258 2011-05-24 Cary Coutant  <ccoutant@google.com>
4259
4260         * gold.cc (queue_initial_tasks): Pass incremental base filename
4261         to Output_file::open_base_file; don't print error message.
4262         * incremental-dump.cc (main): Adjust call to
4263         Output_file::open_for_modification.
4264         * incremental-dump.cc (main): Likewise.
4265         * incremental.cc (Incremental_inputs::report_command_line):
4266         Ignore --incremental-base option when comparing command lines.
4267         Ignore parameter when given as separate argument.
4268         * options.h (class General_options): Add --incremental-base.
4269         * output.cc (Output_file::Output_file):
4270         (Output_file::open_base_file): Add base_name and writable parameters;
4271         read base file into new file; print error message here.
4272         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4273         callers.
4274         * output.h (Output_file::open_for_modification): Rename to...
4275         (Output_file::open_base_file): ...this; add base_name and
4276         writable parameters; adjust all callers.
4277         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4278         callers.
4279         * testsuite/Makefile.am (incremental_test_4): Test
4280         --incremental-base.
4281         * testsuite/Makefile.in: Regenerate.
4282
4283 2011-05-24 Cary Coutant  <ccoutant@google.com>
4284
4285         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4286         incremental_test_4.
4287         * testsuite/Makefile.in: Regenerate.
4288         * testsuite/two_file_test_1_v1.cc: New test source file.
4289         * testsuite/two_file_test_1b_v1.cc: New test source file.
4290         * testsuite/two_file_test_2_v1.cc: New test source file.
4291
4292 2011-05-24 Cary Coutant  <ccoutant@google.com>
4293
4294         * dynobj.h (Dynobj::do_dynobj): New function.
4295         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4296         flag and soname for shared objects.
4297         * incremental.cc (Incremental_inputs::report_object): Make
4298         either Incremental_object_entry or Incremental_dynobj_entry; add
4299         soname to string table.
4300         (Incremental_inputs::report_input_section): Add assertion.
4301         (Output_section_incremental_inputs::set_final_data_size): Adjust
4302         type of input file entry for shared libraries; adjust size of
4303         shared library info entry.
4304         (Output_section_incremental_inputs::write_input_files): Write
4305         as_needed flag for shared libraries.
4306         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4307         of input file entry for shared libraries; write soname.
4308         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4309         soname from incremental info.
4310         * incremental.h (enum Incremental_input_flags): Add
4311         INCREMENTAL_INPUT_AS_NEEDED.
4312         (Incremental_input_entry::Incremental_input_entry): Initialize new
4313         data member.
4314         (Incremental_input_entry::set_as_needed): New function.
4315         (Incremental_input_entry::as_needed): New function.
4316         (Incremental_input_entry::do_dynobj_entry): New function.
4317         (Incremental_input_entry::as_needed_): New data member.
4318         (Incremental_object_entry::Incremental_object_entry): Don't check
4319         for shared library.
4320         (Incremental_object_entry::do_type): Likewise.
4321         (class Incremental_dynobj_entry): New class.
4322         (Incremental_input_entry_reader::as_needed): New function.
4323         (Incremental_input_entry_reader::get_soname): New function.
4324         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4325         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4326         size of shared library info entry.
4327         * layout.cc (Layout::finish_dynamic_section): Don't test for
4328         incremental link when adding DT_NEEDED entries.
4329         * object.h (Object::Object): Initialize new data member.
4330         (Object::dynobj): New function.
4331         (Object::set_as_needed): New function.
4332         (Object::as_needed): New function.
4333         (Object::do_dynobj): New function.
4334         (Object::as_needed_): New data member.
4335
4336 2011-05-24 Cary Coutant  <ccoutant@google.com>
4337
4338         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4339         info; adjust display of GOT entries.
4340         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4341         vector of input objects; remove file_status_.
4342         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4343         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4344         got_plt reader; call target hooks to reserve GOT entries.
4345         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4346         of input file info header and GOT info entry.
4347         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4348         relocation info.
4349         (Got_plt_view_info::got_descriptor): Remove.
4350         (Got_plt_view_info::sym_index): New data member.
4351         (Got_plt_view_info::input_index): New data member.
4352         (Local_got_offset_visitor::visit): Write input file index.
4353         (Global_got_offset_visitor::visit): Write 0 for input file index.
4354         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4355         with sym_index and input_index.
4356         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4357         incremental info GOT entry; replace got_descriptor with input_index.
4358         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4359         map from input file index to object.
4360         (Sized_relobj_incr::do_layout): Replace direct data member reference
4361         with accessor function.
4362         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4363         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4364         Adjust size of input file info header.
4365         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4366         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4367         (Incremental_input_entry_reader::get_input_section): Adjust size of
4368         input file info header.
4369         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4370         of incremental info GOT entry.
4371         (Incremental_got_plt_reader::get_got_desc): Remove.
4372         (Incremental_got_plt_reader::get_got_symndx): New function.
4373         (Incremental_got_plt_reader::get_got_input_index): New function.
4374         (Sized_incremental_binary::Sized_incremental_binary): Remove
4375         file_status_; add input_objects_.
4376         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4377         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4378         (Sized_incremental_binary::file_is_unchanged): Remove.
4379         (Sized_incremental_binary::set_input_object): New function.
4380         (Sized_incremental_binary::input_object): New function.
4381         (Sized_incremental_binary::file_status_): Remove.
4382         (Sized_incremental_binary::input_objects_): New data member.
4383         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4384         references.
4385         (Sized_relobj_incr::invalid_address): Move to base class.
4386         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4387         class.
4388         (Sized_relobj_incr::do_output_section_offset): Likewise.
4389         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4390         (Sized_relobj_incr::section_offsets_): Likewise.
4391         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4392         function.
4393         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4394         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4395         with accessor function.
4396         (Sized_relobj_file::do_layout): Likewise.
4397         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4398         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4399         (Sized_relobj_file::compute_final_local_value): Replace refs to
4400         section_offsets_ with accessor function.
4401         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4402         * object.h (Relobj::Relobj): Initialize new data members.
4403         (Relobj::add_dyn_reloc): New function.
4404         (Relobj::first_dyn_reloc): New function.
4405         (Relobj::dyn_reloc_count): New function.
4406         (Relobj::first_dyn_reloc_): New data member.
4407         (Relobj::dyn_reloc_count_): New data member.
4408         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4409         references.
4410         (Sized_relobj::Address): New typedef.
4411         (Sized_relobj::invalid_address): Move here from child class.
4412         (Sized_relobj::Sized_relobj): Initialize new data members.
4413         (Sized_relobj::sized_relobj): New function.
4414         (Sized_relobj::is_output_section_offset_invalid): Move here from
4415         child class.
4416         (Sized_relobj::get_output_section_offset): Likewise.
4417         (Sized_relobj::local_has_got_offset): Likewise.
4418         (Sized_relobj::local_got_offset): Likewise.
4419         (Sized_relobj::set_local_got_offset): Likewise.
4420         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4421         (Sized_relobj::clear_got_offsets): New function.
4422         (Sized_relobj::section_offsets): Move here from child class.
4423         (Sized_relobj::do_output_section_offset): Likewise.
4424         (Sized_relobj::do_set_section_offset): Likewise.
4425         (Sized_relobj::Local_got_offsets): Likewise.
4426         (Sized_relobj::local_got_offsets_): Likewise.
4427         (Sized_relobj::section_offsets_): Likewise.
4428         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4429         references.
4430         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4431         class.
4432         (Sized_relobj_file::sized_relobj): New function
4433         (Sized_relobj_file::local_has_got_offset): Move to base class.
4434         (Sized_relobj_file::local_got_offset): Likewise.
4435         (Sized_relobj_file::set_local_got_offset): Likewise.
4436         (Sized_relobj_file::get_output_section_offset): Likewise.
4437         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4438         (Sized_relobj_file::do_output_section_offset): Likewise.
4439         (Sized_relobj_file::do_set_section_offset): Likewise.
4440         (Sized_relobj_file::Local_got_offsets): Likewise.
4441         (Sized_relobj_file::local_got_offsets_): Likewise.
4442         (Sized_relobj_file::section_offsets_): Likewise.
4443         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4444         (all constructors).
4445         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4446         (Output_reloc::get_symbol_index): Likewise.
4447         (Output_reloc::local_section_offset): Likewise.
4448         (Output_reloc::get_address): Likewise.
4449         (Output_reloc::symbol_value): Likewise.
4450         (Output_data_got::reserve_slot): Move to class definition.
4451         (Output_data_got::reserve_local): New function.
4452         (Output_data_got::reserve_slot_for_global): Remove.
4453         (Output_data_got::reserve_global): New function.
4454         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4455         (all constructors, two instantiations).
4456         (Output_reloc::get_relobj): New function (two instantiations).
4457         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4458         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4459         (Output_data_reloc::add_global): Adjust type of relobj.
4460         (Output_data_reloc::add_global_relative): Likewise.
4461         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4462         (Output_data_reloc::add_local): Likewise.
4463         (Output_data_reloc::add_local_relative): Likewise.
4464         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4465         (Output_data_reloc::add_local_section): Likewise.
4466         (Output_data_reloc::add_output_section): Likewise.
4467         (Output_data_reloc::add_absolute): Likewise.
4468         (Output_data_reloc::add_target_specific): Likewise.
4469         (Output_data_got::reserve_slot): Move definition here.
4470         (Output_data_got::reserve_local): New function.
4471         (Output_data_got::reserve_global): New function.
4472         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4473         section_offsets_ with accessor function.
4474         (Sized_relobj_file::write_sections): Likewise.
4475         (Sized_relobj_file::do_relocate_sections): Likewise.
4476         * target.h (Sized_target::reserve_local_got_entry): New function.
4477         (Sized_target::reserve_global_got_entry): New function.
4478         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4479         (Target_x86_64::reserve_global_got_entry): New function.
4480         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4481
4482 2011-05-23 Cary Coutant  <ccoutant@google.com>
4483
4484         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4485         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4486         bit when checking got_type.
4487         * incremental.cc (Sized_incremental_binary::setup_readers):
4488         Store symbol table and string table locations; initialize bit vector
4489         of file status flags.
4490         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4491         unchanged files.
4492         (Sized_incremental_binary::do_process_got_plt): New function.
4493         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4494         (Output_section_incremental_inputs::set_final_data_size): Record
4495         file index for each input file.
4496         (Output_section_incremental_inputs::write_got_plt): Store file index
4497         instead of input entry offset for each GOT entry.
4498         * incremental.h
4499         (Incremental_input_entry::Incremental_input_entry): Initialize new
4500         data member.
4501         (Incremental_input_entry::set_offset): Store file index.
4502         (Incremental_input_entry::get_file_index): New function.
4503         (Incremental_input_entry::file_index_): New data member.
4504         (Incremental_binary::process_got_plt): New function.
4505         (Incremental_binary::do_process_got_plt): New function.
4506         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4507         data members.
4508         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4509         (Sized_incremental_binary::set_file_is_unchanged): New function.
4510         (Sized_incremental_binary::file_is_unchanged): New function.
4511         (Sized_incremental_binary::do_process_got_plt): New function.
4512         (Sized_incremental_binary::file_status_): New data member.
4513         (Sized_incremental_binary::main_symtab_loc_): New data member.
4514         (Sized_incremental_binary::main_strtab_loc_): New data member.
4515         * output.cc (Output_data_got::Got_entry::write): Add case
4516         RESERVED_CODE.
4517         (Output_data_got::add_global): Call add_got_entry.
4518         (Output_data_got::add_global_plt): Likewise.
4519         (Output_data_got::add_global_with_rel): Likewise.
4520         (Output_data_got::add_global_with_rela): Likewise.
4521         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4522         (Output_data_got::add_global_pair_with_rela): Likewise.
4523         (Output_data_got::add_local): Call add_got_entry.
4524         (Output_data_got::add_local_plt): Likewise.
4525         (Output_data_got::add_local_with_rel): Likewise.
4526         (Output_data_got::add_local_with_rela): Likewise.
4527         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4528         (Output_data_got::add_local_pair_with_rela): Likewise.
4529         (Output_data_got::reserve_slot): New function.
4530         (Output_data_got::reserve_slot_for_global): New function.
4531         (Output_data_got::add_got_entry): New function.
4532         (Output_data_got::add_got_entry_pair): New function.
4533         (Output_section::add_output_section_data): Edit FIXME.
4534         * output.h
4535         (Output_section_data_build::Output_section_data_build): New
4536         constructor with size parameter.
4537         (Output_data_space::Output_data_space): Likewise.
4538         (Output_data_got::Output_data_got): Initialize new data member; new
4539         constructor with size parameter.
4540         (Output_data_got::add_constant): Call add_got_entry.
4541         (Output_data_got::reserve_slot): New function.
4542         (Output_data_got::reserve_slot_for_global): New function.
4543         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4544         (Output_data_got::add_got_entry): New function.
4545         (Output_data_got::add_got_entry_pair): New function.
4546         (Output_data_got::free_list_): New data member.
4547         * target.h (Sized_target::init_got_plt_for_update): New function.
4548         (Sized_target::register_global_plt_entry): New function.
4549         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4550         Initialize new data member; call init; add constructor with PLT count.
4551         (Output_data_plt_x86_64::init): New function.
4552         (Output_data_plt_x86_64::add_relocation): New function.
4553         (Output_data_plt_x86_64::reserve_slot): New function.
4554         (Output_data_plt_x86_64::free_list_): New data member.
4555         (Target_x86_64::init_got_plt_for_update): New function.
4556         (Target_x86_64::register_global_plt_entry): New function.
4557         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4558         incremental updates.
4559         (Output_data_plt_x86_64::add_relocation): New function.
4560         * testsuite/object_unittest.cc (Object_test): Set default options.
4561
4562 2011-05-16  Ian Lance Taylor  <iant@google.com>
4563
4564         * options.h (class General_options): Make -i a synonym for -r.
4565
4566 2011-05-16  Ian Lance Taylor  <iant@google.com>
4567
4568         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4569
4570 2011-05-10 Cary Coutant  <ccoutant@google.com>
4571
4572         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4573         strip_all (-s).
4574
4575 2011-05-06  Ian Lance Taylor  <iant@google.com>
4576
4577         * layout.cc (Layout::layout): If the output section flags change,
4578         update the ordering.
4579
4580 2011-04-25 Cary Coutant  <ccoutant@google.com>
4581
4582         * incremental-dump.cc (dump_incremental_inputs): Print local
4583         symbol info for each input file.
4584         * incremental.cc
4585         (Output_section_incremental_inputs::set_final_data_size): Add local
4586         symbol info to input file entries in incremental info.
4587         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4588         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4589         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4590         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4591         implementation.
4592         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4593         (Sized_incr_relobj::do_relocate): Write the local symbols.
4594         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4595         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4596         Adjust size of input file header.
4597         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4598         (Incremental_inputs_reader::get_local_symbol_count): New function.
4599         (Incremental_inputs_reader::get_input_section): Adjust size of input
4600         file header.
4601         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4602         (Sized_incr_relobj::This): New typedef.
4603         (Sized_incr_relobj::sym_size): New const data member.
4604         (Sized_incr_relobj::Local_symbol): New struct.
4605         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4606         (Sized_incr_relobj::do_local_symbol_offset): New function.
4607         (Sized_incr_relobj::local_symbol_count_): New data member.
4608         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4609         (Sized_incr_relobj::local_symbol_index_): New data member.
4610         (Sized_incr_relobj::local_symbol_offset_): New data member.
4611         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4612         (Sized_incr_relobj::local_symbols_): New data member.
4613         * object.h (Relobj::output_local_symbol_count): New function.
4614         (Relobj::local_symbol_offset): New function.
4615         (Relobj::do_output_local_symbol_count): New function.
4616         (Relobj::do_local_symbol_offset): New function.
4617         (Sized_relobj::do_output_local_symbol_count): New function.
4618         (Sized_relobj::do_local_symbol_offset): New function.
4619
4620 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4621
4622         * descriptors.cc (set_close_on_exec): New function.
4623         (Descriptors::open): Use set_close_on_exec.
4624         * output.cc (S_ISLNK): Define if not defined.
4625
4626 2011-04-22 Cary Coutant  <ccoutant@google.com>
4627
4628         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4629         global symbol map.
4630         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4631         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4632         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4633         relocations.
4634         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4635         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4636         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4637         * incremental.h
4638         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4639         function.
4640         (Incremental_binary::apply_incremental_relocs): New function.
4641         (Incremental_binary::do_apply_incremental_relocs): New function.
4642         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4643         data member.
4644         (Sized_incremental_binary::add_global_symbol): New function.
4645         (Sized_incremental_binary::global_symbol): New function.
4646         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4647         (Sized_incremental_binary::symbol_map_): New data member.
4648         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4649         * target.h (Sized_target::apply_relocation): New function.
4650         * target-reloc.h (apply_relocation): New function.
4651         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4652
4653 2011-04-22  Doug Kwan  <dougkwan@google.com>
4654
4655         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4656         flag of a SHT_ARM_EXIDX section.
4657         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4658         * testsuite/Makefile.in: Regenerate.
4659         * testsuite/arm_exidx_test.s: New file.
4660         * testsuite/arm_exidx_test.sh: Same.
4661
4662 2011-04-20 Cary Coutant  <ccoutant@google.com>
4663
4664         PR gold/12689
4665         * archive.h (Incremental_archive_entry::Archive_member):
4666         Initialize arg_serial_ (second constructor).
4667
4668 2011-04-17  Ian Lance Taylor  <iant@google.com>
4669
4670         * object.cc (Relocate_info::location): Simplify location string.
4671         * errors.cc (Errors::error_at_location): Don't print program
4672         name.
4673         (Errors::warning_at_location): Likewise.
4674         (Errors::undefined_symbol): Likewise.
4675         * testsuite/debug_msg.sh: Update accordingly.
4676
4677 2011-04-14 Cary Coutant  <ccoutant@google.com>
4678
4679         * gold/layout.cc (Layout::symtab_section_offset): New function.
4680         * gold/layout.h (Layout::symtab_section_offset): New function.
4681         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4682
4683 2011-04-12  Ian Lance Taylor  <iant@google.com>
4684
4685         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4686         with MREMAP_MAYMOVE.
4687         * output.h (class Output_file): Add map_is_allocated_ field.
4688         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4689         not available, provide stubs.  If mremap is not available, #define
4690         it to gold_mremap.
4691         (MREMAP_MAYMOVE): Define if not defined.
4692         (Output_file::Output_file): Initialize map_is_allocated_.
4693         (Output_file::resize): Check map_is_allocated_.
4694         (Output_file::map_anonymous): If mmap fails, use malloc.
4695         (Output_file::unmap): Don't do anything for an anonymous map.
4696         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4697         is not available, provide stubs.
4698         (File_read::View::~View): Use free rather than delete[].
4699         (File_read::make_view): Use malloc rather than new[].  If mmap
4700         fails, use malloc.
4701         (File_read::find_or_make_view): Use malloc rather than new[].
4702         * gold.h: Remove HAVE_REMAP code.
4703         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4704         exists.  Rename mremap to gold_mremap.  If mmap is not available
4705         don't do anything.
4706         * configure, config.in: Rebuild.
4707
4708 2011-04-11  Ian Lance Taylor  <iant@google.com>
4709
4710         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4711         initialize local variable v.
4712
4713 2011-04-11  Cary Coutant  <ccoutant@google.com>
4714
4715         * archive.cc (Archive::include_member): Adjust call to
4716         report_object.
4717         (Add_archive_symbols::run): Track argument serial numbers.
4718         (Lib_group::include_member): Likewise.
4719         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4720         * archive.h (Incremental_archive_entry::Archive_member):
4721         Initialize arg_serial_.
4722         (Archive_member::arg_serial_): New data member.
4723         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4724         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4725         incremental link.
4726         (Sized_dynobj::do_for_all_local_got_entries): New function.
4727         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4728         function.
4729         * fileread.cc (get_mtime): New function.
4730         * fileread.h (get_mtime): New function.
4731         * gold.cc (queue_initial_tasks): Check for incremental update.
4732         (process_incremental_input): New function.
4733         (queue_middle_tasks): Don't force valid target for incremental
4734         update.
4735         * incremental-dump.cc (find_input_containing_global): Adjust
4736         size of symbol info entry.
4737         (dump_incremental_inputs): Dump argument serial number and
4738         in_system_directory flag; bias shndx by 1; print symbol names
4739         when dumping per-file symbol lists; use new symbol info readers.
4740         * incremental.cc
4741         (Output_section_incremental_inputs:update_data_size): New function.
4742         (Sized_incremental_binary::setup_readers): Setup input readers
4743         for each input file; build maps for files added from libraries
4744         and scripts.
4745         (Sized_incremental_binary::check_input_args): New function.
4746         (Sized_incremental_binary::do_check_inputs): Build map of argument
4747         serial numbers to input arguments.
4748         (Sized_incremental_binary::do_file_has_changed): Rename
4749         do_file_is_unchanged to this; compare file modification times.
4750         (Sized_incremental_binary::do_init_layout): New function.
4751         (Sized_incremental_binary::do_reserve_layout): New function.
4752         (Sized_incremental_binary::do_get_input_reader): Remove.
4753         (Sized_incremental_binary::get_symtab_view): New function.
4754         (Incremental_checker::can_incrementally_link_output_file): Remove.
4755         (Incremental_inputs::report_command_line): Exclude --debug options.
4756         (Incremental_inputs::report_archive_begin): Add parameter; track
4757         argument serial numbers; don't put input file entry for archive
4758         before archive members.
4759         (Incremental_inputs::report_archive_end): Put input file entry
4760         for archive after archive members.
4761         (Incremental_inputs::report_object): Add parameter; track argument
4762         serial numbers and in_system_directory flag.
4763         (Incremental_inputs::report_script): Add parameter; track argument
4764         serial numbers.
4765         (Output_section_incremental_inputs::set_final_data_size): Adjust
4766         size of symbol info entry; check for forwarding symbols.
4767         (Output_section_incremental_inputs::write_input_files): Write
4768         in_system_directory flag and argument serial number.
4769         (Output_section_incremental_inputs::write_info_blocks): Map section
4770         indices between incremental info and original input file; store
4771         input section index for each symbol.
4772         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4773         change operator() to visit().
4774         (class Global_got_offset_visitor): Likewise.
4775         (class Global_symbol_visitor_got_plt):
4776         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4777         classes.
4778         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4779         (Sized_incr_relobj::do_read_symbols): New function.
4780         (Sized_incr_relobj::do_layout): New function.
4781         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4782         (Sized_incr_relobj::do_add_symbols): New function.
4783         (Sized_incr_relobj::do_should_include_member): New function.
4784         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4785         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4786         (Sized_incr_relobj::do_section_size): New function.
4787         (Sized_incr_relobj::do_section_name): New function.
4788         (Sized_incr_relobj::do_section_contents): New function.
4789         (Sized_incr_relobj::do_section_flags): New function.
4790         (Sized_incr_relobj::do_section_entsize): New function.
4791         (Sized_incr_relobj::do_section_address): New function.
4792         (Sized_incr_relobj::do_section_type): New function.
4793         (Sized_incr_relobj::do_section_link): New function.
4794         (Sized_incr_relobj::do_section_info): New function.
4795         (Sized_incr_relobj::do_section_addralign): New function.
4796         (Sized_incr_relobj::do_initialize_xindex): New function.
4797         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4798         (Sized_incr_relobj::do_read_relocs): New function.
4799         (Sized_incr_relobj::do_gc_process_relocs): New function.
4800         (Sized_incr_relobj::do_scan_relocs): New function.
4801         (Sized_incr_relobj::do_count_local_symbols): New function.
4802         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4803         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4804         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4805         (Sized_incr_relobj::do_relocate): New function.
4806         (Sized_incr_relobj::do_set_section_offset): New function.
4807         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4808         (Sized_incr_dynobj::do_read_symbols): New function.
4809         (Sized_incr_dynobj::do_layout): New function.
4810         (Sized_incr_dynobj::do_add_symbols): New function.
4811         (Sized_incr_dynobj::do_should_include_member): New function.
4812         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4813         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4814         (Sized_incr_dynobj::do_section_size): New function.
4815         (Sized_incr_dynobj::do_section_name): New function.
4816         (Sized_incr_dynobj::do_section_contents): New function.
4817         (Sized_incr_dynobj::do_section_flags): New function.
4818         (Sized_incr_dynobj::do_section_entsize): New function.
4819         (Sized_incr_dynobj::do_section_address): New function.
4820         (Sized_incr_dynobj::do_section_type): New function.
4821         (Sized_incr_dynobj::do_section_link): New function.
4822         (Sized_incr_dynobj::do_section_info): New function.
4823         (Sized_incr_dynobj::do_section_addralign): New function.
4824         (Sized_incr_dynobj::do_initialize_xindex): New function.
4825         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4826         (make_sized_incremental_object): New function.
4827         (Incremental_library::copy_unused_symbols): New function.
4828         (Incremental_library::do_for_all_unused_symbols): New function.
4829         * incremental.h (enum Incremental_input_flags): New type.
4830         (class Incremental_checker): Remove.
4831         (Incremental_input_entry::Incremental_input_entry): Add argument
4832         serial number.
4833         (Incremental_input_entry::arg_serial): New function.
4834         (Incremental_input_entry::set_is_in_system_directory): New function.
4835         (Incremental_input_entry::is_in_system_directory): New function.
4836         (Incremental_input_entry::arg_serial_): New data member.
4837         (Incremental_input_entry::is_in_system_directory_): New data member.
4838         (class Script_info): Move here from script.h.
4839         (Script_info::Script_info): Add filename parameter.
4840         (Script_info::filename): New function.
4841         (Script_info::filename_): New data member.
4842         (Incremental_script_entry::Incremental_script_entry): Add argument
4843         serial number.
4844         (Incremental_object_entry::Incremental_object_entry): Likewise.
4845         (Incremental_object_entry::add_input_section): Build list of input
4846         sections with map to original shndx.
4847         (Incremental_object_entry::get_input_section_index): New function.
4848         (Incremental_object_entry::shndx_): New data member.
4849         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4850         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4851         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4852         serial number.
4853         (Incremental_inputs::report_archive_begin): Likewise.
4854         (Incremental_inputs::report_object): Likewise.
4855         (Incremental_inputs::report_script): Likewise.
4856         (class Incremental_global_symbol_reader): New class.
4857         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4858         and store flags and input file type.
4859         (Incremental_input_entry_reader::arg_serial): New function.
4860         (Incremental_input_entry_reader::type): Extract type from flags.
4861         (Incremental_input_entry_reader::is_in_system_directory): New function.
4862         (Incremental_input_entry_reader::get_input_section_count): Call
4863         accessor function for type.
4864         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4865         function for type; adjust size of global symbol entry.
4866         (Incremental_input_entry_reader::get_global_symbol_count): Call
4867         accessor function for type.
4868         (Incremental_input_entry_reader::get_object_count): Likewise.
4869         (Incremental_input_entry_reader::get_object_offset): Likewise.
4870         (Incremental_input_entry_reader::get_member_count): Likewise.
4871         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4872         (Incremental_input_entry_reader::get_member_offset): Likewise.
4873         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4874         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4875         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4876         (Incremental_input_entry_reader::get_global_symbol_reader): New
4877         function.
4878         (Incremental_input_entry_reader::get_output_symbol_index): New
4879         function.
4880         (Incremental_input_entry_reader::type_): Remove.
4881         (Incremental_input_entry_reader::flags_): New data member.
4882         (Incremental_inputs_reader::input_file_offset): New function.
4883         (Incremental_inputs_reader::input_file_index): New function.
4884         (Incremental_inputs_reader::input_file): Call input_file_offset.
4885         (Incremental_inputs_reader::input_file_at_offset): New function.
4886         (Incremental_relocs_reader::get_r_type): Reformat.
4887         (Incremental_relocs_reader::get_r_shndx): Reformat.
4888         (Incremental_relocs_reader::get_r_offset): Reformat.
4889         (Incremental_relocs_reader::data): New function.
4890         (Incremental_binary::Incremental_binary): Initialize new data members.
4891         (Incremental_binary::check_inputs): Add cmdline parameter.
4892         (Incremental_binary::file_is_unchanged): Remove.
4893         (Input_reader::arg_serial): New function.
4894         (Input_reader::get_unused_symbol_count): New function.
4895         (Input_reader::get_unused_symbol): New function.
4896         (Input_reader::do_arg_serial): New function.
4897         (Input_reader::do_get_unused_symbol_count): New function.
4898         (Input_reader::do_get_unused_symbol): New function.
4899         (Incremental_binary::input_file_count): New function.
4900         (Incremental_binary::get_input_reader): Change signature to use
4901         index instead of filename.
4902         (Incremental_binary::file_has_changed): New function.
4903         (Incremental_binary::get_input_argument): New function.
4904         (Incremental_binary::get_library): New function.
4905         (Incremental_binary::get_script_info): New function.
4906         (Incremental_binary::init_layout): New function.
4907         (Incremental_binary::reserve_layout): New function.
4908         (Incremental_binary::output_file): New function.
4909         (Incremental_binary::do_check_inputs): New function.
4910         (Incremental_binary::do_file_is_unchanged): Remove.
4911         (Incremental_binary::do_file_has_changed): New function.
4912         (Incremental_binary::do_init_layout): New function.
4913         (Incremental_binary::do_reserve_layout): New function.
4914         (Incremental_binary::do_input_file_count): New function.
4915         (Incremental_binary::do_get_input_reader): Change signature.
4916         (Incremental_binary::input_args_map_): New data member.
4917         (Incremental_binary::library_map_): New data member.
4918         (Incremental_binary::script_map_): New data member.
4919         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4920         new data members.
4921         (Sized_incremental_binary::output_section): New function.
4922         (Sized_incremental_binary::inputs_reader): Add const.
4923         (Sized_incremental_binary::symtab_reader): Add const.
4924         (Sized_incremental_binary::relocs_reader): Add const.
4925         (Sized_incremental_binary::got_plt_reader): Add const.
4926         (Sized_incremental_binary::get_symtab_view): New function.
4927         (Sized_incremental_binary::Inputs_reader): New typedef.
4928         (Sized_incremental_binary::Input_entry_reader): New typedef.
4929         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4930         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4931         (Sized_incremental_binary::do_file_has_changed): New function.
4932         (Sized_incremental_binary::do_init_layout): New function.
4933         (Sized_incremental_binary::do_reserve_layout): New function.
4934         (Sized_input_reader::Inputs_reader): Remove.
4935         (Sized_input_reader::Input_entry_reader): Remove.
4936         (Sized_input_reader::do_arg_serial): New function.
4937         (Sized_input_reader::do_get_unused_symbol_count): New function.
4938         (Sized_input_reader::do_get_unused_symbol): New function.
4939         (Sized_incremental_binary::do_input_file_count): New function.
4940         (Sized_incremental_binary::do_get_input_reader): Change signature;
4941         use index instead of filename.
4942         (Sized_incremental_binary::section_map_): New data member.
4943         (Sized_incremental_binary::input_entry_readers_): New data member.
4944         (class Sized_incr_relobj): New class.
4945         (class Sized_incr_dynobj): New class.
4946         (make_sized_incremental_object): New function.
4947         (class Incremental_library): New class.
4948         * layout.cc (Free_list::num_lists): New static data member.
4949         (Free_list::num_nodes): New static data member.
4950         (Free_list::num_removes): New static data member.
4951         (Free_list::num_remove_visits): New static data member.
4952         (Free_list::num_allocates): New static data member.
4953         (Free_list::num_allocate_visits): New static data member.
4954         (Free_list::init): New function.
4955         (Free_list::remove): New function.
4956         (Free_list::allocate): New function.
4957         (Free_list::dump): New function.
4958         (Free_list::print_stats): New function.
4959         (Layout_task_runner::run): Resize output file for incremental updates.
4960         (Layout::Layout): Initialize new data members.
4961         (Layout::set_incremental_base): New function.
4962         (Layout::init_fixed_output_section): New function.
4963         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4964         incremental updates.
4965         (Layout::create_gold_note): Do not create gold note section for
4966         incremental updates.
4967         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4968         for incremental updates.
4969         (Layout::set_section_offsets): For incremental updates, allocate space
4970         from free list.
4971         (Layout::create_symtab_sections): Layout with offsets relative to
4972         start of section; for incremental updates, allocate space from free
4973         list.
4974         (Layout::create_shdrs): For incremental updates, allocate space from
4975         free list.
4976         (Layout::finish_dynamic_section): For incremental updates, do not
4977         check --as-needed (fixed in subsequent patch).
4978         * layout.h (class Free_list): New class.
4979         (Layout::set_incremental_base): New function.
4980         (Layout::incremental_base): New function.
4981         (Layout::init_fixed_output_section): New function.
4982         (Layout::allocate): New function.
4983         (Layout::incremental_base_): New data member.
4984         (Layout::free_list_): New data member.
4985         * main.cc (main): Print Free_list statistics.
4986         * object.cc (Relobj::finalize_incremental_relocs): Add
4987         clear_counts parameter; clear counts only when clear_counts is set.
4988         (Sized_relobj::Sized_relobj): Initialize new base class.
4989         (Sized_relobj::do_layout): Don't report special sections.
4990         (Sized_relobj::do_for_all_local_got_entries): New function.
4991         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4992         symtab_off to all symbol table offsets.
4993         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4994         * object.h (class Got_offset_list): Move to top of file.
4995         (Object::Object): Allow case where input_file == NULL.
4996         (Object::~Object): Likewise.
4997         (Object::input_file): Assert that input_file != NULL.
4998         (Object::lock): Allow case where input_file == NULL.
4999         (Object::unlock): Likewise.
5000         (Object::is_locked): Likewise.
5001         (Object::token): Likewise.
5002         (Object::release): Likewise.
5003         (Object::is_incremental): New function.
5004         (Object::get_mtime): New function.
5005         (Object::for_all_local_got_entries): New function.
5006         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5007         (Object::set_is_in_system_directory): New function.
5008         (Object::is_in_system_directory): New function.
5009         (Object::do_is_incremental): New function.
5010         (Object::do_get_mtime): New function.
5011         (Object::do_for_all_local_got_entries): New function.
5012         (Object::is_in_system_directory_): New data member.
5013         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5014         (class Sized_relobj_base): New class.
5015         (class Sized_relobj): Derive from Sized_relobj_base.
5016         (class Sized_relobj::Symbols): Redeclare from base class.
5017         (class Sized_relobj::local_got_offset_list): Remove.
5018         (class Sized_relobj::Output_sections): Redeclare from base class.
5019         (class Sized_relobj::do_for_all_local_got_entries): New function.
5020         (class Sized_relobj::write_local_symbols): Add offset parameter.
5021         (class Sized_relobj::local_symbol_offset_): Update comment.
5022         (class Sized_relobj::local_dynsym_offset_): Update comment.
5023         * options.cc (Input_arguments::add_file): Remove const.
5024         * options.h (Input_file_argument::Input_file_argument):
5025         Initialize arg_serial_ (all constructors).
5026         (Input_file_argument::set_arg_serial): New function.
5027         (Input_file_argument::arg_serial): New function.
5028         (Input_file_argument::arg_serial_): New data member.
5029         (Input_arguments::Input_arguments): Initialize file_count_.
5030         (Input_arguments::add_file): Remove const.
5031         (Input_arguments::number_of_input_files): New function.
5032         (Input_arguments::file_count_): New data member.
5033         (Command_line::number_of_input_files): Call
5034         Input_arguments::number_of_input_files.
5035         * output.cc (Output_segment_headers::Output_segment_headers):
5036         Set current size.
5037         (Output_section::Input_section::current_data_size): New function.
5038         (Output_section::Output_section): Initialize new data members.
5039         (Output_section::add_input_section): Don't do merge sections for
5040         an incremental link; allocate space from free list for an
5041         incremental update.
5042         (Output_section::add_output_section_data): Allocate space from
5043         free list for an incremental update.
5044         (Output_section::update_data_size): New function.
5045         (Output_section::set_fixed_layout): New function.
5046         (Output_section::reserve): New function.
5047         (Output_segment::set_section_addresses): Remove const.
5048         (Output_segment::set_section_list_addresses): Remove const; allocate
5049         space from free list for an incremental update.
5050         (Output_segment::set_offset): Adjust size of RELRO segment for an
5051         incremental update.
5052         * output.h (Output_data::current_data_size): Move here from
5053         child classes.
5054         (Output_data::pre_finalize_data_size): New function.
5055         (Output_data::update_data_size): New function.
5056         (Output_section_headers::update_data_size): new function.
5057         (Output_section_data_build::current_data_size): Move to Output_data.
5058         (Output_data_strtab::update_data_size): New function.
5059         (Output_section::current_data_size): Move to Output_data.
5060         (Output_section::set_fixed_layout): New function.
5061         (Output_section::has_fixed_layout): New function.
5062         (Output_section::reserve): New function.
5063         (Output_section::update_data_size): New function.
5064         (Output_section::has_fixed_layout_): New data member.
5065         (Output_section::free_list_): New data member.
5066         (Output_segment::set_section_addresses): Remove const.
5067         (Output_segment::set_section_list_addresses): Remove const.
5068         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5069         New function.
5070         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5071         New function.
5072         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5073         parameter when calling Add_symbols constructor; store argument
5074         serial number for members of a lib group.
5075         (Add_symbols::locks): Allow case where token == NULL.
5076         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5077         (Read_member::~Read_member): New function.
5078         (Read_member::is_runnable): New function.
5079         (Read_member::locks): New function.
5080         (Read_member::run): New function.
5081         (Check_script::~Check_script): New function.
5082         (Check_script::is_runnable): New function.
5083         (Check_script::locks): New function.
5084         (Check_script::run): New function.
5085         (Check_library::~Check_library): New function.
5086         (Check_library::is_runnable): New function.
5087         (Check_library::locks): New function.
5088         (Check_library::run): New function.
5089         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5090         (Add_symbols::library_): New data member.
5091         (class Read_member): New class.
5092         (class Check_script): New class.
5093         (class Check_library): New class.
5094         * reloc.cc (Read_relocs::is_runnable): Allow case where
5095         token == NULL.
5096         (Read_relocs::locks): Likewise.
5097         (Scan_relocs::locks): Likewise.
5098         (Relocate_task::locks): Likewise.
5099         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5100         to clear counters.
5101         (Sized_relobj::incremental_relocs_scan): Fix comment.
5102         (Sized_relobj::do_relocate): Pass output file offset to
5103         write_local_symbols.
5104         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5105         from class declaration.
5106         * script.cc (read_input_script): Allocate Script_info; pass
5107         argument serial number to report_script.
5108         * script.h (class Script_info): Move to incremental.h.
5109         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5110         * symtab.h (Symbol_table::add_from_incrobj): New function.
5111         (Symbol_table::set_file_offset): New function.
5112
5113 2011-04-05  Cary Coutant  <ccoutant@google.com>
5114
5115         * incremental-dump.cc (dump_incremental_inputs): Change signature
5116         to take a Sized_incremental_binary; change caller.  Use readers
5117         in Sized_incremental_binary.
5118         * incremental.cc
5119         (Sized_incremental_binary::find_incremental_inputs_sections):
5120         Rename do_find_incremental_inputs_sections to this.
5121         (Sized_incremental_binary::setup_readers): New function.
5122         (Sized_incremental_binary::do_check_inputs): Check
5123         has_incremental_info_ flag; move setup code to setup_readers;
5124         use input readers.
5125         (Sized_incremental_binary::do_file_is_unchanged): New function.
5126         (Sized_incremental_binary::do_get_input_reader): New function.
5127         * incremental.h (class Incremental_binary): Move to end of file.
5128         (Incremental_binary::file_is_unchanged): New function.
5129         (Incremental_binary::do_file_is_unchanged): New function.
5130         (Incremental_binary::Input_reader): New class.
5131         (Incremental_binary::get_input_reader): New function.
5132         (class Sized_incremental_binary): Move to end of file.
5133         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5134         input section reader classes.
5135         (Sized_incremental_binary::has_incremental_info): New function.
5136         (Sized_incremental_binary::inputs_reader): New function.
5137         (Sized_incremental_binary::symtab_reader): New function.
5138         (Sized_incremental_binary::relocs_reader): New function.
5139         (Sized_incremental_binary::got_plt_reader): New function.
5140         (Sized_incremental_binary::do_file_is_unchanged): New function.
5141         (Sized_incremental_binary::Sized_input_reader): New class.
5142         (Sized_incremental_binary::get_input_reader): New function.
5143         (Sized_incremental_binary::find_incremental_inputs_sections):
5144         Rename do_find_incremental_inputs_sections to this.
5145         (Sized_incremental_binary::setup_readers): New function.
5146         (Sized_incremental_binary::has_incremental_info_): New data member.
5147         (Sized_incremental_binary::inputs_reader_): New data member.
5148         (Sized_incremental_binary::symtab_reader_): New data member.
5149         (Sized_incremental_binary::relocs_reader_): New data member.
5150         (Sized_incremental_binary::got_plt_reader_): New data member.
5151         (Sized_incremental_binary::current_input_file_): New data member.
5152
5153 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5154
5155         PR gold/12640
5156         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5157         violation.
5158
5159 2011-03-30  Cary Coutant  <ccoutant@google.com>
5160
5161         * archive.cc (Archive::include_member): Adjust call to report_object.
5162         (Add_archive_symbols::run): Add script_info to call to
5163         report_archive_begin.
5164         (Lib_group::include_member): Adjust call to report_object.
5165         (Add_lib_group_symbols::run): Adjust call to report_object.
5166         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5167         blocks.  Add object count for script input files.
5168         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5169         script_info parameter; change all callers.
5170         (Incremental_inputs::report_object): Add script_info parameter;
5171         change all callers.
5172         (Incremental_inputs::report_script): Store backpointer to
5173         incremental info entry.
5174         (Output_section_incremental_inputs::set_final_data_size): Record
5175         additional information for scripts.
5176         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5177         * incremental.h (Incremental_script_entry::add_object): New function.
5178         (Incremental_script_entry::get_object_count): New function.
5179         (Incremental_script_entry::get_object): New function.
5180         (Incremental_script_entry::objects_): New data member; adjust
5181         constructor.
5182         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5183         (Incremental_inputs::report_object): Add script_info parameter.
5184         (Incremental_inputs_reader::get_object_count): New function.
5185         (Incremental_inputs_reader::get_object_offset): New function.
5186         * options.cc (Input_arguments::add_file): Return reference to
5187         new input argument.
5188         * options.h (Input_argument::set_script_info): New function.
5189         (Input_argument::script_info): New function.
5190         (Input_argument::script_info_): New data member; adjust all
5191         constructors.
5192         (Input_file_group::add_file): Return reference to new input argument.
5193         (Input_file_lib::add_file): Likewise.
5194         (Input_arguments::add_file): Likewise.
5195         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5196         * script.cc (Parser_closure::Parser_closure): Add script_info
5197         parameter; adjust all callers.
5198         (Parser_closure::script_info): New function.
5199         (Parser_closure::script_info_): New data member.
5200         (read_input_script): Report scripts earlier to incremental info.
5201         (script_add_file): Set script_info in Input_argument.
5202         (script_add_library): Likewise.
5203         * script.h (Script_options::Script_info): Rewrite class.
5204
5205 2011-03-29  Cary Coutant  <ccoutant@google.com>
5206
5207         * archive.cc (Library_base::should_include_member): Move
5208         method here from class Archive.
5209         (Archive::Archive): Initialize base class.
5210         (Archive::should_include_member): Move to base class.
5211         (Archive::do_for_all_unused_symbols): New function.
5212         (Add_archive_symbols::run): Remove redundant access to
5213         incremental_inputs.
5214         (Lib_group::Lib_group): Initialize base class.
5215         (Lib_group::do_filename): New function.
5216         (Lib_group::include_member): Pass pointer to Lib_group to
5217         report_object.
5218         (Lib_group::do_for_all_unused_symbols): New function.
5219         (Add_lib_group_symbols::run): Report archive information for
5220         incremental links.
5221         * archive.h (class Library_base): New base class.
5222         (class Archive): Derive from Library_base.
5223         (Archive::filename): Move to base class.
5224         (Archive::set_incremental_info): Likewise.
5225         (Archive::incremental_info): Likewise.
5226         (Archive::Should_include): Likewise.
5227         (Archive::should_include_member): Likewise.
5228         (Archive::Armap_entry): Remove.
5229         (Archive::Unused_symbol_iterator): Remove.
5230         (Archive::unused_symbols_begin): Remove.
5231         (Archive::unused_symbols_end): Remove.
5232         (Archive::do_filename): New function.
5233         (Archive::do_get_mtime): New function.
5234         (Archive::do_for_all_unused_symbols): New function.
5235         (Archive::task_): Move to base class.
5236         (Archive::incremental_info_): Likewise.
5237         (class Lib_group): Derive from Library_base.
5238         (Lib_group::do_filename): New function.
5239         (Lib_group::do_get_mtime): New function.
5240         (Lib_group::do_for_all_unused_symbols): New function.
5241         (Lib_group::task_): Move to base class.
5242         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5243         function.
5244         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5245         function.
5246         * incremental.cc (Incremental_inputs::report_archive_begin):
5247         Use Library_base; call library's get_mtime; add incremental inputs
5248         entry before members.
5249         (class Unused_symbol_visitor): New class.
5250         (Incremental_inputs::report_archive_end): Use Library_base; use
5251         visitor class to record unused symbols; don't add incremental inputs
5252         entry after members.
5253         (Incremental_inputs::report_object): Use Library_base.
5254         * incremental.h
5255         (Incremental_archive_entry::Incremental_archive_entry): Remove
5256         unused Archive parameter.
5257         (Incremental_inputs::report_archive_begin): Use Library_base.
5258         (Incremental_inputs::report_archive_end): Likewise.
5259         (Incremental_inputs::report_object): Likewise.
5260         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5261         function.
5262         * object.h (Object::for_all_global_symbols): New function.
5263         (Object::do_for_all_global_symbols): New function.
5264         (Sized_relobj::do_for_all_global_symbols): New function.
5265         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5266         function.
5267         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5268         function.
5269
5270 2011-03-27  Ian Lance Taylor  <iant@google.com>
5271
5272         * archive.cc (Archive::interpret_header): Return -1 if something
5273         goes wrong.  Change callers accordingly.
5274
5275 2011-03-25  Cary Coutant  <ccoutant@google.com>
5276
5277         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5278         * testsuite/Makefile.in: Regenerate.
5279
5280 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5281
5282         * plugin.cc (get_view): New.
5283         (Plugin::load): Pass get_view to the plugin.
5284         (Plugin_manager::get_view): New.
5285
5286 2011-03-21  Ian Lance Taylor  <iant@google.com>
5287
5288         * testsuite/final_layout.sh: Rewrite to not use dc.
5289         * testsuite/relro_test.sh: Fail if dc is not present.
5290
5291 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5292
5293         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5294         Change == to -eq.
5295         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5296         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5297         Change == to -eq.
5298         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5299         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5300
5301 2011-03-14  Ian Lance Taylor  <iant@google.com>
5302
5303         * script-sections.cc (Sort_output_sections::script_compare):
5304         Rename from is_before, change return type.
5305         (Sort_output_sections::operator()): Adjust accordingly.
5306
5307 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5308
5309         PR gold/12572
5310         * testsuite/odr_violation2.cc: Add comment to make all error line
5311         numbers double digits.
5312         * testsuite/debug_msg.sh: Adjust expected errors.
5313
5314 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5315
5316         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5317         but mark earlier ones as non-canonical
5318         (offset_to_iterator): Update search target and example
5319         (do_addr2line): Return extra lines in a vector*
5320         (format_file_lineno): Extract from do_addr2line
5321         (one_addr2line): Add vector* out-param
5322         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5323         when a lineno entry appeared last for its instruction
5324         (Dwarf_line_info): Add vector* out-param
5325         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5326         * symtab.cc (Odr_violation_compare): Include the lineno in the
5327         comparison again.
5328         (linenos_from_loc): New. Combine the canonical line for an
5329         address with its other lines.
5330         (True_if_intersect): New. Helper functor to make
5331         std::set_intersection a query.
5332         (detect_odr_violations): Compare sets of lines instead of just
5333         one line for each function. This became less deterministic, but
5334         has fewer false positives.
5335         * symtab.h: Declarations.
5336         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5337         mix an optimized and non-optimized object in the same binary
5338         (odr_violation2.so): Same.
5339         * testsuite/Makefile.in: Regenerate from Makefile.am.
5340         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5341         * testsuite/debug_msg.sh: Update line numbers and add
5342         assertions.
5343         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5344         non-optimized context.
5345         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5346         isn't inlined, and use OdrDerived in an optimized context.
5347         * testsuite/odr_header1.h: Defines OdrDerived, where
5348         optimization will change the
5349         first-instruction-in-the-destructor's file and line number.
5350         * testsuite/odr_header2.h: Defines OdrBase.
5351
5352 2011-03-09  Ian Lance Taylor  <iant@google.com>
5353
5354         * fileread.cc (File_read::clear_views): Don't delete the whole
5355         file view.
5356
5357 2011-03-08  Ian Lance Taylor  <iant@google.com>
5358
5359         PR gold/12525
5360         * fileread.cc: #include <climits>.
5361         (GOLD_IOV_MAX): Define.
5362         (File_read::read_multiple): Limit number of entries by iov_max.
5363         * fileread.h (class File_read): Always set max_readv_entries to
5364         128.
5365
5366 2011-03-07  Ian Lance Taylor  <iant@google.com>
5367
5368         PR gold/12525
5369         * options.h (class General_options): Add -dy and -dn.
5370
5371 2011-03-02  Cary Coutant  <ccoutant@google.com>
5372
5373         * testsuite/script_test_9.t: Add TLS segment.
5374
5375 2011-03-02  Simon Baldwin  <simonb@google.com>
5376
5377         * configure.ac: Add check for gnu_indirect_function support in
5378         the toolchain building binutils.
5379         * configure: Rebuild.
5380
5381 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5382
5383         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5384         plugin only symbols.
5385         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5386         in plugin files as not needed in the symbol table.
5387
5388 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5389
5390         * output.cc (Output_section::add_input_section): Delay fill
5391         generation for section ordering.
5392
5393 2011-02-09  Ian Lance Taylor  <iant@google.com>
5394
5395         PR gold/12316
5396         * object.h (class Sized_relobj): Remove clear_local_symbols.
5397         * reloc.cc (Sized_relobj::do_relocate): Don't call
5398         clear_local_symbols.
5399
5400 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5401
5402         * plugin.cc (is_visible_from_outside): Return true for symbols
5403         in the -u option.
5404
5405 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5406
5407         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5408         filename.
5409
5410 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5411
5412         * icf.h (is_section_foldable_candidate): Change type of parameter
5413         to std::string.
5414         * icf.cc (Icf::find_identical_sections): Change type of local variable
5415         section_name to be std::string.
5416         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5417
5418 2011-01-25  Ian Lance Taylor  <iant@google.com>
5419
5420         * script.cc (script_add_extern): Rewrite to use
5421         add_symbol_reference.
5422
5423 2011-01-25  Doug Kwan  <dougkwan@google.com>
5424
5425         * icf.cc (get_section_contents): Always lock section's object.
5426
5427 2011-01-24  Ian Lance Taylor  <iant@google.com>
5428
5429         * options.h (class General_options): Accept
5430         --no-detect-odr-violations.
5431
5432 2011-01-24  Ian Lance Taylor  <iant@google.com>
5433
5434         * version.cc (version_string): Bump to 1.11.
5435
5436 2011-01-24  Ian Lance Taylor  <iant@google.com>
5437
5438         * plugin.cc (class Plugin_rescan): Define new class.
5439         (Plugin_manager::claim_file): Set any_claimed_.
5440         (Plugin_manager::save_archive): New function.
5441         (Plugin_manager::save_input_group): New function.
5442         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5443         necessary.
5444         (Plugin_manager::new_undefined_symbol): New function.
5445         (Plugin_manager::rescan): New function.
5446         (Plugin_manager::rescannable_defines): New function.
5447         (Plugin_manager::add_input_file): Set any_added_.
5448         * plugin.h (class Plugin_manager): define new fields rescannable_,
5449         undefined_symbols_, any_claimed_, and any_added_.  Declare
5450         Plugin_rescan as friend.  Declare new functions.
5451         (Plugin_manager::Rescannable): Define type.
5452         (Plugin_manager::Rescannable_list): Define type.
5453         (Plugin_manager::Undefined_symbol_list): Define type.
5454         (Plugin_manager::Plugin_manager): Initialize new fields.
5455         * archive.cc (Archive::defines_symbol): New function.
5456         (Add_archive_symbols::run): Pass archive to plugins if any.
5457         * archive.h (class Archive): Declare defines_symbol.
5458         * readsyms.cc (Input_group::~Input_group): New function.
5459         (Finish_group::run): Pass input_group to plugins if any.
5460         * readsyms.h (class Input_group): Declare destructor.
5461         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5462         any.
5463
5464 2011-01-10  Ian Lance Taylor  <iant@google.com>
5465
5466         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5467         section as relro.
5468         (Layout::set_segment_offsets): Reset increase_relro before calling
5469         set_section_addresses a second time.
5470
5471 2011-01-04  Cary Coutant  <ccoutant@google.com>
5472
5473         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5474         sections before NOBITS sections.
5475
5476 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5477
5478         * version.cc (print_version): Update copyright to 2011.
5479
5480 2010-12-23  Cary Coutant  <ccoutant@google.com>
5481
5482         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5483         of OS to this->add.  Add OD parameter to second form of the function.
5484
5485 2010-12-20  Ian Lance Taylor  <iant@google.com>
5486
5487         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5488         second of two consecutive entries with same offset.
5489
5490 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5491
5492         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5493         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5494         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5495         to avoid unneeded links against $(LDADD).
5496         * testsuite/Makefile.in: Regenerate.
5497
5498 2010-12-15  Ian Lance Taylor  <iant@google.com>
5499
5500         PR gold/12324
5501         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5502         for R_X86_64_32 and R_X86_64_PC32.
5503         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5504         ver_matching_def_pic.o.
5505         (ver_matching_def_pic.o): New target.
5506
5507 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5508
5509         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5510         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5511         Move definition before File_read::View member definitions.
5512         (File_read::View::~View): Initialize and hold lock before
5513         updating current_mapped_bytes.
5514
5515 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5516
5517         * dwarf_reader.cc: Remove outdated comment.
5518         * gold-threads.cc: Fix typo in error message.
5519         * archive.cc: Fix typos in comments.
5520         * archive.h: Likewise.
5521         * arm-reloc-property.cc: Likewise.
5522         * arm-reloc-property.h: Likewise.
5523         * arm-reloc.def: Likewise.
5524         * arm.cc: Likewise.
5525         * attributes.h: Likewise.
5526         * cref.cc: Likewise.
5527         * ehframe.cc: Likewise.
5528         * fileread.h: Likewise.
5529         * gold.h: Likewise.
5530         * i386.cc: Likewise.
5531         * icf.cc: Likewise.
5532         * incremental.h: Likewise.
5533         * int_encoding.cc: Likewise.
5534         * layout.h: Likewise.
5535         * main.cc: Likewise.
5536         * merge.h: Likewise.
5537         * object.cc: Likewise.
5538         * object.h: Likewise.
5539         * options.cc: Likewise.
5540         * readsyms.cc: Likewise.
5541         * reduced_debug_output.cc: Likewise.
5542         * reloc.cc: Likewise.
5543         * script-sections.cc: Likewise.
5544         * sparc.cc: Likewise.
5545         * symtab.h: Likewise.
5546         * target-reloc.h: Likewise.
5547         * target.cc: Likewise.
5548         * target.h: Likewise.
5549         * timer.cc: Likewise.
5550         * timer.h: Likewise.
5551         * x86_64.cc: Likewise.
5552
5553 2010-12-09  Cary Coutant  <ccoutant@google.com>
5554
5555         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5556         stack.
5557         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5558         parameter; change all callers.
5559         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5560         * options.h (warn_execstack): New option.
5561
5562 2010-12-07  Doug Kwan  <dougkwan@google.com>
5563
5564         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5565         like function call relocations.
5566
5567 2010-12-07  Ian Lance Taylor  <iant@google.com>
5568
5569         * archive.cc (Archive::get_elf_object_for_member): Permit
5570         punconfigured to be NULL.
5571         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5572         (Archive::include_member): Pass NULL to get_elf_object_for_member
5573         if we searched for the archive and this is the first included
5574         object.
5575
5576 2010-12-01  Ian Lance Taylor  <iant@google.com>
5577
5578         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5579         track_relocs_type_ field.
5580         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5581         Set track_relocs_type_.
5582         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5583         contents when using RELA relocs.
5584         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5585         reloc_map_.
5586         * reloc.cc (Track_relocs::next_addend): New function.
5587         * reloc.h (class Track_relocs): Declare next_addend.
5588
5589 2010-12-01  Ian Lance Taylor  <iant@google.com>
5590
5591         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5592         virtual destructor.
5593
5594 2010-12-01  Ian Lance Taylor  <iant@google.com>
5595
5596         * README: Update compilers known to work and fail.
5597
5598 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5599
5600         * configure.in: For --enable-gold, handle value `default' instead of
5601         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5602         not the default.
5603         * configure: Regenerate.
5604
5605 2010-11-18  Doug Kwan  <dougkwan@google.com>
5606
5607         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5608         and right_alignment to be zero.  Store result alignment only if it is
5609         greater than existing alignment.
5610
5611 2010-11-16  Cary Coutant  <ccoutant@google.com>
5612
5613         PR gold/12220
5614         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5615         Check for ".zdebug_line".
5616
5617 2010-11-16  Doug Kwan  <dougkwan@google.com>
5618             Cary Coutant  <ccoutant@google.com>
5619
5620         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5621         by reference; adjust all callers.
5622         * output.cc (Output_segment::set_section_addresses): Adjust references
5623         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5624         list is empty.
5625         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5626         end at page boundary.
5627
5628 2010-11-16  Cary Coutant  <ccoutant@google.com>
5629
5630         PR gold/12220
5631         * layout.cc (Layout::choose_output_section): Transform names of
5632         compressed sections even when using a script with a SECTIONS clause.
5633         (Layout::output_section_name): Remove code to transform
5634         compressed debug section names.
5635         * output.cc (Output_section::add_input_section): Use uncompressed
5636         section size when tracking input sections.
5637
5638 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5639
5640         * symtab.h (Symbol::NON_PIC_REF): Remove.
5641         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5642         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5643         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5644         (Symbol::use_plt_offset): Take a flags argument and pass it
5645         directly to needs_dynamic_reloc.  Restrict check for undefined
5646         weak symbols to function calls.
5647         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5648         (Target_arm::Scan::global): Use it.
5649         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5650         (Target_arm::Relocate::relocate): Likewise.
5651         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5652         parameter with an r_type parameter.  Use get_reference_flags
5653         to get the flags.
5654         (Target_arm::Relocate::relocate): Update accordingly.
5655         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5656         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5657         (Target_i386::Scan::global): Likewise.
5658         (Target_i386::Relocate::relocate): Likewise.
5659         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5660         parameter with an r_type parameter.  Use get_reference_flags
5661         to get the flags.
5662         (Target_i386::Relocate::relocate): Update accordingly.
5663         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5664         (Target_powerpc::Scan::global): Use it.
5665         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5666         (Target_powerpc::Relocate::relocate): Likewise.
5667         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5668         (Target_sparc::Scan::global): Use it.
5669         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5670         (Target_sparc::Relocate::relocate): Likewise.
5671         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5672         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5673         (Target_x86_64::Scan::global): Likewise.
5674         (Target_x86_64::Relocate::relocate): Likewise.
5675
5676 2010-11-08  Doug Kwan  <dougkwan@google.com>
5677             Cary Coutant  <ccoutant@google.com>
5678
5679         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5680         (Arm_exidx_merge_section::section_contents_): New data member.
5681         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5682         (Arm_input_section::~Arm_input_section): De-allocate memory.
5683         (Arm_input_section::original_contents_): New data member.
5684         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5685         in parameters instead of calling Object::section_contents without
5686         locking.
5687         (Arm_output_section::group_section): New parameter TASK.  Pass it
5688         to callees that need locking objects.
5689         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5690         to lock EXIDX input sections.  Fix a formatting issue.  Call
5691         Arm_exidx_merged_section::build_contents to create merged section
5692         contents.
5693         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5694         to lock object of stub table owner.
5695         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5696         TEXT_SIZE to initialize data member TEXT_SIZE_.
5697         (Arm_exidx_input_section::addralign): Fix typo in comment.
5698         (Arm_exidx_input_section::text_size): New method.
5699         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5700         that require locking objects.  Lock objects before scanning for stubs
5701         and updating local symbols.
5702         (Arm_input_section<big_endian>::init): Copy contents of original
5703         input section.
5704         (Arm_input_section<big_endian>::do_write): Use saved contents of
5705         original input section instead of calling Object::section_contents
5706         without locking.
5707         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5708         size without calling Object::section_size().
5709         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5710         for size.  Allocate a buffer for merged EXIDX entries.
5711         (Arm_exidx_merged_section::build_contents): New method.
5712         (Arm_exidx_merged_section::do_write): Move merge section contents
5713         building code to Arm_exidx_merged_section::build_contetns.  Write
5714         out contetns in buffer instead of building it on the fly.
5715         (Arm_relobj::make_exidx_input_section): Also pass text section size
5716         to Arm_exidx_input_section constructor.
5717         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5718         (Arm_dynobj::do_read_symbols): Fix memory leak.
5719         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5720         * target.h: (class Task): Add forward declaration.
5721         (Target::relax): Add new parameter TASK and pass it to
5722         Target::do_relax().
5723         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5724
5725 2010-11-05  Cary Coutant  <ccoutant@google.com>
5726
5727         PR gold/10708
5728         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5729         object when reading from the file.
5730         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5731         second layout pass.
5732         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5733         when reading section contents.
5734         (get_section_contents): Likewise.
5735         (icf::find_identical_sections): Likewise.
5736         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5737         object when reading from the file.
5738         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5739         the object when doing deferred section layout.
5740
5741 2010-11-03  Nick Clifton  <nickc@redhat.com>
5742
5743         PR gold/12001
5744         * script.h (class Symbol_assignment: name): New member.  Returns
5745         the name of the symbol.
5746         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5747         Returns true if the given symbol name is on the list of
5748         assignments wating to be processed.
5749         * archive.cc (should_incldue_member): If the symbol is undefined,
5750         check to see if it is on the list of symbols pending assignment.
5751
5752 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5753
5754         * script-sections.cc (Script_sections::find_memory_region): Check
5755         for a NULL output section pointer.
5756
5757 2010-10-29  Doug Kwan  <dougkwan@google.com>
5758
5759         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5760         Output_section::add_relaxed_input_section.
5761         * output.cc (Output_section::add_relaxed_input_section): Add new
5762         arguments LAYOUT and NAME.  Set section order index.
5763         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5764         Copy section order index.
5765         * output.h (Output_section::add_relaxed_input_section): Add new
5766         arguments LAYOUT and NAME.
5767
5768 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5769
5770         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5771         NATIVE_OR_CROSS_LINKER.
5772         * testsuite/Makefile.in: Regenerate.
5773
5774 2010-10-20  Doug Kwan  <dougkwan@google.com>
5775
5776         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5777         without SHF_LINK_ORDER flags.
5778         * layout.cc (Layout::choose_output_section): Do not filter
5779         SHF_LINK_ORDER flag in a relocatable link.
5780
5781 2010-10-17  Cary Coutant  <ccoutant@google.com>
5782
5783         * output.h (Output_segment::set_section_addresses): Change function
5784         signature.  Update all callers.
5785         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5786         sections.
5787         (Output_segment::set_section_addresses): Align after last TLS
5788         section.  Add padding before last relro section instead of after.
5789
5790 2010-10-17  Doug Kwan  <dougkwan@google.com>
5791
5792         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5793         GOT output section to be writable.
5794
5795 2010-10-14  Cary Coutant  <ccoutant@google.com>
5796
5797         * debug.h (DEBUG_INCREMENTAL): New flag.
5798         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5799         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5800         mode.
5801         * incremental.cc (report_command_line): Ignore all forms of
5802         --incremental.
5803         * layout.cc (Layout::Layout): Check parameters for incremental link
5804         mode.
5805         * options.cc (General_options::parse_incremental): New function.
5806         (General_options::parse_no_incremental): New function.
5807         (General_options::parse_incremental_full): New function.
5808         (General_options::parse_incremental_update): New function.
5809         (General_options::incremental_mode_): New data member.
5810         (General_options::finalize): Check incremental_mode_.
5811         * options.h (General_options): Update help text for --incremental.
5812         Add --no-incremental, --incremental-full, --incremental-update.
5813         (General_options::Incremental_mode): New enum type.
5814         (General_options::incremental_mode): New function.
5815         (General_options::incremental_mode_): New data member.
5816         * parameters.cc (Parameters::incremental_mode_): New data member.
5817         (Parameters::set_options): Set incremental_mode_.
5818         (Parameters::set_incremental_full): New function.
5819         (Parameters::incremental): New function.
5820         (Parameters::incremental_update): New function.
5821         (set_parameters_incremental_full): New function.
5822         * parameters.h (Parameters::set_incremental_full): New function.
5823         (Parameters::incremental): New function.
5824         (Parameters::incremental_update): New function.
5825         (Parameters::incremental_mode_): New data member.
5826         (set_parameters_incremental_full): New function.
5827         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5828         incremental link mode.
5829         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5830         (Sized_relobj::do_relocate_sections): Likewise.
5831         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5832         option.
5833         * testsuite/Makefile.in: Regenerate.
5834         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5835
5836 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5837
5838         * script-sections.h (class Script_sections): Make
5839         Sections_elements typedef public.
5840         * script-sections.cc (class Sort_output_sections): Add elements_
5841         field.  Add constructor which sets it; change all callers.
5842         (Sort_output_sections::is_before): New function.
5843         (Sort_output_sections::operator()): Call is_before.
5844         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5845         conditional.
5846         * testsuite/script_test_10.sh: New test. Test script section
5847         order.
5848         * testsuite/script_test_10.t: Likewise.
5849         * testsuite/script_test_10.s: Likewise.
5850         * testsuite/Makefile.am: Wrap the cross linker tests and the
5851         common tests into NATIVE_OR_CROSS_LINKER.
5852         (check_SCRIPTS): Add script_test_10.sh.
5853         (check_DATA): Add script_test_10.stdout.
5854         (script_test_10.o, script_test_10): New targets.
5855         (script_test_10.stdout): New target.
5856         * configure, testsuite/Makefile.in: Regenerate.
5857
5858 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5859
5860         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5861         error for the deprecated relocations.
5862         (Target_arm::Scan::global): Likewise.
5863         (Target_arm::Relocate::relocate): Likewise.
5864
5865 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5866
5867         * fileread.cc (Input_file::find_file): Initialize *found_name
5868         and *namep when using the fallback search for case 4.
5869
5870 2010-10-11  Cary Coutant  <ccoutant@google.com>
5871
5872         * options.h (class General_options): Redefine -z lazy as an alias for
5873         the negation of -z now.
5874
5875 2010-10-11  Ian Lance Taylor  <iant@google.com>
5876
5877         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5878         binding.
5879
5880 2010-10-06  Nick Clifton  <nickc@redhat.com>
5881
5882         * script-sections.cc(class Memory_region): Remove
5883         current_lma_offset_ field.  Rename current_vma_offset_ to
5884         current_offset_.  Add last_section_ field.
5885         (Memory_region::get_current_vma_address): Rename to
5886         get_current_address.
5887         (Memory_region::get_current_lma_address): Delete.
5888         (Memory_region::increment_vma_offset): Rename to
5889         increment_offset.
5890         (Memory_region::increment_lma_offset): Delete.
5891         (Memory_region::attributes_compatible): New method.  Returns
5892         true if the provided section is compatible with the region.
5893         (Memory_region::get_last_section): New method.  Returns the last
5894         section to use the region.
5895         (Memory_region::set_last_section): New method.  Stores the last
5896         section to use the region.
5897         (Script_sections::block_in_region): New method.  Returns true if
5898         a block of memory is contained within a region.
5899         (Script_sections::find_memory_region): New method.  Locates a
5900         memory region to be used to set a VMA or LMA address.
5901         (Output_section_definition::set_section_addresses): Add code to
5902         check for addresses set by memory regions.
5903         (Output_segment::set_section_addresses): Remove memory region
5904         walking code.
5905         (Script_sections::create_segment): Add a warning if a header
5906         segment is created outside of any region.
5907         * script-sections.h (class Script_sections): Add prototypes for
5908         find_memory_region and block_in_region methods.
5909         * testsuite/memory_test.s: Use .long instead of .word.
5910         * testsuite/memory_test.t: Add some more output sections.
5911         * testsuite/memory_test.sh: Update expected output.
5912
5913 2010-10-02  Doug Kwan  <dougkwan@google.com>
5914
5915         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5916         defintion to symtab.h
5917         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5918         declaration to defintion.
5919
5920 2010-10-01  Nick Clifton  <nickc@redhat.com>
5921
5922         * expression.cc (eval): Replace dummy argument with NULL.
5923         (eval_maybe_dot): Check for a NULL result section pointer.
5924         (Symbol_expression::value): Likewise.
5925         (Dot_expression::value): Likewise.
5926         (BINARY_EXPRESSION): Likewise.
5927         (Max_expression::value): Likewise.
5928         (Min_expression::value): Likewise.
5929         (Absolute_expression::value): Likewise.
5930         (Addr_expression::value_from_output_section): Likewise.
5931         (Loaddddr_expression::value_from_output_section): Likewise.
5932         (Segment_start_expression::value): Likewise.
5933         * script-sections.cc
5934         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5935         argument with NULL.
5936         (Sections_elememt_dot_assignment::set_section_addresses):
5937         Likewise.
5938         (Output_data_expression::do_write_to_buffer): Likewise.
5939         (Output_section_definition::finalize_symbols): Likewise.
5940         (Output_section_definition::set_section_addresses): Likewise.
5941
5942 2010-09-30  Doug Kwan  <dougkwan@google.com>
5943
5944         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5945
5946 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5947
5948         * target.h (Target::can_icf_inline_merge_sections): New virtual
5949         function.
5950         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5951         virtual function.
5952         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5953         virtual function.
5954         * icf.cc (get_section_contents): Inline merge sections only when
5955         target allows it.
5956
5957 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5958
5959         * configure: Regenerate.
5960
5961 2010-09-17  Ian Lance Taylor  <iant@google.com>
5962
5963         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5964         * testsuite/Makefile.am (memory_test.o): New target.
5965         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5966         memory_test.t.
5967         * testsuite/Makefile.in: Rebuild.
5968
5969 2010-09-17  Doug Kwan  <dougkwan@google.com>
5970
5971         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5972         defintion if relocation uses GOT entries of the symbol.
5973         * testsuite/icf_safe_test.sh: Fix test.
5974         * testsuite/icf_safe_so_test.sh: Fix test.
5975
5976 2010-09-16  Cary Coutant  <ccoutant@google.com>
5977
5978         * script_sections.cc (class Memory_region): Remove "NULL" from
5979         vector initializations.
5980
5981 2010-09-15  Cary Coutant  <ccoutant@google.com>
5982
5983         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5984         Resolve forwarding symbols.
5985
5986 2010-09-15  Doug Kwan  <dougkwan@google.com>
5987
5988         * gold/testsuite/script_test_3.t: Add ARM special sections.
5989         * gold/testsuite/script_test_4.t: Same.
5990         * gold/testsuite/script_test_5.t: Same.
5991         * gold/testsuite/script_test_6.t: Same.
5992         * gold/testsuite/script_test_7.t: Same.
5993         * gold/testsuite/script_test_7.t: Same.
5994         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5995
5996 2010-09-14  Cary Coutant  <ccoutant@google.com>
5997
5998         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5999         (Target_x86_64::Relocate::relocate_tls): Replace check for
6000         saw_tls_block_reloc_ with test for executable section.
6001
6002 2010-09-12  Cary Coutant  <ccoutant@google.com>
6003
6004         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6005         position-independent executables to shared libraries need dynamic
6006         relocations.
6007         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6008         position-independent executables.
6009         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6010         * testsuite/Makefile.in: Regenerate.
6011
6012 2010-09-10  Nick Clifton  <nickc@redhat.com>
6013
6014         PR gold/11997
6015         * testsuite/memory_test.t: Discard any sections that are not
6016         needed.
6017
6018 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6019
6020         PR gold/11996
6021         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6022         "This::" to work around a bug in gcc 4.2.
6023
6024         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6025
6026 2010-09-09  Rafael Espindola  <espindola@google.com>
6027
6028         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6029         sections with different PF_X flags in the same segment.
6030         (Layout::find_first_load_seg): Search all segments to find the first
6031         one.
6032         * options.h (rosegment): New.
6033
6034 2010-09-08  Rafael Espindola  <espindola@google.com>
6035
6036         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6037
6038 2010-09-08  Doug Kwan  <dougkwan@google.com>
6039
6040         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6041         (Arm_relobj::do_relocate_sections): Add new parameter for output
6042         file to match the parent.
6043         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6044         of local symbols instead of input values.  Update code to track
6045         changes in gold::relocate_section.
6046         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6047         (Sized_relobj::compute_final_local_value_internal): New methods.
6048         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6049         body into private version of Sized_relobj::compute_final_local_value.
6050         Call the inline method.
6051         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6052         merged symbol value if there is one.
6053         (Symbol_value::has_output_value): New method defintiion.
6054         (Sized_relobj::Compute_final_local_value_status): New enum type.
6055         (Sized_relobj::compute_final_local_value): New methods.
6056         (Sized_relobj::compute_final_local_value_internal): New methods.
6057         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6058         and arm_cortex_a8.sh.
6059         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6060         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6061         New tests.
6062         * Makefile.in: Regenerate.
6063         * testsuite/arm_bl_out_of_range.s: Update test.
6064         * testsuite/thumb_bl_out_of_range.s: Ditto.
6065         * testsuite/thumb_blx_out_of_range.s: Ditto.
6066         * testsuite/arm_branch_out_of_range.sh: New file.
6067         * testsuite/arm_cortex_a8.sh: Ditto.
6068         * testsuite/arm_cortex_a8_b.s: Ditto.
6069         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6070         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6071         * testsuite/arm_cortex_a8_bl.s: Ditto.
6072         * testsuite/arm_cortex_a8_blx.s: Ditto.
6073         * testsuite/arm_cortex_a8_local.s: Ditto.
6074         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6075         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6076
6077 2010-09-08  Rafael Espindola  <espindola@google.com>
6078
6079         * Makefile.am (memory_test.stdout): Run readelf with -W.
6080         * Makefile.in: Regenerate.
6081         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6082         64 bit output.
6083
6084 2010-09-08  Rafael Espindola  <espindola@google.com>
6085
6086         * script-sections.cc (Script_sections::add_memory_region): Convert
6087         field precision to int.
6088         * script.cc (script_set_section_region, script_set_section_region):
6089         Convert field precision to int.
6090
6091 2010-09-08  Rafael Espindola  <espindola@google.com>
6092
6093         * arm.cc (do_finalize_sections): Create the __exidx_start and
6094         __exdix_end symbols even when the section is missing.
6095
6096 2010-09-08  Nick Clifton  <nickc@redhat.com>
6097
6098         * README: Remove claim that MEMORY is not supported.
6099         * expression.cc (script_exp_function_origin)
6100         (script_exp_function_length): Move from here to ...
6101         * script.cc: ... here.
6102         (script_set_section_region, script_add_memory)
6103         (script_parse_memory_attr, script_include_directive): New
6104         functions.
6105         * script-sections.cc
6106         (class Memory_region): New class.
6107         (class Output_section_definition): Add set_memory_region,
6108         set_section_vma, set_section_lma and get_section_name methods.
6109         (class Script_Sections): Add add_memory_region,
6110         find_memory_region, find_memory_region_origin,
6111         find_memory_region_length and set_memory_region methods.
6112         Have set_section_addresses method walk the list of set memory
6113         regions.
6114         Extend the print methos to display memory regions.
6115         * script-sections.h: Add prototypes for new methods.
6116         Add enum for MEMORY region attributes.
6117         * yyscript.y: Add support for parsing MEMORY regions.
6118         * script-c.h: Add prototypes for new functions.
6119         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6120         * testsuite/Makefile.in: Regenerate.
6121         * testsuite/memory_test.sh: New script.
6122         * testsuite/memory_test.s: New assembler source file.
6123         * testsuite/memory_test.t: New linker script.
6124
6125 2010-08-27  Doug Kwan  <dougkwan@google.com>
6126
6127         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6128         reference override an existing dynamic weak reference.
6129         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6130         * testsuite/Makefile.in: Regenerate.
6131         * testsuite/dyn_weak_ref.sh: New file.
6132         * testsuite/dyn_weak_ref_1.c: Ditto.
6133         * testsuite/dyn_weak_ref_2.c: Ditto.
6134
6135 2010-08-27  Ian Lance Taylor  <iant@google.com>
6136
6137         * incremental.h (class Incremental_input_entry): Add virtual
6138         destructor.
6139
6140 2010-08-27  Ian Lance Taylor  <iant@google.com>
6141
6142         * testsuite/start_lib_test_3.c: Mark t3 as used.
6143
6144 2010-08-27  Nick Clifton  <nickc@redhat.com>
6145
6146         * options.cc (version_script): Fix small typo in previous
6147         whitespace tidyup.
6148
6149 2010-08-25  Nick Clifton  <nickc@redhat.com>
6150
6151         * archive.cc: Formatting fixes: Remove whitespace between
6152         typename and following asterisk.  Remove whitespace between
6153         function name and opening parenthesis.
6154         * archive.h: Likewise.
6155         * arm.cc: Likewise.
6156         * attributes.cc: Likewise.
6157         * attributes.h: Likewise.
6158         * common.cc: Likewise.
6159         * copy-relocs.cc: Likewise.
6160         * dirsearch.h: Likewise.
6161         * dynobj.cc: Likewise.
6162         * ehframe.cc: Likewise.
6163         * ehframe.h: Likewise.
6164         * expression.cc: Likewise.
6165         * fileread.cc: Likewise.
6166         * fileread.h: Likewise.
6167         * gc.h: Likewise.
6168         * gold-threads.cc: Likewise.
6169         * gold.cc: Likewise.
6170         * i386.cc: Likewise.
6171         * icf.h: Likewise.
6172         * incremental-dump.cc: Likewise.
6173         * incremental.cc: Likewise.
6174         * layout.cc: Likewise.
6175         * layout.h: Likewise.
6176         * main.cc: Likewise.
6177         * merge.cc: Likewise.
6178         * merge.h: Likewise.
6179         * object.cc: Likewise.
6180         * object.h: Likewise.
6181         * options.cc: Likewise.
6182         * options.h: Likewise.
6183         * output.cc: Likewise.
6184         * output.h: Likewise.
6185         * plugin.cc: Likewise.
6186         * plugin.h: Likewise.
6187         * powerpc.cc: Likewise.
6188         * reloc.cc: Likewise.
6189         * script-c.h: Likewise.
6190         * script-sections.cc: Likewise.
6191         * script.cc: Likewise.
6192         * stringpool.cc: Likewise.
6193         * symtab.cc: Likewise.
6194         * symtab.h: Likewise.
6195         * target.cc: Likewise.
6196         * timer.cc: Likewise.
6197         * timer.h: Likewise.
6198         * version.cc: Likewise.
6199         * x86_64.cc: Likewise.
6200
6201 2010-08-24  Nick Clifton  <nickc@redhat.com>
6202
6203         PR 11899
6204         * layout.cc (segment_precedes): Sort segments by their physical
6205         addresses, if they have been set.
6206
6207 2010-08-23  Cary Coutant  <ccoutant@google.com>
6208
6209         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6210         symbols data.
6211         (Lib_group::include_member): Unlock object after deleting its
6212         symbols data.
6213         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6214         the bug fixed here.
6215
6216 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6217             Cary Coutant  <ccoutant@google.com>
6218
6219         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6220         constructor, and set_blocker.
6221         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6222         readsyms_blocker_.
6223         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6224         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6225         * testsuite/Makefile.am (start_lib_test): New test case.
6226         * testsuite/Makefile.in: Regenerate.
6227         * testsuite/start_lib_test_main.c: New file.
6228         * testsuite/start_lib_test_1.c: New file.
6229         * testsuite/start_lib_test_2.c: New file.
6230         * testsuite/start_lib_test_3.c: New file.
6231
6232 2010-08-19  Ian Lance Taylor  <iant@google.com>
6233
6234         * Makefile.in: Rebuild with automake 1.11.1.
6235         * aclocal.m4: Likewise.
6236         * testsuite/Makefile.in: Likewise.
6237
6238 2010-08-19  Ian Lance Taylor  <iant@google.com>
6239
6240         PR 10893
6241         * i386.cc (class Output_data_plt_i386): Update declarations.
6242         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6243         local_ifuncs_ fields.
6244         (Target_i386::do_plt_section_for_global): New function.
6245         (Target_i386::do_plt_section_for_local): New function.
6246         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6247         parameter; change all callers.  Initialize global_ifuncs_ and
6248         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6249         __rel_iplt_end.
6250         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6251         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6252         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6253         symbols.
6254         (Target_i386::make_plt_section): New function, broken out of
6255         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6256         (Target_i386::make_plt_entry): Call make_plt_section.
6257         (Target_i386::make_local_ifunc_plt_entry): New function.
6258         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6259         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6260         R_386_IRELATIVE to switch.
6261         (Target_i386::Scan::global): Likewise.
6262         (Target_i386::Relocate::relocate): Likewise.
6263         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6264         switch.
6265         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6266         (Target_x86_64::do_plt_section_for_global): New function.
6267         (Target_x86_64::do_plt_section_for_local): New function.
6268         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6269         parameter; change all callers.  If doing a static link define
6270         __rela_iplt_start and __rela_iplt_end.
6271         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6272         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6273         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6274         to point to .plt.
6275         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6276         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6277         switch.
6278         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6279         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6280         R_X86_64_IRELATIVE to switch.
6281         (Target_x86_64::Scan::global): Likewise.
6282         (Target_x86_64::Relocate::relocate): Likewise.
6283         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6284         switch.
6285         * target.h (class Target): Add plt_section_for_global and
6286         plt_section_for_local functions.  Add do_plt_section_for_global
6287         and do_plt_section_for_local virtual functions.
6288         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6289         clarifying comments.
6290         (Symbol::use_plt_offset): Handle IFUNC symbol.
6291         * object.cc (Sized_relobj::Sized_relobj): Initialize
6292         local_plt_offsets_.
6293         (Sized_relobj::local_has_plt_offset): New function.
6294         (Sized_relobj::local_plt_offset): New function.
6295         (Sized_relobj::set_local_plt_offset): New function.
6296         (Sized_relobj::do_count): Handle IFUNC symbol.
6297         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6298         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6299         is_ifunc_symbol functions.
6300         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6301         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6302         local_plt_offsets_ field.
6303         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6304         * output.h (class Output_section_data): Add non-const
6305         output_section function.
6306         (class Output_data_got): Update declarations.
6307         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6308         Add use_plt_offset parameter to global and local constructors.
6309         Change all callers.  Change local_sym_index_ field to 31 bits.
6310         Change GSYM_CODE and CONSTANT_CODE accordingly.
6311         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6312         doing a static link don't set sh_link field.
6313         (Output_data_got::Got_entry::write): Use PLT offset if
6314         appropriate.
6315         (Output_data_got::add_global_plt): New function.
6316         (Output_data_got::add_local_plt): New function.
6317         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6318         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6319         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6320         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6321         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6322         IFUNC conditional.
6323         * testsuite/ifunc-sel.h: New file.
6324         * testsuite/ifuncmain1.c: New file.
6325         * testsuite/ifuncmain1vis.c: New file.
6326         * testsuite/ifuncmod1.c: New file.
6327         * testsuite/ifuncdep2.c: New file.
6328         * testsuite/ifuncmain2.c: New file.
6329         * testsuite/ifuncmain3.c: New file.
6330         * testsuite/ifuncmod3.c: New file.
6331         * testsuite/ifuncmain4.c: New file.
6332         * testsuite/ifuncmain5.c: New file.
6333         * testsuite/ifuncmod5.c: New file.
6334         * testsuite/ifuncmain6pie.c: New file.
6335         * testsuite/ifuncmod6.c: New file.
6336         * testsuite/ifuncmain7.c: New file.
6337         * configure, testsuite/Makefile.in: Rebuild.
6338
6339 2010-08-18  Ian Lance Taylor  <iant@google.com>
6340
6341         * incremental.cc
6342         (Output_section_incremental_inputs::write_input_files): Add cast
6343         to avoid signed/unsigned comparison warning.
6344         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6345
6346 2010-08-12  Cary Coutant  <ccoutant@google.com>
6347
6348         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6349
6350 2010-08-13  Ian Lance Taylor  <iant@google.com>
6351
6352         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6353
6354 2010-08-12  Cary Coutant  <ccoutant@google.com>
6355             Doug Kwan  <dougkwan@google.com>
6356
6357         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6358         defintion overrides non-weak undef, remember that the original undef
6359         is not weak.
6360         * symtab.cc (Symbol_table::sized_write_global): For undef without
6361         an original weak binding, set binding to global in output.
6362         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6363         * testsuite/Makefile.in: Regenerate.
6364         * testsuite/strong_ref_weak_def.sh: New file.
6365         * testsuite/strong_ref_weak_def_1.c: Ditto.
6366         * testsuite/strong_ref_weak_def_2.c: Ditto.
6367
6368 2010-08-12  Cary Coutant  <ccoutant@google.com>
6369
6370         * testsuite/incremental_test.sh: Rewrite.
6371         * testsuite/incremental_test_1.c: Rewrite.
6372         * testsuite/incremental_test_2.c: Rewrite.
6373
6374 2010-08-12  Cary Coutant  <ccoutant@google.com>
6375
6376         * arm.cc (Target_arm::got_size): Add const.
6377         (Target_arm::got_entry_count): New function.
6378         (Target_arm::plt_entry_count): New function.
6379         (Target_arm::first_plt_entry_offset): New function.
6380         (Target_arm::plt_entry_size): New function.
6381         (Output_data_plt_arm::entry_count): New function.
6382         (Output_data_plt_arm::first_plt_entry_offset): New function.
6383         (Output_data_plt_arm::get_plt_entry_size): New function.
6384         * i386.cc (Target_i386::got_size): Add const.
6385         (Target_i386::got_entry_count): New function.
6386         (Target_i386::plt_entry_count): New function.
6387         (Target_i386::first_plt_entry_offset): New function.
6388         (Target_i386::plt_entry_size): New function.
6389         (Output_data_plt_i386::entry_count): New function.
6390         (Output_data_plt_i386::first_plt_entry_offset): New function.
6391         (Output_data_plt_i386::get_plt_entry_size): New function.
6392         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6393         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6394         * incremental.cc: Include target.h.
6395         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6396         parameter.  Adjust all callers.  Find incremental_got_plt section.
6397         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6398         section.
6399         (Output_section_incremental_inputs::set_final_data_size): Calculate
6400         size of incremental_got_plt section.
6401         (Output_section_incremental_inputs::do_write): Write the
6402         incremental_got_plt section.
6403         (Got_plt_view_info): New struct.
6404         (Local_got_offset_visitor): New class.
6405         (Global_got_offset_visitor): New class.
6406         (Global_symbol_visitor_got_plt): New class.
6407         (Output_section_incremental_inputs::write_got_plt): New function.
6408         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6409         Add parameter.  Adjust all callers.
6410         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6411         (Incremental_inputs::got_plt_section): New function.
6412         (Incremental_inputs::got_plt_section_): New data member.
6413         (Incremental_got_plt_reader): New class.
6414         * layout.cc (Layout::create_incremental_info_sections): Add the
6415         incremental_got_plt section.
6416         * object.h (Got_offset_list::get_list): New function.
6417         (Got offset_list::for_all_got_offsets): New function.
6418         (Sized_relobj::local_got_offset_list): New function.
6419         * powerpc.cc (Target_powerpc::got_size): Add const.
6420         (Target_powerpc::got_entry_count): New function.
6421         (Target_powerpc::plt_entry_count): New function.
6422         (Target_powerpc::first_plt_entry_offset): New function.
6423         (Target_powerpc::plt_entry_size): New function.
6424         (Output_data_plt_powerpc::entry_count): New function.
6425         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6426         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6427         * sparc.cc (Target_sparc::got_size): Add const.
6428         (Target_sparc::got_entry_count): New function.
6429         (Target_sparc::plt_entry_count): New function.
6430         (Target_sparc::first_plt_entry_offset): New function.
6431         (Target_sparc::plt_entry_size): New function.
6432         (Output_data_plt_sparc::entry_count): New function.
6433         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6434         (Output_data_plt_sparc::get_plt_entry_size): New function.
6435         * symtab.h (Symbol::got_offset_list): New function.
6436         (Symbol_table::for_all_symbols): New function.
6437         * target.h (Sized_target::got_entry_count): New function.
6438         (Sized_target::plt_entry_count): New function.
6439         (Sized_target::plt_entry_size): New function.
6440         * x86_64.cc (Target_x86_64::got_size): Add const.
6441         (Target_x86_64::got_entry_count): New function.
6442         (Target_x86_64::plt_entry_count): New function.
6443         (Target_x86_64::first_plt_entry_offset): New function.
6444         (Target_x86_64::plt_entry_size): New function.
6445         (Output_data_plt_x86_64::entry_count): New function.
6446         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6447         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6448
6449 2010-08-12  Cary Coutant  <ccoutant@google.com>
6450
6451         * archive.cc: Include incremental.h.
6452         (Archive::Archive): Initialize incremental_info_.
6453         (Archive::include_member): Record archive members in incremental info.
6454         (Add_archive_symbols::run): Record begin and end of an archive in
6455         incremental info.
6456         (Lib_group::include_member): Record objects in incremental info.
6457         * archive.h (Incremental_archive_entry): Forward declaration.
6458         (Archive::set_incremental_info): New member function.
6459         (Archive::incremental_info): New member function.
6460         (Archive::Unused_symbol_iterator): New class.
6461         (Archive::unused_symbols_begin): New member function.
6462         (Archive::unused_symbols_end): New member function.
6463         (Archive::incremental_info_): New data member.
6464         * incremental-dump.cc (find_input_containing_global): New function.
6465         (dump_incremental_inputs): Dump new incremental info sections.
6466         * incremental.cc: Include symtab.h.
6467         (Output_section_incremental_inputs): New class.
6468         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6469         new incremental info sections.
6470         (Sized_incremental_binary::do_check_inputs): Likewise.
6471         (Incremental_inputs::report_archive): Remove.
6472         (Incremental_inputs::report_archive_begin): New function.
6473         (Incremental_inputs::report_archive_end): New function.
6474         (Incremental_inputs::report_object): New function.
6475         (Incremental_inputs::finalize_inputs): Remove.
6476         (Incremental_inputs::report_input_section): New function.
6477         (Incremental_inputs::report_script): Rewrite.
6478         (Incremental_inputs::finalize): Do nothing but finalize string table.
6479         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6480         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6481         (Incremental_inputs::create_data_sections): New function.
6482         (Incremental_inputs::relocs_entsize): New function.
6483         (Output_section_incremental_inputs::set_final_data_size): New function.
6484         (Output_section_incremental_inputs::do_write): New function.
6485         (Output_section_incremental_inputs::write_header): New function.
6486         (Output_section_incremental_inputs::write_input_files): New function.
6487         (Output_section_incremental_inputs::write_info_blocks): New function.
6488         (Output_section_incremental_inputs::write_symtab): New function.
6489         * incremental.h (Incremental_script_entry): Forward declaration.
6490         (Incremental_object_entry): Forward declaration.
6491         (Incremental_archive_entry): Forward declaration.
6492         (Incremental_inputs): Forward declaration.
6493         (Incremental_inputs_header_data): Remove.
6494         (Incremental_inputs_header): Remove.
6495         (Incremental_inputs_header_write): Remove.
6496         (Incremental_inputs_entry_data): Remove.
6497         (Incremental_inputs_entry): Remove.
6498         (Incremental_inputs_entry_write): Remove.
6499         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6500         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6501         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6502         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6503         Likewise.
6504         (Incremental_input_entry): New class.
6505         (Incremental_script_entry): New class.
6506         (Incremental_object_entry): New class.
6507         (Incremental_archive_entry): New class.
6508         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6509         (Incremental_inputs::report_inputs): Remove.
6510         (Incremental_inputs::report_archive): Remove.
6511         (Incremental_inputs::report_archive_begin): New function.
6512         (Incremental_inputs::report_archive_end): New function.
6513         (Incremental_inputs::report_object): Change prototype.
6514         (Incremental_inputs::report_input_section): New function.
6515         (Incremental_inputs::report_script): Change prototype.
6516         (Incremental_inputs::get_reloc_count): New function.
6517         (Incremental_inputs::set_reloc_count): New function.
6518         (Incremental_inputs::create_data_sections): New function.
6519         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6520         (Incremental_inputs::inputs_section): New function.
6521         (Incremental_inputs::symtab_section): New function.
6522         (Incremental_inputs::relocs_section): New function.
6523         (Incremental_inputs::get_stringpool): Add const.
6524         (Incremental_inputs::command_line): Add const.
6525         (Incremental_inputs::inputs): Remove.
6526         (Incremental_inputs::command_line_key): New function.
6527         (Incremental_inputs::input_file_count): New function.
6528         (Incremental_inputs::input_files): New function.
6529         (Incremental_inputs::relocs_entsize): New function.
6530         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6531         (Incremental_inputs::finalize_inputs): Remove.
6532         (Incremental_inputs::Input_info): Remove.
6533         (Incremental_inputs::lock_): Remove.
6534         (Incremental_inputs::inputs_): Change type.
6535         (Incremental_inputs::inputs_map_): Remove.
6536         (Incremental_inputs::current_object_entry_): New data member.
6537         (Incremental_inputs::inputs_section_): New data member.
6538         (Incremental_inputs::symtab_section_): New data member.
6539         (Incremental_inputs::relocs_section_): New data member.
6540         (Incremental_inputs::reloc_count_): New data member.
6541         (Incremental_inputs_reader): New class.
6542         (Incremental_symtab_reader): New class.
6543         (Incremental_relocs_reader): New class.
6544         * layout.cc (Layout::finalize): Move finalization of incremental info
6545         and creation of incremental info sections to follow finalization of
6546         symbol table.  Set offsets for postprocessing sections.
6547         (Layout::create_incremental_info_sections): Call
6548         Incremental_inputs::create_data_sections.  Add incremental symtab
6549         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6550         sections to layout after input sections.
6551         * layout.h (struct Timespec): Forward declaration.
6552         (Layout::incremental_inputs): Add const.
6553         (Layout::create_incremental_info_sections): Add parameter.
6554         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6555         * object.cc: Include incremental.h.
6556         (Relobj::finalize_incremental_relocs): New function.
6557         (Sized_relobj::do_layout): Record input sections in incremental info.
6558         * object.h (Object::output_section): New function.
6559         (Object::output_section_offset): Moved from Relobj.
6560         (Object::get_incremental_reloc_base): New function.
6561         (Object::get_incremental_reloc_count): New function.
6562         (Object::do_output_section): New function.
6563         (Object::do_output_section_offset): Moved from Relobj.
6564         (Object::do_get_incremental_reloc_base): New function.
6565         (Object::do_get_incremental_reloc_count): New function.
6566         (Object::Object): Initialize new data members.
6567         (Relobj::output_section): Renamed do_output_section and moved to
6568         protected.
6569         (Relobj::output_section_offset): Moved to Object.
6570         (Relobj::do_get_incremental_reloc_base): New function.
6571         (Relobj::do_get_incremental_reloc_count): New function.
6572         (Relobj::allocate_incremental_reloc_counts): New function.
6573         (Relobj::count_incremental_reloc): New function.
6574         (Relobj::finalize_incremental_relocs): New function.
6575         (Relobj::next_incremental_reloc_index): New function.
6576         (Relobj::reloc_counts_): New data member.
6577         (Relobj::reloc_bases_): New data member.
6578         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6579         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6580         (Sized_relobj::incremental_relocs_scan): New function.
6581         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6582         (Sized_relobj::incremental_relocs_write): New function.
6583         (Sized_relobj::incremental_relocs_write_reltype): New function.
6584         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6585         incremental link.
6586         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6587         archives and object files elsewhere.
6588         (Add_symbols::run): Report object files here.
6589         (Finish_group::run): Report end of archive at end of group.
6590         * reloc.cc: Include layout.h, incremental.h.
6591         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6592         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6593         (Sized_relobj::incremental_relocs_scan): New function.
6594         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6595         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6596         (Sized_relobj::incremental_relocs_write): New function.
6597         (Sized_relobj::incremental_relocs_write_reltype): New function.
6598         * script.cc (read_input_script): Rewrite test for incremental link.
6599         Change call to Incremental_inputs::report_script.
6600         * symtab.h (Symbol_table::first_global_index): New function.
6601         (Symbol_table::output_count): New function.
6602
6603 2010-08-12  Doug Kwan  <dougkwan@google.com>
6604
6605         * arm.cc (Target_arm::merge_object_attributes): Check command line
6606         options --no-wchar-size-warning and --no-enum-size-warning.
6607         * options.h (General_options): Add ld-compatible options
6608         --no-enum-size-warning and --no-wchar-size-warning.
6609
6610 2010-08-04  Ian Lance Taylor  <iant@google.com>
6611
6612         * x86_64.cc (Target_x86_64::Scan::local): Use
6613         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6614         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6615         (Target_x86_64::Scan::global): Likewise.
6616         (Target_x86_64::Relocate::relocate): Likewise.
6617         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6618         Likewise.
6619
6620 2010-08-03  Cary Coutant  <ccoutant@google.com>
6621
6622         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6623         to reserve space in merged_strings vector. Keep total input size
6624         for stats.
6625         (Output_merge_string::do_print_merge_stats): Print total input size.
6626         * merge.h (Output_merge_string): Add input_size_ field.
6627         * stringpool.cc (Stringpool_template::string_length): Move
6628         implementations out of Stringpool_template class and place in
6629         stringpool.h.
6630         * stringpool.h (string_length): Move out of Stringpool_template.
6631
6632 2010-08-03  Ian Lance Taylor  <iant@google.com>
6633
6634         PR 11712
6635         * layout.cc (relaxation_loop_body): If address of load segment is
6636         set, adjust address to include headers if possible.
6637
6638 2010-08-03  Ian Lance Taylor  <iant@google.com>
6639
6640         * version.cc (version_string): Bump to 1.10.
6641
6642 2010-08-03  Ian Lance Taylor  <iant@google.com>
6643
6644         PR 11805
6645         * layout.h (enum Output_section_order): Define.
6646         (class Layout): Update declarations.
6647         * layout.cc (Layout::get_output_section): Add order parameter.
6648         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6649         is_first_non_relro parameters.  Change all callers.
6650         (Layout::choose_output_section): Likewise.
6651         (Layout::add_output_section_data): Likewise.
6652         (Layout::make_output_section): Likewise.  Set order.
6653         (Layout::default_section_order): New function.
6654         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6655         * output.cc (Output_section::Output_section): Initialize order_.
6656         Don't initialize deleted fields.
6657         (Output_segment::Output_segment): Don't initialize deleted
6658         fields.
6659         (Output_segment::add_output_section_to_load): New function
6660         replacing add_output_section.  Change all callers to call this or
6661         add_output_section_to_nonload.
6662         (Output_segment::add_output_section_to_nonload): New function.
6663         (Output_segment::remove_output_section): Rewrite.
6664         (Output_segment::add_initial_output_data): Likewise.
6665         (Output_segment::has_any_data_sections): Likewise.
6666         (Output_segment::is_first_section_relro): Likewise.
6667         (Output_segment::maximum_alignment): Likewise.
6668         (Output_segment::has_dynamic_reloc): New function replacing
6669         dynamic_reloc_count.  Change all callers.
6670         (Output_segment::has_dynamic_reloc_list): New function replacing
6671         dynamic_reloc_count_list.  Change all callers.
6672         (Output_segment::set_section_addresses): Rewrite.
6673         (Output_segment::set_offset): Rewrite.
6674         (Output_segment::find_first_and_last_list): Remove.
6675         (Output_segment::set_tls_offsets): Rewrite.
6676         (Output_segment::first_section_load_address): Likewise.
6677         (Output_segment::output_section_count): Likewise.
6678         (Output_segment::section_with_lowest_load_address): Likewise.
6679         (Output_segment::write_section_headers): Likewise.
6680         (Output_segment::print_sections_to_map): Likewise.
6681         * output.h (class Output_data): Remove dynamic_reloc_count_
6682         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6683         (Output_data::add_dynamic_reloc): Rewrite.
6684         (Output_data::has_dynamic_reloc): New function.
6685         (Output_data::dynamic_reloc_count): Remove.
6686         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6687         is_last_relro_, is_first_non_relro_, is_interp_,
6688         is_dynamic_linker_section_ fields.  Add order and set_order
6689         functions.  Remove is_relro_local, set_is_relro_local,
6690         is_last_relro, set_is_last_relro, is_first_non_relro,
6691         set_is_first_non_relro functions, is_interp, set_is_interp,
6692         is_dynamic_linker_section, and set_is_dynamic_linker_section
6693         functions.
6694         (class Output_segment): Change Output_data_list from std::list to
6695         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6696         output_bss_ fields.  Update declarations.
6697
6698 2010-08-02  Ian Lance Taylor  <iant@google.com>
6699
6700         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6701         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6702         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6703
6704 2010-08-02  Ian Lance Taylor  <iant@google.com>
6705
6706         PR 11855
6707         * script.cc (Script_options::Script_options): Initialize
6708         symbol_definitions_ and symbol_references_.
6709         (Script_options::add_symbol_assignment): Update
6710         symbol_definitions_ and symbol_references_.
6711         (Script_options::add_symbol_reference): New function.
6712         (script_symbol): New function.
6713         * script.h (class Script_options): Add symbol_definitions_ and
6714         symbol_references_ fields.
6715         (Script_options::referenced_const_iterator): New type.
6716         (Script_options::referenced_begin): New function.
6717         (Script_options::referenced_end): New function.
6718         (Script_options::is_referenced): New function.
6719         (Script_options::any_unreferenced): New function.
6720         * script-c.h (script_symbol): Declare.
6721         * yyscript.y (exp): Call script_symbol.
6722         * symtab.cc: Include "script.h".
6723         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6724         Change all callers.  Check symbols referenced by scripts.
6725         (Symbol_table::add_undefined_symbols_from_command_line): Add
6726         layout parameter.  Change all callers.
6727         (Symbol_table::do_add_undefined_symbols_from_command_line):
6728         Likewise.  Break out loop body.  Check symbols referenced by
6729         scripts.
6730         (Symbol_table::add_undefined_symbol_from_command_line): New
6731         function broken out of
6732         do_add_undefined_symbols_from_command_line.
6733         * symtab.h (class Symbol_table): Update declarations.
6734         * archive.cc: Include "layout.h".
6735         (Archive::should_include_member): Add layout parameter.  Change
6736         all callers.  Check for symbol mentioned in expression.
6737         * archive.h (class Archive): Update declaration.
6738         * object.cc (Sized_relobj::do_should_include_member): Add layout
6739         parameter.
6740         * object.h (Object::should_include_member): Add layout parameter.
6741         Change all callers.
6742         (Object::do_should_include_member): Add layout parameter.
6743         (class Sized_relobj): Update declaration.
6744         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6745         parameter.
6746         * dynobj.h (class Sized_dynobj): Update declaration.
6747         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6748         layout parameter.
6749         * plugin.h (class Sized_pluginobj): Update declaration.
6750
6751 2010-08-02  Ian Lance Taylor  <iant@google.com>
6752
6753         PR 11866
6754         * output.cc (Output_segment::set_offset): Search for the first and
6755         last sections rather than assuming that the list is in order.
6756         (Output_segment::find_first_and_last_list): New function.
6757         * output.h (class Output_segment): Update declarations.
6758         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6759         (relro_strip_test_SOURCES): New variable.
6760         (relro_strip_test_DEPENDENCIES): New variable.
6761         (relro_strip_test_LDFLAGS): New variable.
6762         (relro_strip_test_LDADD): New variable.
6763         (relro_strip_test.so): New target.
6764
6765 2010-08-02  Ian Lance Taylor  <iant@google.com>
6766
6767         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6768         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6769         (Target_i386::got_tlsdesc_section): New function.
6770         (Target_i386::got_section): Create space for GOT entries for
6771         TLSDESC relocations.
6772         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6773         R_386_TLS_GOTDESC.
6774         (Target_i386::Scan::global): Likewise.
6775         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6776         using TLSDESC GOT.
6777         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6778         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6779         (Target_x86_64::got_tlsdesc_section): New function.
6780         (Target_x86_64::got_section): Create space for GOT entries for
6781         TLSDESC relocations.
6782         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6783         R_386_TLS_GOTDESC.
6784         (Target_x86_64::Scan::global): Likewise.
6785         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6786         using TLSDESC GOT.
6787
6788 2010-08-02  Ian Lance Taylor  <iant@google.com>
6789
6790         * testsuite/final_layout.sh: Use dc to convert from hex to
6791         decimal.
6792
6793 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6794
6795         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6796         paramter to the call to gold::gc_process_relocs.
6797         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6798         paramter to the call to gold::gc_process_relocs.
6799         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6800         parameter to the call to gold::gc_process_relocs.
6801         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6802         template parameter to the call to gold::gc_process_relocs.
6803         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6804         paramter to the call to gold::gc_process_relocs.
6805         * gc.h (get_embedded_addend_size): New function.
6806         (gc_process_relocs): Save the size of the reloc for use by ICF.
6807         * icf.cc (get_section_contents): Get the addend from the text section
6808         for SHT_REL relocation sections.
6809         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6810         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6811         * int_encoding.h (read_from_pointer): New overloaded function.
6812         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6813         * testsuite/icf_sht_rel_addend_test.sh: New file.
6814         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6815         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6816
6817 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6818
6819         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6820         * Makefile.in: Regenerate.
6821         * testsuite/Makefile.in: Regenerate.
6822
6823 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6824
6825         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6826         * gold/testsuite/debug_msg.cc: Likewise.
6827         * gold/testsuite/odr_violation1.cc
6828         * gold/testsuite/odr_violation2.cc
6829
6830 2010-07-21  Cary Coutant  <ccoutant@google.com>
6831
6832         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6833         string, and length fields.
6834         (Output_merge_string::Merged_strings_list): New type.
6835         (Output_merge_string::Merged_strings_lists): New typedef.
6836         (Output_merge_string): Replace merged_strings_ with
6837         merged_strings_lists_.
6838         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6839         Merged_strings_list per input object and section.  Don't store pointer
6840         to the string.  Don't store length with each merged string entry.
6841         (Output_merge_string::finalize_merged_data): Loop over list of merged
6842         strings lists.  Recompute length of each merged string.
6843
6844 2010-07-15  Cary Coutant  <ccoutant@google.com>
6845
6846         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6847         here.
6848
6849 2010-07-14  Ian Lance Taylor  <iant@google.com>
6850
6851         * descriptors.cc (Descriptors::open): Report correct name in error
6852         message.
6853
6854 2010-07-13  Doug Kwan  <dougkwan@google.com>
6855
6856         * arm.cc (Arm_input_section::Arm_input_section): For a
6857         SHT_ARM_EXIDX section, always keeps the input sections.
6858         (Arm_input_section::set_exidx_section_link): New method.
6859         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6860         has_errors_ to false.
6861         (Arm_exidx_input_section::has_errors,
6862         Arm_exidx_input_section::set_has_errors): New methods.
6863         (Arm_exidx_input_section::has_errors_): New data member.
6864         (Arm_relobj::get_exidx_shndx_list): New method.
6865         (Arm_output_section::append_text_sections_to_list): Do not skip
6866         section without SHF_EXECINSTR.
6867         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6868         errors.
6869         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6870         section header.  Make error messages more verbose.  Check for
6871         a non-executable section linked to an EXIDX section.
6872         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6873         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6874         check that there is no deferred EXIDX section if we exit early.
6875         Instead of not making an EXIDX section in case of an error, make one
6876         and set the has_errors flag of it.
6877         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6878         in a relocatable link.
6879         (Target_arm::do_relax): Look for the EXIDX output section instead of
6880         assuming that it is called .ARM.exidx.
6881         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6882         section list.  Do not check for SHF_EXECINSTR section flags but
6883         skip any input section with errors.
6884         * output.cc (Output_section::Output_section): Initialize
6885         always_keeps_input_sections_ to false.
6886         (Output_section::add_input_section): Check for
6887         always_keeps_input_sections_.
6888         *  output.h (Output_section::always_keeps_input_sections,
6889         Output_section::set_always_keeps_input_sections): New methods.
6890         (Output_section::always_keeps_input_sections): New data member.
6891
6892 2010-07-13  Rafael Espindola  <espindola@google.com>
6893
6894         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6895         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6896
6897 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6898             Ian Lance Taylor  <iant@google.com>
6899
6900         * output.h (Output_section_lookup_maps::add_merge_section):
6901         Correct check of whether value was inserted.
6902         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6903         (Output_section_lookup_maps::add_relaxed_input_section):
6904         Likewise.
6905         * arm.cc (Target_arm::got_section): Remove used local os.
6906         * i386.cc (Target_i386::got_section): Likewise.
6907         * x86_64.cc (Target_x86_64::got_section): Likewise.
6908         * sparc.cc (Target_sparc::got_section): Likewise.
6909         (Target_sparc::relocate): Remove unused local have_got_offset.
6910         * powerpc.cc (Target_powerpc::relocate): Likewise.
6911
6912 2010-07-13  Ian Lance Taylor  <iant@google.com>
6913
6914         * compressed_output.cc (zlib_decompress): Fix signature in
6915         !HAVE_ZLIB_H case.
6916
6917         * archive.cc (Archive::include_member): Unlock an external member
6918         of a thin archive.  Don't bother to delete an object we know is
6919         NULL.
6920
6921 2010-07-12  Cary Coutant  <ccoutant@google.com>
6922
6923         * compressed_output.cc (zlib_decompress): New function.
6924         (get_uncompressed_size): New function.
6925         (decompress_input_section): New function.
6926         * compressed_output.h (get_uncompressed_size): New function.
6927         (decompress_input_section): New function.
6928         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6929         Handle compressed debug sections.
6930         * layout.cc (is_compressed_debug_section): New function.
6931         (Layout::output_section_name): Map compressed section names to
6932         canonical names.
6933         * layout.h (is_compressed_debug_section): New function.
6934         (is_debug_info_section): Recognize compressed debug sections.
6935         * merge.cc: Include compressed_output.h.
6936         (Output_merge_data::do_add_input_section): Handle compressed
6937         debug sections.
6938         (Output_merge_string::do_add_input_section): Handle compressed
6939         debug sections.
6940         * object.cc: Include compressed_output.h.
6941         (Sized_relobj::Sized_relobj): Initialize new data members.
6942         (build_compressed_section_map): New function.
6943         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6944         * object.h (Object::section_is_compressed): New method.
6945         (Object::do_section_is_compressed): New method.
6946         (Sized_relobj::Compressed_section_map): New type.
6947         (Sized_relobj::do_section_is_compressed): New method.
6948         (Sized_relobj::compressed_sections_): New data member.
6949         * output.cc (Output_section::add_input_section): Handle compressed
6950         debug sections.
6951         * reloc.cc: Include compressed_output.h.
6952         (Sized_relobj::write_sections): Handle compressed debug sections.
6953
6954 2010-07-08  Cary Coutant  <ccoutant@google.com>
6955
6956         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6957         weak when resolving to a dynamic def.
6958         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6959         for weak undef/dynamic def cases. Adjust callers.
6960         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6961         undef_binding_weak_.
6962         (Symbol_table::sized_write_globals): Adjust symbol binding.
6963         (Symbol_table::sized_write_symbol): Add binding parameter.
6964         * symtab.h (Symbol::set_undef_binding): New method.
6965         (Symbol::is_undef_binding_weak): New method.
6966         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6967         (Symbol_table::should_override): Add new parameter.
6968         (Symbol_table::sized_write_symbol): Add new parameter.
6969
6970         * testsuite/weak_undef_file1.cc: Add new test case.
6971         * testsuite/weak_undef_file2.cc: Fix header comment.
6972         * testsuite/weak_undef_test.cc: Add new test case.
6973
6974 2010-06-29  Doug Kwan  <dougkwan@google.com>
6975
6976         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6977         Initialize USE_SYMBOL_.
6978         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6979         definition.
6980         (Arm_reloc_property::uses_symbol_): New data member declaration.
6981         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6982         uses symbol value and symbol is undefined but not weakly undefined.
6983
6984 2010-06-28  Rafael Espindola  <espindola@google.com>
6985
6986         * plugin.cc (Plugin::load): Use dlerror.
6987
6988 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6989
6990         * symtab.cc (detect_odr_violations): When reporting an ODR
6991         violation, report an object where the symbol is defined.
6992
6993 2010-06-25  Doug Kwan  <dougkwan@google.com>
6994
6995         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6996         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6997         definition.
6998         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6999         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7000         target hook to detect function points.
7001         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7002         * icf.h (Icf::check_section_for_function_pointers): Change type of
7003         parameter SECTION_NAME to const reference to std::string.  Use
7004         target hook to determine if section may have unsafe pointers.
7005         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7006         method definition.
7007
7008 2010-06-21  Rafael Espindola  <espindola@google.com>
7009
7010         * fileread.cc (Input_file::find_fie): New
7011         (Input_file::open): Use Input_file::find_fie.
7012         * fileread.h (Input_file::find_fie): New
7013         * plugin.cc (set_extra_library_path): New.
7014         (Plugin::load): Add set_extra_library_path to the transfer vector.
7015         (Plugin_manager::set_extra_library_path): New.
7016         (Plugin_manager::add_input_file): Use the extra search path if set.
7017         (set_extra_library_path(): New.
7018         * plugin.h (Plugin_manager): Add set_extra_library_path and
7019         extra_search_path_.
7020
7021 2010-06-19  Cary Coutant  <ccoutant@google.com>
7022
7023         * layout.cc (gdb_sections): Add .debug_types.
7024         (lines_only_debug_sections): Likewise.
7025
7026 2010-06-18  Rafael Espindola  <espindola@google.com>
7027
7028         * plugin.cc (add_input_file,add_input_library)
7029         (Plugin_manager::add_input_file): Make filename arguments const.
7030         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7031         const.
7032
7033 2010-06-16  Doug Kwan  <dougkwan@google.com>
7034
7035         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7036         .ARM.attributes section if we have not merged any input
7037         attributes sections.
7038
7039 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7040
7041         * arm.cc: Allow combining objects with no EABI version
7042         information.
7043
7044 2010-06-15  Rafael Espindola  <espindola@google.com>
7045
7046         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7047
7048 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7049
7050         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7051         (struct iovec): Correct !HAVE_READV definition.
7052
7053 2010-06-10  Cary Coutant  <ccoutant@google.com>
7054
7055         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7056         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7057         reloc sections.
7058         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7059
7060         PR 11683
7061         * symtab.h (Symbol::is_placeholder): New member function.
7062         * target-reloc.h (relocate_section): Check for placeholder symbols.
7063
7064         * testsuite/Makefile.am (plugin_test_8): New test.
7065         (plugin_test_9): New test.
7066         * testsuite/Makefile.in: Regenerate.
7067
7068 2010-06-09  Nick Clifton  <nickc@redhat.com>
7069
7070         * yyscript.y (input_list_element): Allow strings prefixed with
7071         the '-' character.  Treat these as libraries.
7072         * script.cc (script_add_library): New function.  Adds a library
7073         specified by "-l<name>" found in an input script.
7074         * script-c.h: Add prototype for script_add_library.
7075
7076 2010-06-07  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7079         Restrict stub-group size to be within long conditional branch
7080         range when working around cortex-A8 erratum.
7081
7082 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7083
7084         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7085         #ifdef typo.
7086
7087 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7088
7089         PR gold/11658
7090         * output.cc
7091         (Output_section::Input_section_sort_entry::compare_section_ordering):
7092         Change to return non-zero correctly.
7093         (Output_section::Input_section_sort_section_order_index_compare
7094         ::operator()): Change to fix ambiguity in comparisons.
7095
7096 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7097
7098         * gold.h (is_wildcard_string): New function.
7099         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7100         (Layout::layout_eh_frame): Ditto.
7101         (Layout::find_section_order_index): New method.
7102         (Layout::read_layout_from_file): New method.
7103         * layout.h (Layout::find_section_order_index): New method.
7104         (Layout::read_layout_from_file): New method.
7105         (Layout::input_section_position_): New private member.
7106         (Layout::input_section_glob_): New private member.
7107         * main.cc (main): Call read_layout_from_file here.
7108         * options.h (--section-ordering-file): New option.
7109         * output.cc (Output_section::input_section_order_specified_): New
7110         member.
7111         (Output_section::Output_section): Initialize new member.
7112         (Output_section::add_input_section): Add new parameter.
7113         Keep input sections when --section-ordering-file is used.
7114         (Output_section::set_final_data_size): Sort input sections when
7115         section ordering file is specified.
7116         (Output_section::Input_section_sort_entry): Add new parameter.
7117         Check sorting type.
7118         (Output_section::Input_section_sort_entry::compare_section_ordering):
7119         New method.
7120         (Output_section::Input_section_sort_compare::operator()): Change to
7121         consider section_order_index.
7122         (Output_section::Input_section_sort_init_fini_compare::operator()):
7123         Change to consider section_order_index.
7124         (Output_section::Input_section_sort_section_order_index_compare
7125         ::operator()): New method.
7126         (Output_section::sort_attached_input_sections): Change to sort
7127         according to section order when specified.
7128         (Output_section::add_input_section<32, true>): Add new parameter.
7129         (Output_section::add_input_section<64, true>): Add new parameter.
7130         (Output_section::add_input_section<32, false>): Add new parameter.
7131         (Output_section::add_input_section<64, false>): Add new parameter.
7132         * output.h (Output_section::add_input_section): Add new parameter.
7133         (Output_section::input_section_order_specified): New
7134         method.
7135         (Output_section::set_input_section_order_specified): New method.
7136         (Input_section::Input_section): Initialize section_order_index_.
7137         (Input_section::section_order_index): New method.
7138         (Input_section::set_section_order_index): New method.
7139         (Input_section::section_order_index_): New member.
7140         (Input_section::Input_section_sort_section_order_index_compare): New
7141         struct.
7142         (Output_section::input_section_order_specified_): New member.
7143         * script-sections.cc (is_wildcard_string): Delete and move modified
7144         method to gold.h.
7145         (Output_section_element_input::Output_section_element_input): Modify
7146         call to is_wildcard_string.
7147         (Output_section_element_input::Input_section_pattern
7148         ::Input_section_pattern): Ditto.
7149         (Output_section_element_input::Output_section_element_input): Ditto.
7150         * testsuite/Makefile.am (final_layout): New test case.
7151         * testsuite/Makefile.in: Regenerate.
7152         * testsuite/final_layout.cc: New file.
7153         * testsuite/final_layout.sh: New file.
7154
7155 2010-06-01  Rafael Espindola  <espindola@google.com>
7156
7157         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7158
7159 2010-06-01  Rafael Espindola  <espindola@google.com>
7160
7161         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7162         visibility of symbols.
7163
7164 2010-05-27  Doug Kwan  <dougkwan@google.com>
7165
7166         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7167         from start of output section instead of address for a local symbol
7168         in a merged or relaxed section when doing a relocatable link.
7169
7170 2010-05-26  Rafael Espindola  <espindola@google.com>
7171
7172         PR 11604
7173         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7174         adding sections the garbage collector removed.
7175         * gold/testsuite/Makefile.am: Add test.
7176         * gold/testsuite/Makefile.in: Regenerate.
7177         * gold/testsuite/plugin_test_7.sh: New.
7178         * gold/testsuite/plugin_test_7_1.c: New.
7179         * gold/testsuite/plugin_test_7_2.c: New.
7180
7181 2010-05-26  Rafael Espindola  <espindola@google.com>
7182
7183         * script-sections.cc (Output_section_definition::set_section_addresses):
7184         Check for --section-start.
7185
7186 2010-05-26  Doug Kwan  <dougkwan@google.com>
7187
7188         * arm.cc (Arm_scan_relocatable_relocs): New class.
7189         (Target_arm::relocate_special_relocatable): New method.
7190         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7191         (Arm_relocate_functions::thumb_branch_common): Same.
7192         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7193         instead of Default_scan_relocatable_relocs.
7194         * target-reloc.h (relocate_for_relocatable): Let target handle
7195         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7196         * target.h (Sized_target::relocate_special_relocatable): New method.
7197
7198 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7199
7200         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7201
7202 2010-05-23  Doug Kwan  <dougkwan@google.com>
7203
7204         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7205         instead of a cast.
7206         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7207         with a direct branch, not a conditional branch, to a stub.
7208         * merge.cc (Output_merge_base::record_input_section): New method
7209         defintion.
7210         (Output_merge_data::do_add_input_section): Record input section if
7211         keeps-input-sections flag is set.
7212         (Output_merge_string::do_add_input_section): Ditto.
7213         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7214         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7215         INPUT_SECTIONS_.
7216         (Output_merge_base::keeps_input_sections,
7217         Output_merge_base::set_keeps_input_sections,
7218         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7219         method definitions.
7220         (Output_merge_base::Input_sections): New type declaration.
7221         (Output_merge_base::input_sections_begin,
7222         Output_merge_base::input_sections_end,
7223         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7224         (Output_merge_base::bool keeps_input_sections_,
7225         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7226         Output_merge_base::input_sections_): New data members.
7227         (Output_merge_data::do_set_keeps_input_sections): New method
7228         defintion.
7229         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7230         * output.cc (Output_section::Input_section::relobj): Move method
7231         defintion from class declaration to here and handle merge sections.
7232         (Output_section::Input_section::shndx): Ditto.
7233         (Output_section::Output_section): Remove initializations of removed
7234         data members and initialize new data member LOOKUP_MAPS_.
7235         (Output_section::add_input_section): Set keeps-input-sections flag
7236         for a newly created merge output section as appropriate.  Adjust code
7237         to use Output_section_lookup_maps class.
7238         (Output_section::add_relaxed_input_section): Adjst code for lookup
7239         maps code refactoring.
7240         (Output_section::add_merge_input_section): Add a new parameter
7241         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7242         class.  If adding input section to a newly created merge output
7243         section fails, remove the new merge section.
7244         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7245         Adjust code for use of the Output_section_lookup_maps class.
7246         (Output_section::find_merge_section): Ditto.
7247         (Output_section::build_lookup_maps): New method defintion.
7248         (Output_section::find_relaxed_input_section): Adjust code to use
7249         Output_section_lookup_maps class.
7250         (Output_section::get_input_sections): Export merge sections.  Adjust
7251         code to use Output_section_lookup_maps class.
7252         (Output_section:::add_script_input_section): Adjust code to use
7253         Output_section_lookup_maps class.  Update lookup maps for merge
7254         sections also.
7255         (Output_section::discard_states): Use Output_section_lookup_maps.
7256         (Output_section::restore_states): Same.
7257         * output.h (Merge_section_properties): Move class defintion out of
7258         Output_section.
7259         (Output_section_lookup_maps): New class.
7260         (Output_section::Input_section::is_merge_section): New method
7261         defintion.
7262         (Output_section::Input_section::relobj): Move defintion out of class
7263         defintion.  Declare method only.
7264         (Output_section::Input_section::shndx): Ditto.
7265         (Output_section::Input_section::output_merge_base): New method defintion.
7266         (Output_section::Input_section::u2_.pomb): New union field.
7267         (Output_section::Merge_section_by_properties_map,
7268         Output_section::Output_section_data_by_input_section_map,
7269         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7270         Remove types.
7271         (Output_section::add_merge_input_section): Add new parameter
7272         KEEPS_INPUT_SECTIONS.
7273         (Output_section::build_lookup_maps): New method declaration.
7274         (Output_section::merge_section_map_,
7275         Output_section::merge_section_by_properties_map_,
7276         Output_section::relaxed_input_section_map_,
7277         Output_section::is_relaxed_input_section_map_valid_): Remove data
7278         members.
7279         (Output_section::lookup_maps_): New data member.
7280
7281 2010-05-21  Doug Kwan  <dougkwan@google.com>
7282
7283         PR gold/11619
7284         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7285         avoid a compilation error.
7286
7287 2010-05-19  Rafael Espindola  <espindola@google.com>
7288
7289         * script-sections.cc (Output_section_definition::allocate_to_segment):
7290         Update the phdrs_list even when the output section is NULL.
7291         * testsuite/Makefile.am: Add test.
7292         * testsuite/Makefile.in: Regenerate.
7293         * testsuite/script_test_9.cc: New.
7294         * testsuite/script_test_9.sh: New.
7295         * testsuite/script_test_9.t: New.
7296
7297 2010-05-19  Doug Kwan  <dougkwan@google.com>
7298
7299         * arm.cc (Arm_input_section::original_size): New method.
7300         (Arm_input_section::do_addralign): Add a cast.
7301         (Arm_input_section::do_output_offset): Remove static cast.
7302         (Arm_input_section::original_addralign,
7303          Arm_input_section::original_size_): Change type to uint32_t.
7304         (Arm_input_section::init): Add safe casts for section alignment
7305         and size.
7306         (Arm_input_section::set_final_data_size): Do not set address and
7307         offset of stub table.
7308         (Arm_output_section::fix_exidx_coverage): Change use of of
7309         Output_section::Simple_input_section to that of
7310         Output_section::Input_section.
7311         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7312         except for the first pass.
7313         * output.cc (Output_section::get_input_sections): Change type of
7314         input_sections to std::list<Input_section>.
7315         (Output_section::add_script_input_section): Rename from
7316         Output_section::add_simple_input_section.  Change type of SIS
7317         parameter from Simple_input_section to Input_section.
7318         * output.h (Output_section::Simple_input_section): Remove class.
7319         (Output_section::Input_section): Change class visibility to public.
7320         (Output_section::Input_section::addralign): Use stored alignments
7321         for special input sections if set.
7322         (Output_section::Input_section::set_addralign): New method.
7323         (Output_section::get_input_sections): Change parameter type from
7324         list of Simple_input_section to list of Input_section.
7325         (Output_section::add_script_input_section): Rename from
7326         Output_section::add_simple_input_section. Change first parameter's
7327         type from Simple_input_section to Input_section and remove the
7328         second and third parameters.
7329         * script-sections.cc (Input_section::Input_section_list): Change
7330         type to list of Output_section::Input_section/
7331         (Input_section_info::Input_section_info): Change parameter type of
7332         INPUT_SECTION to Output_section::Input_section.
7333         (Input_section_info::input_section): Change return type.
7334         (Input_section_info::input_section_): Change type to
7335         Output_section::Input_section.
7336         (Output_section_element_input::set_section_addresses): Adjust code
7337         to use Output_section::Input_section instead of
7338         Output_section::Simple_input_section.  Adjust code for renaming
7339         of Output_section::add_simple_input_section.
7340         (Orphan_output_section::set_section_addresses): Ditto.
7341
7342 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7343
7344         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7345         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7346
7347 2010-05-18  Rafael Espindola  <espindola@google.com>
7348
7349         * options.cc (General_options::finalize): Handle -nostdlib.
7350         * options.h (nostdlib): New option.
7351         * script.cc (script_add_search_dir): Handle -nostdlib.
7352
7353 2010-05-12  Doug Kwan  <dougkwan@google.com>
7354
7355         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7356         attributes section only if there no attributes section after merging.
7357         (Target_arm::merge_object_attributes): Move value of
7358         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7359         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7360         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7361         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7362         and arm_attr_merge_7.stdout.
7363         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7364         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7365         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7366         arm_attr_merge_7b.o): New rules.
7367         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7368         arm_attr_merge_7
7369         * testsuite/Makefile.in: Regenerate.
7370         * testsuite/arm_attr_merge.sh: New file.
7371         * testsuite/arm_attr_merge_[67][ab].s: Same.
7372
7373 2010-05-05  Nick Clifton  <nickc@redhat.com>
7374
7375         * po/es.po: Updated Spanish translation.
7376
7377 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7378
7379         * Makefile.am (install-exec-local): Properly install gold as
7380         default cross linker.
7381         * Makefile.in: Regenerated.
7382
7383 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7384             Nick Clifton  <nickc@redhat.com>
7385
7386         * configure.ac (install_as_default): Define and set to false
7387         unless --enable-gold or --enable-gold=both/gold has been
7388         specified.
7389         * configure: Regenerate.
7390
7391         * Makefile.am (install-exec-local): Install the executable as
7392         'ld.gold'.  If install_as_default is true then also install it as
7393         'ld'.
7394         * Makefile.in: Regenerated.
7395
7396 2010-04-24  Ian Lance Taylor  <iant@google.com>
7397
7398         * layout.cc (Layout::layout_reloc): In relocatable link don't
7399         combine reloc sections for grouped sections.
7400
7401 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7402
7403         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7404         sections that are not ordinary to icf.
7405         * icf.cc (get_section_contents): Handle relocation pointing to section
7406         with no object or shndx information.
7407         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7408         * testsuite/Makefile.in: Regenerate.
7409         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7410         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7411
7412 2010-04-22  Ian Lance Taylor  <iant@google.com>
7413
7414         * expression.cc (Expression::Expression_eval_info): Add
7415         result_alignment_pointer field.
7416         (Expression::eval_with_dot): Add result_alignment_pointer
7417         parameter.  Change all callers.
7418         (Expression::eval_maybe_dot): Likewise.
7419         (class Binary_expression): Add alignment_pointer parameter to
7420         left_value and right_value.  Change all callers.
7421         (BINARY_EXPRESSION): Set result alignment.
7422         (class Trinary_expression): Add alignment_pointer parameter to
7423         arg2_value and arg3_value.  Change all callers.
7424         (Trinary_cond::value): Set result alignment.
7425         (Max_expression::value, Min_expression::value): Likewise.
7426         (Align_expression::value): Likewise.
7427         * script-sections.cc (class Sections_element): Add dot_alignment
7428         parameter to set_section_addresses virtual function.  Update
7429         instantiations.
7430         (class Output_section_element): Likewise.
7431         (Script_sections::create_segments): Add dot_alignment parameter.
7432         Change all callers.
7433         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7434         (Script_sections::set_phdrs_clause_addresses): Likewise.
7435         * script-sections.h: Update declarations.
7436         * script.h: Update declarations.
7437         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7438         min_p_align.
7439         * testsuite/script_test_3.t: Set large alignment.
7440         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7441         segment has expected alignment.
7442
7443 2010-04-22  Nick Clifton  <nickc@redhat.com>
7444
7445         * po/gold.pot: Updated by the Translation project.
7446         * po/vi.po: Updated Vietnamese translation.
7447
7448 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7449
7450         * testsuite/Makefile.am (check_PROGRAMS): Add
7451         icf_virtual_function_folding_test.
7452         * testsuite/Makefile.in: Regenerated.
7453
7454 2010-04-15  Andrew Haley  <aph@redhat.com>
7455
7456         * options.h (merge_exidx_entries): New option.
7457         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7458         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7459         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7460         (Target_arm::merge_exidx_entries): New function.
7461         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7462         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7463         to Arm_exidx_fixup constructor.
7464         Add new arg, merge_exidx_entries.
7465         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7466         Arm_output_section::fix_exidx_coverage.
7467
7468 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7469
7470         * icf.cc (get_section_contents): Check for preemptible functions.
7471         Ignore addend when appropriate.
7472         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7473         section folded.
7474         (add_from_relobj): Check for section folded.
7475         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7476         * symtab.h (should_add_dynsym_entry): Add new parameter.
7477         * target-reloc.h (scan_relocs): Check for section folded.
7478         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7479         Check reloc types for function pointers in shared objects.
7480         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7481         case.
7482         (icf_preemptible_functions_test): New test case.
7483         (icf_string_merge_test): New test case.
7484         * testsuite.Makefile.in: Regenerate.
7485         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7486         bar_glob.  Refactor code.
7487         * testsuite/icf_preemptible_functions_test.cc: New file.
7488         * testsuite/icf_preemptible_functions_test.sh: New file.
7489         * testsuite/icf_string_merge_test.cc: New file.
7490         * testsuite/icf_string_merge_test.sh: New file.
7491         * testsuite/icf_virtual_function_folding_test.cc: New file.
7492         * testsuite/icf_virtual_function_folding_test.sh: New file.
7493
7494 2010-04-14  Doug Kwan  <dougkwan@google.com>
7495
7496         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7497         for local symbol recounting if we remove a section due to ICF.
7498         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7499         there are no regular objects in input.
7500
7501 2010-04-13  Doug Kwan  <dougkwan@google.com>
7502
7503         * arm.cc (Arm_input_section::set_final_data_size): Compute
7504         accurate final data size instead of using current data size.
7505
7506 2010-04-09  Doug Kwan  <dougkwan@google.com>
7507
7508         * layout.cc (Layout::choose_output_section): Handle script section
7509         types.
7510         (Layout::make_output_section_for_script): Add section type parameter.
7511         Handle script section types.
7512         * layout.h (Layout::make_output_section_for_script): Add section
7513         type parameter.
7514         * output.cc (Output_section::Output_section): Initialize data member
7515         is_noload_.
7516         (Output_section::do_reset_address_and_file_offset): Do not set address
7517         to 0 if section is a NOLOAD section.
7518         * output.h (Output_section::is_noload): New method.
7519         (Output_section::set_is_noload): Ditto.
7520         (Output_section::is_noload_): New data member.
7521         * script-c.h (Script_section_type): New enum type.
7522         (struct Parser_output_section_header): Add new file section_type.
7523         * script-sections.cc (Sections_element::output_section_name): Add
7524         parameter for returning script section type.
7525         (Output_section_definition::output_section_name): Ditto.
7526         (Output_section_definition::section_type)P; New method.
7527         (Output_section_definiton::script_section_type_name): Ditto.
7528         (Output_section_definition::script_section_type_): New data member.
7529         (Output_section_definition::Output_section_definition): Initialize
7530         data member Output_section_definition::script_section_type_.
7531         (Output_section_definition::create_sections): Pass script section type
7532         to Layout::make_output_section_for_script.
7533         (Output_section_definition::output_section_name): Return script
7534         section type to caller.
7535         (Output_section_definition::set_section_address): Do not advance
7536         dot value and load address if section type is NOLOAD.  Set address
7537         of NOLOAD sections regardless of section flags.
7538         (Output_section_definition::print): Print section type if it is
7539         not SCRIPT_SECTION_TYPE_NONE.
7540         (Output_section_definition::section_type): New method.
7541         (Output_section_definition::script_section_type_name): Ditto.
7542         (Script_sections::output_section_name): Add new parameter
7543         PSECTION_TYPE for returning script section type.  Pass it to
7544         section elements.  Handle discard sections.
7545         (Sort_output_sections::operator()): Handle NOLOAD sections.
7546         * script-sections.h (Script_sections::Section_type): New enum type.
7547         (Script_sections::output_section_name): Add a new parameter for
7548         returning script section type.
7549         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7550         INFO and NOLOAD.
7551         * yyscript.y (union): Add new field SECTION_TYPE.
7552         (COPY, DSECT, INFO, NOLOAD): New tokens.
7553         (opt_address_and_section_type): Change type to output_section_header.
7554         (section_type): New non-terminal
7555         (section_header): Handle section type.
7556         (opt_address_and_section_type): Return section type value.
7557
7558 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7559
7560         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7561         * testsuite/plugin_common_test_2.c (foo): Likewise.
7562
7563 2010-04-08  Doug Kwan  <dougkwan@google.com>
7564
7565         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7566         Output_merge_data.
7567         * output.cc (Output_section::add_merge_input_section): Simplify
7568         code and return status of Output_merge_base::add_input_section.
7569         Update merge section map only if Output_merge_base::add_input_section
7570         returns true.
7571
7572 2010-04-07  Doug Kwan  <dougkwan@google.com>
7573
7574         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7575         if section is marked as containing instructions but has no mapping
7576         symbols.
7577         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7578         correct section index.
7579         (Arm_relobj::find_linked_text_section): Ditto.
7580
7581 2010-04-07  Cary Coutant  <ccoutant@google.com>
7582
7583         * archive.cc (include_member): Destroy Read_symbols_data object before
7584         releasing file.
7585         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7586         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7587         (Read_symbols_data::~Read_symbols_data) New destructor.
7588         (Section_relocs::Section_relocs) New constructor.
7589         (Section_relocs::~Section_relocs) New destructor.
7590         (Read_relocs_data::Read_relocs_data) New constructor.
7591         (Read_relocs_data::~Read_relocs_data) New destructor.
7592         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7593         pointers to NULL after deleting.
7594
7595 2010-04-07  Doug Kwan  <dougkwan@google.com>
7596
7597         * arm.cc: Replace "endianity" with "endianness" in comments.
7598         (Arm_exidx_cantunwind): Ditto.
7599         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7600         (Arm_relobj::merge_flags_and_attributes): New method.
7601         (Arm_relobj::merge_flags_and_attributes_): New data member.
7602         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7603         (Arm_relobj::scan_sections_for_stubs): Ditto.
7604         (Arm_relobj::do_read_symbols): Check to see if we really want to
7605         merge processor-specific flags and attributes.  Exit early if
7606         an object is empty except for section names and the undefined symbol.
7607         (Target_arm::do_finalize_sections): Move check for ELF format to
7608         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7609         attributes from a regular object only when we have determined that
7610         it is aapropriate.  Do not create an .ARM.attributes section in
7611         output if there is no regular input object.
7612         (Target_arm::merge_processor_specific_flags): Check
7613         --warn-mismatch before printing any error.
7614         (Target_arm::merge_object_attributes): Ditto.
7615         * gold.cc (queue_middle_tasks): Handle the case in which there is
7616         no regular object in input.
7617         * options.cc (General_options::parse_EB): New method.
7618         (General_options::parse_EL): Same.
7619         (General_options::General_options): Initialize endianness_.
7620         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7621         New options.
7622         (General_options::Endianness): New enum.
7623         (General_options::endianness): New method.
7624         (General_options::endianness_): New data member.
7625         * parameters.cc (Parameters::set_options): Check target endianness.
7626         (Parameters::set_target_once): Ditto.
7627         (Parameters::check_target_endianness): New method.
7628         (parameters_force_valid_target): If either -EL or -EB is specified,
7629         use it to define endianness of default target.
7630         * parameters.h (Parameters::check_target_endianness): New method
7631         declaration.
7632         * target.h (class Target): Change "endianity" to "endianness"
7633         in comments.
7634
7635 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7636
7637         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7638         * configure: Regenerate.
7639         * Makefile.in: Regenerate.
7640         * testsuite/Makefile.in: Regenerate.
7641
7642 2010-04-06  Cary Coutant  <ccoutant@google.com>
7643
7644         gcc PR lto/42757
7645         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7646         prevailing definitions of common symbols.
7647         * testsuite/plugin_test_6.sh: New test case.
7648         * testsuite/plugin_common_test_1.c: New test case.
7649         * testsuite/plugin_common_test_2.c: New test case.
7650         * testsuite/Makefile.am (plugin_test_6): New test case.
7651         * testsuite/Makefile.in: Regenerate.
7652
7653 2010-04-06  Nick Clifton  <nickc@redhat.com>
7654
7655         * po/vi.po: New Vietnamese translation.
7656
7657 2010-03-30  Doug Kwan  <dougkwan@google.com>
7658
7659         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7660
7661 2010-03-25  Doug Kwan  <dougkwan@google.com>
7662
7663         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7664         to avoid a conversion warning on a 32-bit host.
7665
7666 2010-03-24  Ian Lance Taylor  <iant@google.com>
7667
7668         * testsuite/script_test_3.t: Add a TLS segment.
7669         * testsuite/Makefile.am (check_PROGRAMS): Add
7670         tls_phdrs_script_test.
7671         (tls_phdrs_script_test_SOURCES): Define.
7672         (tls_phdrs_script_test_DEPENDENCIES): Define.
7673         (tls_phdrs_script_test_LDFLAGS): Define.
7674         (tls_phdrs_script_test_LDADD): Define.
7675         * testsuite/Makefile.in: Rebuild.
7676
7677 2010-03-23  Cary Coutant  <ccoutant@google.com>
7678
7679         * fileread.cc (find_or_make_view): Fix comment.
7680
7681 2010-03-23  Ian Lance Taylor  <iant@google.com>
7682
7683         * script-sections.cc (class Orphan_section_placement): Define
7684         PLACE_TLS and PLACE_TLS_BSS.
7685         (Orphan_section_placement::Orphan_section_placement): Initialize
7686         new places.
7687         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7688         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7689         (tls_script_test_SOURCES): Define.
7690         (tls_script_test_DEPENDENCIES): Define.
7691         (tls_script_test_LDFLAGS): Define.
7692         (tls_script_test_LDADD): Define.
7693         * testsuite/Makefile.in: Rebuild.
7694
7695 2010-03-22  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Arm_relocate_functions::abs8,
7698         Arm_relocate_functions::abs16): Use correct check for overflow
7699         specified in the ARM ELF specs.
7700         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7701         target of a BLX instruction specially.
7702         (Reloc_stub::stub_type_for_reloc): Ditto.
7703         (Relocate::relocate): Use symbolic names instead of numeric relocation
7704         codes to report error.
7705         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7706         workaround.
7707         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7708         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7709         thumb2_blx_out_of_range.stdout
7710         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7711         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7712         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7713         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7714         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7715         thumb2_blx_in_range, thumb2_blx_in_range.o,
7716         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7717         thumb2_blx_out_of_range.o): New rules.
7718         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7719         thumb2_blx_in_range and thumb2_blx_out_of_range.
7720         * testsuite/Makefile.in: Regenerate.
7721         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7722         * testsuite/thumb_blx_in_range.s: New file.
7723         * testsuite/thumb_blx_out_of_range.s: New file.
7724
7725 2010-03-22  Rafael Espindola  <espindola@google.com>
7726
7727         * archive.cc (Should_include): Move to archive.h.
7728         (should_include_member): Make it a member of Archive.
7729         (Lib_group): New.
7730         (Add_lib_group_symbols): New.
7731         * archive.h: Include options.h.
7732         (Archive_member): Moved from Archive.
7733         (Should_include): Moved from archive.cc.
7734         (Lib_group): New.
7735         (Add_lib_group_symbols): New.
7736         * dynobj.cc (do_should_include_member): New.
7737         * dynobj.h (do_should_include_member): New.
7738         * gold.cc (queue_initial_tasks): Update call to queue.
7739         * main.cc (main): Print lib group stats.
7740         * object.cc (do_should_include_member): New.
7741         * object.h: Include archive.h.
7742         (Object::should_include_member): New.
7743         (Object::do_should_include_member): New.
7744         (Sized_relobj::do_should_include_member): New.
7745         * options.cc (General_options::parse_start_lib): New.
7746         (General_options::parse_end_lib): New.
7747         (Input_arguments::add_file): Handle lib groups.
7748         (Input_arguments::start_group): Check we are not in a lib.
7749         (Input_arguments::start_lib): New.
7750         (Input_arguments::end_lib): New.
7751         * options.h (General_options): Add start_lib and end_lib.
7752         (Input_argument::lib_): New.
7753         (Input_argument::lib): New.
7754         (Input_argument::is_lib): New.
7755         (Input_file_lib): New.
7756         (Input_arguments::in_lib_): New.
7757         (Input_arguments::in_lib): New.
7758         (Input_arguments::start_lib): New.
7759         (Input_arguments::end_lib_): New.
7760         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7761         in unused members as preempted.
7762         (Sized_pluginobj::do_should_include_member): New.
7763         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7764         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7765         return the blocker.
7766         (Read_symbols::do_whole_lib_group): New.
7767         (Read_symbols::do_lib_group): New.
7768         (Read_symbols::do_read_symbols): Handle lib groups.
7769         (Read_symbols::get_name): Handle lib groups.
7770         * readsyms.h (Read_symbols): Add an archive member pointer.
7771         (Read_symbols::do_whole_lib_group): New.
7772         (Read_symbols::do_lib_group): New.
7773         (Read_symbols::member_): New.
7774         * script.cc (read_input_script): Update call to queue_soon.
7775
7776 2010-03-19  Doug Kwan  <dougkwan@google.com>
7777
7778         * arm.cc (Stub_table::Stub_table): Initialize new data members
7779         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7780         (Stub_table::add_reloc_stub): Assign stub offset and update
7781         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7782         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7783         New data members.
7784         (Stub_table::update_data_size_and_addralign): Use
7785         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7786         instead of going over all reloc stubs.
7787         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7788         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7789         Stringpool_template::offset_ to size of Stringpool_char.
7790         (Stringpool_template::new_key_offset): Remove code to initialize
7791         Stringpool_template::offset_.
7792         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7793         Stringpool_template::offset_ to zero.
7794
7795 2010-03-15  Doug Kwan  <dougkwan@google.com>
7796
7797         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7798         offset_.
7799         (Stringpool_template::new_key_offset): New method.
7800         (Stringpool_template::add_string): Assign offsets when adding new
7801         strings.
7802         (Stringpool_template::set_string_offsets): Do not set string offsets
7803         when not optimizing.
7804         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7805         member size_.
7806         (Chunked_vector::clear): Clear size_.
7807         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7808         (Chunked_vector::size): Return size_.
7809         (Chunked_vector::push_back): Use size_ to find insert position.
7810         (Chunked_vector::size_): New data member.
7811         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7812         (Stringpool_template::new_key_offset): New method declaration.
7813         (Stringpool_template::offset_): New data member.
7814
7815 2010-03-15   Rafael Espindola  <espindola@google.com>
7816
7817         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7818         Add_symbols' constructor.
7819         * readsyms.h (Add_symbols): Remove the input_group member.
7820
7821 2010-03-10  Ian Lance Taylor  <iant@google.com>
7822
7823         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7824         target to ask whether a reference to a symbol requires a stack
7825         split.
7826         * target.h (Target::is_call_to_non_split): New function.
7827         (Target::do_is_call_to_non_split): Declare virtual function.
7828         * target.cc: Include "symtab.h".
7829         (Target::do_is_call_to_non_split): New function.
7830         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7831
7832 2010-03-10  Cary Coutant  <ccoutant@google.com>
7833
7834         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7835         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7836         (File_read::open[2]): Add whole_file_view_ to list of views.
7837         (File_read::make_view): Remove test of whole_file_view_.
7838         (File_read::find_or_make_view): Create whole_file_view_ if
7839         necessary.
7840         (File_read::clear_views): Replace bool parameter with enum;
7841         adjust all callers.  Don't delete views with permanent data;
7842         do delete cached views and views from archives if
7843         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7844         if clearing the corresponding view.
7845         * fileread.h (File_read::Clear_views_mode): New enum.
7846         (File_read::View::is_permanent_view): New method.
7847         (File_read::clear_views): Replace bool parameter
7848         with enum; adjust all callers.
7849         * options.h (General_options): Change keep_files_mapped option;
7850         add map_whole_files.
7851         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7852         releasing the file.
7853         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7854         the file.
7855
7856 2010-03-10  David S. Miller  <davem@davemloft.net>
7857
7858         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7859
7860 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7861
7862         * icf.cc (get_section_contents): Add '@' marker after processing the
7863         merge reloc.
7864
7865 2010-03-08  Doug Kwan  <dougkwan@google.com>
7866
7867         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7868         due to a conversion warning.
7869         (Arm_relobj::update_output_local_symbol_count): Check for local
7870         symbol with unset output index.
7871
7872 2010-03-05  Ian Lance Taylor  <iant@google.com>
7873
7874         * options.h (class General_options): Add --spare-dynamic-tags.
7875         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7876         --spare-dynamic-tags.
7877
7878 2010-03-05  Ian Lance Taylor  <iant@google.com>
7879
7880         * incremental.cc: Include "libiberty.h".
7881
7882 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7883
7884         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7885         function, is_info_ member.
7886         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7887         (Versions::Versions): Update caller.
7888         (Versions::define_base_version): Likewise.
7889         (Versions::add_def): Likewise.
7890
7891 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7892
7893         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7894         (Scan::possible_function_pointer_reloc): New function.
7895         (Scan::local_reloc_may_be_function_pointer): Change to call
7896         possible_function_pointer_reloc.
7897         (Scan::global_reloc_may_be_function_pointer): Ditto.
7898         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7899         relocations in ".data.rel.ro._ZTV" section.
7900         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7901         * testsuite/icf_safe_so_test.cc: Ditto.
7902         * testsuite/icf_safe_test.cc: Ditto.
7903         * testsuite/icf_safe_test.sh: Ditto.
7904
7905 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7906             Ian Lance Taylor  <iant@google.com>
7907
7908         * target-reloc.h (relocate_section): Check the symbol table index
7909         for -1U before setting the local symbol index.
7910         (scan_relocatable_relocs): If copying the relocation, record that
7911         the local symbol is required.
7912         * object.h (Symbol_value::is_output_symtab_index_set): New
7913         function.
7914         (Symbol_value::may_be_discarded_from_output_symtab): New
7915         function.
7916         (Symbol_value::has_output_symtab_entry): New function.
7917         (Symbol_value::needs_output_symtab_entry): Remove.
7918         (Symbol_value::output_symtab_index): Make sure the symbol index is
7919         set.
7920         (Symbol_value::set_output_symtab_index): Make sure the symbol
7921         index is not set.  Make sure the new index is valid.
7922         (Symbol_value::set_must_have_output_symtab_entry): New function.
7923         (Symbol_value::has_output_dynsym_entry): New function.
7924         (Symbol_value::set_output_dynsym_index): Make sure the new index
7925         is valid.
7926         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7927         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7928         local symbol if permitted.
7929         (Sized_relobj::do_finalize_local_symbols): Call
7930         is_output_symtab_index_set rather than needs_output_symtab_entry.
7931         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7932         rather than needs_output_symtab_entry.  Call
7933         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7934         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7935         is_output_symtab_index_set rather than needs_output_symtab_entry.
7936         * testsuite/discard_locals_relocatable_test.c: New file.
7937         * testsuite/discard_locals_test.sh: Test -r.
7938         * testsuite/Makefile.am (check_DATA): Add
7939         discard_locals_relocatable_test1.syms,
7940         discard_local_relocatable_test2.syms.
7941         (MOSTLYCLEANFILES): Likewise.  Also add
7942         discard_locals_relocatable_test1.lout and
7943         discard_locals_relocatable_test2.out.
7944         (discard_locals_relocatable_test1.syms): New target.
7945         (discard_locals_relocatable_test.o): New target.
7946         (discard_locals_relocatable_test1.out): New target.
7947         (discard_locals_relocatable_test2.syms): New target.
7948         (discard_locals_relocatable_test2.out): New target.
7949         (various): Add missing ../ld-new dependencies.
7950         * testsuite/Makefile.in: Rebuild.
7951
7952 2010-03-03  Nick Clifton  <nickc@redhat.com>
7953
7954         * po/fi.po: New Finnish translation.
7955
7956 2010-03-01  Doug Kwan  <dougkwan@google.com>
7957
7958         * layout.cc (Layout::Layout): Force section types of .init_array*,
7959         .preinit_array* and .fini_array* sections.
7960         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7961         Fix check of return value of std::string::find.().
7962         (Output_section::Input_section_sort_compare::operator()): Remove
7963         comment about .init_array.
7964         (Output_section::Input_section_sort_init_fini_compare::operator()):
7965         New method.
7966         (Output_section::sort_attached_input_sections): Handle .init_array
7967         and .fini_array specially.
7968         * output.h (Output_section::Inut_section_sort_compare): Update
7969         comment.
7970         (Output_section::Input_section_sort_init_fini_compare): New struct.
7971
7972 2010-02-26  Doug Kwan  <dougkwan@google.com>
7973
7974         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7975         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7976         * testsuite/debug_msg.sh: Avoid matching source line number for
7977         use of global variable undef_int.
7978
7979 2010-02-26  Doug Kwan  <dougkwan@google.com>
7980
7981         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7982         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7983         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7984         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7985         * options.cc (General_options::General_options): Initialize member
7986         fix_v4bx_.
7987         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7988         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7989         and rm_no_fix_v4bx.stdout
7990         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7991         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7992         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7993         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7994         and arm_no_fix_v4bx.
7995         * Makefile.in: Regenerate.
7996         * testsuite/arm_fix_v4bx.s: New file.
7997         * testsuite/arm_fix_v4bx.sh: Ditto.
7998
7999 2010-02-24  Doug Kwan  <dougkwan@google.com>
8000
8001         * arm.cc (Target_arm::got_section): Make the .got section the first
8002         non RELRO section in the data segment.
8003         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8004         suffixes of section names.
8005
8006 2010-02-24  Doug Kwan  <dougkwan@google.com>
8007
8008         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8009         flags and attributes merging if an input file is a binary file.
8010         * fileread.cc (Input_file::open): Record format of original file.
8011         * fileread.h (Input_file::Format): New enum type.
8012         (Input_file::Input_file): Initialize data member format_.
8013         (Input_file::format): New method definition.
8014         (Input_file::format_):: New data member.
8015
8016 2010-02-24  Doug Kwan  <dougkwan@google.com>
8017
8018         * arm.cc (Arm_output_data_got): New class.
8019         (ARM_TCB_SIZE): New constant
8020         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8021         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8022         If user uses a script with a SECTIONS clause, issue only a warning
8023         for a misplaced EXIDX input section.  Otherwise, issue an error.
8024         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8025         garbage collection.
8026         (Target_arm::got_mode_index_entry): Handle static linking.
8027         (Target_arm::Scan::local): Ditto.
8028         (Target_arm::Scan::global): Ditto.
8029         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8030         all incorrectly implemented relocations.
8031         (Target_arm::fix_exidx_coverage): Pass layout to
8032         Arm_output_section::fix_exidx_coverage.
8033         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8034         from ".ARM.exidx." and ".ARM.extab.".
8035
8036 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8037
8038         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8039         section if it does not already exist.
8040         * attributes.cc (Attributes_section_data::Attributes_section_data):
8041         Don't crash if size is zero.
8042
8043 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8044             Ian Lance Taylor  <iant@google.com>
8045
8046         * gold.cc (queue_middle_tasks): If no input files were opened,
8047         exit.
8048         * workqueue.h (Task_function::Task_function): Assert that there is
8049         a blocker.
8050
8051 2010-02-22  Doug Kwan  <dougkwan@google.com>
8052
8053         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8054         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8055         types to avoid warnings due to different uint64_t implementations
8056         on different hosts.
8057
8058 2010-02-21  Doug Kwan  <dougkwan@google.com>
8059
8060         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8061         handling of the maximum backward branch offset.
8062         (Arm_relocate_functions::thumb_branch_common): Ditto.
8063         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8064         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8065         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8066         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8067         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8068         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8069         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8070         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8071         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8072         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8073         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8074         thumb2_bl_out_of_range.o): New rules.
8075         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8076         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8077         thumb2_bl_out_of_range
8078         * testsuite/Makefile.in: Regenerate.
8079         * testsuite/arm_bl_in_range.s: New file.
8080         * testsuite/arm_bl_out_of_range.s: Ditto.
8081         * testsuite/arm_branch_in_range.sh: Ditto.
8082         * testsuite/arm_branch_range.t: Ditto.
8083         * testsuite/thumb2_branch_range.t: Ditto.
8084         * testsuite/thumb_bl_in_range.s: Ditto.
8085         * testsuite/thumb_bl_out_of_range.s: Ditto.
8086         * testsuite/thumb_branch_range.t: Ditto.
8087
8088 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8089
8090         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8091         Add reloc offset information.
8092         * icf.cc (get_section_contents): Change iterators to point to the new
8093         vectors. Add reloc offset information to the contents.
8094         * icf.h (Icf::Sections_reachable_info): New typedef.
8095         (Icf::Sections_reachable_list): New typedef.
8096         (Icf::Offset_info): New typedef.
8097         (Icf::Reloc_info): New struct typedef.
8098         (Icf::Reloc_info_list): New typedef.
8099         (Icf::symbol_reloc_list): Delete method.
8100         (Icf::addend_reloc_list): Delete method.
8101         (Icf::section_reloc_list): Delete method.
8102         (Icf::reloc_info_list): New method.
8103         (Icf::reloc_info_list_): New member.
8104
8105 2010-02-19  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8108         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8109         * arm.cc (Arm_relocation_functions): New forward declaration.
8110         (Target_arm::Target_arm): Initialize new data members
8111         got_mod_index_offset_ and tls_base_symbol_defined_.
8112         (Target_arm::Relocate::relocate_tls): New method.
8113         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8114          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8115         New methods.
8116         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8117         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8118         (Target_arm::got_mod_index_offset_,
8119         Target_arm::tls_base_symbol_defined_): New data members.
8120         (Target_arm::Scan::local, Target::Scan::global,
8121         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8122         relocations.
8123
8124 2010-02-18  Doug Kwan  <dougkwan@google.com>
8125
8126         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8127         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8128         text section as a parameter becuase some broken tools may not set
8129         the link in section header.
8130         (Target_arm::has_got_section): New method.
8131         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8132         without any mapping symbol as data only.  Remove warning.
8133         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8134         link in its section header, try to discover the link by inspecting the
8135         REL31 relocation at the beginning of the section.
8136         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8137         in error message.
8138         (Target_arm::Scan::global): Treat any reference to the symbol
8139         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8140
8141 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8142
8143         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8144         (Scan::global_reloc_may_be_function_pointer): New function.
8145         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8146         (Scan::global_reloc_may_be_function_pointer): New function.
8147         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8148         (Scan::global_reloc_may_be_function_pointer): New function.
8149         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8150         (Scan::global_reloc_may_be_function_pointer): New function.
8151         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8152         (Scan::global_reloc_may_be_function_pointer): New function.
8153         (Scan::possible_function_pointer_reloc): New function.
8154         (Target_x86_64::can_check_for_function_pointers): New function.
8155         * gc.h (gc_process_relocs): Scan relocation types to determine if
8156         function pointers were taken for targets that support it.
8157         * icf.cc (Icf::find_identical_sections): Include functions for
8158         folding in safe ICF whose pointer is not taken.
8159         * icf.h (Secn_fptr_taken_set): New typedef.
8160         (fptr_section_id_): New member.
8161         (section_has_function_pointers): New function.
8162         (set_section_has_function_pointers): New function.
8163         (check_section_for_function_pointers): New function.
8164         * options.h: Fix comment for safe ICF option.
8165         * target.h (can_check_for_function_pointers): New function.
8166         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8167         Modify icf_safe_test for X86-64.
8168         * testsuite/Makefile.in: Regenerate.
8169         * testsuite/icf_safe_so_test.cc: New file.
8170         * testsuite/icf_safe_so_test.sh: New file.
8171         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8172         (main): Change to take pointer to function kept_func_3.
8173         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8174         folding is done correctly for X86-64.
8175
8176 2010-02-12  David S. Miller  <davem@davemloft.net>
8177
8178         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8179         is_symbolless parameter.
8180         (Output_reloc<SHT_REL>::is_symbolless): New.
8181         (Output_reloc<SHT_REL>::is_symbolless_): New.
8182         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8183         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8184         (Output_reloc<SHT_RELA>::is_symbolless): New.
8185         (Output_data_reloc::add_global): Handle is_symbolless.
8186         (Output_data_reloc::add_global_relative): Likewise.
8187         (Output_data_reloc::add_local): Likewise.
8188         (Output_data_reloc::add_local_relative): Likewise.
8189         (Output_data_reloc::add_symbolless_global_addend): New.
8190         (Output_data_reloc::add_symbolless_local_addend): New.
8191         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8192         is_symbolless.
8193         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8194         instead of ->is_relative_
8195         (Output_reloc::write): Likewise.
8196         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8197         (Output_reloc::write_rel): Simplify.
8198
8199         * sparc.cc (Target_sparc::Scan::local): Use
8200         ->add_symbolless_local_addend as needed.
8201         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8202         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8203         based upon relocation offset.
8204
8205 2010-02-11  Doug Kwan  <dougkwan@google.com>
8206
8207         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8208         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8209         beginning of function.
8210         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8211         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8212         parameter is_32bit in calls to should_apply_static_reloc.
8213         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8214         (check_DATA): Add arm_abs_global.stdout.
8215         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8216         arm_abs_global.stdout): New rules.
8217         (MOSTLLYCLEANFILES): Add arm_abs_global
8218         * Makefile.in: Regenerate.
8219         * testsuite/arm_abs_global.s: New file.
8220         * testsuite/arm_abs_global.sh: Ditto.
8221         * testsuite/arm_abs_lib.s: Ditto.
8222
8223 2010-02-11  Ian Lance Taylor  <iant@google.com>
8224
8225         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8226         Read_relocs task.
8227         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8228         Allocate_commons_task first.
8229         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8230         task, rather than symtab_lock_.
8231         (Gc_process_relocs::~Gc_process_relocs): New function.
8232         (Gc_process_relocs::is_runnable): Check this_blocker_.
8233         (Gc_process_relocs::locks): Use next_blocker_ rather than
8234         blocker_.
8235         (Scan_relocs::~Scan_relocs): New function.
8236         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8237         symtab_lock_.
8238         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8239         next_blocker_.
8240         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8241         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8242         constructor accordingly.
8243         (class Gc_process_relocs): Likewise.
8244         (class Scan_relocs): Likewise.
8245         * common.h (class Allocate_commons_task): Remove symtab_lock_
8246         field, and corresponding constructor parameter.
8247         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8248         symtab_lock_.
8249         (Allocate_commons_task::locks): Likewise.
8250
8251 2010-02-11  Ian Lance Taylor  <iant@google.com>
8252
8253         * gold-threads.h (class Once): Define.
8254         (class Initialize_lock): Rewrite as child of Once.
8255         * gold-threads.cc (class Once_initialize): Define.
8256         (once_pointer_control): New static variable.
8257         (once_pointer, once_arg): New static variables.
8258         (c_run_once): New static function.
8259         (Once::Once, Once::run_once, Once::internal_run): New functions.
8260         (class Initialize_lock_once): Remove.
8261         (initialize_lock_control): Remove.
8262         (initialize_lock_pointer): Remove.
8263         (initialize_lock_once): Remove.
8264         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8265         (Initialize_lock::initialize): Rewrite.
8266         (Initialize_lock::do_run_once): New function.
8267         * archive.cc (Archive::interpret_header): Only clear name if it is
8268         not already empty.
8269         * fileread.cc: Include "gold-threads.h"
8270         (file_counts_lock): New static variable.
8271         (file_counts_initialize_lock): Likewise.
8272         (File_read::release): Only increment counts when using --stats.
8273         Use a lock around the increment.
8274         * parameters.cc (class Set_parameters_target_once): Define.
8275         (set_parameters_target_once): New static variable.
8276         (Parameters::Parameters): Move here from parameters.h.
8277         (Parameters::set_target): Rewrite.
8278         (Parameters::set_target_once): New function.
8279         (Parameters::clear_target): Move here and rewrite.
8280         * parameters.h (class Parameters): Update declarations.  Add
8281         set_parameters_target_once_ field.
8282         (Parameters::Parameters): Move to parameters.cc.
8283         (Parameters::clear_target): Likewise.
8284         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8285         task.
8286         (Start_group::~Start_group): New function.
8287         (Start_group::is_runnable): New function.
8288         (Start_group::locks, Start_group::run): New functions.
8289         (Finish_group::run): Change saw_undefined to size_t.
8290         * readsyms.h (class Start_group): Define.
8291         (class Finish_group): Change saw_undefined_ field to size_t.
8292         (Finish_group::Finish_group): Remove saw_undefined and
8293         this_blocker parameters.  Change all callers.
8294         (Finish_group::set_saw_undefined): New function.
8295         (Finish_group::set_blocker): New function.
8296         * symtab.h (class Symbol_table): Change saw_undefined to return
8297         size_t.  Change saw_undefined_ field to size_t.
8298         * target-select.cc (Set_target_once::do_run_once): New function.
8299         (Target_selector::Target_selector): Initialize set_target_once_
8300         field.  Don't initialize lock_ and initialize_lock_ fields.
8301         (Target_selector::instantiate_target): Rewrite.
8302         (Target_selector::set_target): New function.
8303         * target-select.h (class Set_target_once): Define.
8304         (class Target_selector): Update declarations.  Make
8305         Set_target_once a friend.  Remove lock_ and initialize_lock_
8306         fields.  Add set_target_once_ field.
8307
8308 2010-02-10  Ian Lance Taylor  <iant@google.com>
8309
8310         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8311         queueing any tasks.
8312         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8313         (queue_middle_tasks): Add all blockers before queueing any tasks.
8314         (queue_final_tasks): Likewise.
8315         * token.h (Task_token::add_blockers): New function.
8316         * object.h (Input_objects::number_of_relobjs): New function.
8317
8318 2010-02-10  Ian Lance Taylor  <iant@google.com>
8319
8320         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8321         shared, not if not position independent.
8322         * x86_64.cc (Relocate::relocate_tls): Likewise.
8323         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8324         (tls_pie_pic_test): New target.
8325         * testsuite/Makefile.in: Rebuild.
8326
8327         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8328         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8329         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8330         * testsuite/Makefile.in: Rebuild.
8331
8332 2010-02-09  David S. Miller  <davem@davemloft.net>
8333
8334         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8335         R_SPARC_RELATIVE using ->add_local_relative().
8336         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8337
8338         * output.h (Output_data_dynamic::add_section_size): New method
8339         that takes two Output_data objects.
8340         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8341         entry param.  Handle it in initializers.
8342         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8343         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8344         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8345         arg.
8346         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8347         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8348         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8349         for dynrel_includes_plt.
8350         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8351         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8352         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8353         before .rela.plt
8354         (Target_sparc::do_finalize_sections): Update to pass true for
8355         dynrel_includes_plt.
8356         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8357         output before .rela.plt
8358         (Target_powerpc::do_finalize_sections): Update to pass true for
8359         dynrel_includes_plt when 32-bit.
8360
8361 2010-02-08  Doug Kwan  <dougkwan@google.com>
8362
8363         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8364         method.
8365         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8366         Arm_relobj::scan_section_for_cortex_a8_stubs,
8367         Arm_relobj::do_relocation_section): Instead of calling
8368         Output_section::output_address, use faster
8369         Arm_relobj::simple_input_section_output_address.
8370
8371 2010-02-08  David S. Miller  <davem@davemloft.net>
8372
8373         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8374         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8375         relocation helper function.
8376
8377         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8378         just like R_SPARC_GOT{10,13,22}.
8379         (Target_sparc::Scan::local): Likewise.
8380         (Target_sparc::Relocate:relocate): Likewise.
8381
8382 2010-02-06  Ian Lance Taylor  <iant@google.com>
8383
8384         * configure.ac: Rewrite targetobjs duplicate removal code to use
8385         only shell constructs.
8386         * configure: Rebuild.
8387
8388 2010-02-05  Doug Kwan  <dougkwan@google.com>
8389
8390         PR 11247
8391         * arm.cc (Arm_relobj::section_is_scannable): New method.
8392         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8393         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8394
8395 2010-02-04  Doug Kwan  <dougkwan@google.com>
8396
8397         PR 11247
8398         * arm-reloc-property.cc (cstdio): Include.
8399         * configure.ac (targetobjs): Remove duplicates.
8400         * configure: Regenerate.
8401         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8402         big and little endian version for a given address size.
8403
8404 2010-02-03  Doug Kwan  <dougkwan@google.com>
8405
8406         * arm-reloc-property.cc
8407         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8408         definition.
8409         * arm-reloc-property.h
8410         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8411         New method definition.
8412         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8413         declaration.
8414         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8415         overflow to N.
8416         (GOT_PREL): Change implemented to Y.
8417         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8418         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8419         (Arm_relocate_functions::movw_abs_nc): Remove method.
8420         (Arm_relocate_functions::movt_abs): Ditto.
8421         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8422         (Arm_relocate_functions::thm_movt_abs): Ditto.
8423         (Arm_relocate_functions::movw_rel_nc): Ditto.
8424         (Arm_relocate_functions::movw_rel): Ditto.
8425         (Arm_relocate_functions::movt_rel): Ditto.
8426         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8427         (Arm_relocate_functions:thm_movw_rel): Ditto.
8428         (Arm_relocate_functions:thm_movt_rel): Ditto.
8429         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8430         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8431         New method definitions.
8432         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8433         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8434         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8435         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8436         (Target_arm::Relocate::relocate): Check for non-static or
8437         unimplemented relocation code and exit early.  Change calls to
8438         Target_arm::reloc_uses_thumb_bit and
8439         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8440         instead.  Refactor code to handle similar relocations to increase
8441         code sharing.  Remove check for unsupported relocation code in switch
8442         statement.
8443         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8444         relocation property table to find out size.  Change error message to
8445         print out the name of a relocation code instead of the numeric value.
8446         (Target_arm::scan_reloc_for_stub): Use relocation property table
8447         instead of calling Target_arm::reloc_uses_thumb_bit().
8448
8449 2010-02-02  Doug Kwan  <dougkwan@google.com>
8450
8451         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8452         types of relaxed input section.
8453
8454 2010-02-02  Doug Kwan  <dougkwan@google.com>
8455
8456         * Makefile.am (HFILES): Add arm-reloc-property.h.
8457         (DEFFILES): New.
8458         (TARGETSOURCES): Add arm-reloc-property.cc
8459         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8460         (libgold_a_SOURCES): $(DEFFILES)
8461         * Makefile.in: Regenerate.
8462         * arm-reloc-property.cc: New file.
8463         * arm-reloc-property.h: New file.
8464         * arm-reloc.def: New file.
8465         * arm.cc: Update comments.
8466         (arm-reloc-property.h): New included header.
8467         (arm_reloc_property_table): New global variable.
8468         (Target_arm::do_select_as_default_target): New method definition.
8469         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8470         arm-reloc-property to targ_extra_obj.
8471         * parameters.cc (set_parameters_target): Call
8472         Target::select_as_default_target().
8473         * target.h (Target::select_as_default_target): New method definition.
8474         (Target::do_select_as_default_target): Same.
8475
8476 2010-02-01  Doug Kwan  <dougkwan@google.com>
8477
8478         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8479         first_output_text_section_.
8480         (Arm_exidx_fixup::first_output_text_section): New method definition.
8481         (Arm_exidx_fixup::first_output_text_section_): New data member.
8482         (Arm_exidx_fixup::process_exidx_section): Record the first text
8483         output section seen.
8484         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8485         and entsize in output section header.
8486
8487 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8488
8489         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8490         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8491         (Arm_relocate_functions::thm_alu11): New Method.
8492         (Arm_relocate_functions::thm_pc8): New Method.
8493         (Arm_relocate_functions::thm_pc12): New Method.
8494         (Target_arm::Scan::local): Handle the relocations.
8495         (Target_arm::Scan::global): Likewise.
8496         (Target_arm::Relocate::relocate): Likewise.
8497         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8498
8499 2010-01-29  Doug Kwan  <dougkwan@google.com>
8500
8501         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8502         of relocation types as ld.
8503
8504 2010-01-29  Doug Kwan  <dougkwan@google.com>
8505
8506         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8507         to public.
8508         (Arm_relocate_functions::thumb_branch_common): Ditto.
8509         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8510         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8511         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8512         Arm_relocate_functions::jump24): Remove.
8513         (Target_arm::Relocate::relocate): Adjust code to call
8514         Arm_relocation_functions::arm_branch_common and
8515         Arm_relocation_functions::thumb_branch_common instead of their removed
8516         wrappers.  Merge switch-cases together to reduce source code size.
8517
8518 2010-01-29  Doug Kwan  <dougkwan@google.com>
8519
8520         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8521         output_local_symbol_count_needs_update_.
8522         (Arm_relobj::output_local_symbol_count_needs_update,
8523          Arm_relobj::set_output_local_symbol_count_needs_update,
8524          Arm_relobj::update_output_local_symbol_count): New methods.
8525         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8526         member.
8527         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8528         of pointed function as in a R_ARM_PREL31 relocation.
8529         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8530         for output local symbol count updating.
8531         (Target_arm::do_relax): Update output local symbol counts in objects
8532         if necessary.
8533         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8534
8535 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8536
8537         * arm.cc: Added support for the ARM relocations:
8538         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8539         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8540         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8541         movw_prel_nc).
8542         (Arm_relocate_functions::movw_rel): New method.
8543         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8544         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8545         thm_movw_prel_nc).
8546         (Arm_relocate_functions::thm_movw_rel): New method.
8547         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8548         thm_movt_prel).
8549         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8550         relocations.
8551         (Target_arm::Scan::global): Likewise.
8552         (Target_arm::Relocate::relocate): Likewise.
8553         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8554         Likewise.
8555
8556 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8557
8558         * arm.cc: Added support for ARM group relocations.
8559         (Target_arm::reloc_needs_sym_origin): New method.
8560         (Arm_relocate_functions::calc_grp_kn): New method.
8561         (Arm_relocate_functions::calc_grp_residual): New method.
8562         (Arm_relocate_functions::calc_grp_gn): New method.
8563         (Arm_relocate_functions::arm_grp_alu): New Method.
8564         (Arm_relocate_functions::arm_grp_ldr): New Method.
8565         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8566         (Arm_relocate_functions::arm_grp_ldc): New Method.
8567         (Target_arm::Scan::local): Handle the ARM group relocations.
8568         (Target_arm::Scan::global): Likewise.
8569         (Target_arm::Relocate::relocate): Likewise.
8570         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8571         Likewise.
8572
8573 2010-01-26  Doug Kwan  <dougkwan@google.com>
8574
8575         * arm.cc (set): Include.
8576         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8577         pointer type.
8578         (Arm_output_section::Text_section_list): New type.
8579         (Arm_output_section::append_text_sections_to_list): New method.
8580         (Arm_output_section::fix_exidx_coverage): Ditto.
8581         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8582         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8583         Relobj::set_section_offset() instead of
8584         Sized_relobj::invalidate_section_offset().
8585         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8586         parameter for section headers. Ignore relocation sections for
8587         unallocated sections and EXIDX sections.
8588         (Target_arm::fix_exidx_coverage): New method.
8589         (Target_arm::output_section_address_less_than): New type.
8590         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8591         linked text section instead of the EXIDX section.
8592         (Arm_output_section::create_stub_group): Add an assertion to check
8593         that this is not an EXIDX output section.
8594         (Arm_output_section::append_text_sections_to_list): New method.
8595         (Arm_output_section::fix_exidx_coverage): Ditto.
8596         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8597         Arm_relobj::section_needs_reloc_stub_scanning.
8598         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8599         first pass.
8600         (Target_arm::fix_exidx_coverage): New method.
8601         * object.h (Relobj::set_output_section): New method.
8602         (Sized_relobj::invalidate_section_offset): Remove method.
8603         (Sized_relobj::do_invalidate_section_offset): Remove method.
8604         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8605
8606 2010-01-25  Doug Kwan  <dougkwan@google.com>
8607
8608         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8609         Fix warning due to signed and unsigned comparison on a 32-bit host.
8610
8611 2010-01-22  Doug Kwan  <dougkwan@google.com>
8612
8613         * arm.cc (Target_arm::do_relax): Record an output section for section
8614         offset adjustment it contains any stub table that has changed.
8615         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8616         offsets in an output section if necessary.
8617         * output.cc (Output_section::Output_section): Initialize
8618         section_offsets_need_adjustments_.
8619         (Output_section::add_input_section_for_script): Renamed to
8620         Output_section::add_simple_input_section.
8621         (Output_section::save_states): Add a comment.
8622         (Output_section::discard_states): New method defintion.
8623         (Output_section::adjust_section_offsets): Same.
8624         * output.h (Output_section::add_input_section_for_script): Renamed to
8625         Output_section::add_simple_input_section.
8626         (Output_section::discard_states): New method declaration.
8627         (Output_section::adjust_section_offsets): Same.
8628         (Output_section::section_offsets_need_adjustment,
8629         Output_section::set_section_offsets_need_adjustment): New method
8630         definitions.
8631         (Output_section::section_offsets_need_adjustment_): New data member.
8632         * script-sections.cc
8633         (Output_section_element_input::set_section_address): Adjust code for
8634         renaming of Output_section::add_input_section_for_script.
8635         (Orphan_output_section::set_section_address): Same.
8636
8637 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8638
8639         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8640         Fix_v4bx enum values .
8641         * gold/options.h (General_options): New option definitions.
8642         (General_options::fix_v4bx): New method.
8643         (General_options::Fix_v4bx): New enum.
8644         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8645         (General_options::parse_fix_v4bx_interworking): New method.
8646
8647 2010-01-22  Doug Kwan  <dougkwan@google.com>
8648
8649         * arm.cc (Arm_exidx_fixup): New class.
8650
8651 2010-01-21  Doug Kwan  <dougkwan@google.com>
8652
8653         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8654         classes.
8655         (Arm_exidx_section_offset_map): New type.
8656
8657 2010-01-21  Doug Kwan  <dougkwan@google.com>
8658
8659         * arm.cc (Arm_exidx_input_section): New class.
8660         (Arm_relobj::exidx_input_section_by_link,
8661         Arm_relobj::exidx_input_section_by_shndx,
8662         Arm_relobj::make_exidx_input_section): New methods.
8663         (read_arm_attributes_section): Remove.
8664         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8665         information about them.
8666         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8667         to here.
8668
8669 2010-01-20  Doug Kwan  <dougkwan@google.com>
8670
8671         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8672         Input_section_specifier to Section_id.
8673         (Target_arm::new_arm_input_section: Adjust code for change of key
8674         type.
8675         (Target_arm::find_arm_input_section): Ditto.
8676         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8677         (Section_id): Remove.
8678         (Garbage_collection::Section_id_hash): Remove.
8679         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8680         (Section_id): Remove.
8681         (Icf::Section_id_hash): Remove.
8682         * object.h (Section_id, Const_section_id, Section_id_hash,
8683         Const_section_id_hash): New type definitions.
8684         * output.cc (Output_section::add_relaxed_input_section): Change to
8685         use Const_section_id instead of Input_section_specifier as key type.
8686         (Output_section::add_merge_input_section): Ditto.
8687         (Output_section::build_relaxation_map): Change to use Section_id
8688         instead of Input_section_specifier as key type.
8689         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8690         Ditto.
8691         (Output_section::convert_input_sections_to_relaxed_sections): Change
8692         to use Const_section_id instead of Input_section_specifier as key type.
8693         (Output_section::find_merge_section): Ditto.
8694         (Output_section::find_relaxed_input_section): Ditto.
8695         * output.h (Input_section_specifier): Remove class.
8696         (Output_section::Output_section_data_by_input_section_map): Change
8697         key type to Const_section_id.
8698         (Output_section::Output_relaxed_input_section_by_input_section_map):
8699         Ditto.
8700         (Output_section::Relaxation_map): Change key type to Section_id.
8701
8702 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8703
8704         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8705         (class Arm_v4bx_stub): New class.
8706         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8707         (Stub_factory::make_arm_v4bx_stub): New method.
8708         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8709         (Stub_table::empty): Handle v4bx stubs.
8710         (Stub_table::add_arm_v4bx_stub): New method.
8711         (Stub_table::find_arm_v4bx_stub): New method.
8712         (Arm_relocate_functions::v4bx): New method.
8713         (Target_arm::fix_v4bx): New method.
8714         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8715         (Stub_table::relocate_stubs): Likewise.
8716         (Stub_table::do_write): Likewise.
8717         (Stub_table::update_data_size_and_addralign): Likewise.
8718         (Stub_table::finalize_stubs):  Likewise.
8719         (Target_arm::Scan::local): Likewise.
8720         (Target_arm::Scan::global): Likewise.
8721         (Target_arm::do_finalize_sections): Likewise.
8722         (Target_arm::Relocate::relocate): Likewise.
8723         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8724         Likewise.
8725         (Target_arm::scan_reloc_for_stub): Likewise.
8726         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8727
8728 2010-01-19  Ian Lance Taylor  <iant@google.com>
8729
8730         * output.cc (Output_section_headers::do_sized_write): Write large
8731         segment count to sh_info field.
8732         (Output_file_header::do_sized_write): For large segment count,
8733         write PN_XNUM to e_phnum field.
8734
8735 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8736
8737         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8738         (Arm_relocate_functions::thm_jump8): New function.
8739         (Arm_relocate_functions::thm_jump11): New function.
8740         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8741         R_ARM_THM_JUMP11.
8742         (Target_arm::Scan::global): Likewise.
8743         (Target_arm::Relocate::relocate): Likewise.
8744         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8745         Likewise.
8746
8747 2010-01-14  Doug Kwan  <dougkwan@google.com>
8748
8749         * arm.cc (map, utility): Include headers.
8750         (Target_arm::apply_cortex_a8_workaround): New method.
8751         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8752         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8753         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8754         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8755         the --[no-]fix-cortex-a8 command line options.
8756         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8757         (Target_arm::relocate_stub): Use addend in instruction template.
8758         * options.h (DEFINE_bool): Set the user-set flag.
8759         (General_options): Add --[no-]-fix-cortex options.
8760         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8761         : Update fast look-up map after conversion.
8762
8763 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8764
8765         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8766         in the first pass of do_layout.
8767
8768 2010-01-13  Doug Kwan  <dougkwan@google.com>
8769
8770         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8771         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8772         apparent compiler problem of not folding static constant integral
8773         data members of elfcpp::Elf_sizes<32>.
8774
8775 2010-01-13  Doug Kwan  <dougkwan@google.com>
8776
8777         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8778         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8779         Arm_relobj::scan_section_for_cortex_a8_erratum,
8780         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8781         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8782         sections to scan for relocation stubs into a new method
8783         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8784         relocation and Cortex-A8 stub scanning.
8785         (Target_arm::do_relax): Force stubs to be after stubbed sections
8786         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8787         the beginning of a new relaxation pass.  Update a comment.
8788         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8789
8790 2010-01-12  Ian Lance Taylor  <iant@google.com>
8791
8792         * target-reloc.h (visibility_error): New inline function.
8793         (relocate_section): Call visibility_error.
8794         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8795         (MOSTLYCLEANFILES): Likewise.
8796         (protected_4_pic.o, protected_3.err): New targets.
8797         * testsuite/protected_4.cc: New file.
8798
8799 2010-01-12  Doug Kwan  <dougkwan@google.com>
8800
8801         * arm.cc (Cortex_a8_reloc): New class.
8802         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8803         and cortex_a8_relocs_info_.
8804         (Target_arm::fix_cortex_a8): New method definition.
8805         (Target_arm::Cortex_a8_relocs_info): New type.
8806         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8807         New data member declarations.
8808         (Target_arm::scan_reloc_for_stub): Record information about
8809         relocations for THUMB branches that might be exempted from the
8810         Cortex-A8 workaround.
8811         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8812         at the beginning of a relaxation pass.
8813
8814 2010-01-12  Doug Kwan  <dougkwan@google.com>
8815
8816         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8817         (Arm_relobj::Mapping_symbol_position,
8818          Arm_reloj::Mapping_symbol_position_less,
8819          Arm_relobj::Mapping_symbols_info): New types.
8820         (Target_arm::is_mapping_symbol_name): New method definition.
8821         (Arm_relobj::do_count_local_symbols): Save information about mapping
8822         symbols.
8823
8824 2010-01-11  Doug Kwan  <dougkwan@google.com>
8825
8826         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8827         Arm_relocate_functions::thumb32_branch_upper,
8828         Arm_relocate_functions::thumb32_branch_lower,
8829         Arm_relocate_functions::thumb32_cond_branch_offset,
8830         Arm_relocate_functions::thumb32_cond_branch_upper,
8831         Arm_relocate_functions::thumb32_cond_branch_lower,
8832         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8833         branch offset encoding.
8834         (Arm_relocate_functions::thumb_branch_common): Use new branch
8835         offset encoding methods to avoid code duplication.
8836         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8837         (Stub_addend_reader::operator()): Use new branch encoding method
8838         to avoid code duplication.
8839
8840 2010-01-11  Doug Kwan  <dougkwan@google.com>
8841
8842         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8843         (Target_arm::do_finalize_sections): Define special EXIDX section
8844         symbols only if referenced.
8845         * gc.h (Garbage_collection::add_reference): New method.
8846         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8847         code duplication.
8848
8849 2010-01-11  Ian Lance Taylor  <iant@google.com>
8850
8851         * script.cc (Version_script_info::build_expression_list_lookup):
8852         Change complaing about duplicate wildcard match from error to
8853         warning.
8854
8855         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8856         of 2009-12-30.
8857         (Version_script_info::Version_script_info): Initialize globs_,
8858         default_version_, default_is_global_, and exact_.  Don't
8859         initialize globals_ or locals_.
8860         (Version_script_info::build_lookup_tables): Build local symbols
8861         first.
8862         (Version_script_info::unquote): New function.
8863         (Version_script_info::add_exact_match): New function.
8864         (Version_script_info::build_expression_list_lookup): Remove lookup
8865         parameter.  Add is_global parameter.  Change all callers.  Handle
8866         wildcard pattern specially.  Unquote pattern.  Call
8867         add_exact_match.
8868         (Version_script_info::get_name_to_match): New function.
8869         (Version_script_info::get_symbol_version): New function.
8870         (Version_script_info::get_symbol_version_helper): Remove.
8871         (Version_script_info::check_unmatched_names): Call unquote.
8872         * script.h (class Version_script_info): Change get_symbol_version
8873         to be non-inline and add is_global parameter; change all callers.
8874         Rewrite symbol_is_local.  Update declarations.  Define struct
8875         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8876         Remove globals_ and locals_ members.  Add exact_, globs_,
8877         default_version_, is_global_.
8878         (Version_script_info::Glob): Remove pattern, add expression and
8879         is_global.  Update constructor.  Change all callers.
8880         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8881         default version.
8882         (Versions::symbol_section_contents): If a symbol is undefined, or
8883         defined in a dynamic object, set the version index to
8884         VER_NDX_LOCAL.
8885         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8886         symbol_is_local.
8887         (Symbol_table::add_from_pluginobj): Likewise.
8888         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8889
8890 2010-01-11  Doug Kwan  <dougkwan@google.com>
8891
8892         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8893         (incremental_dump_LDADD): Add linking option for libintl.
8894         * Makefile.in: Regenerate.
8895
8896 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8897
8898         PR gold/11144
8899         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8900         instead of -Ds.
8901         * testsuite/Makefile.in: Regenerated.
8902
8903 2010-01-10  Doug Kwan  <dougkwan@google.com>
8904
8905         * options.h (DEFINE_var): Use parentheses around argument varname__
8906         in macro body to avoid any unintended subsequent substitutions.
8907
8908 2010-01-10  Ian Lance Taylor  <iant@google.com>
8909
8910         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8911         candidates before doing symbol resolution.
8912
8913         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8914         ODR candidates if only one is weak.
8915
8916 2010-01-08  Ian Lance Taylor  <iant@google.com>
8917
8918         * script.cc (Version_script_info::build_expression_list_lookup):
8919         Don't warn about ambiguous version, just record the ambiguity.
8920         (Version_script_info::get_symbol_version_helper): Give error if
8921         version is ambiguous.
8922
8923 2010-01-08  Doug Kwan  <dougkwan@google.com>
8924
8925         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8926         prev_data_size_ and prev_addralign_.  Remove initializer for
8927         deleted data member has_been_changed_.
8928         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8929         to determine if the table is empty.
8930         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8931         Remove.
8932         (Stub_table::add_reloc_stub): Define method in class definition
8933         instead of just declaring it there.
8934         (Stub_table::add_cortex_a8_stub): New method definition.
8935         (Stub_table::update_data_size_and_addralign): Ditto.
8936         (Stub_table::finalize_stubs): Ditto.
8937         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8938         (Stub_table::do_addralign_): Return address alignment in the
8939         (Stub_table::do_reset_address_and_file_offset): Define method in
8940         class definition instead of declaring it there.  Set current data
8941         size to be the data size of the previous pass.
8942         (Stub_table::set_final_data_size): Use current data size as the
8943         final data size.
8944         (Stub_table::relocate_stub): Change parameter type of stub from
8945         Reloc_stub pointer to Stub pointer.
8946         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8947         (Stub_table::Cortex_a8_stub_list): New typedef.
8948         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8949          Stub_table::prev_addralign_): New data member.
8950         (Arm_relobj::Arm_relobj): Initialize data member
8951         section_has_cortex_a8_workaround_.
8952         (Arm_relobj::section_has_cortex_a8_workaround,
8953          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8954          definitions.
8955         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8956         declarations.
8957         (Target_arm::relocate_stub): Change parameter type of stub from
8958         Reloc_stub pointer to Stub pointer.
8959         (Insn_template::size, Insn_template::alignment): Handle
8960         THUMB16_SPECIAL_TYPE.
8961         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8962          Stub_table::update_data_size_and_addralign,
8963          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8964         definitions.
8965         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8966         (Stub_table::do_write): Ditto.
8967         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8968
8969 2010-01-08  Ian Lance Taylor  <iant@google.com>
8970
8971         PR 11108
8972         * symtab.h (class Symbol): Remove fields is_target_special_ and
8973         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8974         (Symbol::is_defined_in_discarded_section): New function.
8975         (Symbol::set_is_defined_in_discarded_section): New function.
8976         (Symbol::has_plt_offset): Rewrite.
8977         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8978         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8979         Don't initialize is_target_special_ or has_plt_offset_.
8980         Initialize is_defined_in_discarded_section_.
8981         (Symbol_table::add_from_relobj): If appropriate, set
8982         is_defined_in_discarded_section.
8983         * resolve.cc (Symbol::override_base_with_special): Don't test
8984         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8985         * target-reloc.h (relocate_section): Do special handling for
8986         symbols defined in discarded sections for global symbols as well
8987         as local symbols.
8988
8989 2010-01-08  Ian Lance Taylor  <iant@google.com>
8990
8991         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8992         the SHT_SYMTAB case.
8993
8994 2010-01-08  Ian Lance Taylor  <iant@google.com>
8995
8996         * object.cc (Sized_relobj::do_layout): Don't get confused if
8997         layout_eh_frame returns NULL.
8998
8999 2010-01-08  Ian Lance Taylor  <iant@google.com>
9000
9001         PR 11084
9002         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9003         dynamic symbol table, use the normal symbol table.
9004         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9005         symbol table.
9006
9007 2010-01-08  Ian Lance Taylor  <iant@google.com>
9008
9009         PR 11072
9010         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9011         sections.
9012
9013 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9014
9015         * version.cc (print_version): Change to "Copyright 2010".
9016
9017 2010-01-08  Ian Lance Taylor  <iant@google.com>
9018
9019         PR 10287
9020         PR 11063
9021         * i386.cc (class Target_i386): Change return type of plt_section
9022         to be non-const.
9023         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9024         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9025         tls_desc_rel_ field.
9026         (Output_data_plt_i386::rel_tls_desc): New function.
9027         (Target_i386::rel_tls_desc_section): New function.
9028         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9029         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9030         R_386_TLS_DESC reloc in rel_tls_desc_section.
9031         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9032         Define struct Tlsdesc_info.
9033         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9034         (Target_x86_64::do_reloc_symbol_index): New function.
9035         (Target_x86_64::add_tlsdesc_info): New function.
9036         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9037         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9038         tlsdesc_rel_ field.
9039         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9040         all callers.
9041         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9042         (Target_x86_64::rela_tlsdesc_section): New function.
9043         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9044         handling.
9045         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9046         (Target_x86_64::do_reloc_addend): New function.
9047         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9048         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9049         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9050         (Output_reloc::type): New function.
9051         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9052         (Output_reloc::is_target_specific): New function.
9053         (Output_reloc::target_arg): New function.
9054         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9055         absolute relocs and target specific relocs.
9056         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9057         add_target_specific.
9058         (class Output_data_reloc) [SHT_RELA]: Likewise.
9059         * output.cc (Output_reloc::Output_reloc): Add four new versions
9060         for absolute relocs and target specific relocs.
9061         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9062         (Output_reloc::get_symbol_index): Likewise.
9063         (Output_reloc::local_section_offset): Check that local_sym_index_
9064         is not TARGET_CODE or 0.
9065         (Output_reloc::symbol_value): Likewise.
9066         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9067         reloc.
9068         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9069         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9070         functions.
9071         * layout.cc (add_target_dynamic_tags): Use output section for
9072         DT_PLTRELSZ and DT_JMPREL.
9073
9074 2010-01-07  Ian Lance Taylor  <iant@google.com>
9075
9076         PR 11061
9077         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9078         function.
9079         (class Output_data_reloc_generic): Define.
9080         (class Output_data_reloc_base): Change base class to
9081         Output_data_reloc_generic.  Change add() method to call
9082         bump_relative_reloc_count for a relative reloc.  Remove
9083         sort_relocs_ field.
9084         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9085         to sort_relocs().
9086         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9087         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9088         appropriate.
9089         * layout.h (class Layout): Update declaration.
9090
9091 2010-01-07  Ian Lance Taylor  <iant@google.com>
9092
9093         * output.h (class Output_data): Add const version of
9094         output_section and do_output_section.
9095         (class Output_section_data): Add const version of
9096         do_output_section.
9097         (class Output_section): Likewise.
9098         * layout.cc (Layout::add_target_dynamic_tags): New function.
9099         * layout.h (class Layout): Update declarations.
9100         * arm.cc (Target_arm::do_finalize_sections): Use
9101         add_target_dynamic_tags.
9102         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9103         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9104         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9105         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9106
9107 2010-01-07  Ian Lance Taylor  <iant@google.com>
9108
9109         PR 11042
9110         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9111         object as needed.
9112
9113 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9114             Ian Lance Taylor  <iant@google.com>
9115
9116         PR 11019
9117         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9118         Xindex::read_symtab_xindex.
9119
9120 2010-01-07  Doug Kwan  <dougkwan@google.com>
9121
9122         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9123         (Insn_template::thumb16_bcond_insn): New method declaration.
9124         (Insn_template): Fix spelling.
9125         (Stub::thumb16_special): New method declaration.
9126         (Stub::do_write): Define virtual method which was previously pure
9127         virtual.
9128         (Stub::do_thumb16_special): New method declaration.
9129         (Stub::do_fixed_endian_write): New template member.
9130         (Reloc_stub::do_write): Remove.
9131         (Reloc_stub::do_fixed_endian_write): Remove.
9132         (Cortex_a8_stub): New class definition.
9133         (Stub_factory::make_cortex_a8_stub): New method definition.
9134         (Stub_factory::Stub_factory): Add missing static storage class
9135         qualifier for elf32_arm_stub_a8_veneer_blx.
9136
9137 2010-01-07  Ian Lance Taylor  <iant@google.com>
9138
9139         PR 10980
9140         * options.h (class General_options): Add --warn-unresolved-symbols
9141         and --error-unresolved-symbols.
9142         * errors.cc (Errors::undefined_symbol): Implement
9143         --warn-unresolved-symbols.
9144
9145         * options.h (class General_options): Add -z text and -z textoff.
9146         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9147
9148 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9149
9150         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9151         (Garbage_collection::cident_sections): New function.
9152         (Garbage_collection::add_cident_section): New function.
9153         (Garbage_collection::cident_sections_): New member.
9154         (gc_process_relocs): Add references to sections whose names are C
9155         identifiers.
9156         * gold.h (cident_section_start_prefix): New constant.
9157         (cident_section_stop_prefix): New constant.
9158         (is_cident): New function.
9159         * layout.cc (Layout::define_section_symbols): Replace string constants
9160         with the newly defined constants.
9161         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9162         C identifiers.
9163         * testsuite/Makefile.am: Add gc_orphan_section_test.
9164         * testsuite/Makefile.in: Regenerate.
9165         * testsuite/gc_orphan_section_test.cc: New file.
9166         * testsuite/gc_orphan_section_test.sh: New file.
9167
9168 2010-01-06  Ian Lance Taylor  <iant@google.com>
9169
9170         PR 10980
9171         * options.h (class General_options): Add --warn-shared-textrel.
9172         * layout.cc (Layout::finish_dynamic_section): Implement
9173         --warn-shared-textrel.
9174
9175         PR 10980
9176         * options.h (class General_options): Add --warn-multiple-gp.
9177
9178 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9179
9180         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9181         $(THREADSLIB) and $(LIBDL).
9182         * Makefile.in: Rebuild.
9183
9184 2010-01-06  Ian Lance Taylor  <iant@google.com>
9185
9186         PR 10980
9187         * options.cc (General_options::parse_section_start): New function.
9188         (General_options::section_start): New function.
9189         (General_options::General_options): Initialize all members.
9190         * options.h: Include <map>
9191         (class General_options): Add --section-start.  Add section_starts_
9192         member.
9193         * layout.cc (Layout::attach_allocated_section_to_segment): If
9194         --section-start was used, set the address of the segment.  Remove
9195         local sort_sections.
9196         (Layout::relaxation_loop_body): If the address of the load segment
9197         has been set by --section-start, don't use it.
9198         * output.h (Output_segment::update_flags_for_output_section): New
9199         function.
9200         * output.cc (Output_segment::add_output_section): Call
9201         update_flags_for_output_section.
9202
9203 2010-01-05  Ian Lance Taylor  <iant@google.com>
9204
9205         PR 10980
9206         * options.h (class General_options): Add --undefined-version.
9207         * script.cc (struct Version_expression): Add was_matched_by_symbol
9208         field.
9209         (Version_script_info::matched_symbol): New function.
9210         (Version_script_info::get_symbol_version_helper): Call
9211         matched_symbol.
9212         (Version_script_info::check_unmatched_names): New function.
9213         * script.h (class Version_script_info): Update declarations.
9214         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9215
9216         * options.h (class General_options): Use DEFINE_bool_alias for
9217         allow_multiple_definition.
9218         * resolve.cc (Symbol_table::should_override): Don't test
9219         allow_multiple_definition.
9220
9221         PR 10980
9222         * options.h (class General_options): Add --cref.
9223         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9224         until after printing cref table.
9225         * cref.cc: Include "symtab.h".
9226         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9227         (Cref_table_compare::operator()): New function.
9228         (Cref_inputs::gather_cref): New function.
9229         (filecol): New static const.
9230         (Cref_inputs::print_cref): New function.
9231         (Cref::print_cref): New function.
9232         * cref.h: Include <cstdio>.
9233         (class Cref): Update declarations.
9234         * mapfile.h (Mapfile::file): New function.
9235         * object.h (class Object): Define Symbols.  Declare virtual
9236         do_get_global_symbols.
9237         (Object::get_global_symbols): New function.
9238         * object.cc (Input_objects::add_object): Pass object to cref_ if
9239         --cref.
9240         (Input_objects::archive_start): Likewise.
9241         (Input_objects::archive_stop): Likewise.
9242         (Input_objects::print_cref): New function.
9243         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9244         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9245         --cref.
9246         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9247         function.
9248         * plugin.h (class Sized_pluginobj): Update declarations.
9249
9250 2010-01-05  Ian Lance Taylor  <iant@google.com>
9251
9252         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9253         to is_default_version.  Rename insdef to insdefault.
9254         (Symbol_table::add_from_relobj): Rename def to is_default_version
9255         and local to is_forced_local.
9256         (Symbol_table::add_from_pluginobj): Likewise.
9257         (Symbol_table::add_from_dynobj): Likewise.
9258         (Symbol_table::define_special_symbol): Rename insdef to
9259         insdefault.
9260
9261 2010-01-04  Ian Lance Taylor  <iant@google.com>
9262
9263         PR 10980
9264         * options.h (class General_options): Add
9265         --allow-multiple-definition and -z muldefs.
9266         * resolve.cc (Symbol_table::should_override): Don't warn about a
9267         multiple symbol definition if --allow-multiple-definition or -z
9268         muldefs.
9269
9270         PR 10980
9271         * options.h (class General_options): Add --add-needed and
9272         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9273         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9274         error if --copy-dt-needed-entries aka --add-needed is used and
9275         would cause a change in behaviour.
9276
9277         PR 10980
9278         * options.h (class General_options): Add -G as a short version of
9279         --shared.  Add no-op options -assert, -g, and -i.
9280
9281 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9282
9283         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9284         check for .text or .gnu.linkonce.t sections.
9285         * icf.cc (Icf::find_identical_sections): Ditto.
9286         Change the detection for mangled function name within the section
9287         name.
9288         * icf.h (is_section_foldable_candidate): New function.
9289
9290 2009-12-30  Ian Lance Taylor  <iant@google.com>
9291
9292         PR 10980
9293         * options.h (class General_options): Permit two dashes with
9294         --retain-symbols-file.
9295
9296 2009-12-30  Ian Lance Taylor  <iant@google.com>
9297
9298         PR 10979
9299         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9300         don't put the file header and segment headers in the text
9301         segment.
9302
9303         PR 10979
9304         * common.cc (Sort_commons::operator()): Stabilize sort when both
9305         entries are NULL.
9306         (Symbol_table::do_allocate_commons_list): When allocating common
9307         symbols, skip a symbol which is no longer common.
9308         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9309         an object before checking its type.
9310         * testsuite/common_test_2.c: New file.
9311         * testsuite/common_test_3.c: New file.
9312         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9313         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9314         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9315         (common_test_2_pic.o, common_test_2.so): New targets.
9316         (common_test_3_pic.o, common_test_3.so): New targets.
9317         * testsuite/Makefile.in: Rebuild.
9318
9319         PR 10979
9320         * script.cc (read_input_script): If we see a new SECTIONS clause,
9321         and we have added an input section, give an error.
9322         * layout.h (class Layout): Add have_added_input_section function.
9323         Add have_added_input_section_ field.
9324         * layout.cc (Layout::Layout): Initialize
9325         have_added_input_section_.
9326         (Layout::layout): Set have_added_input_section_.
9327         (Layout::layout_eh_frame): Likewise.
9328
9329 2009-12-30  Ian Lance Taylor  <iant@google.com>
9330
9331         PR 10931
9332         * options.h (class General_options): Add --sort-common option.
9333         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9334         * common.cc (Sort_common): Add sort_order parameter to
9335         constructor.  Add sort_order_ field.
9336         (Sort_commons::operator): Check sort_order_.
9337         (Symbol_table::allocate_commons): Determine the sort order.
9338         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9339         Change all callers.
9340         (Symbol_table::do_allocate_commons_list): Likewise.
9341
9342 2009-12-30  Ian Lance Taylor  <iant@google.com>
9343
9344         PR 10916
9345         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9346         symbols from this object, don't change the visibility of an
9347         undefined symbol.
9348         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9349
9350 2009-12-30  Ian Lance Taylor  <iant@google.com>
9351
9352         PR 10861
9353         * script.h (class Version_script_info): Define Language enum.
9354         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9355         new fields globals_, locals_, and is_finalized_.
9356         * script.cc: Various formatting fixes.
9357         (class Parser_closure): Change language_stack_ from a vector of
9358         std::string to one of Version_script_info::Language.  Adjust all
9359         uses accordingly.
9360         (class Lazy_demangler): Remove.
9361         (struct Version_expression): Change language from std::string to
9362         Version_script_info::Language.
9363         (Version_script_info::Version_script_info): New function.
9364         (Version_script_info::~Version_script_info): Don't call clear.
9365         (Version_script_info::finalize): New function.
9366         (Version_script_info::build_lookup_tables): New function.
9367         (Version_script_info::build_expression_list_lookup): New
9368         function.
9369         (Version_script_info::get_symbol_version_helper): Rewrite to use
9370         lookup tables.
9371         (Version_script_info::print_expression_list): Adjust to use
9372         Version_script_info::Language.
9373         (script_push_lex_into_version_mode): Check that the version script
9374         has not been finalized.
9375         (version_script_push_lang): Change language string to
9376         Version_script_info::Language.
9377         * options.cc (Command_line::version_script): New function.
9378         * options.h (class General_options): Add finalize_dynamic_list
9379         function.  Change version_script from declaration to definition.
9380         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9381         * testsuite/version_script.map: Remove duplicate def of foo.
9382         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9383         version_script.map.
9384         * testsuite/Makefile.in: Rebuild.
9385
9386 2009-12-30  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10843
9389         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9390         if the input symbol index is 0, make the output symbol index 0.
9391
9392 2009-12-30  Ian Lance Taylor  <iant@google.com>
9393
9394         PR 10670
9395         * options.h (class General_options): Add -x/--discard-all.
9396         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9397         --discard-all.  If the local symbol needs a dynamic entry, check
9398         that before handling --discard-locals.
9399
9400 2009-12-30  Ian Lance Taylor  <iant@google.com>
9401
9402         PR 10450
9403         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9404         flags to PF_R.
9405         (Output_segment::add_output_section): Don't change the flags if
9406         the type is PT_TLS.
9407
9408         PR 10450
9409         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9410         GNU hash table if they need a dynamic value.  Otherwise, don't add
9411         them if they are defined in a dynamic object or are forced local.
9412
9413 2009-12-29  Ian Lance Taylor  <iant@google.com>
9414
9415         PR 10450
9416         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9417         .gnu.hash table for a 32-bit target.
9418
9419         PR 10450
9420         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9421         regular and a dynamic object only needs a dynamic symbol table
9422         entry if it is externally visible.
9423
9424         PR 10450
9425         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9426         constructor.  Add global_offset_table_ field.
9427         (Target_i386::got_section): Set global_offset_table_.
9428         (Target_i386::do_finalize_sections): Set global_offset_table_
9429         size.
9430         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9431         in constructor.  Add global_offset_table_ field.
9432         (Target_x86_64::got_section): Set global_offset_table_.
9433         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9434         size.
9435
9436         * layout.cc (Layout::Layout): Initialize increase_relro_.
9437         (Layout::get_output_section): Add is_relro, is_last_relro, and
9438         is_first_non_relro parameters.  Change all callers.
9439         (Layout::choose_output_section): Likewise.
9440         (Layout::add_output_section_data): Likewise.
9441         (Layout::make_output_section): Likewise.
9442         (Layout::set_segment_offsets): Clear increase_relro when using a
9443         linker script.
9444         * layout.h (class Layout): Add increase_relro method.  Add
9445         increase_relro_ field.  Update declarations.
9446         * output.cc (Output_section::Output_section): Initialize
9447         is_last_relro_ and is_first_non_relro_.
9448         (Output_segment::add_output_section): Group relro sections is
9449         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9450         (Output_segment::maximum_alignment): Remove relro handling.
9451         (Output_segment::set_section_addresses): Add increase_relro
9452         parameter.  Change all callers.  Add initial alignment to align
9453         relro sections on separate page.  Remove old relro handling.
9454         (Output_segment::set_section_list_addresses): Remove in_relro
9455         parameter.  Change all callers.
9456         (Output_segment::set_offset): Add increase parameter.  Change all
9457         callers.  Remove old relro handling.
9458         * output.h (class Output_section): Add new methods: is_last_relro,
9459         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9460         Add is_last_relro_ and is_first_non_relro_ fields.
9461         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9462         Create separate .got.plt section.  Call increase_relro.
9463         * x86_64.cc (Target_x86_64::got_section): Likewise.
9464         * testsuite/relro_script_test.t: Add .got.plt.
9465
9466         PR 10450
9467         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9468         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9469         (Layout::finalize): Call set_dynamic_symbol_size.
9470         (Layout::set_dynamic_symbol_size): New function.
9471         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9472         set_dynamic_symbol_size.
9473
9474         PR 10450
9475         * output.h (class Output_section): Add is_entsize_zero_ field.
9476         * output.cc (Output_section::Output_section): Initialize
9477         is_entsize_zero_.
9478         (Output_section::set_entsize): If two different entsizes are
9479         requested, force it to zero.
9480         (Output_section::add_input_section): Set flags for .debug_str
9481         before updating section flags.  Set entsize.
9482         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9483         and SHF_STRING if all input sections have those flags.
9484
9485 2009-12-29   Rafael Espindola  <espindola@google.com>
9486
9487         * main.cc (main): Fix the sys time reporting.
9488         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9489         reporting.
9490
9491 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9492
9493         * options.cc (General_options::parse_version): Allow -v to exit
9494         without an error if there is nothing to link.
9495
9496 2009-12-29  Ian Lance Taylor  <iant@google.com>
9497
9498         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9499         using a version of gcc before 4.1.
9500         * configure: Rebuild.
9501
9502 2009-12-28  Chris Demetriou  <cgd@google.com>
9503
9504         * attributes.cc (Output_attributes_section_data::do_write): Use
9505         std::vector::front rather than std::vector::data.
9506
9507 2009-12-28  Ian Lance Taylor  <iant@google.com>
9508
9509         * symtab.h (class Symbol_table): Add enum Defined.
9510         * resolve.cc (Symbol_table::should_override): Add defined
9511         parameter.  Change all callers.  Test whether object is NULL
9512         before calling a method on it.
9513         (Symbol_table::report_resolve_problem): Add defined parameter.
9514         Change all callers.
9515         (Symbol_table::should_override_with_special): Likewise.
9516         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9517         parameter.  Change all callers.
9518         (Symbol_table::do_define_in_output_data): Likewise.
9519         (Symbol_table::define_in_output_segment): Likewise.
9520         (Symbol_table::do_define_in_output_segment): Likewise.
9521         (Symbol_table::define_as_constant): Likewise.
9522         (Symbol_table::do_define_as_constant): Likewise.
9523         * script.h (class Symbol_assignment): Add is_defsym parameter to
9524         constructor; change all callers.
9525         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9526         parameter.  Change all callers.  Add is_defsym_ field.
9527         (class Parser_closure): Add parsing_defsym parameter to
9528         constructor; change all callers.  Add parsing_defsym accessor
9529         function.  Add parsing_defsym_ field.
9530
9531 2009-12-28  Ian Lance Taylor  <iant@google.com>
9532
9533         * gold.cc (queue_middle_tasks): Fix formatting.
9534         * object.cc (Relobj::is_section_name_included): Likewise.
9535
9536 2009-12-23  Ian Lance Taylor  <iant@google.com>
9537
9538         * i386.cc (Target_i386::do_calls_non_split): Recognize
9539         -fsplit-stack prologue for a function with a static chain.
9540         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9541         -fsplit-stack prologue when using %r11.
9542
9543 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9544
9545         * options.cc (General_options::parse_version): Make -v continue and do
9546         the link like GNU ld does.
9547
9548 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9549
9550         * Makefile.am (CCFILES): Add timer.cc.
9551         (HFILES): Add timer.h.
9552         * configure.ac: Check for sysconf and times.
9553         * main.cc: include timer.h.
9554         (main): Use Timer instead of get_run_time.
9555         * timer.cc: New.
9556         * timer.h: New.
9557         * workqueue.cc: include timer.h.
9558         (Workqueue::find_and_run_task):
9559         Report user, sys and wall time.
9560         * Makefile.in: Regenerate.
9561         * config.in: Regenerate.
9562         * configure: Regenerate.
9563
9564 2009-12-16  Doug Kwan  <dougkwan@google.com>
9565
9566         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9567         sections.
9568         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9569         relaxed input sections.
9570         * output.cc (Output_section::find_relaxed_input_section): Change
9571         return type to Output_relaxed_input_section pointer.  Adjust code
9572         for new type of relaxed_input_section_map_.
9573         * output.h (Output_section::find_relaxed_input_section): Change
9574         return type to Output_relaxed_input_section pointer.
9575         (Output_section::Output_relaxed_input_section_by_input_section_map):
9576         New type.
9577         (Output_section::relaxed_input_section_map_): Change type to
9578         Output_section::Output_relaxed_input_section_by_input_section_map.
9579         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9580         input section.
9581
9582 2009-12-15  Ian Lance Taylor  <iant@google.com>
9583
9584         * layout.cc (Layout::create_shstrtab): Only write out after input
9585         sections if we are compressing debug sections.
9586
9587 2009-12-15  Ian Lance Taylor  <iant@google.com>
9588
9589         * archive.cc (Archive::add_symbols): Only look up a symbol without
9590         a version if there is, in fact, a version.
9591
9592 2009-12-14  Ian Lance Taylor  <iant@google.com>
9593
9594         Revert -Wshadow changes, all changes from:
9595         2009-12-11  Doug Kwan  <dougkwan@google.com>
9596         2009-12-11  Nick Clifton  <nickc@redhat.com>
9597         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9598
9599 2009-12-11  Doug Kwan  <dougkwan@google.com>
9600
9601         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9602         due to -Wshadow.
9603         * attributes.cc (Object_attribute::size): Ditto.
9604         (Attributes_section_data::size): Ditto.
9605         (Attributes_section_data::Attributes_section_data): Ditto.
9606         (Output_attributes_section_data::do_write): Ditto.
9607         * attributes.h (Object_attribute::set_type): Ditto.
9608         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9609
9610 2009-12-11  Nick Clifton  <nickc@redhat.com>
9611
9612         * archive.cc: Fix shadowed variable warnings.
9613         * arm.cc: Likewise.
9614         * compressed_output.cc: Likewise.
9615         * compressed_output.h: Likewise.
9616         * configure: Likewise.
9617         * dwarf_reader.cc: Likewise.
9618         * dynobj.cc: Likewise.
9619         * dynobj.h: Likewise.
9620         * ehframe.cc: Likewise.
9621         * ehframe.h: Likewise.
9622         * errors.cc: Likewise.
9623         * expression.cc: Likewise.
9624         * fileread.cc: Likewise.
9625         * fileread.h: Likewise.
9626         * freebsd.h: Likewise.
9627         * i386.cc: Likewise.
9628         * icf.cc: Likewise.
9629         * incremental.h: Likewise.
9630         * layout.cc: Likewise.
9631         * layout.h: Likewise.
9632         * mapfile.cc: Likewise.
9633         * merge.cc: Likewise.
9634         * merge.h: Likewise.
9635         * object.cc: Likewise.
9636         * object.h: Likewise.
9637         * options.h: Likewise.
9638         * output.cc: Likewise.
9639         * output.h: Likewise.
9640         * parameters.cc: Likewise.
9641         * plugin.cc: Likewise.
9642         * powerpc.cc: Likewise.
9643         * reduced_debug_output.cc: Likewise.
9644         * reduced_debug_output.h: Likewise.
9645         * reloc.cc: Likewise.
9646         * reloc.h: Likewise.
9647         * resolve.cc: Likewise.
9648         * script-sections.cc: Likewise.
9649         * script.cc: Likewise.
9650         * script.h: Likewise.
9651         * sparc.cc: Likewise.
9652         * symtab.cc: Likewise.
9653         * symtab.h: Likewise.
9654         * target-select.cc: Likewise.
9655         * target-select.h: Likewise.
9656         * token.h: Likewise.
9657         * workqueue.cc: Likewise.
9658         * workqueue.h: Likewise.
9659         * x86_64.cc: Likewise.
9660
9661 2009-12-10  Doug Kwan  <dougkwan@google.com>
9662
9663         * arm.cc (attributes.h): New include.
9664         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9665         (Arm_relobj::~Arm_relobj): Delete object pointed by
9666         attributes_section_data_.
9667         (Arm_relobj::attributes_section_data): New method definition.
9668         (Arm_relobj::attributes_section_data_): New data member declaration.
9669         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9670         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9671         attributes_section_data_.
9672         (Arm_dynobj::attributes_section_data): New method definition.
9673         (Arm_dynobj::attributes_section_data_): New data member declaration.
9674         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9675         initialization value of may_use_blx_ to false.
9676         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9677         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9678         object attributes to compute results instead of hard-coding.
9679         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9680         Target_arm::get_secondary_compatible_arch,
9681         Target_arm::set_secondary_compatible_arch
9682         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9683         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9684         New method declarations.
9685         (Target_arm::get_aeabi_object_attribute): New method definition.
9686         (Target_arm::attributes_section_data_): New data member declaration.
9687         (read_arm_attributes_section): New template definition.
9688         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9689         (Arm_dynobj::do_read_symbols): Ditto.
9690         (Target_arm::do_finalize_sections): Merge attributes sections from
9691         input.  Check for BLX use after attributes section merging.
9692         Fix __exidx_start and __exidx_end visibility.  Create an
9693         .ARM.attributes section if necessary.
9694         (Target_arm::get_secondary_compatible_arch,
9695         Target_arm::set_secondary_compatible_arch,
9696         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9697         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9698         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9699         New method definitions.
9700
9701 2009-12-09  Ian Lance Taylor  <iant@google.com>
9702
9703         * plugin.cc (Plugin::load): Don't cast from void* to a function
9704         pointer.
9705
9706 2009-12-09  Ian Lance Taylor  <iant@google.com>
9707
9708         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9709         information fields.
9710
9711 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9712
9713         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9714         Replace two_file_shared_1.so with two_file_shared_2.so.
9715         * testsuite/Makefile.in: Regenerated.
9716
9717 2009-12-08  Doug Kwan  <dougkwan@google.com>
9718
9719         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9720         (HFILES): Add attributes.h and int_encoding.h.
9721         * Makefile.in: Regenerate.
9722         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9723         function definitions to int_encoding.cc
9724         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9725         prototypes to int_encoding.h
9726         * reduced_debug_output.cc (int_encoding.h): New include.
9727         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9728         function definitions to int_encoding.cc
9729         (insert_into_vector, read_from_pointer): Move template definitions to
9730         int_encoding.h
9731         * attributes.cc: New file.
9732         * attributes.h: New file.
9733         * int_encoding.cc: New file.
9734         * int_encoding.h: New file.
9735
9736 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9737
9738         PR gold/11055
9739         * incremental-dump.cc (dump_incremental_inputs): New.
9740         (main): Use dump_incremental_inputs.
9741
9742 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9743
9744         PR gold/10893
9745         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9746         checking elfcpp::STT_FUNC.
9747         (Target_i386::Relocate::relocate): Likewise.
9748         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9749
9750         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9751         symbols from shared libraries into normal FUNC symbols.
9752
9753         * symtab.h (Symbol): Add is_func and use it.
9754
9755 2009-12-05  Doug Kwan  <dougkwan@google.com>
9756
9757         * arm.cc (Target_arm::arm_info): Initialize new fields
9758         attributes_section and attributes_vendor.
9759         * i386.cc (Target_i386::i386_info): Same.
9760         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9761         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9762         fields attributes_section and attributes_vendor.
9763         * sparc.cc (Target_sparc::sparc_info): Same.
9764         * target.h (Target::attributes_section, Target::attributes_vendor,
9765         Target::is_attributes_section, Target::attribute_arg_type,
9766         Target::attributes_order): New method definitions.
9767         (Target::Target_info::attributes_section,
9768         Target::Target_info::attributes_vendor): New fields.
9769         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9770         virtual method definitions.
9771         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9772         attributes_section and attributes_vendor.
9773         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9774
9775 2009-12-05  Doug Kwan  <dougkwan@google.com>
9776
9777         * arm.cc: Update comments about interworking and stub generation.
9778         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9779         considered as non-PIC.
9780         (Arm_relocate_functions::base_abs): Fix formatting.
9781         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9782         of function to use GOT entry address instead of offset.
9783         (Target_arm::Scan::global): Issue an error if a symbol would need a
9784         PLT does not get one because it is untyped.  Remove code to create
9785         dynamic symbols for relative branches.
9786         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9787         takes unsigned integer instead of boolean.
9788
9789 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9790
9791         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9792         (two_file_test_LDADD): Likewise.
9793         (common_test_1_LDADD): Likewise.
9794         (exception_test_LDADD) Likewise.
9795         (weak_test_LDADD): Likewise.
9796         (many_sections_test_LDADD): Likewise.
9797         (initpri1_LDADD): Likewise.
9798         (script_test_1_LDADD): Likewise.
9799         (script_test_2_LDADD): Likewise.
9800         (justsyms_LDADD): Likewise.
9801         (binary_test_LDADD): Likewise.
9802         (large_LDADD): Likewise.
9803         * testsuite/Makefile.in: Regenerated.
9804
9805 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9806
9807         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9808         (Symbol_table::override_with_special): Likewise.
9809         (Symbol_table::add_from_object): Likewise.
9810
9811 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9812
9813         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9814         Don't set the data_offset twice.
9815
9816 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9817
9818         * testsuite/Makefile.in: Regenerate.
9819
9820 2009-12-03  Doug Kwan  <dougkwan@google.com>
9821
9822         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9823         (Target_arm::do_finalize_sections): Add parameter for symbol table
9824         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9825         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9826         parameter for symbol table pointer.
9827         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9828         an additional parameter for a pointer to symbol table.
9829         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9830         parameter for a symbol table pointer.
9831         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9832         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9833         Ditto.
9834         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9835         parameter for a symbol table pointer.
9836
9837 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9838
9839         * incremental.cc (Incremental_inputs_header)
9840         (Incremental_inputs_header_write, Incremental_inputs_entry)
9841         (Incremental_inputs_entry_write): Move ...
9842         * incremental.h (Incremental_inputs_header)
9843         (Incremental_inputs_header_write, Incremental_inputs_entry)
9844         (Incremental_inputs_entry_write): here.
9845
9846 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9847
9848         * incremental.cc (make_sized_incremental_binary): Set the target.
9849         Error if it is incompatible.
9850         * output.h (Output_file): Add filename method.
9851
9852 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9853
9854         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9855         from the get_* methods.
9856
9857 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9858
9859         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9860         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9861         Write 0 for the data_offset of scripts.
9862
9863 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9864
9865         * testsuite/Makefile.am: Add the incremental_test.sh test.
9866         * testsuite/incremental_test.sh: New.
9867         * testsuite/incremental_test_1.c: New.
9868         * testsuite/incremental_test_2.c: New.
9869
9870 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9871
9872         * incremental-dump.cc (main): Fix typos.
9873
9874 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9875
9876         PR gold/11025
9877         * incremental-dump.cc (main): Use llu to print 64 bit values.
9878
9879 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9880             H.J. Lu  <hongjiu.lu@intel.com>
9881
9882         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9883         $(LIBDL).
9884         (incremental_dump_LDADD): Likewise.
9885         * Makefile.in: Regenerated.
9886
9887 2009-11-25  Doug Kwan  <dougkwan@google.com>
9888
9889         Revert:
9890
9891         2009-11-25  Doug Kwan  <dougkwan@google.com>
9892
9893                 * arm.cc (Target_arm::Target_arm): Move method definition
9894                 outside of class definition.  Add code to handle
9895                 --target1-rel, --target1-abs and --target2= options.
9896                 (Target_arm::get_reloc_reloc_type): Change method to be
9897                 non-static and const.
9898                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9899                 New data member declaration.
9900                 (Target_arm::Scan::local, Target_arm::Scan::global,
9901                 Target_arm::Relocate::relocate,
9902                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9903                 Adjust call to Target_arm::get_real_reloc_type.
9904                 (Target_arm::get_real_reloc_type): Use command line options
9905                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9906                 * options.h (--target1-rel, --target1-abs, --target2): New
9907                 ARM-only options.
9908
9909 2009-11-25  Doug Kwan  <dougkwan@google.com>
9910
9911         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9912         class definition.  Add code to handle --target1-rel, --target1-abs
9913         and --target2= options.
9914         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9915         and const.
9916         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9917         member declaration.
9918         (Target_arm::Scan::local, Target_arm::Scan::global,
9919         Target_arm::Relocate::relocate,
9920         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9921         call to Target_arm::get_real_reloc_type.
9922         (Target_arm::get_real_reloc_type): Use command line options to
9923         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9924         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9925         options.
9926
9927 2009-11-25  Doug Kwan  <dougkwan@google.com>
9928
9929         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9930         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9931         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9932         formatting.
9933         (Arm_relocate_functions::thm_call): Replace body with a call to
9934         Arm_relocate_functions::thumb_branch_common.
9935         (Arm_relocate_functions::thm_jump24,
9936         Arm_relocate_functions::thm_xpc22): New method definitions.
9937         (Arm_relocate_functions::thumb_branch_common): New method definition.
9938         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9939         operator.
9940         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9941         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9942
9943 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9944
9945         * Makefile.am: Build incremental-dump
9946         * Makefile.in: Regenerate.
9947         * incremental-dump.cc: New.
9948         * incremental.cc (Incremental_inputs_header_data,
9949         Incremental_inputs_entry_data): Move to incremental.h
9950         * incremental.h: (Incremental_inputs_header_data,
9951         Incremental_inputs_entry_data): Move from incremental.cc
9952
9953 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9954
9955         * incremental.cc (Incremental_inputs_header,
9956         Incremental_inputs_header_write, Incremental_inputs_entry,
9957         Incremental_inputs_entry_write): Add a typedef with the data type.
9958
9959 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9960
9961         * incremental.cc (Incremental_inputs_header,
9962         Incremental_inputs_header_write, Incremental_inputs_entry,
9963         Incremental_inputs_entry_write): Update comment about which
9964         type has the filed descriptions.
9965
9966 2009-11-15  Doug Kwan  <dougkwan@google.com>
9967
9968         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9969         (Arm_relocate_functions::arm_branch_common): Change method defintion
9970         in class definition to a method declaration and update list of formal
9971         parameters.
9972         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9973         Arm_relocation_functions::jump24): Adjust call to
9974         Arm_relocate_functions::arm_branch_common.  Update list of formal
9975         parameters.
9976         (Arm_relocate_functions::xpc25): New method definition.
9977         (Arm_relocate_functions::arm_branch_common): Move method defintion
9978         out from class definition.  Use stubs for mode-switching and extending
9979         branch ranges.
9980         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9981         specially.  Change code to enable use of stubs in ARM branches.
9982
9983 2009-11-10  Doug Kwan  <dougkwan@google.com>
9984
9985         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9986         in method declaration.
9987         (Target_arm::relocate_stub): New method declaration.
9988         (Target_arm::default_target): Change to return a pointer instead of
9989         a const reference.
9990         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9991         Target_arm::default_target.
9992         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9993         method definition.
9994         (Target_arm::relocate_section): Adjust view.
9995         (Target_arm::relocate_stub): New method definition.
9996
9997 2009-11-10  Doug Kwan  <dougkwan@google.com>
9998
9999         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10000         a format warning.
10001         * incremental.cc (open_incremental_binary): Initialized local
10002         variables to avoid warnings.
10003         * object.cc (make_elf_object): Ditto.
10004         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10005         a format warning.
10006
10007 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10008
10009         PR gold/10930
10010         * testsuite/plugin_test.c: Include "config.h".
10011
10012 2009-11-09  Doug Kwan  <dougkwan@google.com>
10013
10014         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10015         (arm_symbol_value): Remove.
10016         (Arm_relocate_functions::arm_branch_common,
10017         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10018         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10019         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10020         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10021         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10022         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10023         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10024         Arm_relocate_functions::thm_mobw_abs_nc,
10025         Arm_relocate_functions::thm_mov_abs,
10026         Arm_relocate_functions::movw_prel_nc,
10027         Arm_relocate_functions::thm_movt_abs,
10028         Arm_relocate_functions::movt_prel,
10029         Arm_relocate_functions::thm_movw_prel_nc,
10030         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10031         (Target_arm::Relocate::relocate): Only decompose address into two
10032         parts if relocation type uses the thumb-bit and pass the actual
10033         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10034         calls to methods in Arm_relocate_functions for this change.
10035
10036 2009-11-08  Ian Lance Taylor  <iant@google.com>
10037
10038         PR 10925
10039         * reloc.cc: Instantiate
10040         Sized_relobj::initialize_input_to_output_maps and
10041         Sized_relobj:free_input_to_output_maps.
10042
10043 2009-11-06  Ian Lance Taylor  <iant@google.com>
10044
10045         PR 10876
10046         * defstd.cc (in_segment): Set only_if_ref true for "end".
10047
10048 2009-11-06  Doug Kwan  <dougkwan@google.com>
10049
10050         * arm.cc (class Reloc_stub): Correct a comment.
10051         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10052         (Target_arm::scan_section_for_stubs): New method declaration.
10053         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10054         Change methods from private to protected.
10055         (Target_arm::do_may_relax): New method definition.
10056         (Target_arm::do_relax, Target_arm::group_sections,
10057         Target_arm::scan_reloc_for_stub,
10058         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10059         (Target_arm::arm_input_section_map_): New data member declaration.
10060         (Target_arm::scan_reloc_for_stub,
10061         Target_arm::scan_reloc_section_for_stubs,
10062         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10063         Target_arm::do_relax): New method definitions.
10064
10065 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10066
10067         * configure.ac: Check for (struct stat)::st_mtim
10068         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10069         * config.in: Regenerate.
10070         * configure: Regenerate.
10071
10072 2009-11-05  Ian Lance Taylor  <iant@google.com>
10073
10074         PR 10910
10075         * output.cc (Output_segment::add_output_section): Add missing
10076         return statement.
10077
10078 2009-11-04  Ian Lance Taylor  <iant@google.com>
10079
10080         PR 10880
10081         * object.h (class Object): Add is_needed and set_is_needed
10082         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10083         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10084         defined in a dynamic object and referenced by a regular object,
10085         set is_needed for the dynamic object.
10086         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10087         if the file is marked with as_needed and it is not needed.
10088
10089 2009-11-04  Ian Lance Taylor  <iant@google.com>
10090
10091         PR 10887
10092         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10093         tags if data is discarded by linker script.
10094         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10095         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10096         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10097         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10098
10099 2009-11-04  Ian Lance Taylor  <iant@google.com>
10100
10101         * layout.cc (Layout::get_output_section): Add is_interp and
10102         is_dynamic_linker_section parameters.  Change all callers.
10103         (Layout::choose_output_section): Likewise.
10104         (Layout::make_output_section): Likewise.
10105         (Layout::add_output_section_data): Add is_dynamic_linker_section
10106         parameter.  Change all callers.
10107         * layout.h (class Layout): Update declarations.
10108         * output.h (class Output_section): Add is_interp, set_is_interp,
10109         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10110         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10111         generate_code_fills_at_write_ to a bitfield.
10112         * output.cc (Output_section::Output_sections): Initialize new
10113         fields.
10114         (Output_segment::add_output_section): Add do_sort parameter.
10115         Change all callers.
10116
10117 2009-11-03  Ian Lance Taylor  <iant@google.com>
10118
10119         PR 10860
10120         * options.h (class General_options): Add --warn-common.
10121         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10122         merging two common symbols.
10123         (Symbol_table::should_override): Handle --warn-common when merging
10124         a common symbol with a defined symbol.  Use report_resolve_problem
10125         for multiple definitions.
10126         (Symbol_table::report_resolve_problem): New function.
10127         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10128
10129 2009-11-03  Doug Kwan  <dougkwan@google.com>
10130
10131         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10132         stub_factory_.
10133         (Target_arm::stub_factory): New method definition.
10134         (Target_arm::new_arm_input_section,
10135         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10136         Target_arm::reloc_uses_thumb_bit): New method declarations.
10137         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10138         New type definitions.
10139         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10140         member declarations.
10141         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10142         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10143         New method definitions.
10144
10145 2009-11-03  Ian Lance Taylor  <iant@google.com>
10146
10147         * options.h (class General_options): Add --warn_constructors.
10148
10149 2009-11-03  Ian Lance Taylor  <iant@google.com>
10150
10151         PR 10893
10152         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10153         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10154
10155 2009-11-03  Ian Lance Taylor  <iant@google.com>
10156
10157         PR 10895
10158         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10159         --msgid-bugs-address.
10160         (install-pdf): New target.
10161         (install-data_yes): Look up one directory to find mkinstalldirs.
10162
10163 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10164
10165         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10166         tree.
10167
10168 2009-10-30  Doug Kwan  <dougkwan@google.com>
10169
10170         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10171
10172 2009-10-30  Doug Kwan  <dougkwan@google.com>
10173
10174         * arm.cc (Stub_addend_reader): New struct template definition
10175         and partial specializations.
10176         (Stub_addend_reader::operator()): New method definition for a
10177         partially specialized template.
10178
10179 2009-10-30  Doug Kwan  <dougkwan@google.com>
10180
10181         * arm.cc (Arm_relobj::processor_specific_flags): New method
10182         definition.
10183         (Arm_relobj::do_read_symbols): New method declaration.
10184         (Arm_relobj::processor_specific_flags_): New data member declaration.
10185         (Arm_dynobj): New class definition.
10186         (Target_arm::do_finalize_sections): Add input_objects parameter.
10187         (Target_arm::do_adjust_elf_header): New method declaration.
10188         (Target_arm::are_eabi_versions_compatible,
10189         (Target_arm::merge_processor_specific_flags): New method declaration.
10190         (Target_arm::do_make_elf_object): New overloaded method definitions
10191         and declaration.
10192         (Arm_relobj::do_read_symbols): New method definition.
10193         (Arm_dynobj::do_read_symbols): Ditto.
10194         (Target_arm::do_finalize_sections): Add input_objects parameters.
10195         Merge processor-specific flags from all input objects.
10196         (Target_arm::are_eabi_versions_compatible,
10197         Target_arm::merge_processor_specific_flags,
10198         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10199         New method definitions.
10200         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10201         Input_objects pointer type parameter.
10202         * layout.cc (Layout::finalize): Pass input objects to target's.
10203         finalize_sections function.
10204         * output.cc (Output_file_header::do_sized_write): Set ELF file
10205         header's processor-specific flags.
10206         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10207         Input_objects pointer type parameter.
10208         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10209         * target.h (Input_objects): New forward class declaration.
10210         (Target::processor_specific_flags,
10211         Target::are_processor_specific_flags_sect): New method definitions.
10212         (Target::finalize_sections): Add input_objects parameter.
10213         (Target::Target): Initialize processor_specific_flags_ and
10214         are_processor_specific_flags_set_.
10215         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10216         parameter.
10217         (Target::set_processor_specific_flags): New method definition.
10218         (Target::processor_specific_flags_,
10219         Target::are_processor_specific_flags_set_): New data member
10220         declarations.
10221         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10222         Input_objects pointer type parameter.
10223
10224 2009-10-30  Doug Kwan  <dougkwan@google.com>
10225
10226         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10227
10228 2009-10-28  Ian Lance Taylor  <iant@google.com>
10229
10230         * object.h (class Relobj): Drop options parameter from
10231         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10232         do_scan_relocs, do_relocate.  Change all callers.
10233         (class Sized_relobj): Drop options parameters from
10234         do_gc_process_relocs, do_scan_relocs, do_relocate,
10235         do_relocate_sections, relocate_sections, emit_relocs_scan,
10236         emit_relocs_scan_reltype.  Change all callers.
10237         (struct Relocate_info): Remove options field and all references to
10238         it.
10239         * reloc.h (class Read_relocs): Remove options constructor
10240         parameter and options_ field.  Change all callers.
10241         (class Gc_process_relocs, class Scan_relocs): Likewise.
10242         (class Relocate_task): Likewise.
10243         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10244         all callers.
10245         (scan_relocatable_relocs): Likewise.
10246         * target.h (class Sized_target): Remove options parameter from
10247         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10248         all callers.
10249         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10250         callers.
10251         * arm.cc: Update functions to remove options parameters.
10252         * i386.cc: Likewise.
10253         * powerpc.cc: Likewise.
10254         * sparc.cc: Likewise.
10255         * x86_64.cc: Likewise.
10256         * testsuite/testfile.cc: Likewise.
10257
10258 2009-10-28  Doug Kwan  <dougkwan@google.com>
10259
10260         * arm.cc (Arm_relobj): New class definition.
10261         (Arm_relobj::scan_sections_for_stubs,
10262         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10263         New method definitions.
10264
10265 2009-10-28  Cary Coutant  <ccoutant@google.com>
10266
10267         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10268         (Plugin::cleanup_done_): New member.
10269         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10270         (Plugin_manager::cleanup_done_): Remove.
10271         (Plugin_manager::add_input_file): Edit error message.
10272         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10273         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10274
10275 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10276
10277         * fileread.cc: (File_read::View::~View): Use the new
10278         data_ownership_ filed.
10279         (File_read::~File_read): Dispose the new whole_file_view_.
10280         (File_read::open): Mmap the whole file if needed.
10281         (File_read::open): Use whole_file_view_ instead of contents_.
10282         (File_read::find_view): Use whole_file_view_ if applicable.
10283         (File_read::do_read): Use whole_file_view_ instead of contents_.
10284         (File_read::make_view): Use whole_file_view_ instead of contents_,
10285         update File_read::View::View call.
10286         (File_read::find_or_make_view): Update File_read::View::View
10287         call.
10288         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10289         remove contents_
10290         (File_read::View::Data_ownership): New enum.
10291         (File_read::View::View): Replace bool mapped_ with Data_ownership
10292         argument.
10293         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10294         (File_read::View::data_ownership_): New field.
10295         (File_read::contents_): Remove (replaced by whole_file_view_).
10296         (File_read::whole_file_view_): New field.
10297         * options.h (class General_options): Add --keep-files-mapped.
10298
10299 2009-10-27  Cary Coutant  <ccoutant@google.com>
10300
10301         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10302         * testsuite/Makefile.am (plugin_test_5): New test case.
10303         * testsuite/Makefile.in: Regenerate.
10304
10305 2009-10-25  Doug Kwan  <dougkwan@google.com>
10306
10307         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10308         from private to protected to allow access by child class.
10309         (Sized_relobj::do_relocate_sections): New method declaration.
10310         (Sized_relobj::relocate_sections): Virtualize.
10311         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10312         Sized_relobj::relocate_sections.  Instantiate template explicitly
10313         for different target sizes and endianity.
10314
10315 2009-10-24  Doug Kwan  <dougkwan@google.com>
10316
10317         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10318         (Arm_input_section::as_arm_input_section): New method.
10319         (Arm_output_section): New class definition.
10320         (Arm_output_section::create_stub_group,
10321         Arm_output_section::group_sections): New method definitions.
10322
10323 2009-10-22  Doug Kwan  <dougkwan@google.com>
10324
10325         * arm.cc (Arm_input_section): New class definition.
10326         (Arm_input_section::init, Arm_input_section:do_write,
10327         Arm_input_section::set_final_data_size,
10328         Arm_input_section::do_reset_address_and_file_offset): New method
10329         definitions.
10330
10331 2009-10-21  Doug Kwan  <dougkwan@google.com>
10332
10333         * arm.cc (Stub_table, Arm_input_section): New forward class
10334         declarations.
10335         (Stub_table): New class defintion.
10336         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10337         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10338         New method definition.
10339
10340 2009-10-21  Doug Kwan  <dougkwan@google.com>
10341
10342         * arm.cc: Update copyright comments.
10343         (Target_arm): New forward class template declaration.
10344         (Arm_address): New type.
10345         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10346         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10347         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10348         constants.
10349         (Insn_template): Same.
10350         (DEF_STUBS): New macro.
10351         (Stub_type): New enum type.
10352         (Stub_template): New class definition.
10353         (Stub): Same.
10354         (Reloc_stub): Same.
10355         (Stub_factory): Same.
10356         (Target_arm::Target_arm): Initialize may_use_blx_ and
10357         should_force_pic_veneer_.
10358         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10359         Target_arm::should_force_pic_veneer,
10360         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10361         Target_arm::using_thumb_only, Target_arm:;default_target): New
10362         method defintions.
10363         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10364         New data member declarations.
10365         (Insn_template::size, Insn_template::alignment): New method defintions.
10366         (Stub_template::Stub_template): New method definition.
10367         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10368         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10369         (Stub_factory::Stub_factory): New method definition.
10370         * gold.h (string_hash): New template.
10371         * output.h (Input_section_specifier::hash_value): Use
10372         gold::string_hash.
10373         (Input_section_specifier::string_hash): Remove.
10374         * stringpool.cc (Stringpool_template::string_hash): Use
10375         gold::string_hash.
10376
10377 2009-10-20  Doug Kwan  <dougkwan@google.com>
10378
10379         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10380         symbols of relaxed input sections.
10381         * output.h (Output_section::find_relaxed_input_section): Make
10382         method public.
10383
10384 2009-10-16  Doug Kwan  <dougkwan@google.com>
10385
10386         * dynobj.cc (Versions::Versions): Initialize version_script_.
10387         Only insert base version symbol definition for a shared object
10388         if version script defines any version versions.
10389         (Versions::define_base_version): New method definition.
10390         (Versions::add_def): Check that base version is not needed.
10391         (Versions::add_need): Define base version lazily.
10392         * dynobj.h (Versions::define_base_version): New method declaration.
10393         (Versions::needs_base_version_): New data member declaration.
10394         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10395         (check_DATA): Add no_version_test.stdout.
10396         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10397         New make rules.
10398         * testsuite/Makefile.in: Regenerate.
10399         * testsuite/no_version_test.c: New file.
10400         * testsuite/no_version_test.sh: Ditto.
10401
10402 2009-10-16  Doug Kwan  <dougkwan@google.com>
10403
10404         * expression.cc (class Segment_start_expression): New class definition.
10405         (Segment_start_expression::value): New method definition.
10406         (script_exp_function_segment_start): Return a new
10407         Segment_start_expression.
10408         * gold/script-c.h (script_saw_segment_start_expression): New function
10409         prototype.
10410         * script-sections.cc (Script_sections::Script_sections): Initialize
10411         SAW_SEGMENT_START_EXPRESSION_ to false.
10412         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10413         and -Tbbs options to specify section addresses if given in
10414         command line and no SEGMENT_START expression is seen in a script.
10415         * script-sections.h (Script_sections::saw_segment_start_expression,
10416         Script_sections::set_saw_segment_start_expression): New method
10417         definition.
10418         (Script_sections::saw_segment_start_expression_): New data member
10419         declaration.
10420         * script.cc (script_saw_segment_start_expression): New function.
10421         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10422         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10423         script_test_7.sh and script_test_8.sh.
10424         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10425         script_test_8.stdout.
10426         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10427         (script_test_6, script_test_6.stdout, script_test_7,
10428         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10429         * Makefile.in: Regenerate.
10430         * testsuite/script_test_6.sh: New file.
10431         * testsuite/script_test_6.t: Same.
10432         * testsuite/script_test_7.sh: Same.
10433         * testsuite/script_test_7.t: Same.
10434         * testsuite/script_test_8.sh: Same.
10435
10436 2009-10-16  Doug Kwan  <dougkwan@google.com>
10437
10438         * output.cc (Output_segment::set_section_list_address): Cast
10439         expressions to unsigned long long type to avoid format warnings.
10440
10441 2009-10-15  Ian Lance Taylor  <iant@google.com>
10442
10443         * script.cc (Script_options::add_symbol_assignment): Always add a
10444         dot assignment to script_sections_.
10445         * script-sections.cc (Script_sections::add_dot_assignment):
10446         Initialize if necessary.
10447
10448         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10449         program headers with no load segment if there is a linker script.
10450
10451         * layout.cc (Layout::set_segment_offsets): Align the file offset
10452         to the segment aligment for -N or -n with no load segment.
10453         * output.cc (Output_segment::add_output_section): Don't crash if
10454         the first section is a TLS section.
10455         (Output_segment::set_section_list_addresses): Print an error
10456         message if the address moves backward in a linker script.
10457         * script-sections.cc
10458         (Output_section_element_input::set_section_addresses): Don't
10459         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10460         (Orphan_output_section::set_section_addresses): Likewise.
10461
10462 2009-10-15  Doug Kwan  <dougkwan@google.com>
10463
10464         * layout.cc (Layout::finish_dynamic_section): Generate tags
10465         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10466         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10467         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10468
10469 2009-10-14  Ian Lance Taylor  <iant@google.com>
10470
10471         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10472         fields.
10473         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10474         data_shdr fields of relinfo.
10475         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10476         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10477         R_386_TLS_LDO_32, adjust based on section flags.
10478         (Target_i386::Relocate::fix_up_ldo): Remove.
10479
10480 2009-10-13  Ian Lance Taylor  <iant@google.com>
10481
10482         Add support for -pie.
10483         * options.h (class General_options): Add -pie and
10484         --pic-executable.
10485         (General_options::output_is_position_independent): Test -pie.
10486         (General_options::output_is_executable): Return true if not shared
10487         and not relocatable.
10488         (General_options::output_is_pie): Remove.
10489         * options.cc (General_options::finalize): Reject incompatible uses
10490         of -pie.
10491         * gold.cc (queue_middle_tasks): A -pie link is not static.
10492         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10493         * symtab.cc (Symbol::final_value_is_known): Return false if
10494         output_is_position_independent.
10495         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10496         output_is_position_independent.
10497         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10498         output_is_position_independent.
10499         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10500         output_is_position_independent.
10501         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10502         two_file_pie_test.
10503         (basic_pie_test.o, basic_pie_test): New targets.
10504         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10505         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10506         (two_file_pie_test): New target.
10507         * testsuite/Makefile.in: Rebuild.
10508         * README: Remove note saying that -pie is not supported.
10509
10510 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10511
10512         * options.h (class General_options): Add -init and -fini.
10513         * layout.cc (Layout::finish_dynamic_section): Emit
10514         given init and fini functions.
10515
10516 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10517
10518         * gc.h (gc_process_relocs): Check if icf is enabled using new
10519         function.
10520         * gold.cc (queue_initial_tasks): Likewise.
10521         (queue_middle_tasks): Likewise.
10522         * object.cc (do_layout): Likewise.
10523         * symtab.cc (is_section_folded): Likewise.
10524         * main.cc (main): Likewise.
10525         * reloc.cc (Read_relocs::run): Likewise.
10526         (Sized_relobj::do_scan_relocs): Likewise.
10527         * icf.cc (is_function_ctor_or_dtor): New function.
10528         (Icf::find_identical_sections): Check if function is ctor or dtor when
10529         safe icf is chosen.
10530         * options.h (General_options::icf): Change option to be an enum.
10531         (Icf_status): New enum.
10532         (icf_enabled): New method.
10533         (icf_safe_folding): New method.
10534         (set_icf_status): New method.
10535         (icf_status_): New variable.
10536         * (options.cc) (General_options::finalize): Set icf_status_.
10537         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10538         icf_test and icf_keep_unique_test to use the --icf enum flag.
10539         * testsuite/icf_safe_test.sh: New file.
10540         * testsuite/icf_safe_test.cc: New file.
10541
10542 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10543
10544         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10545         includes to gc.h and icf.h.
10546         * arm.cc: Include gc.h.
10547         * gold.cc: Likewise.
10548         * i386.cc: Likewise.
10549         * powerpc.cc: Likewise.
10550         * sparc.cc: Likewise.
10551         * x86_64.cc: Likewise.
10552         * gc.h: Include icf.h.
10553
10554 2009-10-11  Ian Lance Taylor  <iant@google.com>
10555
10556         * plugin.cc: Include "gold.h" before other header files.
10557
10558 2009-10-10  Chris Demetriou  <cgd@google.com>
10559
10560         * options.h (Input_file_argument::Input_file_type): New enum.
10561         (Input_file_argument::is_lib_): Replace with...
10562         (Input_file_argument::type_): New member.
10563         (Input_file_argument::Input_file_argument): Take Input_file_type
10564         'type' rather than boolean 'is_lib' as second argument.
10565         (Input_file_argument::is_lib): Use type_.
10566         (Input_file_argument::is_searched_file): New function.
10567         (Input_file_argument::may_need_search): Handle is_searched_file.
10568         * options.cc (General_options::parse_library): Support -l:filename.
10569         (General_options::parse_just_symbols): Update for Input_file_argument
10570         changes.
10571         (Command_line::process): Likewise.
10572         * archive.cc (Archive::get_file_and_offset): Likewise.
10573         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10574         * script.cc (read_script_file, script_add_file): Likewise.
10575         * fileread.cc (Input_file::Input_file): Likewise.
10576         (Input_file::will_search_for): Handle is_searched_file.
10577         (Input_file::open): Likewise.
10578         * readsyms.cc (Read_symbols::get_name): Likewise.
10579         * testsuite/Makefile.am (searched_file_test): New test.
10580         * testsuite/Makefile.in: Regenerate.
10581         * testsuite/searched_file_test.cc: New file.
10582         * testsuite/searched_file_test_lib.cc: New file.
10583
10584 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10585             Ian Lance Taylor  <iant@google.com>
10586
10587         * descriptor.cc: Include <cstdio> and "binary-io.h".
10588         (Descriptors::open): Open the files in binary mode always.
10589         * script.cc (Lex::get_token): Treat \r as whitespace.
10590
10591 2009-10-09  Ian Lance Taylor  <iant@google.com>
10592
10593         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10594
10595 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10596             Ian Lance Taylor  <iant@google.com>
10597
10598         * configure.ac: Check for readv function also.
10599         * fileread.cc (readv): Define if not HAVE_READV.
10600         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10601         does not exist.
10602         * config.in: Regenerate.
10603         * configure: Regenerate.
10604
10605 2009-10-09  Doug Kwan  <dougkwan@google.com>
10606
10607         * layout.cc (Layout::make_output_section): Call target hook to make
10608         ordinary output section.
10609         (Layout::finalize): Adjust parameter list of call the
10610         Target::may_relax().
10611         * layout.h (class Layout::section_list): New method.
10612         * merge.h (Output_merge_base::entsize): Change visibility to public.
10613         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10614         New methods.
10615         (Output_merge_string::do_is_string): New method.
10616         * object.cc (Sized_relobj::do_setup): renamed from
10617         Sized_relobj::set_up.
10618         * object.h (Sized_relobj::adjust_shndx,
10619         Sized_relobj::initializ_input_to_output_maps,
10620         Sized_relobj::free_input_to_output_maps): Change visibilities to
10621         protected.
10622         (Sized_relobj::setup): Virtualize.
10623         (Sized_relobj::do_setup): New method declaration.
10624         (Sized_relobj::invalidate_section_offset,
10625         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10626         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10627         * options.cc (parse_int): New function.
10628         * options.h (parse_int): New declaration.
10629         (DEFINE_int): New macro.
10630         (stub_group_size): New option.
10631         * output.cc (Output_section::Output_section): Initialize memebers
10632         merge_section_map_, merge_section_by_properties_map_,
10633         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10634         (Output_section::add_input_section): Handled deferred code-fill
10635         generation and remove an old comment.
10636         (Output_section::add_relaxed_input_section): New method definition.
10637         (Output_section::add_merge_input_section): Use merge section by
10638         properties map to speed to search.  Update merge section maps
10639         as appropriate.
10640         (Output_section::build_relaxation_map): New method definition.
10641         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10642         Same.
10643         (Output_section::relax_input_section): Renamed to
10644         Output_section::convert_input_sections_to_relaxed_sections and change
10645         interface to take a vector of pointers to relaxed sections.
10646         (Output_section::find_merge_section,
10647         Output_section::find_relaxed_input_section): New method definitions.
10648         (Output_section::is_input_address_mapped,
10649         Output_section::output_offset, Output_section::output_address):
10650         Use output section data maps to speed up searching.
10651         (Output_section::find_starting_output_address): Add comments.
10652         (Output_section::do_write,
10653         Output_section::write_to_postprocessing_buffer): Do code-fill
10654         generation as appropriate.
10655         (Output_section::get_input_sections): Invalidate relaxed input section
10656         map.
10657         (Output_section::restore_states): Adjust type of checkpoint .
10658         Invalidate relaxed input section map.
10659         * output.h (Output_merge_base): New class declaration.
10660         (Input_section_specifier): New class defintion.
10661         (class Output_relaxed_input_section) Change base class to
10662         Output_section_data_build.
10663         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10664         base class initializer.
10665         (Output_section::add_relaxed_input_section): New method declaration.
10666         (Output_section::Input_section): Change visibility to protected.
10667         (Output_section::Input_section::relobj,
10668         Output_section::Input_section::shndx): Handle relaxed input sections.
10669         Output_section::input_sections) Change visibility to protected.  Also
10670         define overload to return a non-const pointer.
10671         (Output_section::Merge_section_properties): New class defintion.
10672         (Output_section::Merge_section_by_properties_map,
10673         Output_section::Output_section_data_by_input_section_map,
10674         Output_section::Relaxation_map): New types.
10675         (Output_section::relax_input_section): Rename method to
10676         Output_section::convert_input_sections_to_relaxed_sections and change
10677         interface to take a vector of relaxed section pointers.
10678         (Output_section::find_merge_section,
10679         Output_section::find_relaxed_input_section,
10680         Output_section::build_relaxation_map,
10681         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10682         New method declarations.
10683         (Output_section::merge_section_map_
10684         Output_section::merge_section_by_properties_map_,
10685         Output_section::relaxed_input_section_map_,
10686         Output_section::is_relaxed_input_section_map_valid_,
10687         Output_section::generate_code_fills_at_write_): New data members.
10688         * script-sections.cc
10689         (Output_section_element_input::set_section_addresses): Call
10690         current_data_size and addralign methods of relaxed input sections.
10691         (Orphan_output_section::set_section_addresses): Call current_data_size
10692         and addralign methods of relaxed input sections.
10693         * symtab.cc (Symbol_table::compute_final_value): Extract template
10694         from the body of Symbol_table::sized_finalize_symbol.
10695         (Symbol_table::sized_finalized_symbol): Call
10696         Symbol_table::compute_final_value.
10697         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10698         (Symbol_table::compute_final_value): New templated method declaration.
10699         * target.cc (Target::do_make_output_section): New method defintion.
10700         * target.h (Target::make_output_section): New method declaration.
10701         (Target::relax): Add more parameters for input objects, symbol table
10702         and layout.  Adjust call to do_relax.
10703         (Target::do_make_output_section): New method declaration.
10704         (Target::do_relax): Add parameters for input objects, symbol table
10705         and layout.
10706
10707 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10708
10709         * pread.c: Include stdio.h.
10710
10711 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10712
10713         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10714         defined.
10715
10716 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10717
10718         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10719         Change read_shndx type to unsigned int.
10720         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10721         int.
10722         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10723         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10724         Change read_shndx type to unsigned int.
10725         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10726         int.
10727         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10728         * layout.cc (Layout::create_symtab_sections): Cast the result of
10729         local_symcount * symsize to off_t in the gold_assert.
10730
10731 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10732
10733         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10734         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10735         R_ARM_BASE_ABS.
10736         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10737         (Arm_relocate_functions::thm_abs5): New function.
10738         (Arm_relocate_functions::abs12): New function.
10739         (Arm_relocate_functions::abs16): New function.
10740         (Arm_relocate_functions::base_abs): New function.
10741         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10742         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10743         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10744         R_ARM_BASE_ABS.
10745         (Scan::global): Likewise.
10746         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10747         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10748         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10749         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10750         R_ARM_BASE_ABS.
10751
10752 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10753
10754         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10755         (Arm_relocate_functions::movt_prel): New function.
10756         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10757         (Arm_relocate_functions::thm_movt_prel): New function.
10758         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10759         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10760         (Scan::global, Relocate::relocate): Likewise.
10761         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10762
10763 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10764
10765         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10766         Incremental_checker.
10767         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10768         unsigned int.
10769         (class Incremental_inputs_header): New class.
10770         (Incremental_inputs_header_writer): Edit comment.
10771         (Incremental_inputs_entry): New class.
10772         (Incremental_inputs_entry_writer): Edit comment.
10773         (Sized_incremental_binary::do_find_incremental_inputs_section):
10774         Add *strtab_shndx parameter, fill it.
10775         (Sized_incremental_binary::do_check_inputs): New method.
10776         (Incremental_checker::can_incrementally_link_output_file): Use
10777         Sized_incremental_binary::check_inputs.
10778         (Incremental_inputs::report_command_line): Save command line in
10779         command_line_.
10780         * incremental.h:
10781         (Incremental_binary::find_incremental_inputs_section): New
10782         method.
10783         (Incremental_binary::do_find_incremental_inputs_section): Add
10784         strtab_shndx parameter.
10785         (Incremental_binary::do_check_inputs): New pure virtual method.
10786         (Sized_incremental_binary::do_check_inputs): Declare.
10787         (Incremental_checker::Incremental_checker): Add incremental_inputs
10788         parameter, use it to initialize incremental_inputs_.
10789         (Incremental_checker::incremental_inputs_): New field.
10790         (Incremental_checker::command_line): New method.
10791         (Incremental_checker::inputs): New method.
10792         (Incremental_checker::command_line_): New field.
10793
10794 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10795
10796         * incremental.cc: Include <cstdarg> and "target-select.h".
10797         (vexplain_no_incremental): New function.
10798         (explain_no_incremental): New function.
10799         (Incremental_binary::error): New method.
10800         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10801         method.
10802         (make_sized_incremental_binary): New function.
10803         (open_incremental_binary): New function.
10804         (can_incrementally_link_file): Add checks if output is ELF and has
10805         inputs section.
10806         * incremental.h: Include "elfcpp_file.h" and "output.h".
10807         (Incremental_binary): New class.
10808         (Sized_incremental_binary): New class.
10809         (open_incremental_binary): Declare.
10810         * object.cc (is_elf_object): Use
10811         elfcpp::Elf_recognizer::is_elf_file.
10812         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10813         * output.h (Output_file::filesize): New method.
10814
10815 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10816
10817         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10818         New function.
10819         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10820         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10821         function.
10822         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10823         function.
10824         (Arm_relocate_functions::movw_abs_nc): New function.
10825         (Arm_relocate_functions::movt_abs): New function.
10826         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10827         (Arm_relocate_functions::thm_movt_abs): New function.
10828         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10829         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10830         (Scan::global): Likewise.
10831         (Relocate::relocate): Likewise.
10832         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10833
10834 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10835
10836         * arm.cc (Arm_relocate_functions::got_prel) New function.
10837         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10838         (Relocate::relocate): Likewise.
10839         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10840
10841 2009-10-06  Ian Lance Taylor  <iant@google.com>
10842
10843         * options.h (class General_options): Define
10844         split_stack_adjust_size parameter.
10845         * object.h (class Object): Add uses_split_stack_ and
10846         has_no_split_stack_ fields.  Add uses_split_stack and
10847         has_no_split_stack accessor functions.  Declare
10848         handle_split_stack_section.
10849         (class Reloc_symbol_changes): Define.
10850         (class Sized_relobj): Define Function_offsets.  Declare
10851         split_stack_adjust, split_stack_adjust_reltype, and
10852         find_functions.
10853         * object.cc (Object::handle_split_stack_section): New function.
10854         (Sized_relobj::do_layout): Call handle_split_stack_section.
10855         * dynobj.cc (Sized_dynobj::do_layout): Call
10856         handle_split_stack_section.
10857         * reloc.cc (Sized_relobj::relocate_sections): Call
10858         split_stack_adjust for executable sections in split_stack
10859         objects.  Pass reloc_map to relocate_section.
10860         (Sized_relobj::split_stack_adjust): New function.
10861         (Sized_relobj::split_stack_adjust_reltype): New function.
10862         (Sized_relobj::find_functions): New function.
10863         * target-reloc.h: Include "object.h".
10864         (relocate_section): Add reloc_symbol_changes parameter.  Change
10865         all callers.
10866         * target.h (class Target): Add calls_non_split method.  Declare
10867         do_calls_non_split virtual method.  Declare match_view and
10868         set_view_to_nop.
10869         * target.cc: Include "elfcpp.h".
10870         (Target::do_calls_non_split): New function.
10871         (Target::match_view): New function.
10872         (Target::set_view_to_nop): New function.
10873         * gold.cc (queue_middle_tasks): Give an error if mixing
10874         split-stack and non-split-stack objects with -r.
10875         * i386.cc (Target_i386::relocate_section): Add
10876         reloc_symbol_changes parameter.
10877         (Target_i386::do_calls_non_split): New function.
10878         * x86_64.cc (Target_x86_64::relocate_section): Add
10879         reloc_symbol_changes parameter.
10880         (Target_x86_64::do_calls_non_split): New function.
10881         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10882         parameter.
10883         * powerpc.cc (Target_powerpc::relocate_section): Add
10884         reloc_symbol_changes parameter.
10885         * sparc.cc (Target_sparc::relocate_section): Add
10886         reloc_symbol_changes parameter.
10887         * configure.ac: Call AM_CONDITIONAL for the default target.
10888         * configure: Rebuild.
10889         * testsuite/Makefile.am (TEST_AS): New variable.
10890         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10891         (check_DATA): Add split_i386 and split_x86_64 files.
10892         (SPLIT_DEFSYMS): Define.
10893         (split_i386_[1234n].o): New targets.
10894         (split_i386_[124]): New targets.
10895         (split_i386_[1234r].stdout): New targets.
10896         (split_x86_64_[1234n].o): New targets.
10897         (split_x86_64_[124]): New targets.
10898         (split_x86_64_[1234r].stdout): New targets.
10899         (MOSTLYCLEANFILES): Add new executables.
10900         * testsuite/split_i386.sh: New file.
10901         * testsuite/split_x86_64.sh: New file.
10902         * testsuite/split_i386_1.s: New file.
10903         * testsuite/split_i386_2.s: New file.
10904         * testsuite/split_i386_3.s: New file.
10905         * testsuite/split_i386_4.s: New file.
10906         * testsuite/split_i386_n.s: New file.
10907         * testsuite/split_x86_64_1.s: New file.
10908         * testsuite/split_x86_64_2.s: New file.
10909         * testsuite/split_x86_64_3.s: New file.
10910         * testsuite/split_x86_64_4.s: New file.
10911         * testsuite/split_x86_64_n.s: New file.
10912         * testsuite/testfile.cc (Target_test): Update relocation_section
10913         function.
10914         * testsuite/Makefile.in: Rebuild.
10915
10916 2009-10-06  Ian Lance Taylor  <iant@google.com>
10917
10918         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10919         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10920         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10921         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10922         the address on ldo_addrs_.
10923         (Target_i386::Relocate::fix_up_ldo): New function.
10924
10925 2009-10-06   Rafael Espindola  <espindola@google.com>
10926
10927         * plugin.cc (add_input_library): New.
10928         (Plugin::load): Add add_input_library to tv.
10929         (Plugin_manager::add_input_file): Add the is_lib argument.
10930         (add_input_file): Update call to Plugin_manager::add_input_file.
10931         (add_input_library): New.
10932         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10933
10934 2009-09-30  Doug Kwan  <dougkwan@google.com>
10935
10936         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10937         symbol and call Symbol::may_need_copy_reloc to determine if
10938         a copy reloc is needed.
10939         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10940         nocopyreloc is given in command line.
10941         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10942         given in command line.
10943         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10944         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10945         of the removed Target_i386::may_need_copy_reloc.
10946         * options.h (copyreloc): New option with default value false.
10947         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10948         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10949         instead of the removed Target_powerpc::may_need_copy_reloc.
10950         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10951         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10952         instead of the removed Target_sparc::may_need_copy_reloc.
10953         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10954         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10955         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10956         instead of the removed Target_x86_64::may_need_copy_reloc.
10957
10958 2009-09-30  Ian Lance Taylor  <iant@google.com>
10959
10960         * object.h (class Object): Remove target_ field, and target,
10961         sized_target, and set_target methods.
10962         (Object::sized_target): Remove.
10963         (class Sized_relobj): Update declarations.  Remove sized_target.
10964         * object.cc (Sized_relobj::setup): Remove target parameter.
10965         Change all callers.
10966         (Input_objects::add_object): Don't do anything with the target.
10967         (make_elf_sized_object): Add punconfigured parameter.  Change all
10968         callers.  Set or test parameter target.
10969         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10970         Change all callers.
10971         * parameters.cc (Parameters::set_target): Change parameter type to
10972         be non-const.
10973         (Parameters::default_target): Remove.
10974         (set_parameters_target): Change parameter type to be non-const.
10975         (parameters_force_valid_target): New function.
10976         (parameters_clear_target): New function.
10977         * parameters.h (class Parameters): Update declarations.  Remove
10978         default_target method.  Add sized_target and clear_target
10979         methods.  Change target_ to be non-const.
10980         (set_parameters_target): Update declaration.
10981         (parameters_force_valid_target): Declare.
10982         (parameters_clear_target): Declare.
10983         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10984         as NULL if we aren't searching.
10985         (Add_symbols::run): Don't check for compatible target.
10986         * fileread.cc (Input_file::open_binary): Call
10987         parameters_force_valid_target.
10988         * gold.cc (queue_middle_tasks): Likewise.
10989         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10990         set_target on object.
10991         * dynobj.h (class Sized_dynobj): Update declarations.
10992         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10993         make_elf_object returns NULL.
10994         (Archive::include_member): Don't check whether object target is
10995         compatible.
10996         * output.cc (Output_section::add_input_section): Get target from
10997         parameters.
10998         (Output_section::relax_input_section): Likewise.
10999         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11000         parameters.
11001         (Sized_relobj::do_scan_relocs): Likewise.
11002         (Sized_relobj::relocate_sections): Likewise.
11003         * resolve.cc (Symbol_table::resolve): Likewise.
11004         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11005         parameter.  Change all callers.
11006         (Symbol_table::add_from_object): Get target from parameters.
11007         (Symbol_table::add_from_relobj): Don't check object target.
11008         (Symbol_table::add_from_dynobj): Likewise.
11009         (Symbol_table::define_special_symbol): Get target from
11010         parameters.
11011         * symtab.h (class Symbol_table): Update declaration.
11012         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11013         parameter.  Change all callers.  Clear parameter target.
11014         (Binary_test): Test target here.
11015         * testsuite/object_unittest.cc (gold_testsuite): Remove
11016         target_test_pointer parameter.  Change all callers.
11017         (Object_test): Test target here.
11018
11019 2009-09-26  Ian Lance Taylor  <iant@google.com>
11020
11021         * testsuite/initpri1.c: Don't try to use constructor priorities if
11022         compiling with gcc before 4.3.
11023
11024 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11025
11026         * testsuite/retain_symbols_file_test.sh (check_present): Change
11027         output file name to retain_symbols_file_test.stdout.
11028         (check_absent): Likewise.
11029
11030 2009-09-18  Craig Silverstein  <csilvers@google.com>
11031
11032         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11033         * options.cc: Include <cerrno> and <fstream>.
11034         (General_options::finalize): Parse -retain-symbols-file tag.
11035         * options.h: New flag.
11036         (General_options): New method should_retain_symbol, new
11037         variable symbols_to_retain.
11038         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11039         should_retain_symbol map.
11040         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11041         * testsuite/Makefile.in: Regenerate.
11042         * testsuite/retain_symbols_file_test.sh: New file.
11043
11044 2009-09-18  Nick Clifton  <nickc@redhat.com>
11045
11046         * po/es.po: Updated Spanish translation.
11047
11048 2009-09-17  Doug Kwan  <dougkwan@google.com>
11049
11050         * debug.h (DEBUG_RELAXATION): New constant.
11051         (DEBUG_ALL): Add DEBUG_RELAXATION.
11052         (debug_string_to_enum): Add relaxation debug option.
11053         * layout.cc
11054         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11055         Layout::Relaxation_debug_check::read_sections,
11056         Layout::Relaxation_debug_check::read_sections): New method definitions.
11057         (Layout::Layout): Initialize data members
11058         record_output_section_data_from_scrips_,
11059         script_output_section_data_list_ and relaxation_debug_check_.
11060         (Layout::save_segments, Layout::restore_segments,
11061         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11062         Layout::relaxation_loop_body): New method definitions.
11063         (Layout::finalize): Support relaxation.  Move section layout code to
11064         Layout::relaxation_loop_body.
11065         (Layout::set_asection_address_from_script): Move code for orphan
11066         section placement out.
11067         (Layout::place_orphan_sections_in_script): New method definition.
11068         * layout.h (Output_segment_headers, Output_file_header):
11069         New forward class declarations.
11070         (Layout::~Layout): Define.
11071         (Layout::new_output_section_data_from_script): New method definition.
11072         (Layout::place_orphan_sections_in_script): New method declaration.
11073         (Layout::Segment_states): New type declaration.
11074         (Layout::save_segments, Layout::restore_segments,
11075         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11076         Layout::relaxation_loop_body): New method declarations.
11077         (Layout::Output_section_data_list): New type declaration.
11078         (Layout::Relaxation_debug_check): New class definition.
11079         (Layout::record_output_section_data_from_script_,
11080         Layout::script_output_section_data_list_, Layout::segment_states_,
11081         Layout::relaxation_debug_check_): New data members.
11082         * output.cc: (Output_section_headers::do_size): New method definition.
11083         (Output_section_headers::Output_section_headers): Move size
11084         computation to Output_section_headers::do_size.
11085         (Output_segment_headers::do_size): New method definition.
11086         (Output_file_header::Output_file_header): Move size computation to
11087         Output_file_header::do_size and call it.
11088         (Output_file_header::do_size): New method definition.
11089         (Output_data_group::Output_data_group): Adjust call to
11090         Output_section_data.
11091         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11092         (Output_symtab_xindex::do_write): Add array bound check.
11093         (Output_section::Input_section::print_to_mapfile): Handle
11094         RELAXED_INPUT_SECTION_CODE.
11095         (Output_section::Output_section): Initialize data member checkpoint_.
11096         (Output_section::~Output_section): Delete checkpoint object pointed
11097         by checkpoint_.
11098         (Output_section::add_input_section): Always add an Input_section if
11099         relaxing.
11100         (Output_section::add_merge_input_section): Add assert.
11101         (Output_section::relax_input_section): New method definition.
11102         (Output_section::set_final_data_size): Set load address to zero for
11103         an unallocated section.
11104         (Output_section::do_address_and_file_offset_have_reset_values):
11105         New method definition.
11106         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11107         Handle relaxed input section.
11108         (Output_section::sort_attached_input_sections): Checkpoint input
11109         section list lazily.
11110         (Output_section::get_input_sections): Change type of input_sections to
11111         list of Simple_input_section pointers.  Checkpoint input section list
11112         lazily.  Also handle relaxed input sections.
11113         (Output_section::add_input_section_for_script): Take a reference to
11114         a Simple_input_section object instead of Relobj pointer and section
11115         index as parameter.  Handle relaxed input sections.
11116         (Output_section::save_states, Output_section::restore_states): New
11117         method definitions.
11118         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11119         (Output_data::is_data_size_fixed): New method definition.
11120         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11121         if it is fixed.
11122         (Output_data::address_and_file_offset_have_reset_values): New method
11123         definition.
11124         (Output_data::do_address_and_file_offset_have_reset_values): New method
11125         definition.
11126         (Output_data::set_data_size): Check that data size is not fixed.
11127         (Output_data::fix_data_size): New method definition.
11128         (Output_data::is_data_size_fixed_): New data member.
11129         (Output_section_headers::set_final_data_size): New method definition.
11130         (Output_section_headers::do_size): New method declaration.
11131         (Output_segment_headers::set_final_data_size): New method definition.
11132         (Output_segment_headers::do_size): New method declaration.
11133         (Output_file_header::set_final_data_size)::New method definition.
11134         (Output_file_header::do_size)::New method declaration.
11135         (Output_section_data::Output_section_data): Add new parameter
11136         is_data_size_fixed and use it to fix data size.
11137         (Output_data_const::Output_data_const): Adjust call to base class
11138         constructor and fix data size.
11139         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11140         base class constructor and fix data size.
11141         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11142         base class constructor and fix data size.
11143         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11144         class constructor and fix data size.
11145         (Output_data_group::set_final_data_size): New method definition.
11146         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11147         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11148         class constructor and fix data size.
11149         (Output_relaxed_input_section): New class definition.
11150         (Output_section::Simple_input_section): New class definition.
11151         (Output_section::get_input_sections): Adjust parameter list.
11152         (Output_section::add_input_section_for_script): Same.
11153         (Output_section::save_states, Output_section::restore_states,
11154         Output_section::do_address_and_file_offset_have_reset_values,
11155         (Output_section::Input_section::Input_section): Handle
11156         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11157         Output_relaxed_input_section.
11158         (Output_section::Input_section::is_input_section,
11159         Output_section::Input_section::set_output_section): Handle relaxed
11160         input section.
11161         (Output_section::Input_section::is_relaxed_input_section,
11162         Output_section::Input_section::output_section_data,
11163         Output_section::Input_section::relaxed_input_section): New method
11164         definitions.
11165         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11166         value.
11167         (Output_section::Input_section::u1_): Update comments.
11168         (Output_section::Input_section::u2_): Add new union member poris.
11169         (Output_section::Checkpoint_output_section): New classs definition.
11170         (Output_section::relax_input_section): New method declaration.
11171         (Output_section::checkpoint_): New data member.
11172         (Output_segment): Update comments.
11173         (Output_segment::Output_segment): Un-privatize copy constructor.
11174         (Output_segment::operator=): Un-privatize.
11175         * script-sections.cc (Output_section_element::Input_section_list):
11176         Change element type to Output_section::Simple_input_section.
11177         (Output_section_element_dot_assignment::set_section_addresses):
11178         Register output section data for relaxation clean up.
11179         (Output_data_exression::Output_data_expression): Adjust call to base
11180         constructor to fix data size.
11181         (Output_section_element_data::set_section_addresses): Register
11182         Output_data_expression object for relaxation clean up.
11183         (struct Input_section_info): Replace Relobj pointer and section index
11184         pair with Output_section::Simple_input_section and Convert struct to a
11185         class.
11186         (Input_section_sorter::operator()): Adjust access to
11187         Input_section_info data member to use accessors.
11188         (Output_section_element_input::set_section_addresses): Use layout
11189         parameter.  Adjust code to use Output_section::Simple_input_section
11190         and Input_secction_info classes.  Register filler for relaxation
11191         clean up.
11192         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11193         and section index pair with Output_section::Simple_input_section
11194         class.  Adjust code accordingly.
11195         (Phdrs_element::release_segment): New method definition.
11196         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11197         segment list.
11198         (Script_sections::release_segments): New method definition.
11199         * gold/script-sections.h (Script_sections::release_segments): New
11200         method declaration.
11201         * gold/target.h (Target::may_relax, Target::relax,
11202         Target::do_may_relax, Target::do_relax): New method definitions.
11203
11204 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11205
11206         * arm.cc (has_signed_unsigned_overflow): New function.
11207         (Arm_relocate_functions::abs8): New function.
11208         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11209         (Target_arm::Scan::global): Likewise.
11210         (Target_arm::relocate::relocate): Likewise.
11211         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11212         Likewise.
11213
11214 2009-09-16  Cary Coutant  <ccoutant@google.com>
11215
11216         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11217         * testsuite/Makefile.in: Regenerate.
11218
11219 2009-09-11  Nick Clifton  <nickc@redhat.com>
11220
11221         * po/gold.pot: Updated by the Translation project.
11222
11223 2009-09-08  Cary Coutant  <ccoutant@google.com>
11224
11225         * output.cc (Output_file::open): Add execute permission to empty file.
11226         * testsuite/Makefile.am (permission_test): New test.
11227         * testsuite/Makefile.in: Regenerate.
11228
11229 2009-09-02  Ian Lance Taylor  <iant@google.com>
11230
11231         * output.cc (Output_file::resize): Call map_no_anonymous rather
11232         than map.
11233
11234 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11235
11236         * gold.cc: Include "incremental.h".
11237         (queue_initial_tasks): Call Incremental_checker methods.
11238         * incremental.cc: Include "output.h".
11239         (Incremental_checker::can_incrementally_link_output_file): New
11240         method.
11241         * incremental.h (Incremental_checker): New class.
11242
11243         * output.cc (Output_file::open_for_modification): New method.
11244         (Output_file::map_anonymous): Changed return type to bool.  Record
11245         map in base_ field.
11246         (Output_file::map_no_anonymous): New method, broken out of map.
11247         (Output_file::map): Use map_no_anonymous and map_anonymous.
11248         * output.h (class Output_file): Update declarations.
11249
11250 2009-08-24  Cary Coutant  <ccoutant@google.com>
11251
11252         * options.h (Command_line::Pre_options): New class.
11253         (Command_line::pre_options): New member.
11254         * options.cc (gold::options::ready_to_register): New variable.
11255         (One_option::register_option): Do nothing if not registering options.
11256         Assert if same short option registered twice.
11257         (General_options::General_options): Turn off option registration when
11258         done constructing.
11259         (Command_line::Pre_options::Pre_options): New constructor.
11260
11261 2009-08-24  Cary Coutant  <ccoutant@google.com>
11262
11263         * options.h (General_options::no_keep_memory): Remove incorrect
11264         short option.
11265
11266 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11267
11268         * Makefile.am (am__skiplex, am__skipyacc): New.
11269         * Makefile.in: Regenerate.
11270
11271 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11272
11273         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11274         (INCLUDES): ... this.
11275         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11276         (AM_CPPFLAGS): Renamed from ...
11277         (INCLUDE): ... this.
11278         * Makefile.in, testsuite/Makefile.in: Regenerate.
11279
11280         * Makefile.in: Regenerate.
11281         * aclocal.m4: Likewise.
11282         * config.in: Likewise.
11283         * configure: Likewise.
11284         * testsuite/Makefile.in: Likewise.
11285
11286         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11287         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11288         * Makefile.in: Regenerate.
11289         * testsuite/Makefile.in: Regenerate.
11290
11291 2009-08-19  Cary Coutant  <ccoutant@google.com>
11292
11293         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11294         symbols in shared libraries overridden by hidden or internal symbols
11295         in the main program.
11296
11297 2009-08-19  Chris Demetriou  <cgd@google.com>
11298
11299         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11300         checking source file names in error messages.
11301
11302 2009-08-18  Doug Kwan  <dougkwan@google.com>
11303
11304         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11305         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11306         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11307         an elfcpp::Ehdr as parameter.
11308         * object.cc (Object::set_target): Remove the version that looks up
11309         a target and sets it.
11310         (Sized_relobj::setup): Take a Target object instead of
11311         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11312         (make_elf_sized_object): Find target and ask target to
11313         make an ELF object.
11314         * object.h: (Object::set_target): Remove the version that looks up
11315         a target and sets it.
11316         (Sized_relobj::setup): Take a Target object instead of
11317         an elfcpp:Ehdr as parameter.
11318         * target.cc: Include dynobj.h.
11319         (Target::do_make_elf_object_implementation): New.
11320         (Target::do_make_elf_object): New.
11321         * target.h (Target::make_elf_object): New template declaration.
11322         (Target::do_make_elf_object): New method declarations.
11323         (Target::do_make_elf_object_implementation): New template declaration.
11324
11325 2009-08-14  Ian Lance Taylor  <iant@google.com>
11326
11327         * gold.h (FUNCTION_NAME): Define.
11328         (gold_unreachable): Use FUNCTION_NAME.
11329
11330 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11331
11332         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11333         symbol in the --keep-unique list is not found.
11334
11335 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11336
11337         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11338         been maked as --keep-unique.
11339         (Icf::unfold_section): New function.
11340         * icf.h (Icf::unfold_section): New function.
11341         * options.h (General_options::keep_unique): New option.
11342         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11343         * testsuite/Makefile.in: Regenerate.
11344         * testsuite/icf_keep_unique_test.sh: New file.
11345         * testsuite/icf_keep_unique_test.cc: New file.
11346
11347 2009-08-12  Cary Coutant  <ccoutant@google.com>
11348
11349         PR 10471
11350         * resolve.cc (Symbol_table::resolve): Check for references from
11351         dynamic objects to hidden and internal symbols.
11352         * testsuite/Makefile.am (hidden_test.sh): New test.
11353         * testsuite/Makefile.in: Regenerate.
11354         * testsuite/hidden_test.sh: New script.
11355         * testsuite/hidden_test_1.c: New test source.
11356         * testsuite/hidden_test_main.c: New test source.
11357
11358 2009-08-11  Doug Kwan  <dougkwan@google.com>
11359
11360         * arm.cc: Update comments.
11361         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11362         segment to locate the .ARM.exidx section if present.
11363
11364 2009-08-09  Doug Kwan  <dougkwan@google.com>
11365
11366         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11367         patch.
11368
11369 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11370         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11371         compiler warnings.
11372
11373 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11374
11375         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11376         valid tls_segment only for non-debug-section relocations.
11377         * testsuite/Makefile.am: Add gc_tls_test.
11378         * testsuite/Makefile.in: Regenerate.
11379         * testsuite/gc_tls_test.cc: New file.
11380         * testsuite/gc_tls_test.sh: New file.
11381
11382 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11383
11384         * icf.cc: New file.
11385         * icf.h: New file.
11386         * Makefile.am (CCFILES): Add icf.cc.
11387         (HFILES): Add icf.h
11388         * Makefile.in: Regenerate.
11389         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11390         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11391         section, symbol and addend information for the relocs.
11392         * gold.cc (queue_middle_tasks): Call identical code folding.
11393         * gold.h: Add defines for multimap.
11394         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11395         to the call of finalize_local_symbols.
11396         * main.cc (main): Create object of class Icf.
11397         * object.cc (Sized_relobj::do_layout): Allow this function to be
11398         called twice during icf.
11399         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11400         to sections marked as identical by icf.
11401         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11402         when available.
11403         (Sized_relobj::do_section_entsize): New function.
11404         * object.h (Object::section_entsize): New function.
11405         (Object::do_section_entsize): New pure virtual function.
11406         (Relobj::finalize_local_symbols): Add new parameter.
11407         (Relobj::do_section_entsize): New function.
11408         * options.h (General_options::icf): New option.
11409         (General_options::icf_iterations): New option.
11410         (General_options::print_icf_sections): New option.
11411         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11412         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11413         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11414         icf.
11415         * symtab.cc (Symbol_table::is_section_folded): New function.
11416         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11417         to sections marked as identical by icf.
11418         * symtab.h (Symbol_table::set_icf): New function.
11419         (Symbol_table::icf): New function.
11420         (Symbol_table::is_section_folded): New function.
11421         (Symbol_table::icf_): New data member.
11422         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11423         * testsuite/Makefile.am: Add commands to build icf_test.
11424         * testsuite/Makefile.in: Regenerate.
11425         * testsuite/icf_test.sh: New file.
11426         * testsuite/icf_test.cc: New file.
11427
11428 2009-07-24  Chris Demetriou  <cgd@google.com>
11429
11430         * layout.cc (is_compressible_debug_section): Fix incorrect
11431         comment about compressed section names.
11432
11433 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11434
11435         PR 10419
11436         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11437
11438 2009-07-16  Ian Lance Taylor  <iant@google.com>
11439
11440         PR 10400
11441         * layout.h: #include <map>.
11442         (class Kept_section): Change from struct to class.  Add accessors
11443         and setters.  Add section size to Comdat_group mapping.  Change
11444         Comdat_group to std::map.  Add is_comdat_ field.  Add
11445         linkonce_size field in union.
11446         (class Layout): Update declaration of find_or_add_kept_section.
11447         Don't declare find_kept_object.
11448         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11449         parameter.  Add object, shndx, is_comdat, and is_group_name
11450         parameters.  Change all callers.  Adjust for new Kept_section.
11451         (Layout::find_kept_object): Remove.
11452         * object.cc (Sized_relobj::include_section_group): Update use of
11453         Kept_section.  Rename secnum to shndx.  Only record
11454         Kept_comdat_section if sections are the same size.
11455         (Sized_relobj::include_linkonce_section): Update use of
11456         Kept_section.  Only record Kept_comdat_section if sections are the
11457         same size.  Set size of linkonce section.
11458         (Sized_relobj::map_to_kept_section): Update call to
11459         get_kept_comdat_section.
11460         * object.h (class Sized_relobj): Rename fields in
11461         Kept_comdat_section to drop trailing underscores; change object
11462         field to Relobj*.  Change Kept_comdat_section_table to store
11463         struct rather than pointer.
11464         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11465         Add kept_object and kept_shndx parameters.  Change all callers.
11466         (Sized_relobj::get_kept_comdat_section): Change return type to
11467         bool.  Add kept_object and kept_shndx parameters.  Change all
11468         callers.
11469         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11470         Layout::find_or_add_kept_section.
11471
11472 2009-07-09  Ian Lance Taylor  <iant@google.com>
11473
11474         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11475         Reserve space in the hash table.
11476
11477 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11478
11479         * fileread.cc (File_read::get_mtime): New method.
11480         * fileread.h (Timespec): New structure.
11481         (File_read::get_mtime): New method.
11482         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11483         Renamed from timestamp_nsec.
11484         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11485         Elf_Xword.
11486         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11487         timestamp_nsec.
11488         (Incremental_inputs::report_archive): Save mtime; style fix.
11489         (Incremental_inputs::report_obejct): Save mtime; style fix.
11490         (Incremental_inputs::report_script): Save mtime; style fix.
11491         (Incremental_inputs::finalize_inputs): Style fix.
11492         (Incremental_inputs::finalize): Style fix.
11493         (Incremental_inputs::create_input_section_data): Store inputs
11494         mtime.
11495         * incremental.h (Incremental_inputs::report_script): Add mtime
11496         argument.
11497         (Incremental_inputs::Input_info::Input_info): Intialize only one
11498         union member.
11499         (Incremental_inputs::Input_info::archive): Move to nameless
11500         union.
11501         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11502         (Incremental_inputs::Input_info::script): Move to nameless union.
11503         (Incremental_inputs::mtime): New field.
11504         * script.cc (read_input_script): Pass file mtime to
11505         Incremental_input.
11506         * script.h (Script_info::inputs): Style fix.
11507
11508 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11509
11510         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11511         instead of 32.
11512
11513 2009-06-24  Ian Lance Taylor  <iant@google.com>
11514
11515         PR 10156
11516         * layout.cc (Layout::choose_output_section): If we find an
11517         existing section, update the flags.
11518         (Layout::create_notes): New function, broken out of
11519         Layout::finalize.
11520         (Layout::finalize): Don't create note sections.
11521         (Layout::create_note): Don't crash if linker script discards
11522         section.
11523         (Layout::create_gold_note): Likewise.
11524         (Layout::create_build_id): Likewise.  Don't set
11525         after_input_sections on the section.
11526         (Layout::create_executable_stack_info): Remove target parameter.
11527         Change caller.
11528         * layout.h (class Layout): Declare create_notes.  Update
11529         declaration of create_executable_stack_info.
11530         * gold.cc (queue_middle_tasks): Call create_notes.
11531         * output.cc (Output_section::update_flags_for_input_section): Move
11532         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11533         invalid.
11534         * output.h (Output_data::mark_address_invalid): New function.
11535         (class Output_section): Only declare, not define,
11536         update_flags_for_input_section.  Remove set_flags.
11537
11538 2009-06-24  Ian Lance Taylor  <iant@google.com>
11539
11540         * script-sections.cc (Output_section_definition::
11541         set_section_addresses): Rename shadowing local load_address to
11542         laddr.
11543
11544 2009-06-24  Ian Lance Taylor  <iant@google.com>
11545
11546         PR 10244
11547         * reloc.cc (relocate_sections): Skip empty relocation sections.
11548
11549 2009-06-23  Ian Lance Taylor  <iant@google.com>
11550
11551         PR 10156
11552         * layout.cc (Layout::create_note): Use choose_output_section
11553         rather than make_output_section.
11554
11555 2009-06-23  Ian Lance Taylor  <iant@google.com>
11556
11557         PR 10237
11558         * options.cc (General_options::parse_V): Set printed_version_.
11559         (General_options::General_options): Initialize printed_version_.
11560         * options.h (class General_options): Add printed_version_ field.
11561         * gold.cc (queue_initial_tasks): If there are no input files,
11562         don't give a fatal error if we printed the version information.
11563         (queue_middle_tasks): If using -r with a shared object, give a
11564         fatal error rather than an ordinary error.
11565
11566 2009-06-23  Ian Lance Taylor  <iant@google.com>
11567
11568         PR 10219
11569         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11570         (Layout::make_output_section): Set have_stabstr_section_ if we see
11571         a .stab*str section.
11572         (Layout::finalize): Call link_stabs_sections.
11573         (Layout::link_stabs_sections): New file.
11574         * layout.h (class Layout): Add have_stabstr_section_ field.
11575         Declare link_stabs_sections.
11576
11577 2009-06-23  Doug Kwan  <dougkwan@google.com>
11578
11579         * Makefile.am (libgold_a_LIBADD): New.
11580         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11581         * Makefile.in: Regenerate.
11582         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11583         * configure: Regenerate.
11584         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11585         * fileread.cc: Include sys/state.h
11586         * gold.h: Declare memmem and strndup if found missing.
11587         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11588
11589 2009-06-23  Ian Lance Taylor  <iant@google.com>
11590
11591         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11592         * configure: Rebuild.
11593
11594 2009-06-23  Ian Lance Taylor  <iant@google.com>
11595
11596         PR 10147
11597         * object.cc (Object::section_contents): Don't try to get a view if
11598         the section has length zero.
11599         (Object::handle_gnu_warning_section): If the section is empty, use
11600         the name of the section as the warning.
11601
11602 2009-06-23  Ian Lance Taylor  <iant@google.com>
11603
11604         PR 10133
11605         * stringpool.h (class Stringpool_template): Add optimize_ field.
11606         (Stringpool_template::set_optimize): New function.
11607         * stringpool.cc (Stringpool_template::Stringpool_template):
11608         Initialize optimize_ field.
11609         (Stringpool_template::set_string_offsets): Test local optimize
11610         fild rather than parameter.
11611         * layout.cc (Layout::Layout): Call set_optimize on the section
11612         name stringpool.
11613
11614 2009-06-22  Ian Lance Taylor  <iant@google.com>
11615
11616         PR 10030
11617         * yyscript.y: Parse TARGET.
11618         * script.cc (script_set_target): New function.
11619         * script-c.h (script_set_target): Declare.
11620         * options.cc (General_options::string_to_object_format): Rename
11621         from string_to_object_format in anonymous namespace.  Change
11622         callers.
11623         * options.h (class General_options): Declare
11624         string_to_object_format.
11625
11626 2009-06-22  Ian Lance Taylor  <iant@google.com>
11627
11628         * script-sections.cc (Script_sections::create_segments): Don't put
11629         program headers in a PT_LOAD segment if -n or -N.
11630
11631 2009-06-22  Ian Lance Taylor  <iant@google.com>
11632
11633         PR 10141
11634         * options.h (class General_options): Add -z lazy and -z now.  Sort
11635         -z options into alphabetical order.
11636         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11637
11638 2009-06-21  Ian Lance Taylor  <iant@google.com>
11639
11640         * layout.cc (Layout::make_output_section): Call
11641         Target::new_output_section.
11642         (Layout::attach_allocated_section_to_segment): Put large section
11643         sections in a separate load segment with the large segment flag
11644         set.
11645         (Layout::segment_precedes): Sort large data segments after other
11646         load segments.
11647         (align_file_offset): New static function.
11648         (Layout::set_segment_offsets): Use align_file_offset.
11649         * output.h (class Output_section): Add is_small_section_ and
11650         is_large_section_ fields.
11651         (Output_section::is_small_section): New function.
11652         (Output_section::set_is_small_section):  New function.
11653         (Output_section::is_large_section): New function.
11654         (Output_section::set_is_large_section): New function.
11655         (Output_section::is_large_data_section): New function.
11656         (class Output_segment): Add is_large_data_segment_ field.
11657         (Output_segment::is_large_data_segment): New function.
11658         (Output_segment::set_is_large_data_segment): New function.
11659         * output.cc (Output_section::Output_section): Initialize new
11660         fields.
11661         (Output_segment::Output_segment): Likewise.
11662         (Output_segment::add_output_section): Add assertion that large
11663         data sections always go in large data segments.  Force small data
11664         sections to the end of the list of data sections.  Force small BSS
11665         sections to the start of the list of BSS sections.  For large BSS
11666         sections to the end of the list of BSS sections.
11667         * symtab.h (class Symbol): Declare is_common_shndx.
11668         (Symbol::is_defined): Check Symbol::is_common_shndx.
11669         (Symbol::is_common): Likewise.
11670         (class Symbol_table): Define enum Commons_section_type.  Update
11671         declarations.  Add small_commons_ and large_commons_ fields.
11672         * symtab.cc (Symbol::is_common_shndx): New function.
11673         (Symbol_table::Symbol_table): Initialize new fields.
11674         (Symbol_table::add_from_object): Put small and large common
11675         symbols in the right list.
11676         (Symbol_table::sized_finalized_symbol): Check
11677         Symbol::is_common_shndx.
11678         (Symbol_table::sized_write_globals): Likewise.
11679         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11680         common symbol lists.  Don't call do_allocate_commons_list if the
11681         list is empty.
11682         (Symbol_table::do_allocate_commons_list): Remove is_tls
11683         parameter.  Add comons_section_type parameter.  Change all
11684         callers.  Handle small and large common symbols.
11685         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11686         Symbol::is_common_shndx.
11687         * resolve.cc (symbol_to_bits): Likewise.
11688         * target.h (Target::small_common_shndx): New function.
11689         (Target::small_common_section_flags): New function.
11690         (Target::large_common_shndx): New function.
11691         (Target::large_common_section_flags): New function.
11692         (Target::new_output_section): New function.
11693         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11694         small_common_section_flags, and large_common_section_flags
11695         fields.
11696         (Target::do_new_output_section): New virtual function.
11697         * arm.cc (Target_arm::arm_info): Initialize new fields.
11698         * i386.cc (Target_i386::i386_info): Likewise.
11699         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11700         Likewise.
11701         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11702         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11703         (Target_x86_64::do_new_output_section): New function.
11704         * configure.ac: Define conditional MCMODEL_MEDIUM.
11705         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11706         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11707         (large_LDFLAGS): Define.
11708         * testsuite/large.c: New file.
11709         * testsuite/testfile.cc (Target_test::test_target_info):
11710         Initialize new fields.
11711         * configure, testsuite/Makefile.in: Rebuild.
11712
11713 2009-06-05  Doug Kwan  <dougkwan@google.com>
11714
11715         * Makefile.am (CCFILES): Add target.cc.
11716         * Makefile.in: Regenerate.
11717         * i386.cc (class Target_i386): Define new virtual method to
11718         override do_is_local_label_name in parent.
11719         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11720         local symbols if --discard-locals or -X is given.
11721         * options.h (class General_options): Declare new options
11722         '--discard-locals' and '-X' for discarding locals.
11723         * target.h (class Target): Define new methods is_local_label_name.
11724         Declare new virtual method do_is_local_label_name.
11725         * target.cc: New file.
11726         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11727         (check_SCRIPTS): Add discard_locals_test.sh.
11728         (check_DATA): Add discard_local_tests.syms.
11729         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11730         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11731         * testsuite/Makefile.in: Regenerate.
11732         * testsuite/discard_locals_test.c: New file.
11733         * testsuite/discard_locals_test.sh: Same.
11734
11735 2009-06-05  Doug Kwan  <dougkwan@google.com>
11736
11737         * object.cc (Sized_relobj::Sized_relobj): Initialize
11738         discarded_eh_frame_shndx_ to -1U.
11739         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11740         section.
11741         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11742         a discarded .eh_frame section.
11743         (Sized_relobj::do_finalize_local_symbols): Ditto.
11744         * object.h (class Sized_relobj): Declare new member
11745         discarded_eh_frame_shndx_.
11746         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11747         (local_labels_test.o, local_labels_test): New rules.
11748         * testsuite/Makefile.in: Regenerate.
11749
11750 2009-06-04  Doug Kwan  <dougkwan@google.com>
11751
11752         * layout.cc (Layout::section_name_mapping): Add mapping for
11753         special ARM sections.
11754
11755 2009-06-03  Doug Kwan  <dougkwan@google.com>
11756
11757         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11758         (utils::has_overflow): Same.
11759
11760 2009-06-03  Ian Lance Taylor  <iant@google.com>
11761
11762         * layout.cc (Layout::section_name_mapping): New array, replacing
11763         Layout::linkonce_mapping.
11764         (Layout::section_name_mapping_count): New variable, replacing
11765         Layout::linkonce_mapping_count.
11766         (Layout::linkonce_output_name): Remove.
11767         (Layout::output_section_name): Rewrite.
11768         * layout.h (class Layout): Rename Linkonce_mapping to
11769         Section_name_mapping, linkonce_mapping to section_name_mapping,
11770         linkonce_mapping_count to section_name_mapping_count.  Don't
11771         declare linkonce_output_name.
11772
11773 2009-06-03  Doug Kwan  <dougkwan@google.com>
11774
11775         * gold/arm.cc (namespace utils): New.
11776         (Target_arm::reloc_is_non_pic): Define new method.
11777         (class Arm_relocate_functions): New.
11778         (Target_arm::Relocate::relocate): Handle relocation types used by
11779         Android.
11780
11781 2009-06-03  Ian Lance Taylor  <iant@google.com>
11782
11783         * arm.cc (Target_arm::scan::global): Use || instead of |.
11784
11785 2009-06-02  Doug Kwan  <dougkwan@google.com>
11786
11787         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11788         issued_non_pic_error_.
11789         (class Target_arm::Scan): Declare new method check_non_pic.
11790         Define new method symbol_needs_plt_entry.
11791         Declare new data member issued_non_pic_error_.
11792         (class Target_arm::Relocate): Declare new method
11793         should_apply_static_reloc.
11794         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11795         (Target_arm::Scan::check_non_pic): Define new method.
11796         (Target_arm::Scan::local): Handle a small subset of reloc types used
11797         by Android.
11798         (Target_arm::Scan::local): Same.
11799         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11800
11801 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11802
11803         * incremental.cc (Incremental_inputs::report_command_line): Filter
11804         out --incremental-* options.
11805
11806 2009-05-29  Doug Kwan  <dougkwan@google.com>
11807
11808         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11809         template class.
11810         (class Target_arm): Update comment.
11811         (Target_arm::Target_arm): Initialize new data members GOT_,
11812         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11813         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11814         and Target_arm::rel_dyn_section.
11815         Declare new_enum Target_arm::Got_type.
11816         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11817         and DYNBSS_.
11818         Update commments for member do_dynsym_value.
11819         (Target_arm::got_size, Target_arm::plt_section,
11820         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11821         new methods inside class defintion.
11822         (Target_arm::got_section): Define new method.
11823         (Target_arm::rel_dyn_section): Same.
11824         (Output_data_plt_arm): New template class.
11825         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11826         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11827         (Output_data_plt_arm::add_entry): Same.
11828         (Output_data_plt_arm::first_plt_entry): Define new
11829         static data member for PLT instruction template.
11830         (Output_data_plt_arm::plt_entry): Same.
11831         (Output_data_plt_arm::do_write): Define new method.
11832         (Target_arm::make_plt_entry): Same.
11833         (Target_arm::do_finalize_sections): Same.
11834         (Target_arm::do_dynsym_value): Same.
11835
11836 2009-05-28  Doug Kwan  <dougkwan@google.com>
11837
11838         * Makefile.am (TARGETSOURCES): Add arm.cc.
11839         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11840         * Makefile.in: Regenerate.
11841         * arm.cc: New file.
11842         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11843
11844 2009-05-26  Doug Kwan  <dougkwan@google.com>
11845
11846         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11847         (General_options::check_excluded_libs): Strip off directories in
11848         archive name before matching like GNU ld does.
11849         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11850         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11851         (exclude_libs_test_LDFLAGS): Add linker option
11852         -Wl,--exclude-libs,libexclude_libs_test_3
11853         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11854         an explicit archive without using -l.
11855         (alt/libexclude_libs_test_3.a): New make rule.
11856         * testsuite/Makefile.in: Regenerate.
11857         * testsuite/exclude_libs_test.c : Declare lib3_default().
11858         (main): Call it.
11859         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11860         * exclude_libs_test_3.c: New file.
11861
11862 2009-05-26  Nick Clifton  <nickc@redhat.com>
11863
11864         * po/id.po: New Indonesian translation.
11865         * po/gold.pot: Updated template file.
11866
11867 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11868
11869         * testsuite/Makefile.am: Add -ffunction-sections to compile
11870         gc_comdat_test files.  Add -Wl,--gc-sections to build
11871         gc_comdat_test.
11872         * testsuite/Makefile.in: Regenerate.
11873         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11874
11875 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11876
11877         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11878         kept comdat section was garbage collected.
11879         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11880         * testsuite/Makefile.in: Regenerate.
11881         * testsuite/gc_comdat_test.sh: New file.
11882         * testsuite/gc_comdat_test_1.cc: New file.
11883         * testsuite/gc_comdat_test_2.cc: New file.
11884
11885 2009-05-19  Doug Kwan  <dougkwan@google.com>
11886
11887         * archive.cc (Archive::Archive): Move constructor from archive.h
11888         to here.  Initialize no_export_.
11889         (Archive::get_elf_object_for_member): Set no_export flag of object.
11890         * archive.h (Archive::Archive): Move constructor body to
11891         archive.cc.
11892         (Archive::no_export): New method.
11893         (Archive::no_export_): New field.
11894         * object.h (Object::Object): Initialize no_export_ to false.
11895         (Object::no_export, Object::set_no_export): New methods.
11896         (Object::no_export_): New field.
11897         * options.cc (General_options::parse_exclude_libs): New method.
11898         (General_options::check_excluded_libs) Same.
11899         * options.h (exclude_libs): New option.
11900         (General_options::check_excluded_libs): New method declaration.
11901         (General_options::excluded_libs_): New field.
11902         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11903         default or protected visibility if an object has no-export flag set.
11904         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11905         (check_SCRIPTS): Add exclude_libs_test.sh.
11906         (check_DATA): Add exclude_libs_test.syms.
11907         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11908         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11909         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11910         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11911         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11912         libexclude_libs_test_2.a): New rules.
11913         * testsuite/Makefile.in: Regenerate.
11914         * testsuite/exclude_libs_test.c: New file.
11915         * testsuite/exclude_libs_test.sh: Ditto.
11916         * testsuite/exclude_libs_test_1.c: Ditto.
11917         * testsuite/exclude_libs_test_2.c: Ditto.
11918
11919 2009-05-15  Ian Lance Taylor  <iant@google.com>
11920
11921         * configure.ac: Check for declarations for cases where libiberty.h
11922         checks HAVE_DECL_xxx.
11923         * configure, config.in: Rebuild.
11924
11925 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11926
11927         * gold.h (Incremental_argument_list): Remove (invalid) forward
11928         declaration.
11929         * incremental.cc (Incremental_inputs::report_achive): New method.
11930         (Incremental_inputs::report_object): New method.
11931         (Incremental_inputs::report_script): New method.
11932         (Incremental_inputs::finalize_inputs): New method.
11933         (Incremental_inputs::finalize): Call finalize_inputs().
11934         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11935         Create inputs entries.
11936         * incremental.h (Incremental_input_type): New enum.
11937         (Incremental_inputs::Incremental_input): Initialize new fields.
11938         (Incremental_inputs::report_inputs): New method.
11939         (Incremental_inputs::report_achive): New method.
11940         (Incremental_inputs::report_object): New method.
11941         (Incremental_inputs::report_script): New method.
11942         (Incremental_inputs::finalize_inputs): New method.
11943         (Incremental_inputs::Input_info): New struct.
11944         (Incremental_inputs::Input_info_map): New typedef.
11945         (Incremental_inputs::lock_): New field.
11946         (Incremental_inputs::Inputs_): New field.
11947         (Incremental_inputs::Inputs_map): New field.
11948         * main.cc (main): Call Incremental_input::report_inputs.
11949         * options.h (Input_argument_list): Typedef moved from
11950         Input_arguments.
11951         (Input_file_group::Files): Remove, use ::Input_argument_list.
11952         (Input_file_group::Input_argument_list): Remove, use
11953         ::Input_argument_list.
11954         * plugin.cc (Plugin_manager::add_input_file): Add error in
11955         incremental build.
11956         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11957         functions.
11958         * script.cc (read_input_script): Call
11959         Incremental_input::report_script.
11960         * script.h (Script_info): New class.
11961
11962 2009-04-27  Ian Lance Taylor  <iant@google.com>
11963
11964         * x86_64.cc (do_adjust_output_section): Set entsize to
11965         plt_entry_size.
11966
11967 2009-04-23  Elliott Hughes  <enh@google.com>
11968
11969         * output.cc (Output_file::close): After short writes, continue
11970         writing from the correct offset in the buffer being written.
11971
11972 2009-04-23  Chris Demetriou  <cgd@google.com>
11973
11974         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11975         * configure: Regenerate.
11976         * config.in: Regenerate.
11977         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11978         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11979
11980 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11981
11982         * incremental.cc (Incremental_inputs_header_data): Renamed from
11983         Incremental_input_header_data.
11984         (Incremental_inputs_header_data::data_size): New field.
11985         (Incremental_inputs_header_data::put_input_file_count): Renamed
11986         from input_file_count.
11987         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11988         from command_line_offset.
11989         (Incremental_inputs_header_data::put_reserved): Renamed from
11990         put_reserved.
11991         (Incremental_inputs_entry_data): Renamed from
11992         Incremental_input_entry_data.
11993         (Incremental_inputs_entry_data::data_size): New field.
11994         (Incremental_inputs::report_command_line): New method.
11995         (Incremental_inputs::finalize): New method.
11996         (Incremental_inputs::create_incremental_inputs_data): New method.
11997         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11998         * incremental.h: New file.
11999         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12000         (Layout::finalize): Create incremental inputs section in
12001         incremental builds.
12002         (Layout::create_incremental_info_sections): New method.
12003         * layout.h (Layout::incremental_inputs): New method.
12004         (Layout::create_incremental_info_sections): New method.
12005         (Layout::incremental_inputs_): New field.
12006         * main.cc (main): Notify Incremental_input of the command line.
12007
12008 2009-04-01  Ian Lance Taylor  <iant@google.com>
12009             Mikolaj Zalewski  <mikolajz@google.com>
12010
12011         * gold.h (reserve_unordered_map): Define, three versions, one for
12012         each version of Unordered_map.
12013         * layout.cc (Layout::Layout): Remove options parameter.  Add
12014         number_of_input_files parameter.  Don't initialize options_.
12015         Initialize number_of_input_files_ and resized_signatures_.  Move
12016         sections_are_attached_.
12017         (Layout::layout_group): Reserve space for group_signatures_.
12018         (Layout::find_or_add_kept_section): Change name parameter to be a
12019         reference.  Resize signatures_ map when it gets large enough.
12020         (Layout::layout_eh_frame): Use parameters->options() instead of
12021         this->options_.
12022         (Layout::make_output_section): Likewise.
12023         (Layout::attach_allocated_section_to_segment): Likewise.
12024         (Layout::finalize, Layout::create_executable_stack): Likewise.
12025         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12026         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12027         * layout.h (class Layout): Update declarations.  Remove options_
12028         field.  Add number_of_input_files_ and resized_signatures_
12029         fields.  Move sections_are_attached_ field.
12030         * main.cc (main): Pass number of input files to Layout
12031         constructor.  Don't pass options.
12032
12033 2009-03-30  Ian Lance Taylor  <iant@google.com>
12034
12035         * ffsll.c (ffsll): Correct implementation.
12036
12037 2009-03-27  Ian Lance Taylor  <iant@google.com>
12038
12039         * ffsll.c: New file.
12040         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12041         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12042         * ftruncate.c (ftruncate): Declare before definition.
12043         * mremap.c (mremap): Likewise.
12044         * pread.c (pread): Likewise.
12045         * configure, Makefile.in, config.in: Rebuild.
12046
12047         * mremap.c: New file.
12048         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12049         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12050         (mremap): Declare if HAVE_MREMAP is not defined.
12051         * configure, Makefile.in, config.in: Rebuild.
12052
12053 2009-03-27  Cary Coutant  <ccoutant@google.com>
12054
12055         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12056         position independent.
12057         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12058         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12059
12060 2009-03-24  Cary Coutant  <ccoutant@google.com>
12061
12062         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12063         an executable.
12064         (needs_dynamic_reloc): Likewise.
12065
12066 2009-03-24  Ian Lance Taylor  <iant@google.com>
12067
12068         * yyscript.y (file_cmd): Recognize EXTERN.
12069         (extern_name_list, extern_name_list_body): New nonterminals.
12070         * script.cc (script_add_extern): Define.
12071         * script-c.h (script_add_extern): Declare.
12072
12073 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12074
12075         * object.cc (is_elf_object): Define.
12076         * object.h (is_elf_object): Declare.
12077         * archive.cc (Archive::get_elf_object_for_member): Call
12078         is_elf_object.
12079         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12080
12081 2009-03-24  Elliott Hughes  <enh@google.com>
12082
12083         * output.cc (Output_file::map_anonymous): Define.
12084         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12085         try an anonymous one.  Report the size if the mmap fails.
12086         * output.h (class Output_file): Declare map_anonymous.
12087
12088 2009-03-24  Ian Lance Taylor  <iant@google.com>
12089
12090         * target-select.cc (instantiate_target): Don't acquire the lock if
12091         the instantiated_target_ field has already been set.
12092
12093 2009-03-23  Ian Lance Taylor  <iant@google.com>
12094
12095         * gold-threads.h (class Initialize_lock): Define.
12096         * gold-threads.cc (class Initialize_lock_once): Define.
12097         (initialize_lock_control): New static variable.
12098         (initialize_lock_pointer): New static variable.
12099         (initialize_lock_once): New static function.
12100         (Initialize_lock::Initialize_lock): Define.
12101         (Initialize_lock::initialize): Define.
12102         * target-select.h: Include "gold-threads.h".
12103         (class Target_selector): Add lock_ and initialize_lock_ fields.
12104         Don't define instantiate_target, just declare it.
12105         * target-select.cc (Target_selector::Target_selector): Initialize
12106         new fields.
12107         (Target_selector::instantiate_target): Define.
12108         * descriptors.h: Include "gold-threads.h".
12109         (class Descriptors): Add initialize_lock_ field.
12110         * descriptors.cc (Descriptors::Descriptors): Initialize new
12111         field.
12112         (Descriptors::open): Use initialize_lock_ field
12113         * errors.h (class Errors): Add initialize_lock_ field.
12114         * errors.cc (Errors::Errors): Initialize new field.
12115         (Errors::initialize_lock): Use initialize_lock_ field.
12116         * powerpc.cc (class Target_selector_powerpc): Remove
12117         instantiated_target_ field.  In do_recognize call
12118         instantiate_target rather than do_instantiate_target.  In
12119         do_instantiate_target just allocate a new target.
12120         * sparc.cc (class Target_selector_sparc): Likewise.
12121
12122         * freebsd.h: New file.
12123         * i386.cc: Include "freebsd.h".
12124         (Target_i386): Derive from Target_freebsd rather than
12125         Sized_target.
12126         (Target_selector_i386): Derive from Target_selector_freebsd rather
12127         than Target_selector.
12128         * x86_64.cc: Include "freebsd.h".
12129         (Target_x86_64): Derive from Target_freebsd rather than
12130         Sized_target.
12131         (Target_selector_x86_64): Derive from Target_selector_freebsd
12132         rather than Target_selector.
12133         * target.h (class Target): Add adjust_elf_header and
12134         do_adjust_elf_header.
12135         * output.cc (Output_file_header:: do_sized_write): Call target
12136         adjust_elf_header routine.
12137         * configure.tgt: Set targ_osabi.
12138         * configure.ac: Define GOLD_DEFAULT_OSABI.
12139         * parameters.cc (Parameters::default_target): Pass
12140         GOLD_DEFAULT_OSABI to select_target.
12141         * target-select.h (class Target_selector): Make instantiate_target
12142         protected rather than private.
12143         * Makefile.am (HFILES): Add freebsd.h.
12144         * configure, Makefile.in, config.in: Rebuild.
12145
12146         * merge.cc (do_add_input_section): Correct pend value.  Change
12147         message about last entry not being null terminated from error to
12148         warning.
12149
12150 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12151
12152         * incremental.cc: New file.
12153         * Makefile.am (CCFILES): Add incremental.cc.
12154         * Makefile.in: Rebuild.
12155
12156 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12157
12158         * layout.cc (Layout::output_section_name): Preserve names
12159         of '.note.' sections.
12160
12161 2009-03-19  Ian Lance Taylor  <iant@google.com>
12162
12163         * descriptors.cc (Descriptors::open): Check that the options are
12164         valid before using them.
12165
12166 2009-03-18  Ian Lance Taylor  <iant@google.com>
12167
12168         * script-sections.h: Include <list>.
12169         (class Script_sections): Change Sections_elements from std::vector
12170         to std::list.  Typedef public Elements_iterator.  Add
12171         orphan_section_placement_, data_segment_align_start_, and
12172         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12173         field.
12174         * script-sections.cc (class Orphan_section_placement): New class.
12175         (class Sections_element): Add virtual functions is_relro and
12176         orphan_section_init.  Remove virtual function place_orphan_here.
12177         (class Output_section_definition): Add is_relro and
12178         orphan_section_init.  Remove place_orphan_here.
12179         (class Orphan_output_section): Likewise.
12180         (Script_sections::Script_sections): Update for field changes.
12181         (Script_sections::data_segment_align): Set saw_data_segment_align_
12182         and data_segment_align_start_, not data_segment_align_index.
12183         (Script_sections::data_segment_relro_end): Check
12184         saw_data_segment_align_.  Use data_segment_align_start_ rather
12185         than data_segment_align_index_.
12186         (Script_sections::place_orphan): Rewrite to use
12187         Orphan_section_placement.
12188
12189 2009-03-17  Ian Lance Taylor  <iant@google.com>
12190
12191         * archive.cc (Archive::add_symbols): Check for a version attached
12192         to the symbol name in the archive map.
12193         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12194         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12195         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12196         (ver_test_11.a): New target.
12197         * testsuite/Makefile.in: Rebuild.
12198
12199         * configure.ac: Check for chsize and posix_fallocate.  Replace
12200         ftruncate.
12201         * ftruncate.c: New file, from gnulib.
12202         * output.cc (posix_fallocate): Define dummy version if not
12203         HAVE_POSIX_FALLOCATE.
12204         (Output_file::map): Call posix_fallocate rather than lseek and
12205         write.
12206         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12207         * configure, Makefile.in, config.in: Rebuild.
12208
12209 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12210
12211         * layout.h (Layout::create_note): Add section_name parameter.
12212         * layout.cc (Layout::create_note): Likewise.
12213         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12214
12215 2009-03-17  Ian Lance Taylor  <iant@google.com>
12216
12217         * descriptors.cc: Include "options.h".
12218         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12219         (Descriptors::open): Always use O_CLOEXEC when opening a new
12220         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12221         then set FD_CLOEXEC.
12222
12223         * sparc.cc (class Target_sparc): Add has_got_section.
12224         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12225         make sure we have a GOT section.
12226
12227         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12228         (Target_sparc::Scan::local): Likewise.
12229         (Target_sparc::Scan::global): Likewise.
12230         (Target_sparc::Relocate::relocate): Likewise.
12231         (Target_sparc::Relocate::relocate_tls): Likewise.
12232
12233         * symtab.cc (Symbol_table::define_default_version): New function,
12234         broken out of add_from_object.
12235         (Symbol_table::add_from_object): Call define_default_version.
12236         (Symbol_table::define_special_symbol): Add resolve_oldsym
12237         parameter.  Change all callers.  If the version for a symbol comes
12238         from a version script, resolve it with the symbol with the same
12239         name with no version.  Also add the symbol without a version if
12240         appropriate.
12241         (do_define_in_output_data): If resolving with oldsym, don't delete
12242         sym.
12243         (do_define_in_output_segment): Likewise.
12244         (do_define_as_constant): Likewise.
12245         * symtab.h (class Symbol_table): Update declarations.
12246
12247 2009-03-13  Ian Lance Taylor  <iant@google.com>
12248
12249         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12250         (Read_symbols::requeue): New function.
12251         (Read_symbols::do_read_symbols): If make_elf_object fails because
12252         the target type is not configured, and the file was searched for,
12253         issue a warning and retry with the next directory.
12254         (Add_symbols::run): If the file has an incompatible format, and
12255         it was searched for, requeue the Read_symbols task.  On error,
12256         release the object.
12257         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12258         dirindex parameter to constructor.  Change all callers.  Declare
12259         incompatible_warning and requeue.
12260         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12261         input_argument_ and input_group_ fields.  Add them to
12262         constructor.  Change all callers.
12263         (class Read_script): Add dirindex_ field.  Add it to constructor.
12264         Change all callers.
12265         * archive.cc (Archive::setup): Remove input_objects parameter.
12266         Change all callers.
12267         (Archive::get_file_and_offset): Likewise.
12268         (Archive::read_all_symbols): Likewise.
12269         (Archive::read_symbols): Likewise.
12270         (Archive::get_elf_object_for_member): Remove input_objects
12271         parameter.  Add punconfigured parameter.  Change all callers.
12272         (Archive::add_symbols): Change return type to bool.  Check return
12273         value of include_member.
12274         (Archive::include_all_members): Likewise.
12275         (Archive::include_member): Change return type to bool.  Return
12276         false if first included object has incompatible target.  Set
12277         included_member_ field.
12278         (Add_archive_symbols::run): If add_symbols returns false, requeue
12279         Read_symbols task.
12280         * archive.h (class Archive): Add included_member_ field.
12281         Initialize it in constructor.  Add input_file and searched_for
12282         methods.  Update declarations.
12283         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12284         input_argument_ fields.  Add them to constructor.  Change all
12285         callers.
12286         * script.cc: Include "target-select.h".
12287         (class Parser_closure): Add skip_on_incompatible_target_ and
12288         found_incompatible_target_ fields.  Add
12289         skip_on_incompatible_target parameter to constructor.  Change all
12290         callers.  Add methods skip_on_incompatible_target,
12291         clear_skip_on_incompatible_target, found_incompatible_target, and
12292         set_found_incompatible_target.
12293         (read_input_script): Add dirindex parameter.  Change all callers.
12294         If parser finds an incompatible target, requeue Read_symbols
12295         task.
12296         (script_set_symbol): Clear skip_on_incompatible_target in
12297         closure.
12298         (script_add_assertion, script_parse_option): Likewise.
12299         (script_start_sections, script_add_phdr): Likewise.
12300         (script_check_output_format): New function.
12301         * script.h (read_input_script): Update declaration.
12302         * script-c.h (script_check_output_format): Declare.
12303         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12304         (ignore_cmd): Remove OUTPUT_FORMAT.
12305         * fileread.cc (Input_file::Input_file): Add explicit this.
12306         (Input_file::will_search_for): New function.
12307         (Input_file::open): Add pindex parameter.  Change all callers.
12308         * fileread.h (class Input_file): Add input_file_argument method.
12309         Declare will_search_for.  Update declarations.
12310         * object.cc (make_elf_object): Add punconfigured parameter.
12311         Change all callers.
12312         * object.h (class Object): Make input_file public.  Add
12313         searched_for method.
12314         (make_elf_object): Update declaration.
12315         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12316         restart search.
12317         * dirsearch.h (class Dirsearch): Update declaration.
12318         * options.h (class General_options): Add --warn-search-mismatch.
12319         * parameters.cc (Parameters::is_compatible_target): New function.
12320         * parameters.h (class Parameters): Declare is_compatible_target.
12321         * workqueue.cc (Workqueue::add_blocker): New function.
12322         * workqueue.h (class Workqueue): Declare add_blocker.
12323
12324         * fileread.cc (Input_file::open): Remove options parameter.
12325         Change all callers.
12326         (Input_file::open_binary): Likewise.
12327         * script.cc (read_input_script): Likewise.
12328         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12329         options parameter from constructor.  Change all callers.
12330         (class Read_script): Likewise.
12331         * fileread.h (class Input_file): Update declarations.
12332         * script.h (read_input_script): Update declaration.
12333
12334 2009-03-10  Nick Clifton  <nickc@redhat.com>
12335
12336         * po/es.po: New Spanish translation.
12337
12338 2009-03-06  Cary Coutant  <ccoutant@google.com>
12339
12340         * options.cc (parse_short_option): Keep dash_z from registering itself.
12341
12342 2009-03-03  Ian Lance Taylor  <iant@google.com>
12343
12344         PR 9918
12345         * target-reloc.h (relocate_section): Pass output_section to
12346         relocate.
12347         * i386.cc (Target_i386::should_apply_static_reloc): Add
12348         output_section parameter.  Change all callers.
12349         (Target_i386::Relocate::relocate): Add output_section parameter.
12350         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12351         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12352         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12353         * testsuite/two_file_shared.sh: New script.
12354         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12355         (check_DATA): Add two_file_shared.dbg.
12356         (two_file_shared.dbg): New target.
12357         * testsuite/Makefile.in: Rebuild.
12358
12359 2009-03-01  Ian Lance Taylor  <iant@google.com>
12360
12361         * configure.ac: Check for byteswap.h.
12362         * configure: Rebuild.
12363         * config.in: Rebuild.
12364
12365 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12366
12367         * layout.cc (Layout::find_or_add_kept_section): New function.
12368         (Layout::add_comdat): Removed.
12369         * layout.h (struct Kept_section): Move out of class Layout.
12370         Remove trailing underscores from field names.  Add group_sections
12371         field.  Rename group_ field to is_group.  Change all uses.
12372         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12373         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12374         comdat_groups_ field.
12375         (Sized_relobj::include_section_group): Use
12376         find_or_add_kept_section and Kept_section::group_sections.
12377         (Sized_relobj::include_linkonce_section): Likewise.
12378         * object.cc (class Sized_relobj): Don't define Comdat_group or
12379         Comdat_group_table.  Remove find_comdat_group and
12380         add_comdat_group.  Remove comdat_groups_ field.
12381         * plugin.cc (include_comdat_group): Use
12382         Layout::find_or_add_kept_section.
12383
12384 2009-02-28  Ian Lance Taylor  <iant@google.com>
12385
12386         * README: --gc-sections and map files are now supported.  Document
12387         some build requirements.
12388
12389         PR 6992
12390         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12391         relocatable link set the value of the section symbol to zero.
12392         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12393         relocatable link don't include the section address in the local
12394         symbol value.
12395
12396 2009-02-27  Ian Lance Taylor  <iant@google.com>
12397
12398         PR 6811
12399         * options.h (class Search_directory): Add is_system_directory.
12400         (class General_options): Declare is_in_system_directory.
12401         * options.cc (get_relative_sysroot): Make static.
12402         (get_default_sysroot): Make static.
12403         (General_optoins::is_in_system_directory): New function.
12404         * fileread.cc (Input_file::is_in_system_directory): New function.
12405         * fileread.h (class Input_file): Declare is_in_system_directory.
12406         * object.h (class Object): Add is_in_system_directory.
12407         (class Input_objects): Remove system_library_directory_ field.
12408         * object.cc (Input_objects::add_object): Don't set
12409         system_library_directory_.
12410         (input_objects::found_in_system_library_directory): Remove.
12411         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12412         parameter.  Change all callers.
12413         (Symbol_table::sized_write_globals): Likewise.
12414         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12415         Call Object::is_in_system_directory.
12416         * symtab.h (class Symbol_table): Update declarations.
12417
12418         PR 5990
12419         * descriptors.h (Open_descriptor): Add is_on_stack field.
12420         * descriptors.cc (Descriptors::open): If the descriptor is on the
12421         top of the stack, remove it.  Initialize is_on_stack field.
12422         (Descriptors::release): Only add pod to stack if it is not on the
12423         stack already.
12424         (Descriptors::close_some_descriptor): Clear stack_next and
12425         is_on_stack fields.
12426
12427         PR 7091
12428         * output.cc (Output_section::find_starting_output_address): Rename
12429         from starting_output_address; add PADDR parameter; change return
12430         type.
12431         * output.h (class Output_section): Declare
12432         find_starting_output_address instead of starting_output_address.
12433         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12434         section symbol for which we can't find a merge section.
12435
12436         PR 9836
12437         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12438         hidden or internal, force the symbol to be local.
12439         * resolve.cc (Symbol::override_visibility): Define.
12440         (Symbol::override_base): Use override_visibility.
12441         (Symbol_table::resolve): Likewise.
12442         (Symbol::override_base_with_special): Likewise.
12443         (Symbol_table::override_with_special): If the visibility is hidden
12444         or internal, force the symbol to be local.
12445         * symtab.h (class Symbol): Add set_visibility and
12446         override_visibility.
12447         * testsuite/ver_test_1.sh: New file.
12448         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12449         (check_DATA): Add ver_test_1.syms.
12450         (ver_test_1.syms): New target.
12451         * testsuite/Makefile.in: Rebuild.
12452
12453 2009-02-25  Cary Coutant  <ccoutant@google.com>
12454
12455         * layout.cc (Layout::choose_output_section): Don't rename sections
12456         when using a linker script that has a SECTIONS clause.
12457         * Makefile.in: Regenerate.
12458
12459         * testsuite/Makefile.am (script_test_5.sh): New test case.
12460         * testsuite/Makefile.in: Regenerate.
12461         * testsuite/script_test_5.cc: New file.
12462         * testsuite/script_test_5.sh: New file.
12463         * testsuite/script_test_5.t: New file.
12464
12465 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12466
12467         * archive.cc (Archive::include_member): Update calls to add_symbols.
12468         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12469         the Layout argument.
12470         * dynobj.h (do_add_symbols): Add the Layout argument.
12471         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12472         Layout argument.
12473         * object.h (Object::add_symbols): Add the Layout argument.
12474         (Object::do_add_symbols): Add the Layout argument.
12475         (Sized_relobj::do_add_symbols): Add the Layout argument.
12476         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12477         Unify the two versions.
12478         (Add_plugin_symbols): Remove.
12479         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12480         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12481         (Add_plugin_symbols): Remove.
12482         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12483         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12484         (Add_symbols::run): Make it work with Pulginobj.
12485
12486 2009-02-06  Ian Lance Taylor  <iant@google.com>
12487
12488         * object.cc (Sized_relobj::do_layout): Make info message start
12489         with lower case letter.
12490
12491 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12492
12493         * binary.cc: Fix file comment.
12494
12495         * options.h (enum Incremental_disposition): Define.
12496         (class General_options): Add new options: --incremental,
12497         --incremental_changed, --incremental_unchanged,
12498         --incremental_unknown.  Add incremental_disposition_ and
12499         implicit_incremental_ fields.
12500         (General_options::incremental_disposition): New function.
12501         (class Position_dependent_options): Add incremental_disposition
12502         option.
12503         (Position_dependent_options::copy_from_options): Set incremental
12504         dispositions.
12505         * options.cc (General_options::parse_incremental_changed): New
12506         function.
12507         (General_options::parse_incremental_unchanged): New function.
12508         (General_options::parse_incremental_unknown): New function.
12509         (General_options::General_options): Initialize new fields
12510         incremental_disposition_ and implicit_incremental_.
12511         (General_options::finalize): Check for uasge of --incremental-*
12512         without --incremental.
12513
12514 2009-02-06  Chris Demetriou  <cgd@google.com>
12515
12516         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12517         pointer and to report location as the file name associated with
12518         the symbol.
12519         (gold_undefined_symbol_at_location): New function to replace the
12520         old gold_undefined_symbol functionality.
12521         * target-reloc.h (relocate_section): Update to use
12522         gold_undefined_symbol_at_location.
12523         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12524         Call gold_undefined_symbol function rather than gold_error.
12525         * errors.h (Errors::undefined_symbol): Take location as a
12526         string, rather than calculating it from a relocation.
12527         * errors.cc (Errors::fatal): Print "fatal error:" before the
12528         formatted message.
12529         (Errors::error, Errors::error_at_location): Print "error: "
12530         before the formatted message.
12531         (Errors::undefined_symbol): Take location as a string, rather
12532         than calculating it from a relocation.
12533         (gold_undefined_symbol_at_location): New function akin to
12534         old gold_undefined_symbol, calculates location from relocation.
12535         (gold_undefined_symbol): Change to take only a Symbol pointer
12536         and to report location as the file name associated with the symbol.
12537         * testsuite/debug_msg.sh: Update for changed error messages.
12538         * testsuite/undef_symbol.sh: Likewise.
12539
12540 2009-02-04  Duncan Sands  <baldrick@free.fr>
12541
12542         PR 9812
12543         * reduced_debug_output.h
12544         (Output_reduced_debug_abbrev_section::failed): Use format for
12545         gold_warning.
12546         (Output_reduced_debug_info_section::faild): Likewise.
12547
12548 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12549
12550         * script.cc (Lazy_demangler): New class.
12551         (Version_script_info::get_symbol_version_helper): Demangle a
12552         symbol only once.
12553
12554 2009-01-29  Cary Coutant  <ccoutant@google.com>
12555
12556         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12557         to __tls_get_addr.
12558         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12559
12560 2009-01-28  Ian Lance Taylor  <iant@google.com>
12561
12562         * version.cc (version_string): Bump to 1.9.
12563
12564         * gold.h: Include <cstring> and <stdint.h>.
12565         * version.cc: Include <cstdio>.
12566         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12567         warning.
12568         * reduced_debug_output.cc (insert_into_vector): Rename from
12569         Insert_into_vector; change all callers.  Use Swap_unaligned to
12570         avoid aliasing issue; remove union since it is unnecessary.
12571
12572 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12573
12574         * Makefile.am (CCFILES): Add gc.cc.
12575         (HFILES): Add gc.h.
12576         * Makefile.in: Regenerate.
12577         * gold.cc (Gc_runner): New class.
12578         (queue_initial_tasks): Call garbage collection related tasks
12579         when corresponding options are invoked.
12580         (queue_middle_gc_tasks): New function.
12581         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12582         processed early before laying out sections during garbage collection.
12583         * gold.h (queue_middle_gc_tasks): New function.
12584         (is_prefix_of): Move from "layout.cc".
12585         * i386.cc (Target_i386::gc_process_relocs): New function.
12586         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12587         * main.cc (main): Create object of class "Garbage_collection".
12588         * object.cc (Relobj::copy_symbols_data): New function.
12589         (Relobj::is_section_name_included): New function.
12590         (Sized_relobj::do_layout): Allow this function to be called twice
12591         during garbage collection and defer layout of section during the
12592         first call.
12593         * object.h (Relobj::get_symbols_data): New function.
12594         (Relobj::is_section_name_included): New function.
12595         (Relobj::copy_symbols_data): New function.
12596         (Relobj::set_symbols_data): New function.
12597         (Relobj::get_relocs_data): New function.
12598         (Relobj::set_relocs_data): New function.
12599         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12600         (Relobj::gc_process_relocs): New function.
12601         (Relobj::do_gc_process_relocs): New pure virtual function.
12602         (Relobj::sd_): New data member.
12603         (Sized_relobj::is_output_section_offset_invalid): New function.
12604         (Sized_relobj::do_gc_process_relocs): New function.
12605         * options.h (General_options::gc_sections): Modify to not be a no-op.
12606         (General_options::print_gc_sections): New option.
12607         * plugin.cc (Plugin_finish::run): Remove function call to
12608         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12609         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12610         * reloc.cc (Read_relocs::run): Add task to process relocs and
12611         determine unreferenced sections when doing garbage collection.
12612         (Gc_process_relocs): New class.
12613         (Sized_relobj::do_gc_process_relocs): New function.
12614         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12615         sections that are garbage collected.
12616         * reloc.h (Gc_process_relocs): New class.
12617         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12618         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12619         symbols whose corresponding sections are garbage collected.
12620         (Symbol_table::Symbol_table): Add new parameter for the garbage
12621         collection object.
12622         (Symbol_table::gc_mark_undef_symbols): New function.
12623         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12624         (Symbol_table::gc_mark_dyn_syms): New function.
12625         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12626         as garbage.
12627         (Symbol_table::add_from_object): Likewise.
12628         (Symbol_table::add_from_relobj): When building shared objects, do not
12629         treat externally visible symbols as garbage.
12630         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12631         table information for static and relocatable links.
12632         * symtab.h (Symbol_table::set_gc): New function.
12633         (Symbol_table::gc): New function.
12634         (Symbol_table::gc_mark_undef_symbols): New function.
12635         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12636         (Symbol_table::gc_mark_dyn_syms): New function.
12637         (Symbol_table::gc_): New data member.
12638         * target.h (Sized_target::gc_process_relocs): New pure virtual
12639         function.
12640         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12641         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12642
12643 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12644
12645         * options.h (General_options::gc_sections): Define as a no-op for now.
12646         (General_options::no_keep_memory): Ditto.
12647         (General_options::Bshareable): Define.
12648         * options.cc (General_options::finalize): Honor -Bshareable.
12649
12650 2009-01-20  Andreas Schwab  <schwab@suse.de>
12651
12652         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12653         read the value in the contents, since we don't use it.  Use the
12654         template endianness when writing.
12655         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12656
12657 2009-01-19  Andreas Schwab  <schwab@suse.de>
12658
12659         * configure.tgt (powerpc64-*): Fix targ_obj.
12660
12661 2009-01-15  Ian Lance Taylor  <iant@google.com>
12662
12663         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12664         local symbols when stripping all symbols.
12665
12666 2009-01-14  Cary Coutant  <ccoutant@google.com>
12667
12668         * output.cc (Output_reloc): Add explicit instantiations.
12669
12670 2009-01-14  Cary Coutant  <ccoutant@google.com>
12671
12672         * archive.cc (Archive::get_elf_object_for_member): Remove call
12673         to File_read::claim_for_plugin.
12674         * descriptors.cc (Descriptors::open): Remove reference to
12675         is_claimed.
12676         (Descriptors::claim_for_plugin): Remove.
12677         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12678         (Descriptors::is_claimed): Remove.
12679         (claim_descriptor_for_plugin): Remove.
12680         * fileread.cc (File_read::claim_for_plugin): Remove.
12681         * fileread.h (File_read::claim_for_plugin): Remove.
12682         (File_read::descriptor): Reopen descriptor if necessary.
12683         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12684         (Plugin_manager::all_symbols_read): Add task parameter. Change
12685         all callers.
12686         (Plugin_manager::get_input_file): New function.
12687         (Plugin_manager::release_input_file): New function.
12688         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12689         corresponding data member.
12690         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12691         and pass to base constructor. Change all callers.
12692         (get_input_file, release_input_file): New functions.
12693         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12694         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12695         (Plugin_manager::all_symbols_read): Add task parameter.
12696         (Plugin_manager::get_input_file): New function.
12697         (Plugin_manager::release_input_file): New function.
12698         (Plugin_manager::task_): New data member.
12699         (Pluginobj::Pluginobj): Add filesize parameter.
12700         (Pluginobj::filename): New function.
12701         (Pluginobj::descriptor): New function.
12702         (Pluginobj::filesize): New function.
12703         (Pluginobj::filesize_): New data member.
12704         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12705         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12706         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12707
12708         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12709         with archive libraries.
12710         * testsuite/Makefile.in: Regenerate.
12711         * testsuite/plugin_test.c (struct sym_info): New type.
12712         (get_input_file, release_input_file): New static variables.
12713         (onload): Capture new transfer vector entries.
12714         (claim_file_hook): Stop reading at end of file according to filesize.
12715         Factor out parsing of readelf output into separate function.
12716         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12717         APIs and get the source file name from the symbol table.  Convert
12718         source file name to corresponding object file name.  Print info
12719         message when adding new input files.
12720         (parse_readelf_line): New function.
12721         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12722         * testsuite/plugin_test_2.sh: Likewise.
12723         * testsuite/plugin_test_3.sh: Likewise.
12724         * testsuite/plugin_test_4.sh: New test case.
12725
12726 2009-01-07  Ian Lance Taylor  <iant@google.com>
12727
12728         * version.cc (version_string): Bump to 1.8.
12729
12730 2008-12-23  Cary Coutant  <ccoutant@google.com>
12731
12732         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12733         * plugin.cc (Plugin_manager::finish): Rename as
12734         layout_deferred_objects.  Move cleanup to separate function.
12735         (Plugin_manager::cleanup): New function.
12736         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12737         separately.
12738         * plugin.h (Plugin_manager::finish): Rename as
12739         layout_deferred_objects.
12740         (Plugin_manager::cleanup): New function.
12741         (Plugin_manager::cleanup_done): New field.
12742
12743 2008-12-23  Cary Coutant  <ccoutant@google.com>
12744
12745         * plugin.cc (is_visible_from_outside): New function.
12746         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12747         so we don't return "IR only" status for exported symbols or -r links.
12748
12749         * testsuite/Makefile.am (plugin_test_3): New test case.
12750         * testsuite/Makefile.in: Regenerate.
12751         * testsuite/plugin_test_3.sh: New file.
12752
12753 2008-12-22  Cary Coutant  <ccoutant@google.com>
12754
12755         * object.cc (Sized_relobj::layout_section): New function.
12756         (Sized_relobj::do_layout): Defer layout of input sections until after
12757         plugin has provided replacement files.
12758         (Sized_relobj::do_layout_deferred_sections): New function.
12759         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12760         (Relobj::layout_deferred_sections): New function.
12761         (Relobj::do_layout_deferred_sections): New function.
12762         (Sized_relobj::do_layout_deferred_sections): New function.
12763         (Sized_relobj::layout_section): New function.
12764         (Sized_relobj::Deferred_layout): New structure.
12765         (Sized_relobj::deferred_layout_): New field.
12766         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12767         Change all callers.  Layout deferred sections.
12768         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12769         references.
12770         (Plugin_hook::run): Move code from do_plugin_hook inline.
12771         (Plugin_hook::do_plugin_hook): Remove.
12772         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12773         (Plugin_manager::finish): Renamed, was cleanup.
12774         (Plugin_manager::should_defer_layout): New function.
12775         (Plugin_manager::add_deferred_layout_object): New function.
12776         (Plugin_manager::Deferred_layout_list): New type.
12777         (Plugin_manager::deferred_layout_objects_): New field.
12778         (Plugin_hook::do_plugin_hook): Remove.
12779
12780 2008-12-17  Ian Lance Taylor  <iant@google.com>
12781
12782         * options.h (class General_options): Add --no case for
12783         --export-dynamic.
12784
12785 2008-12-16  Cary Coutant  <ccoutant@google.com>
12786
12787         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12788         vector.
12789         (Plugin_manager::claim_file): Create plugin object even if
12790         plugin did not call the add_symbols callback.
12791         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12792         asking for more symbols than were added.
12793         * testsuite/Makefile.am (plugin_test_1): Add test case with
12794         no global symbols.
12795         (empty.syms): New target.
12796         * testsuite/Makefile.in: Regenerate.
12797         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12798         message. Don't call add_symbols if no globals.
12799         (all_symbols_read_hook): Don't provide replacement for empty
12800         claimed file.
12801
12802 2008-12-12  Ian Lance Taylor  <iant@google.com>
12803
12804         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12805         r_type == 0 for a local symbol with r_sym == 0.
12806         (scan_relocatable_relocs): Pass r_sym to
12807         local_non_section_strategy.
12808         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12809         r_sym parameter.
12810
12811         * configure.ac: Update test for TLS descriptors: they are
12812         supported as of glibc 2.9.
12813         * configure: Rebuild.
12814
12815 2008-12-11  Ian Lance Taylor  <iant@google.com>
12816
12817         PR 7091
12818         * target-reloc.h (Default_scan_relocatable_relocs): For each
12819         function, map r_type == 0 to RELOC_DISCARD.
12820
12821 2008-12-10  Cary Coutant  <ccoutant@google.com>
12822
12823         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12824         object to override a kept COMDAT group from a plugin object.
12825
12826 2008-12-09  Ian Lance Taylor  <iant@google.com>
12827
12828         PR 7088
12829         * yyscript.y (file_cmd): Handle INPUT.
12830
12831         * testsuite/initpri1.c: Change all declarations to be full
12832         prototypes by adding void, to avoid compiler warnings.
12833
12834 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12835
12836         * options.cc (General_options::parse_plugin_opt): New.
12837         (General_options::add_plugin): The argument now is just the filename.
12838         (General_options::add_plugin_option): New.
12839         * options.h (plugin_opt): New.
12840         (add_plugin): Change argument name.
12841         (add_plugin_option): New.
12842         * plugin.cc (Plugin::load): Don't parse the plugin option.
12843         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12844         (Plugin::add_option): New.
12845         (Plugin::args_): Change type.
12846         (Plugin::filename_): New.
12847         (Plugin_manager::add_plugin_option): New.
12848         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12849         * testsuite/Makefile.in: Regenerate.
12850
12851 2008-12-05  Cary Coutant  <ccoutant@google.com>
12852
12853         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12854         Handle --strip-lto-sections option.
12855         * options.h (strip_lto_sections): New option.
12856
12857 2008-12-01  Cary Coutant  <ccoutant@google.com>
12858
12859         * plugin.cc (ld_plugin_message): Change format parameter to const.
12860         Fix mismatch between new[] and delete.
12861
12862 2008-11-14  Cary Coutant  <ccoutant@google.com>
12863
12864         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12865         instead of -1U.
12866
12867 2008-11-05  Craig Silverstein  <csilvers@google.com>
12868
12869         * options.cc (General_options::parse_dynamic_list): New function.
12870         * options.h (General_options): New flags dynamic_list,
12871         dynamic_list_data, dynamic_list_cpp_new, and
12872         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12873         (General_options::in_dynamic_list): New function.
12874         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12875         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12876         (Lex::can_continue_name): Likewise.
12877         (yylex): Likewise.
12878         (read_script_file): New parameter script_options.
12879         (read_dynamic_list): New function.
12880         (Script_options::define_dynamic_list): New function.
12881         (dynamic_list_keyword_parsecodes): New variable.
12882         (dynamic_list_keywords): New variable.
12883         * script.h (Script_options::define_dynamic_list): New function
12884         prototype.
12885         (read_dynamic_list): New function prototype.
12886         * symtab.cc (strprefix): New macro.
12887         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12888         dynamic_list_data, dynamic_list_cpp_new, and
12889         dynamic_list_cpp_typeinfo.
12890         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12891         (dynamic_list_expr): New rule.
12892         (dynamic_list_nodes): Likewise.
12893         (dynamic_list_node): Likewise.
12894         * testsuite/Makefile.am (dynamic_list): New test.
12895         * testsuite/Makefile.in: Regenerated.
12896         * testsuite/dynamic_list.t: New file.
12897         * testsuite/dynamic_list.sh: New file.
12898
12899 2008-11-05  Craig Silverstein  <csilvers@google.com>
12900
12901         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12902         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12903         (t11_last): Likewise.
12904         * testsuite/ver_test_6.c (main): Likewise.
12905
12906 2008-10-07  Cary Coutant  <ccoutant@google.com>
12907
12908         * options.c (General_options::finalize): Add check for -static and
12909         -shared.
12910         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12911         is not empty.
12912
12913 2008-10-02  Cary Coutant  <ccoutant@google.com>
12914
12915         * plugin.cc (make_sized_plugin_object): Fix conditional
12916         compilation to work when not all targets are enabled.
12917
12918 2008-09-29  Cary Coutant  <ccoutant@google.com>
12919
12920         * archive.cc (Archive::get_file_and_offset): Use filename instead
12921         of name to get library path.
12922         (Archive::include_member): Unlock external member of a thin archive.
12923
12924         * testsuite/Makefile.am (TEST_AR): New variable.
12925         (thin_archive_test_1): New test.
12926         (thin_archive_test_2): New test.
12927         * testsuite/Makefile.in: Regenerate.
12928         * testsuite/thin_archive_main.cc: New file.
12929         * testsuite/thin_archive_test_1.cc: New file.
12930         * testsuite/thin_archive_test_2.cc: New file.
12931         * testsuite/thin_archive_test_3.cc: New file.
12932         * testsuite/thin_archive_test_4.cc: New file.
12933
12934 2008-09-29  Cary Coutant  <ccoutant@google.com>
12935
12936         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12937         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12938         instead of -1U.
12939         (Sized_relobj::do_finalize_local_symbols): Likewise.
12940         (Sized_relobj::map_to_kept_section): Likewise.
12941         * object.h (Sized_relobj::invalid_address): New constant.
12942         (Sized_relobj::do_output_section_offset): Check for invalid_address
12943         and return -1ULL.
12944         * output.cc (Output_reloc::local_section_offset): Use constant
12945         invalid_address instead of -1U.
12946         (Output_reloc::get_address): Likewise.
12947         (Output_section::output_address): Change -1U to -1ULL.
12948         * output.h (Output_reloc::invalid_address): New constant.
12949         * reloc.cc (Sized_relobj::write_sections): Use constant
12950         invalid_address instead of -1U.
12951         (Sized_relobj::relocate_sections): Likewise.
12952         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12953         values for merge sections.
12954         * target-reloc.h (relocate_for_relocatable): Use constant
12955         invalid_address instead of -1U.
12956
12957 2008-09-19  Cary Coutant  <ccoutant@google.com>
12958
12959         Add plugin functionality for link-time optimization (LTO).
12960         * configure.ac (plugins): Add --enable-plugins option.
12961         * configure: Regenerate.
12962         * config.in: Regenerate.
12963         * Makefile.am (LIBDL): New variable.
12964         (CCFILES): Add plugin.cc.
12965         (HFILES): Add plugin.h.
12966         (ldadd_var): Add LIBDL.
12967         * Makefile.in: Regenerate.
12968
12969         * archive.cc: Include "plugin.h".
12970         (Archive::setup): Don't preread archive symbols when using a plugin.
12971         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12972         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12973         files.
12974         (Archive::include_member): Add symbols from plugin objects.
12975         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12976         * descriptors.cc (Descriptors::open): Check for file descriptors
12977         abandoned by plugins.
12978         (Descriptors::claim_for_plugin): New function.
12979         * descriptors.h (Descriptors::claim_for_plugin): New function.
12980         (Open_descriptor::is_claimed): New field.
12981         (claim_descriptor_for_plugin): New function.
12982         * fileread.cc (File_read::claim_for_plugin): New function.
12983         * fileread.h (File_read::claim_for_plugin): New function.
12984         (File_read::descriptor): New function.
12985         * gold.cc: Include "plugin.h".
12986         (queue_initial_tasks): Add task to call plugin hooks for generating
12987         new object files.
12988         * main.cc: Include "plugin.h".
12989         (main): Load plugin libraries.
12990         * object.h (Pluginobj): Declare.
12991         (Object::pluginobj): New function.
12992         (Object::do_pluginobj): New function.
12993         (Object::set_target): New function.
12994         * options.cc: Include "plugin.h".
12995         (General_options::parse_plugin): New function.
12996         (General_options::General_options): Initialize plugins_ field.
12997         (General_options::add_plugin): New function.
12998         * options.h (Plugin_manager): Declare.
12999         (General_options): Add --plugin option.
13000         (General_options::has_plugins): New function.
13001         (General_options::plugins): New function.
13002         (General_options::add_plugin): New function.
13003         (General_options::plugins_): New field.
13004         * plugin.cc: New file.
13005         * plugin.h: New file.
13006         * readsyms.cc: Include "plugin.h".
13007         (Read_symbols::do_read_symbols): Check for archive before checking
13008         for ELF file.  Call plugin hooks to claim files.
13009         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13010         from a real object file; force override when processing replacement
13011         files.
13012         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13013         (Symbol::init_base_object): Likewise.
13014         (Symbol::init_base_output_data): Likewise.
13015         (Symbol::init_base_output_segment): Likewise.
13016         (Symbol::init_base_constant): Likewise.
13017         (Symbol::init_base_undefined): Likewise.
13018         (Symbol::output_section): Assert that object is not a plugin.
13019         (Symbol_table::add_from_pluginobj): New function.
13020         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13021         undefined.
13022         (Symbol_table::sized_write_globals): Likewise.
13023         (Symbol_table::add_from_pluginobj): Instantiate template.
13024         * symtab.h (Sized_pluginobj): Declare.
13025         (Symbol::in_real_elf): New function.
13026         (Symbol::set_in_real_elf): New function.
13027         (Symbol::in_real_elf_): New field.
13028         (Symbol_table::add_from_pluginobj): New function.
13029
13030         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13031         (LIBDL): New variable.
13032         (LDADD): Add LIBDL.
13033         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13034         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13035         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13036         (MOSTLYCLEANFILES): Likewise.
13037         * testsuite/Makefile.in: Regenerate.
13038         * testsuite/plugin_test.c: New file.
13039         * testsuite/plugin_test_1.sh: New file.
13040         * testsuite/plugin_test_2.sh: New file.
13041
13042 2008-09-16  Ian Lance Taylor  <iant@google.com>
13043
13044         * target-reloc.h (relocate_section): Check whether a symbol is
13045         defined by the ABI before reporting an undefined symbol error.
13046         * target.h (Target::is_defined_by_abi): Make parameter const.
13047         (Target::do_is_defined_by_abi): Likewise.
13048         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13049         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13050         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13051         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13052         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13053         * testsuite/Makefile.in: Rebuild.
13054
13055         * fileread.cc (make_view): Add casts to avoid warning.
13056
13057 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13058
13059         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13060         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13061
13062 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13063
13064         * options.h (General_options::output_is_executable): New.
13065         (General_options::output_is_pie): New.
13066         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13067         for shared libraries.
13068         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13069
13070 2008-09-11  Chris Demetriou  <cgd@google.com>
13071
13072         * options.h (origin): New -z option.
13073         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13074         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13075         in DT_FLAGS_1.
13076
13077 2008-09-05  Cary Coutant  <ccoutant@google.com>
13078
13079         * fileread.cc (File_read::make_view): Add check for attempt to map
13080         beyond end of file.
13081
13082 2008-09-05  Cary Coutant  <ccoutant@google.com>
13083
13084         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13085         explicit instantiations.
13086
13087 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13088
13089         PR gold/6858
13090         * options.cc (General_options::finalize): Allow undefined symbols
13091         in shlibs if linking -shared.
13092
13093         PR gold/6859
13094         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13095         symbols as not needing a dynsym entry.
13096
13097 2008-08-20  Craig Silverstein  <csilvers@google.com>
13098
13099         * fileread.cc (File_read::open): Do not lock the file unless it
13100         was successfully opened.
13101
13102 2008-08-14  Cary Coutant  <ccoutant@google.com>
13103
13104         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13105         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13106         * testsuite/tls_test.cc (struct int128): 128-bit struct
13107         for testing TLS relocs with non-zero addend.
13108         (v12): New TLS variable.
13109         (t12): New test.
13110         (t_last): Add check for v12.
13111         * testsuite/tls_test.h (t12): New function.
13112         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13113
13114 2008-08-13  Ian Lance Taylor  <iant@google.com>
13115
13116         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13117         set tls_segment_ or relro_segment_.
13118         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13119         when appropriate.
13120         * output.h (Output_section::clear_is_relro): New function.
13121         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13122         sections specially even when output_data_ is empty.
13123         (Output_segment::maximum_alignment): When first section is relro,
13124         only force alignment for PT_LOAD segments.
13125         * script.cc (script_data_segment_align): New function.
13126         (script_data_segment_relro_end): New function.
13127         * script-c.h (script_data_segment_align): Declare.
13128         (script_data_segment_relro_end): Declare.
13129         * script-sections.h (class Script_sections): Declare
13130         data_segment_align and data_segment_relro_end.  Add fields
13131         segment_align_index_ and saw_relro_end_.
13132         * script-sections.cc (class Sections_element): Add set_is_relro
13133         virtual function.  Add new bool* parameter to place_orphan_here.
13134         Add get_output_section virtual function.
13135         (class Output_section_definition): Add set_is_relro.  Add new
13136         bool* parameter to place_orphan_here.  Add get_output_section.
13137         Add is_relro_ field.
13138         (Output_section_definition::Output_section_definition): Initialize
13139         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13140         and is_relro_ fields.
13141         (Output_section_definition::place_orphan_here): Add is_relro
13142         parameter.
13143         (Output_section_definition::set_section_addresses): Set relro for
13144         output section.
13145         (Output_section_definition::alternate_constraint): Likewise.
13146         (class Orphan_output_section): Add new bool* parameter to
13147         place_orphan_here.  Add get_output_section.
13148         (Orphan_output_section::place_orphan_here): Add is_relro
13149         parameter.
13150         (Script_sections::Script_sections): Initialize
13151         data_segment_align_index_ and saw_relro_end_.
13152         (Script_sections::data_segment_align): New function.
13153         (Script_sections::data_segment_relro_end): New function.
13154         (Script_sections::place_orphan): Set or clear is_relro.
13155         (Script_sections::set_section_addresses): Force alignment of first
13156         TLS section.
13157         * yyscript.y (exp): Call script_data_segment_align and
13158         script_data_segment_relro_end.
13159         * testsuite/relro_script_test.t: New file.
13160         * testsuite/relro_test.cc (using_script): Declare.
13161         (t1, t2): Test using_script.
13162         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13163         (relro_script_test_SOURCES): Define.
13164         (relro_script_test_DEPENDENCIES): Define.
13165         (relro_script_test_LDFLAGS): Define.
13166         (relro_script_test_LDADD): Define.
13167         (relro_script_test.so): New target.
13168         * testsuite/Makefile.in: Rebuild.
13169
13170 2008-08-06  Cary Coutant <ccoutant@google.com>
13171
13172         * archive.cc (Archive::total_archives, Archive::total_members)
13173         (Archive::total_members_loaded): New variables.
13174         (Archive::setup): Add parameter.  Add option to preread
13175         archive symbols.
13176         (Archive::read_armap): Add counter.
13177         (Archive::get_file_and_offset): New function.
13178         (Archive::get_elf_object_for_member): New function.
13179         (Archive::read_all_symbols): New function.
13180         (Archive::read_symbols): New function.
13181         (Archive::add_symbols): Add counters.
13182         (Archive::include_all_members): Use armap to find members if it's
13183         already built.
13184         (Archive::include_member): Skip reading symbols if already read.
13185         Factored code into Archive::get_file_and_offset and
13186         Archive::get_elf_object_for_member.  Changed call to
13187         Mapfile::report_include_archive_member.
13188         (Archive::print_stats): New function.
13189         * archive.h: Declare Object and Read_symbols_data classes.
13190         (Archive::Archive): Add initializers for new members.
13191         (Archive::setup): Add parameter.
13192         (Archive::print_stats): New function.
13193         (Archive::total_archives, Archive::total_members)
13194         (Archive::total_members_loaded): New variables.
13195         (Archive::get_file_and_offset): New function.
13196         (Archive::get_elf_object_for_member): New function.
13197         (Archive::read_all_symbols): New function.
13198         (Archive::read_symbols): New function.
13199         (Archive::Archive_member): New class.
13200         (Archive::members_): New member.
13201         (Archive::num_members_): New member.
13202         * main.cc: Include archive.h.
13203         (main): Call Archive::print_stats.
13204         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13205         archive parameter; member_name is now the fully-decorated name.
13206         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13207         * options.h: (General_options): Add --preread-archive-symbols option.
13208         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13209         Archive::setup.
13210
13211 2008-08-04  Ian Lance Taylor  <iant@google.com>
13212
13213         * symtab.h (Symbol::use_plt_offset): New function.
13214         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13215         * powerpc.cc (Relocate::relocate): Likewise.
13216         * sparc.cc (Relocate::relocate): Likewise.
13217         * x86_64.cc (Relocate::relocate): Likewise.
13218         * testsuite/weak_plt.sh: New test.
13219         * testsuite/weak_plt_main.cc: New test.
13220         * testsuite/weak_plt_shared.cc: New test.
13221         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13222         (check_PROGRAMS): Add weak_plt.
13223         (check_DATA): Add weak_plt_shared.so.
13224         (weak_plt_main_pic.o, weak_plt): New targets.
13225         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13226         * testsuite/Makefile.in: Rebuild.
13227
13228         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13229         gcctestdir/ld.
13230         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13231         * testsuite/Makefile.in: Rebuild.
13232
13233 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13234
13235         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13236         * Makefile.in: Regenerate.
13237         * po/POTFILES.in: Regenerate.
13238
13239 2008-07-29  Ian Lance Taylor  <iant@google.com>
13240
13241         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13242         symbols before other symbols.
13243         * testsuite/script_test_2.cc (test_addr): Declare.
13244         (test_addr_alias): Declare.
13245         (main): Check that test_addr and test_addr_alias have the right
13246         values.
13247         * testsuite/script_test_2.t: Define test_addr_alias and
13248         test_addr.
13249
13250 2008-07-24  Ian Lance Taylor  <iant@google.com>
13251
13252         PR 5990
13253         * descriptors.cc: New file.
13254         * descriptors.h: New file.
13255         * gold-threads.h (class Hold_optional_lock): New class.
13256         * fileread.cc: Include "descriptors.h".
13257         (File_read::~File_read): Release descriptor rather than closing
13258         it.
13259         (File_read::open) [file]: Call open_descriptor rather than open.
13260         Set is_descriptor_opened_.
13261         (File_read::open) [memory]: Assert that descriptor is not open.
13262         (File_read::reopen_descriptor): New function.
13263         (File_read::release): Release descriptor.
13264         (File_read::do_read): Make non-const.  Reopen descriptor.
13265         (File_read::read): Make non-const.
13266         (File_read::make_view): Reopen descriptor.
13267         (File_read::do_readv): Likewise.
13268         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13269         Update declarations.
13270         * layout.cc: Include "descriptors.h".
13271         (Layout::create_build_id): Use open_descriptor rather than open.
13272         * output.cc: Include "descriptors.h".
13273         (Output_file::open): Use open_descriptor rather than open.
13274         * archive.cc (Archive::const_iterator): Change Archive to be
13275         non-const.
13276         (Archive::begin, Archive::end): Make non-const.
13277         (Archive::count_members): Likewise.
13278         * archive.h (class Archive): Update declarations.
13279         * object.h (Object::read): Make non-const.
13280         * Makefile.am (CCFILES): Add descriptors.cc.
13281         (HFILES): Add descriptors.h.
13282         * Makefile.in: Rebuild.
13283
13284         PR 6716
13285         * gold.h: Always include <clocale>.  Add Solaris workarounds
13286         following code in binutils/sysdep.h.
13287
13288         PR 6048
13289         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13290         this->eh_frame_hdr_ is NULL before using it.
13291
13292         * dynobj.cc (Versions::Versions): Update comment.
13293
13294         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13295         the base version name.
13296
13297         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13298         array size plus one.
13299         (Stringpool_template::set_string_offsets): Subtract one from key
13300         before using it as an array index.
13301         (Stringpool_template::get_offset_with_length): Likewise.
13302         (Stringpool_template::write_to_buffer): Likewise.
13303         * stringpool.h (Stringpool_template::get_offset_from_key):
13304         Likewise.
13305
13306 2008-07-23  Ian Lance Taylor  <iant@google.com>
13307
13308         PR 6658
13309         * object.h (Merged_symbol_value::value): Do our best to handle a
13310         negative addend.
13311
13312         PR 6647
13313         * script.cc (Version_script_info::get_versions): Don't add empty
13314         version tag to return value.
13315         (Version_script_info::get_symbol_version_helper): Change return
13316         type to bool.  Add pversion parameter.  Change all callers.
13317         (script_register_vers_node): Don't require a non-NULL tag.
13318         * script.h (class Version_script_info): Update declarations.
13319         (Version_script_info::get_symbol_version): Change return type to
13320         bool.  Add version parameter.  Change all callers.
13321         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13322         handling.  Handle an empty version from a version script.
13323         (Symbol_table::define_special_symbol): Likewise.
13324         * testsuite/ver_test_10.script: New file.
13325         * testsuite/ver_test_10.sh: New file.
13326         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13327         (check_DATA): Add ver_test_10.syms.
13328         (ver_test_10.syms, ver_test_10.so): New target.
13329         * testsuite/Makefile.in: Rebuild.
13330
13331 2008-07-23  Simon Baldwin  <simonb@google.com>
13332
13333         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13334         to zero for undefined symbols from dynamic libraries.
13335
13336 2008-07-23  Ian Lance Taylor  <iant@google.com>
13337
13338         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13339         Change all callers.
13340         * symtab.h (class Symbol_table): Update declaration.
13341         * testsuite/ver_test_9.cc: New file.
13342         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13343         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13344         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13345         (ver_test_9.so, ver_test_9.o): New targets.
13346         * testsuite/Makefile.in: Rebuild.
13347
13348 2008-07-22  Ian Lance Taylor  <iant@google.com>
13349
13350         * options.h (class General_options): Define --check-sections.
13351         * layout.cc (Layout::set_segment_offsets): Handle
13352         --check-sections.
13353
13354         * options.h (class General_options): Define -n/--nmagic and
13355         -N/--omagic.
13356         * options.cc (General_options::finalize): For -n/--nmagic or
13357         -N/--omagic, set -static.
13358         * layout.cc (Layout::attach_allocated_section_to_segment): If
13359         -N/--omagic, don't put read-only and read-write sections in
13360         different segments.
13361         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13362         finding a read-only segment.
13363         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13364         don't set the minimum segment alignment to the common page size,
13365         and don't set the file offset to the address modulo the page size.
13366         * script-sections.cc (Script_sections::create_segments): If
13367         -n/--omagic, don't put read-only and read-write sections in
13368         different segments.
13369
13370         * cref.cc: New file.
13371         * cref.h: New file.
13372         * options.h (class General_options): Add --print-symbol-counts.
13373         * main.cc (main): Issue defined symbol report if requested.
13374         * archive.cc (Archive::interpret_header): Make into a const member
13375         function.
13376         (Archive::add_symbols): Call Input_objects::archive_start and
13377         archive_stop.
13378         (Archive::const_iterator): Define new class.
13379         (Archive::begin, Archive::end): New functions.
13380         (Archive::include_all_members): Rewrite to use iterator.
13381         (Archive::count_members): New function.
13382         * archive.h (class Archive): Update declarations.
13383         (Archive::filename): New function.
13384         * object.cc: Include "cref.h".
13385         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13386         (Sized_relobj::do_get_global_symbol_counts): New function.
13387         (Input_objects::add_object): Add object to cross-referencer.
13388         (Input_objects::archive_start): New function.
13389         (Input_objects::archive_stop): New function.
13390         (Input_objects::print_symbol_counts): New function.
13391         * object.h: Declare Cref and Archive.
13392         (Object::get_global_symbol_counts): New function.
13393         (Object::do_get_global_symbol_counts): New pure virtual function.
13394         (class Sized_relobj): Add defined_count_ field.  Update
13395         declarations.
13396         (class Input_objects): Add cref_ field.  Update constructor.
13397         Update declarations.
13398         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13399         defined_count_.
13400         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13401         symbol counts.
13402         (Sized_dynobj::do_get_global_symbol_counts): New function.
13403         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13404         defined_count_.  Update declarations.  Define Symbols typedef.
13405         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13406         parameter.  Change all callers.
13407         (Symbol_table::add_from_dynobj): Add sympointers and defined
13408         parameters.  Change all callers.
13409         * symtab.h (class Symbol_table): Update declarations.
13410         * Makefile.am (CCFILES): Add cref.cc.
13411         (HFILES): Add cref.h.
13412         * Makefile.in: Rebuild.
13413
13414 2008-07-22  Simon Baldwin  <simonb@google.com>
13415
13416         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13417         to zero when writing undefined symbols.
13418
13419 2008-07-22  Ian Lance Taylor  <iant@google.com>
13420
13421         * output.cc (Output_section::add_input_section): Don't try to
13422         merge empty merge sections.
13423
13424 2008-07-21  Craig Silverstein  <csilvers@google.com>
13425
13426         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13427         Include symbol version in error message.
13428
13429 2008-07-20  Chris Demetriou  <cgd@google.com>
13430
13431         * configure.ac (gold_cv_c_random_seed): New configured variable.
13432         (RANDOM_SEED_CFLAGS): New substituted variable.
13433         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13434         * configure: Rebuild.
13435         * Makefile.in: Likewise.
13436         * testsuite/Makefile.in: Likewise.
13437
13438 2008-07-18  Ian Lance Taylor  <iant@google.com>
13439
13440         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13441         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13442         * testsuite/ver_test_main.cc (main): Call t4.
13443         (t4, t4_2a): Define.
13444         * testsuite/ver_test_2.cc (t4_2): Define.
13445         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13446         * testsuite/ver_test_4.cc (t4_2a): Define.
13447         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13448         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13449
13450 2008-07-17  Ian Lance Taylor  <iant@google.com>
13451
13452         * dynobj.cc (Versions::add_def): If we give an error about a
13453         missing version, go ahead and create the version anyhow.
13454
13455 2008-07-10  Ian Lance Taylor  <iant@google.com>
13456
13457         Handle output sections with more than 0x7fffffff bytes.
13458         * object.h (class Relobj): Change map_to_output_ to
13459         output_sections_, and just keep a section pointer.  Change all
13460         uses.  Move comdat group support to Sized_relobj.
13461         (Relobj::is_section_specially_mapped): Remove.
13462         (Relobj::output_section): Remove poff parameter.  Change all
13463         callers.
13464         (Relobj::output_section_offset): New function.
13465         (Relobj::set_section_offset): Rewrite.
13466         (Relobj::map_to_output): Remove.
13467         (Relobj::output_sections): New function.
13468         (Relobj::do_output_section_offset): New pure virtual function.
13469         (Relobj::do_set_section_offset): Likewise.
13470         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13471         group support from Relobj.  Update declarations.
13472         (Sized_relobj::get_output_section_offset): New function.
13473         (Sized_relobj::do_output_section_offset): New function.
13474         (Sized_relobj::do_set_section_offset): New function.
13475         * object.cc (Relobj::output_section_address): Remove.
13476         (Sized_relobj::Sized_relobj): Initialize new fields.
13477         (Sized_relobj::include_section_group): Cast find_kept_object to
13478         Sized_relobj.
13479         (Sized_relobj::include_linkonce_section): Likewise.
13480         (Sized_relobj::do_layout): Use separate arrays for output section
13481         and output offset.
13482         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13483         output_sections.
13484         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13485         output_sections and section_offsets.
13486         (Sized_relobj::write_local_symbols): Likewise.
13487         (map_to_kept_section): Compute output address directly.
13488         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13489         output_sections and section_offsets.
13490         (Sized_relobj::write_sections): Likewise.
13491         (Sized_relobj::relocate_sections): Likewise.
13492         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13493         * output.h (class Output_reloc): Update declarations.  Change
13494         u2_.relobj to Sized_relobj*.
13495         (class Output_data_reloc): Change add functions to use
13496         Sized_relobj*.
13497         * output.cc (Output_reloc::Output_reloc): Change relobj to
13498         Sized_relobj*.
13499         (Output_reloc::local_section_offset): Change return type to
13500         Elf_Addr.  Use get_output_section_offset.
13501         (Output_reloc::get_address): Likewise.
13502         (Output_section::is_input_address_mapped): Don't call
13503         is_section_specially_mapped.
13504         (Output_section::output_offset): Likewise.
13505         (Output_section::output_address): Likewise.
13506         (Output_section::starting_output_address): Likewise.
13507         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13508         parameter to Sized_relobj*.
13509         (Copy_relocs::need_copy_reloc): Likewise.
13510         (Copy_relocs::save): Likewise.
13511         * copy-relocs.h (class Copy_relocs): Update declarations.
13512         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13513         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13514         * target-reloc.h (relocate_for_relocatable): Change
13515         offset_in_output_section type to Elf_Addr.  Change code that uses
13516         it as well.
13517         * layout.cc (Layout::layout): Always set *off.
13518         * mapfile.cc (Mapfile::print_input_section): Use
13519         output_section_offset.
13520         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13521         Sized_relobj*.
13522         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13523         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13524         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13525
13526 2008-07-03  Ian Lance Taylor  <iant@google.com>
13527
13528         * layout.cc (Layout::include_section): Do not discard unrecognized
13529         SHT_STRTAB sections.
13530
13531 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13532
13533         * script.cc (Lex::can_continue_name): Make '?' allowable in
13534         version-script names.
13535         * testsuite/version_script.map: Change glob pattern to use '?'
13536
13537 2008-06-30  Manish Singh  <yosh@gimp.org>
13538
13539         PR 6585
13540         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13541         Correct typo.
13542
13543 2008-06-30  Ian Lance Taylor  <iant@google.com>
13544
13545         PR 6660
13546         PR 6682
13547         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13548         versions]: Don't try to read the value in the contents, since we
13549         don't use it.  Use the template endianness when writing.
13550
13551 2008-06-25  Cary Coutant  <ccoutant@google.com>
13552
13553         * fileread.cc (File_read::make_view): Assert on zero-length view.
13554         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13555         symbol table when there are no symbols to read.
13556
13557 2008-06-23  Craig Silverstein  <csilvers@google.com>
13558
13559         * version.cc (version_string): Bump to 1.7
13560
13561 2008-06-18  Craig Silverstein  <csilvers@google.com>
13562
13563         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13564         constant 0xFFFF to type Valtype.
13565         (Powerpc_relocate_functions::rel16_ha): Likewise.
13566
13567 2008-06-17  Ian Lance Taylor  <iant@google.com>
13568
13569         * output.h (Output_section::Input_section): Initialize p2align_ to
13570         zero for Output_section_data constructors.
13571         (Output_section::Input_section::addralign): If not an input
13572         section, return the alignment of the Output_section_data.
13573         * testsuite/copy_test.cc: New file.
13574         * testsuite/copy_test_1.cc: New file.
13575         * testsuite/copy_test_2.cc: New file.
13576         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13577         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13578         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13579         (copy_test_1_pic.o, copy_test_1.so): New targets.
13580         (copy_test_2_pic.o, copy_test_2.so): New targets.
13581         * testsuite/Makefile.in: Rebuild.
13582
13583         * script-sections.cc (Script_sections::place_orphan): Initialize
13584         local variable exact.
13585
13586 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13587
13588         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13589
13590 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13591             David S. Miller  <davem@davemloft.net>
13592
13593         * powerpc.cc: New file.
13594         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13595         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13596         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13597         * Makefile.in: Rebuild.
13598
13599 2008-06-09  Ian Lance Taylor  <iant@google.com>
13600
13601         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13602         <exception>.
13603         (throwing, orig_terminate): New static variables.
13604         (terminate_handler): New static function.
13605         (t2): Set terminate handler.
13606
13607 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13608
13609         PR 6584
13610         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13611         alignment.
13612
13613 2008-05-30  Cary Coutant  <ccoutant@google.com>
13614
13615         * archive.cc (Archive::include_all_members) Correct to step
13616         over symbol table and extended name table in thin archives.
13617
13618 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13619
13620         PR 6407
13621         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13622         calculation.
13623
13624 2008-05-28  Caleb Howe  <cshowe@google.com>
13625
13626         * reduced_debug_output.cc: New file.
13627         * reduced_debug_output.h: New file.
13628         * options.h (class General_options): Add --strip-debug-non-line.
13629         * options.cc (General_options::finalize): Add strip_debug_non_line
13630         to the strip heirarchy.
13631         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13632         fields.
13633         * layout.cc: Include "reduced_debug_output.h".
13634         (Layout::Layout): Initialize new fields.
13635         (line_only_debug_sections): New static array.
13636         (is_lines_only_debug_sections): New static inline function.
13637         (Layout::include_section): Handle --strip-debug-non-line.
13638         (Layout::make_output_section): If --strip-debug-non-line, build
13639         new output sections for .debug_abbrev and .debug_info.
13640         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13641         gold.  Warn about possible overflow.
13642         (read_signed_LEB_128): Likewise.
13643         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13644         (read_signed_LEB_128): Declare.
13645         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13646         (HFILES): Add reduced_debug_output.h.
13647         * Makefile.in: Rebuild.
13648
13649 2008-05-21  Ian Lance Taylor  <iant@google.com>
13650
13651         * mapfile.cc: New file.
13652         * mapfile.h: New file.
13653         * options.h (class General_options): Add -M/--print-map and -Map.
13654         * options.cc (General_options::finalize): Make -M equivalent to
13655         -Map -.
13656         * main.cc: Include <cstdio> and "mapfile.h".
13657         (main): Open mapfile if requested.
13658         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13659         constructor.  Change caller.
13660         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13661         (queue_middle_tasks): Likewise.
13662         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13663         declarations.
13664         * archive.cc: Include "mapfile.h".
13665         (Archive::add_symbols): Add mapfile parameter.  Change all
13666         callers.  Pass mapfile, symbol, and reason to include_member.
13667         (Archive::include_all_members): Add mapfile parameter.  Change all
13668         callers.
13669         (Archive::include_member): Add mapfile, sym, and why parameters.
13670         Change all callers.  Report inclusion to map file.
13671         * archive.h: Include "fileread.h".
13672         (class Archive): Update declarations.
13673         (Archive::file): New const method.
13674         (class Add_archive_symbols): Add mapfile_ field.  Update
13675         constructor.  Change all callers.
13676         * readsyms.h (class Read_symbols): Likewise.
13677         (class Finish_group): Likewise.
13678         (class Read_script): Likewise.
13679         * common.cc: Include "mapfile.h".
13680         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13681         all callers.
13682         (Symbol_table::do_allocate_commons): Likewise.
13683         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13684         symbol allocation to mapfile.
13685         * common.h (class Allocate_commons_task): Add mapfile_ field.
13686         Update constructor.  Change all callers.
13687         * symtab.h (class Symbol_table): Update declarations.
13688         * layout.cc: Include "mapfile.h".
13689         (Layout_task_runner::run): Print information to mapfile.
13690         (Layout::create_gold_note): Change Output_data_fixed_space to
13691         Output_data_zero_fill.
13692         (Layout::create_build_id): Likewise.
13693         (Layout::print_to_mapfile): New function.
13694         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13695         constructor.  Change caller.
13696         (class Layout): Declare print_to_mapfile.
13697         * output.cc (Output_section::Input_section::print_to_mapfile): New
13698         function.
13699         (Output_section::add_input_section): If producing a map, always
13700         add to input_sections_ list.
13701         (Output_section::do_print_to_mapfile): New function.
13702         (Output_segment::print_sections_to_mapfile): New function.
13703         (Output_segment::print_section_list_to_mapfile): New function.
13704         * output.h: Include "mapfile.h".
13705         (Output_data::print_to_mapfile): New function.
13706         (Output_data::do_print_to_mapfile): New virtual function.
13707         (Output_segment_headers::do_print_to_mapfile): New function.
13708         (Output_file_header::do_print_to_mapfile): New function.
13709         (Output_data_const::do_print_to_mapfile): New function.
13710         (class Output_data_const_buffer): Add map_name_ field.  Update
13711         constructor.  Change all callers.  Add do_print_to_mapfile
13712         function.
13713         (class Output_data_fixed_space): Likewise.
13714         (class Output_data_space): Likewise.
13715         (class Output_data_zero_fill): New class.
13716         (Output_data_strtab::do_print_to_mapfile): New function.
13717         (Output_data_reloc_base::do_print_to_mapfile): New function.
13718         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13719         (Output_data_group::do_print_to_mapfile): New function.
13720         (Output_data_got::do_print_to_mapfile): New function.
13721         (Output_data_dynamic::do_print_to_mapfile): New function.
13722         (Output_symtab_xindex::do_print_to_mapfile): New function.
13723         (class Output_section): Declare do_print_to_mapflie.  Declare
13724         print_to_mapfile in Input_section.
13725         (class Output_segment): Declare new functions.
13726         * object.h (Sized_relobj::symbol_count): New function.
13727         * script-sections.cc
13728         (Output_section_element_dot_assignment::set_section_addresses):
13729         Change Output_data_fixed_space to Output_data_zero_fill.
13730         (Output_data_expression::do_print_to_mapfile): New function.
13731         * script.cc (read_input_script): Add mapfile parameter.  Change
13732         all callers.
13733         * script.h (read_input_script): Update declaration.
13734         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13735         (Eh_frame::do_print_to_mapfile): New function.
13736         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13737         (Output_merge_string::do_print_to_mapfile): New function.
13738         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13739         function.
13740         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13741         function.
13742         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13743         function.
13744         * Makefile.am (CCFILES): Add mapfile.cc.
13745         (HFILES): Add mapfile.h.
13746         * Makefile.in: Rebuild.
13747
13748 2008-05-19  Ian Lance Taylor  <iant@google.com>
13749
13750         * options.h (class General_options): Add -z relro.
13751         * layout.cc (Layout::Layout): Initialize relro_segment_.
13752         (Layout::add_output_section_data): Return the output section.
13753         (Layout::make_output_section): Rcognize relro sections and mark
13754         them appropriately.
13755         (Layout::attach_allocated_section_to_segment): Put relro sections
13756         in a PT_GNU_RELRO segment.
13757         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13758         section as relro.
13759         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13760         PT_TLS segments.
13761         (Layout::linkonce_mapping): Map d.rel.ro.local to
13762         .data.rel.ro.local.
13763         (Layout::output_section_name): Us .data.rel.ro.local for any
13764         section which begins with that.
13765         * layout.h (class Layout): Update add_output_section_data
13766         declaration.  Add relro_segment_ field.
13767         * output.cc (Output_section::Output_section): Initialize is_relro_
13768         and is_relro_local_ fields.
13769         (Output_segment::add_output_section): Group relro sections.
13770         (Output_segment::is_first_section_relro): New function.
13771         (Output_segment::maximum_alignment): If there is a relro section,
13772         align the segment to the common page size.
13773         (Output_segment::set_section_addresses): Track whether we are
13774         looking at relro sections.  If the last section is a relro
13775         section, align to the common page size.
13776         (Output_segment::set_section_list_addresses): Add in_relro
13777         parameter.  Change all callers.  Align to the page size when
13778         moving from relro to non-relro section.
13779         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13780         segment.
13781         * output.h (class Output_section): Add is_relro_ and
13782         is_relro_local_ fields.
13783         (Output_section::is_relro): New function.
13784         (Output_section::set_is_relro): New function.
13785         (Output_section::is_relro_local): New function.
13786         (Output_section::set_is_relro_local): New function.
13787         (class Output_segment): Update declarations.
13788         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13789         * sparc.cc (Target_sparc::got_section): Likewise.
13790         * x86_64.cc (Target_x86_64::got_section): Likewise.
13791         * testsuite/relro_test_main.cc: New file.
13792         * testsuite/relro_test.cc: New file.
13793         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13794         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13795         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13796         (relro_test.so, relro_test_pic.o): New targets.
13797         * testsuite/Makefile.in: Rebuild.
13798
13799 2008-05-16  Ian Lance Taylor  <iant@google.com>
13800
13801         * output.cc (Output_segment::add_output_section): Remove front
13802         parameter.
13803         * output.h (class Output_segment): Remove
13804         add_initial_output_section and overloaded add_output_section.
13805         Update declaration of remaining add_output_section.
13806         * layout.cc (Layout::create_interp): Call add_output_section
13807         rather than add_initial_output_section.
13808         (Layout::finish_dynamic_section): Likewise.
13809
13810         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13811         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13812         know the dynamic type.
13813         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13814         field.  Initialize it in constructor.
13815         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13816         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13817         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13818         reloc.
13819
13820         * output.cc (Output_reloc::get_address): Change return type to
13821         Elf_Addr.
13822         * output.h (class Output_reloc): Update get_address declaration.
13823         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13824         for section addresses.
13825
13826 2008-05-09  Ian Lance Taylor  <iant@google.com>
13827
13828         PR 6493
13829         * gold.cc (gold_nomem): Use return value of write.
13830
13831 2008-05-08  Ian Lance Taylor  <iant@google.com>
13832
13833         * symtab.c (Symbol::init_base_output_data): Add version
13834         parameter.  Change all callers.
13835         (Symbol::init_base_output_segment): Likewise.
13836         (Symbol::init_base_constant): Likewise.
13837         (Symbol::init_base_undefined): Likewise.
13838         (Sized_symbol::init_output_data): Likewise.
13839         (Sized_symbol::init_output_segment): Likewise.
13840         (Sized_symbol::init_constant): Likewise.
13841         (Sized_symbol::init_undefined): Likewise.
13842         (Symbol_table::do_define_in_output_data): If the new symbol has a
13843         version, mark it as the default.
13844         (Symbol_table::do_define_in_output_segment): Likewise.
13845         (Symbol_table::do_define_as_constant): Likewise.
13846         * symtab.h (class Symbol): Update declarations.
13847         (class Sized_symbol): Likewise.
13848         * resolve.cc (Symbol::override_version): New function.
13849         (Symbol::override_base): Call override_version.
13850         (Symbol::override_base_with_special): Likewise.
13851         * testsuite/ver_script_8.script: New file.
13852         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13853         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13854         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13855         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13856
13857 2008-05-06  Ian Lance Taylor  <iant@google.com>
13858
13859         PR 6049
13860         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13861         functions.
13862         (class General_options): Remove existing --undefined, and add
13863         --no-undefined instead.  Add new --undefined as synonym for -u.
13864         * archive.cc (Archive::add_symbols): Check whether symbol was
13865         named with -u.
13866         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13867         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13868         all uses.  Add IS_UNDEFINED.  Update declarations to split
13869         different versions of init_base.  Declare init_base_undefined.
13870         (Symbol::is_defined): Handle IS_UNDEFINED.
13871         (Symbol::is_undefined): Likewise.
13872         (Symbol::is_weak_undefined): Call is_undefined.
13873         (Symbol::is_absolute): Handle IS_CONSTANT.
13874         (class Sized_symbol): Update declarations to split different
13875         versions of init.  Declare init_undefined.
13876         (class Symbol_table): Declare new functions.
13877         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13878         Change all callers.
13879         (Symbol::init_base_output_data): Likewise.
13880         (Symbol::init_base_output_segment): Likewise.
13881         (Symbol::init_base_constant): Likewise.
13882         (Symbol::init_base_undefined): New function.
13883         (Sized_symbol::init_object): Rename from init.  Change all
13884         callers.
13885         (Sized_symbol::init_output_data): Likewise.
13886         (Sized_symbol::init_output_segment): Likewise.
13887         (Sized_symbol::init_constant): Likewise.
13888         (Sized_symbol::init_undefined): New function.
13889         (Symbol_table::add_undefined_symbols_from_command_line): New
13890         function.
13891         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13892         function.
13893         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13894         (Symbol::output_section): Likewise.
13895         (Symbol::set_output_section): Likewise.
13896         (Symbol_table::sized_finalize_symbol): Likewise.
13897         (Symbol_table::sized_write_globals): Likewise.
13898         * resolve.cc (Symbol_table::should_override): Likewise.
13899         (Symbol::override_base_with_special): Likewise.
13900
13901         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13902         symbol, change it to have default visibility.
13903         * testsuite/protected_1.cc: New file.
13904         * testsuite/protected_2.cc: New file.
13905         * testsuite/protected_3.cc: New file.
13906         * testsuite/protected_main_1.cc: New file.
13907         * testsuite/protected_main_2.cc: New file.
13908         * testsuite/protected_main_3.cc: New file.
13909         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13910         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13911         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13912         (protected_1.so): New target.
13913         (protected_1_pic.o, protected_2_pic.o): New targets.
13914         (protected_3_pic.o): New target.
13915         (check_PROGRAMS): Add protected_2.
13916         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13917         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13918         * testsuite/Makefile.in: Rebuild.
13919
13920         * options.h (DEFINE_var): Add set_user_set_##varname__.
13921         (DEFINE_bool_alias): New macro.
13922         (class General_options): Define -Bstatic using DEFINE_bool_alias
13923         rather than DEFINE_special.  Add --undefined as an alias for -z
13924         defs.
13925         * options.cc (General_options::parse_Bstatic): Remove.
13926
13927         * options.h (class General_options): Add --fatal-warnings.
13928         * main.cc (main): Implement --fatal-warnings.
13929         * errors.h (Errors::warning_count): New function.
13930
13931         * options.h (class General_options): Add -Bsymbolic-functions.
13932         * symtab.h (Symbol::is_preemptible): Check for
13933         -Bsymbolic-functions.
13934
13935 2008-05-05  Ian Lance Taylor  <iant@google.com>
13936
13937         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13938         as noVARNAME rather than no-VARNAME.
13939         (class General_options): Add option -z combreloc.
13940         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13941         get_address.
13942         (Output_reloc::sort_before) [SHT_REL]: New function.
13943         (Output_reloc::sort_before) [SHT_RELA]: New function.
13944         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13945         Sort_relocs_comparison.
13946         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13947         parameter.  Change all callers.
13948         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13949         sort_relocs parameter.  Change all callers.
13950         * output.cc (Output_reloc::get_address): New function, broken out
13951         of write_rel.
13952         (Output_reloc::write_rel): Call it.
13953         (Output_reloc::compare): New function.
13954         (Output_data_reloc_base::do_write): Optionally sort relocs.
13955
13956         * configure.ac: If targ_extra_obj is set, link it in.
13957         * configure.tgt: Initialize all variables.
13958         (x86_64*): Set targ_extra_obj and targ_extra_size.
13959         * configure: Rebuild.
13960
13961         * object.cc (Sized_relobj::include_section_group): Adjust section
13962         indexes read from group data.  Build vector to pass to
13963         layout_group.
13964         * layout.cc (Layout::layout_group): Add flags and shndxes
13965         parameters.  Remove contents parameter.  Change caller.  Update
13966         explicit instantiations.
13967         * layout.h (class Layout): Update layout_group declaration.
13968         * output.cc (Output_data_group::Output_data_group): Add flags and
13969         input_shndxes parameters.  Remove contents parameter.  Change
13970         caller.
13971         (Output_data_group::do_write): Change input_sections_ to
13972         input_shndxes_.
13973         * output.h (class Output_data_group): Update constructor
13974         declaration.  Rename input_sections_ to input_shndxes_.
13975         * testsuite/many_sections_test.cc: Add template.
13976
13977 2008-04-30  Cary Coutant  <ccoutant@google.com>
13978
13979         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13980
13981         * layout.cc (Layout::include_section): Refactored check for debug
13982         info section.
13983         (Layout::add_comdat): Add new parameters.  Change type
13984         of signature parameter.  Add object and shndx to signatures table.
13985         (Layout::find_kept_object): New function.
13986         * layout.h: Include <cstring>.
13987         (Layout::is_debug_info_section): New function.
13988         (Layout::add_comdat): Add new parameters.
13989         (Layout::find_kept_object): New function.
13990         (Layout::Kept_section): New struct.
13991         (Layout::Signatures): Change type of map range.
13992         * object.cc (Relobj::output_section_address): New function.
13993         (Sized_relobj::include_section_group): Add new parameters.  Change
13994         calls to Layout::add_comdat.  Change to build table of kept comdat
13995         groups and table mapping discarded sections to kept sections.
13996         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13997         (Sized_relobj::do_layout): Change calls to include_section_group and
13998         include_linkonce_section.
13999         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14000         value to zero when section is discarded.
14001         (Sized_relobj::map_to_kept_section): New function.
14002         * object.h (Relobj::output_section_address): New function.
14003         (Relobj::Comdat_group): New type.
14004         (Relobj::find_comdat_group): New function.
14005         (Relobj::Comdat_group_table): New type.
14006         (Relobj::Kept_comdat_section): New type.
14007         (Relobj::Kept_comdat_section_table): New type.
14008         (Relobj::add_comdat_group): New function.
14009         (Relobj::set_kept_comdat_section): New function.
14010         (Relobj::get_kept_comdat_section): New function.
14011         (Relobj::comdat_groups_): New field.
14012         (Relobj::kept_comdat_sections_): New field.
14013         (Symbol_value::input_value): Update comment.
14014         (Sized_relobj::map_to_kept_section) New function.
14015         (Sized_relobj::include_linkonce_section): Add new parameter.
14016         * target-reloc.h (Comdat_behavior): New type.
14017         (get_comdat_behavior): New function.
14018         (relocate_section): Add code to map a discarded section to the
14019         corresponding kept section when applying a relocation.
14020
14021 2008-04-30  Craig Silverstein  <csilvers@google.com>
14022
14023         * dwarf_reader.cc (next_generation_count): New static var.
14024         (Addr2line_cache_entry): New struct.
14025         (addr2line_cache): New static var.
14026         (Dwarf_line_info::one_addr2line): Added caching.
14027         (Dwarf_line_info::clear_addr2line_cache): New function.
14028         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14029         cache-size parameter.
14030         (Dwarf_line_info::one_addr2line_cache): New function.
14031         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14032         new cache-size argument to one_addr2line(), and clear cache.
14033
14034 2008-04-28  Cary Coutant  <ccoutant@google.com>
14035
14036         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14037         R_386_PC8 relocations.
14038
14039 2008-04-23  Ian Lance Taylor  <iant@google.com>
14040
14041         * object.cc (Sized_relobj::include_section_group): Check for
14042         invalid section group.
14043
14044         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14045         header size.
14046
14047         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14048         than read for file header.
14049         * archive.cc (Archive::include_member): Likewise.
14050
14051 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14052
14053         * aclocal.m4: Regenerate.
14054         * configure: Regenerate.
14055
14056 2008-04-19  Ian Lance Taylor  <iant@google.com>
14057
14058         * version.cc (version_string): Bump to 1.6.
14059
14060         * testsuite/Makefile.am (many_sections_r_test): New target.
14061         (many_sections_r_test_SOURCES): Remove.
14062         (many_sections_r_test_DEPENDENCIES): Remove.
14063         (many_sections_r_test_LDFLAGS): Remove.
14064         (many_sections_r_test_LDADD): Remove.
14065
14066         * object.cc (Sized_relobj::do_add_symbols): Always pass
14067         local_symbol_count_ to add_from_relobj.
14068
14069         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14070         every thousand variables.
14071         * testsuite/Makefile.in: Rebuild.
14072
14073         * object.cc (Xindex::initialize_symtab_xindex): New function.
14074         (Xindex::read_symtab_xindex): New function.
14075         (Xindex::sym_xindex_to_shndx): New function.
14076         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14077         available.
14078         (Sized_relobj::do_initialize_xindex): New function.
14079         (Sized_relobj::do_read_symbols): Adjust section links.
14080         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14081         parameter.  Change all callers.
14082         (Sized_relobj::include_section_group): Adjust section links and
14083         symbol section indexes.
14084         (Sized_relobj::do_layout): Adjust section links.
14085         (Sized_relobj::do_count_local_symbols): Adjust section links and
14086         symbol section indexes.
14087         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14088         ordinary and special symbols.
14089         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14090         dynsym_xindex parameters.  Change all callers.  Adjust section
14091         links.  Use SHN_XINDEX when needed.
14092         (Sized_relobj::get_symbol_location_info): Adjust section links.
14093         Don't get fooled by special symbols.
14094         * object.h (class Xindex): Define.
14095         (class Object): Add xindex_ parameter.  Declare virtual functoin
14096         do_initialize_xindex.
14097         (Object::adjust_sym_shndx): New function.
14098         (Object::set_xindex): New protected function.
14099         (class Symbol_value): Add is_ordinary_shndx_ field.
14100         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14101         (Symbol_value::value): Assert ordinary section.
14102         (Symbol_value::initialize_input_to_output_map): Likewise.
14103         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14104         Change all callers.
14105         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14106         all callers.
14107         (class Sized_relobj): Update declarations.
14108         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14109         parameter.  Change all callers.
14110         (Sized_relobj::adjust_shndx): New function.
14111         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14112         field.
14113         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14114         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14115         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14116         (Sized_dynobj::read_dynsym_section): Adjust section links.
14117         (Sized_dynobj::read_dynamic): Likewise.
14118         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14119         section links.
14120         (Sized_dynobj::do_initialize_xindex): New function.
14121         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14122         do_initialize_xindex.
14123         (Sized_dynobj::adjust_shndx): New function.
14124         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14125         dynsym_xindex_ fields.
14126         (Layout::finalize): Add a call to set_section_indexes before
14127         creating the symtab sections.
14128         (Layout::set_section_indexes): Don't do anything if the section
14129         already has a section index.
14130         (Layout::create_symtab_sections): Add shnum parameter.  Change
14131         caller.  Create .symtab_shndx section if needed.
14132         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14133         caller.
14134         (Layout::allocated_output_section_count): New function.
14135         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14136         needed.
14137         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14138         fields.  Update declarations.
14139         (Layout::symtab_xindex): New function.
14140         (Layout::dynsym_xindex): New function.
14141         (class Write_symbols_task): Add layout_ field.
14142         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14143         Change caller.
14144         * output.cc (Output_section_headers::Output_section_headers): Add
14145         shstrtab_section parameter.  Change all callers.
14146         (Output_section_headers::do_sized_write): Store overflow values
14147         for section count and section string table section index in
14148         section header zero.
14149         (Output_file_header::do_sized_write): Check for overflow of
14150         section count and section string table section index.
14151         (Output_symtab_xindex::do_write): New function.
14152         (Output_symtab_xindex::endian_do_write): New function.
14153         * output.h (class Output_section_headers): Add shstrtab_section_.
14154         Update declarations.
14155         (class Output_symtab_xindex): Define.
14156         (Output_section::has_out_shndx): New function.
14157         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14158         field.
14159         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14160         Change all callers.
14161         (Sized_symbol::init): Likewise.
14162         (Symbol::output_section): Check for ordinary symbol.
14163         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14164         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14165         callers.
14166         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14167         Change all callers.  Simplify handling of symbols from sections
14168         not included in the link.
14169         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14170         distinction.
14171         (Weak_alias_sorter::operator()): Assert that symbols are
14172         ordinary.
14173         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14174         distinction.
14175         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14176         parameters.  Change all callers.
14177         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14178         symbol distinction.  Use SHN_XINDEX when needed.
14179         (Symbol_table::write_section_symbol): Add symtab_xindex
14180         parameter.  Change all callers.
14181         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14182         SHN_XINDEX when needed.
14183         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14184         declarations.
14185         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14186         (Symbol::is_defined): Check is_ordinary.
14187         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14188         (Symbol::is_absolute, Symbol::is_common): Likewise.
14189         (class Sized_symbol): Update declarations.
14190         (class Symbol_table): Update declarations.
14191         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14192         parameters.  Change all callers.
14193         (Sized_symbol::override): Likewise.
14194         (Symbol_table::override): Likewise.
14195         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14196         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14197         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14198         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14199         to be in an ordinary section.
14200         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14201         object and is_ordinary parameters.  Change all callers.
14202         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14203         Change all callers.  Don't add undefined or non-ordinary symbols
14204         to reloc_map_.
14205         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14206         Change all callers.
14207         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14208         declarations.
14209         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14210         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14211         (Sized_relobj::relocate_sections): Likewise.
14212         * target-reloc.h (scan_relocs): Adjust section symbol index.
14213         (scan_relocatable_relocs): Likewise.
14214         * i386.cc (Scan::local): Check for ordinary symbols.
14215         * sparc.cc (Scan::local): Likewise.
14216         * x86_64.cc (Scan::local): Likewise.
14217         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14218         to symbol_section_and_value.
14219         * testsuite/many_sections_test.cc: New file.
14220         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14221         (check_PROGRAMS): Add many_sections_test.
14222         (many_sections_test_SOURCES): Define.
14223         (many_sections_test_DEPENDENCIES): Define.
14224         (many_sections_test_LDFLAGS): Define.
14225         (BUILT_SOURCES): Add many_sections_define.h.
14226         (many_sections_define.h): New target.
14227         (BUILT_SOURCES): Add many_sections_check.h.
14228         (many_sections_check.h): New target.
14229         (check_PROGRAMS): Add many_sections_r_test.
14230         (many_sections_r_test_SOURCES): Define.
14231         (many_sections_r_test_DEPENDENCIES): Define.
14232         (many_sections_r_test_LDFLAGS): Define.
14233         (many_sections_r_test_LDADD): Define.
14234         (many_sections_r_test.o): New target.
14235         * testsuite/Makefile.in: Rebuild.
14236
14237 2008-04-17  Cary Coutant  <ccoutant@google.com>
14238
14239         * errors.cc (Errors::info): New function.
14240         (gold_info): New function.
14241         * errors.h (Errors::info): New function.
14242         * gold.h (gold_info): New function.
14243         * object.cc (Input_objects::add_object): Print trace output.
14244         * options.cc (options::parse_set): New function.
14245         (General_options::parse_wrap): Deleted.
14246         (General_options::General_options): Deleted initializer.
14247         * options.h (options::String_set): New typedef.
14248         (options::parse_set): New function.
14249         (DEFINE_set): New macro.
14250         (General_options::wrap): Changed to use DEFINE_set. Changed
14251         callers of any_wrap_symbols and is_wrap_symbol.
14252         (General_options::trace, General_options::trace_symbol):
14253         New options.
14254         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14255         (General_options::wrap_symbols_): Deleted.
14256         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14257
14258 2008-04-17  David S. Miller  <davem@davemloft.net>
14259
14260         * options.cc (General_options::parse_V): New function.
14261         * options.h: Add entries for -V and -Qy.
14262
14263 2008-04-17  Ian Lance Taylor  <iant@google.com>
14264
14265         * common.cc (Symbol_table::allocate_commons): Remove options
14266         parameter.  Change caller.
14267         (Symbol_table::do_allocate_commons): Remove options parameter.
14268         Change caller.  Just call do_allocate_commons_list twice.
14269         (Symbol_table::do_allocate_commons_list): New function, broken out
14270         of do_allocate_commons.
14271         * common.h (class Allocate_commons_task): Remove options_ field.
14272         Update constructor.
14273         * symtab.cc (Symbol_table::Symbol_table): Initialize
14274         tls_commons_.
14275         (Symbol_table::add_from_object): Put TLS common symbols on
14276         tls_commons_ list.
14277         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14278         which are IN_OUTPUT_DATA.
14279         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14280         allocate_commons and do_allocate_commons declarations.  Declare
14281         do_allocate_commons_list.
14282         * gold.cc (queue_middle_tasks): Update creation of
14283         Allocate_commons_task to not pass options.
14284         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14285         (TLS_TEST_C_FLAGS): New variable.
14286         (tls_test_c_pic.o): New target.
14287         (tls_test_shared.so): Link in tls_test_c_pic.o.
14288         (tls_test_c_pic_ie.o): New target.
14289         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14290         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14291         (tls_test_c.o): New target.
14292         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14293         (tls_pic_test_LDADD): Likewise.
14294         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14295         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14296         (tls_test_c_gnu2.o): New target.
14297         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14298         tls_test_c_gnu2.o.
14299         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14300         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14301         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14302         * testsuite/tls_test.cc: Include "config.h".
14303         (t_last): Call t11_last.
14304         * testsuite/tls_test.h (t11, t11_last): Declare.
14305         * testsuite/tls_test_c.c: New file.
14306         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14307         * configure.ac: Check for OpenMP support.
14308         * configure, config.in, Makefile.in: Rebuild.
14309         * testsuite/Makefile.in: Rebuild.
14310
14311 2008-04-16  Cary Coutant  <ccoutant@google.com>
14312
14313         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14314         (Target_i386::tls_base_symbol_defined_): New field.
14315         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14316         (Target_i386::Scan::global): Likewise.
14317         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14318         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14319         (Target_x86_64::tls_base_symbol_defined_): New field.
14320         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14321         (Target_x86_64::Scan::global): Likewise.
14322
14323 2008-04-16  Cary Coutant  <ccoutant@google.com>
14324
14325         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14326         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14327         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14328         building shared libraries.
14329         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14330         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14331         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14332         * testsuite/Makefile.in: Rebuild.
14333         * testsuite/weak_undef.h: New file.
14334         * testsuite/weak_undef_file1.cc: Add extra test cases.
14335         * testsuite/weak_undef_file2.cc: Likewise.
14336         * testsuite/weak_undef_test.cc: Likewise.
14337
14338 2008-04-16  David S. Miller  <davem@davemloft.net>
14339
14340         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14341         Add issued_non_pic_error_ field.  Declare check_non_pic.
14342         (Target_sparc::Scan::check_non_pic): New function.
14343         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14344         (Target_sparc::Scan::global): Likewise.
14345
14346         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14347         * configure: Rebuild.
14348
14349         * options.h (DEFINE_enable): New macro.
14350         (new_dtags): New enable option.
14351         (initfirst, interpose, loadfltr, nodefaultlib,
14352         nodelete, nodlopen, nodump): New -z options.
14353         * layout.cc (Layout:finish_dynamic_section): If new
14354         dtags enabled, emit DT_RUNPATH.  Also, emit a
14355         DT_FLAGS_1 containing any specified -z flags.
14356
14357 2008-04-16  Ian Lance Taylor  <iant@google.com>
14358
14359         * copy-relocs.cc: New file.
14360         * copy-relocs.h: New file.
14361         * reloc.cc: Remove Copy_relocs code.
14362         * reloc.h: Likewise.
14363         * reloc-types.h (struct Reloc_types) [both versions]: Add
14364         get_reloc_addend_noerror.
14365         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14366         variants of add_global which take an addend which must be zero.
14367         * i386.cc: Include "copy-relocs.h".
14368         (class Target_i386): Change type of copy_relocs_ to variable,
14369         update initializer.
14370         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14371         Change all callers.
14372         (Target_i386::do_finalize_sections): Change handling of
14373         copy_relocs_.
14374         * sparc.cc: Include "copy-relocs.h".
14375         (class Target_sparc): Change type of copy_relocs_ to variable,
14376         update initializer.
14377         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14378         Change all callers.
14379         (Target_sparc::do_finalize_sections): Change handling of
14380         copy_relocs_.
14381         * x86_64.cc: Include "copy-relocs.h".
14382         (class Target_x86_64): Change type of copy_relocs_ to variable,
14383         update initializer.
14384         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14385         class.  Change all callers.
14386         (Target_x86_64::do_finalize_sections): Change handling of
14387         copy_relocs_.
14388         * Makefile.am (CCFILES): Add copy-relocs.cc.
14389         (HFILES): Add copy-relocs.h.
14390
14391         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14392
14393         * testsuite/script_test_4.sh: Permit leading zeroes.
14394
14395 2008-04-15  Ian Lance Taylor  <iant@google.com>
14396
14397         * script-sections.cc (Script_sections::create_segments): Use
14398         header_size_adjustment even when there is enough room for the
14399         headers.
14400         * testsuite/script_test_4.sh: New file.
14401         * testsuite/script_test_4.t: New file.
14402         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14403         (check_DATA): Add script_test_4.stdout.
14404         (MOSTLYCLEANFILES): Likewise.
14405         (script_test_4): New target.
14406         (script_test_4.stdout): New target.
14407         * testsuite/Makefile.in: Rebuild.
14408
14409         * sparc.cc: Add definitions for Output_data_plt_sparc class
14410         constants.
14411
14412 2008-04-14  David S. Miller  <davem@davemloft.net>
14413
14414         * sparc.cc: New file.
14415         * Makefile.am (TARGETSOURCES): Add sparc.cc
14416         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14417         * configure.tgt: Document targ_extra_size and
14418         targ_extra_big_endian.  Add entries for sparc-* and
14419         sparc64-*.
14420         * configure.ac: Handle targ_extra_size and
14421         targ_extra_big_endian.
14422         * Makefile.in: Rebuild.
14423         * configure: Likewise.
14424         * po/POTFILES.in: Likewise.
14425         * po/gold.pot: Likewise.
14426
14427 2008-04-14  Ian Lance Taylor  <iant@google.com>
14428
14429         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14430         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14431         in the name/type/flags to section mapping.  Don't call
14432         allocate_output_section.
14433         (Layout::choose_output_section): Change parameter from adjust_name
14434         to is_input_section.  Don't permit input sections after sections
14435         are attached to segments.  Don't call allocate_output_section.
14436         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14437         not write_enable_output_section.
14438         (Layout::make_output_section): Don't push to
14439         unattached_section_list_ nor call attach_to_segment.  Call
14440         attach_section_to_segment if sections are attached.
14441         (Layout::attach_sections_to_segments): New function.
14442         (Layout::attach_section_to_segment): New function.
14443         (Layout::attach_allocated_section_to_segment): Rename from
14444         attach_to_segment.  Remove flags parameter.
14445         (Layout::allocate_output_section): Remove function.
14446         (Layout::write_enable_output_section): Remove function.
14447         * layout.h (class Layout): Update for above changes.  Add new
14448         field sections_are_attached_.
14449         * output.h (Output_section::update_flags_for_input_section): New
14450         function.
14451         * output.cc (Output_section::add_input_section): Call
14452         update_flags_for_input_section.
14453         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14454
14455 2008-04-11  Cary Coutant  <ccoutant@google.com>
14456
14457         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14458         thought unnecessary.
14459         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14460
14461 2008-04-11  Ian Lance Taylor  <iant@google.com>
14462
14463         * output.h (class Output_section_data): Remove inline definition
14464         of set_addralign.
14465         * output.cc (Output_section_data::set_addralign): New function.
14466
14467 2008-04-11  Cary Coutant  <ccoutant@google.com>
14468
14469         Add support for TLS descriptors for i386 and x86_64.
14470         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14471         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14472         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14473         GOT_TYPE_TLS_DESC.
14474         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14475         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14476         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14477         relocations.
14478         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14479         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14480         Fix problem with initial-exec relocations.
14481         (Target_i386::Relocate::relocate_tls): Likewise.
14482         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14483         relaxation.
14484         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14485         support for section-plus-offset dynamic table entries.
14486         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14487         (Output_data_dynamic::Dynamic_entry): Add support for
14488         section-plus-offset dynamic table entries.
14489         (Output_data_dynamic::Classification): Likewise.
14490         (Output_data_dynamic::classification_): Renamed offset_.
14491         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14492         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14493         (Target_x86_64::make_plt_section): New function.
14494         (Target_x86_64::reserve_tlsdesc_entries): New function.
14495         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14496         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14497         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14498         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14499         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14500         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14501         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14502         add extra PLT entry for TLS descriptors.
14503         (Output_data_plt_x86_64::got_): New field.
14504         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14505         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14506         fields.
14507         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14508         descriptors.
14509         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14510         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14511         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14512         R_386_TLS_DESC_CALL relocations.
14513         (Target_x86_64::Scan::global): Likewise.
14514         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14515         for TLS descriptors.
14516         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14517         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14518         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14519         GD-to-IE relaxation.
14520         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14521         and TLS_DESCRIPTORS.
14522         * Makefile.in: Rebuild.
14523         * configure: Rebuild.
14524         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14525         (tls_test_shared2.so): New target.
14526         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14527         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14528         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14529         (tls_shared_gd_to_ie_test_LDADD): New variable.
14530         (tls_shared_gnu2_gd_to_ie_test): New target.
14531         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14532         New targets.
14533         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14534         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14535         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14536         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14537         (tls_shared_gnu2_test): New target.
14538         (tls_test_gnu2_shared.so): New target.
14539         (tls_shared_gnu2_test_SOURCES): New variable.
14540         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14541         (tls_shared_gnu2_test_LDFLAGS): New variable.
14542         (tls_shared_gnu2_test_LDADD): New variable.
14543         * testsuite/Makefile.in: Rebuild.
14544         * testsuite/Makefile.
14545
14546 2008-04-11  Ian Lance Taylor  <iant@google.com>
14547
14548         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14549         justsyms.t.
14550         * testsuite/Makefile.in: Rebuild.
14551
14552         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14553         long.
14554         * testsuite/script_test_2.cc (main): Adjust test.
14555
14556 2008-04-11  David S. Miller  <davem@davemloft.net>
14557             Ian Lance Taylor  <iant@google.com>
14558
14559         * options.h (General_options): Add entries for '-Y' and
14560         '-relax'.
14561         * options.cc (General_options:finalize): If -Y was used, add those
14562         entries to the library path instead of the default "/lib" and
14563         "/usr/lib".
14564
14565 2008-04-11  David S. Miller  <davem@davemloft.net>
14566
14567         * testsuite/justsyms.t: Start at 0x100.
14568         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14569         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14570         long.
14571         * testsuite/script_test_2.cc: Adjust string and section length
14572         checks.
14573
14574 2008-04-09  Ian Lance Taylor  <iant@google.com>
14575
14576         PR gold/5996
14577         * script-sections.cc (Sections_element::allocate_to_segment): Add
14578         orphan parameter.
14579         (Output_section_definition::allocate_to_segment): Likewise.
14580         (Orphan_output_section::allocate_to_segment): Likewise.
14581         (Script_sections::attach_sections_using_phdrs_clause): Don't
14582         propagate non-PT_LOAD segments to orphan sections.
14583         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14584         readelf rather than objdump.
14585         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14586         .interp section and PT_INTERP segment are the same size.
14587         * testsuite/Makefile.in: Rebuild.
14588
14589         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14590         aliases for symbols defined in the same object.
14591         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14592         (weak_alias_test_SOURCES): New variable.
14593         (weak_alias_test_DEPENDENCIES): New variable.
14594         (weak_alias_test_LDFLAGS): New variable.
14595         (weak_alias_test_LDADD): New variable.
14596         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14597         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14598         (weak_alias_test_3.o): New target.
14599         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14600         * testsuite/weak_alias_test_main.cc: New file.
14601         * testsuite/weak_alias_test_1.cc: New file.
14602         * testsuite/weak_alias_test_2.cc: New file.
14603         * testsuite/weak_alias_test_3.cc: New file.
14604
14605 2008-04-08  Ian Lance Taylor  <iant@google.com>
14606
14607         * options.h (class General_options): Add --noinhibit-exec option.
14608         * main.cc (main): Check --noinhibit-exec.
14609
14610         * options.h (class General_options): Define --wrap as a special
14611         option.  Add wrap_symbols_ field.
14612         (General_options::any_wrap_symbols): New function.
14613         (General_options::is_wrap_symbol): New function.
14614         * options.cc (General_options::parse_wrap): New function.
14615         (General_options::General_options): Initialize wrap_symbols_.
14616         * symtab.cc (Symbol_table::wrap_symbol): New function.
14617         (Symbol_table::add_from_object): Handle --wrap.
14618         * symtab.h (class Symbol_table): Declare wrap_symbol.
14619         * target.h (Target::wrap_char): New function.
14620         (Target::Target_info): Add wrap_char field.
14621         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14622         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14623         * testsuite/testfile.cc (Target_test::test_target_info):
14624         Likewise.
14625
14626         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14627         there is one.
14628
14629         * layout.h (class Layout): Add added_eh_frame_data_ field.
14630         * layout.cc (Layout::Layout): Initialize new field.
14631         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14632         output section until we find a section we merged successfully.
14633         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14634         that the size be non-zero.
14635
14636         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14637         qualifier.
14638
14639 2008-04-08  Craig Silverstein  <csilvers@google.com>
14640
14641         * configure.ac: Export new conditional variable HAVE_ZLIB.
14642         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14643         on HAVE_ZLIB.
14644         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14645         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14646
14647 2008-04-07  Ian Lance Taylor  <iant@google.com>
14648
14649         * version.cc (version_string): Set to "1.5".
14650
14651         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14652         Add issued_non_pic_error_ field.  Declare check_non_pic.
14653         (Target_x86_64::Scan::check_non_pic): New function.
14654         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14655         (Target_x86_64::Scan::global): Likewise.
14656
14657         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14658         addend parameter.  Change caller.  Handle merge sections.
14659         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14660         Address to Addend.  Don't add in the result of
14661         local_section_offset, pass down the addend and use the returned
14662         value.
14663         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14664         Update declarations of local_section_offset and symbol_value.
14665         * testsuite/two_file_test_1.cc (t18): New function.
14666         * testsuite/two_file_test_2.cc (f18): New function.
14667         * testsuite/two_file_test_main.cc (main): Call t18.
14668         * testsuite/two_file_test.h (t18, f18): Declare.
14669
14670         * configure.ac: Don't test for objdump, c++filt, or readelf.
14671         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14672         conditionals.
14673         (TEST_READELF): New variable.
14674         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14675         (check_PROGRAMS): Add two_file_strip_test.
14676         (two_file_strip_test): New target.
14677         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14678         (two_file_same_shared_strip_test_SOURCES): New variable.
14679         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14680         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14681         (two_file_same_shared_strip_test_LDADD): New variable.
14682         (two_file_shared_strip.so): New target.
14683         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14684         (ver_test_5.syms, ver_test_7.syms): Likewise.
14685         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14686         (strip_test_3.stdout): Use TEST_OBJDUMP.
14687         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14688
14689 2008-04-04  Cary Coutant  <ccoutant@google.com>
14690
14691         * symtab.h (Symbol::is_weak_undefined): New function.
14692         (Symbol::is_strong_undefined): New function.
14693         (Symbol::is_absolute): New function.
14694         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14695         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14696         absolute symbols.
14697         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14698         (weak_undef_test): New target.
14699         * testsuite/Makefile.in: Rebuild.
14700         * testsuite/weak_undef_file1.cc: New file.
14701         * testsuite/weak_undef_file2.cc: New file.
14702         * testsuite/weak_undef_test.cc: New file.
14703
14704 2008-04-03  Craig Silverstein  <csilvers@google.com>
14705
14706         * compressed_output.h (class Output_compressed_section): Use
14707         unsigned buffer.
14708         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14709         add zlib header.
14710         (zlib_compressed_suffix): Removed.
14711         (Output_compressed_section::set_final_data_size): Use unsigned
14712         buffers.
14713         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14714         Fix linker invocation.
14715         (flagstest_o_specialfile_and_compress_debug_sections):
14716         Likewise.
14717         * testsuite/Makefile.in: Regenerated.
14718
14719 2008-04-02  David S. Miller  <davem@davemloft.net>
14720
14721         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14722         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14723
14724 2008-04-02  Craig Silverstein  <csilvers@google.com>
14725
14726         * TODO: New file.
14727
14728 2008-04-02  Ian Lance Taylor  <iant@google.com>
14729
14730         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14731         parameters.  Update for new key type to views_.  Change all
14732         callers.
14733         (File_read::read): Adjust for byteshift in returned view.
14734         (File_read::add_view): New function, broken out of
14735         find_and_make_view.
14736         (File_read::make_view): New function, broken out of
14737         find_and_make_view.
14738         (File_read::find_or_make_view): Add offset and aligned
14739         parameters.  Rewrite accordingly.  Change all callers.
14740         (File_read::get_view): Add offset and aligned parameters.  Adjust
14741         for byteshift in return value.
14742         (File_read::get_lasting_view): Likewise.
14743         * fileread.h (class File_read): Update declarations.
14744         (class File_read::View): Add byteshift_ field.  Add byteshift to
14745         constructor.  Add byteshift method.
14746         * archive.h (Archive::clear_uncached_views): New function.
14747         (Archive::get_view): Add aligned parameter.  Change all callers.
14748         * object.h (Object::get_view): Add aligned parameter.  Change all
14749         callers.
14750         (Object::get_lasting_view): Likewise.
14751
14752         * fileread.cc (File_read::release): Don't call clear_views if
14753         there are multiple objects.
14754         * fileread.h (File_read::clear_uncached_views): New function.
14755         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14756         on the archive.
14757
14758 2008-03-31  Cary Coutant  <ccoutant@google.com>
14759
14760         Add thin archive support.
14761         * archive.cc (Archive::armagt): New const.
14762         (Archive::setup): Remove task parameter and calls to unlock.
14763         (Archive::unlock_nested_archives): New function.
14764         (Archive::read_header): Add nested_off parameter. Change
14765         all callers.
14766         (Archive::interpret_header): Likewise.
14767         (Archive::include_all_members): Change to handle thin
14768         archives.
14769         (Archive::include_member): Likewise.
14770         * archive.h (Archive::Archive): Add new parameters and
14771         initializers.
14772         (Archive::armagt): New const.
14773         (Archive::setup): Remove task parameter.
14774         (Archive::unlock_nested_archives): New function.
14775         (Archive::read_header): Add nested_off parameter.
14776         (Archive::interpret_header): Likewise.
14777         (Archive::Nested_archive_table): New typedef.
14778         (Archive::is_thin_archive_): New field.
14779         (Archive::nested_archives_): New field.
14780         (Archive::options_): New field.
14781         (Archive::dirpath_): New field.
14782         (Archive::task_): New field.
14783         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14784         for thin archives.  Pass additional parameters to
14785         Archive::Archive.  Unlock the archive file after calling
14786         Archive::setup.
14787
14788 2008-03-29  Ian Lance Taylor  <iant@google.com>
14789
14790         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14791         version symbol to be local.
14792         * testsuite/ver_test_4.sh: New file.
14793         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14794         (check_DATA): Add ver_test_4.syms.
14795         (ver_test_4.syms): New target.
14796         * testsuite/Makefile.in: Rebuild.
14797
14798         * output.cc
14799         (Output_section::Input_section_sort_entry::has_priority): New
14800         function.
14801         (Output_section::Input_section_sort_entry::match_file_name): New
14802         function.
14803         (Output_section::Input_section_sort_entry::match_section_name):
14804         Remove.
14805         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14806         Remove.
14807         (Output_section::Input_section_sort_entry::match_section_file):
14808         Remove.
14809         (Output_section::Input_section_sort_compare::operator()): Rewrite
14810         using new Input_section_sort_entry functions.  Sort crtbegin and
14811         crtend first.  Sort sections with no priority before sections with
14812         a priority.
14813         * testsuite/initpri1.c (d3): Check j != 4.
14814         (cd5): New constructor/destructor function.
14815         (main): Check j != 2.
14816
14817         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14818         new symbol when resolving, don't call set_is_default.
14819         * testsuite/ver_test_7.cc: New file.
14820         * testsuite/ver_test_7.sh: New file.
14821         * testsuite/Makefile.am (ver_test_7.so): New target.
14822         (ver_test_7.o): New target.
14823         (check_SCRIPTS): Add ver_test_7.sh.
14824         (check_DATA): Add ver_test_7.syms.
14825         (ver_test_7.syms): New target.
14826
14827 2008-03-28  Ian Lance Taylor  <iant@google.com>
14828
14829         * layout.cc (Layout::layout): If we see an input section with a
14830         name that needs sorting, set the must_sort flag for the output
14831         section.
14832         (Layout::make_output_section): If the name of the output section
14833         indicates that it might require sorting, set the may_sort flag.
14834         * output.h (Output_section::may_sort_attached_input_sections): New
14835         function.
14836         (Output_section::set_may_sort_attached_input_sections): New
14837         function.
14838         (Output_section::must_sort_attached_input_sections): New
14839         function.
14840         (Output_section::set_must_sort_attached_input_sections): New
14841         function.
14842         (class Output_section): Declare Input_section_sort_entry.  Define
14843         Input_section_sort_compare.  Declare
14844         sort_attached_input_sections.  Add new fields:
14845         may_sort_attached_input_sections_,
14846         must_sort_attached_input_sections_,
14847         attached_input_sections_are_sorted_.
14848         * output.cc (Output_section::Output_section): Initialize new
14849         fields.
14850         (Output_section::add_input_section): Add an entry to
14851         input_sections_ if may_sort or must_sort are true.
14852         (Output_section::set_final_data_size): Call
14853         sort_attached_input_sections if necessary.
14854         (Output_section::Input_section_sort_entry): Define new class.
14855         (Output_section::Input_section_sort_compare::operator()): New
14856         function.
14857         (Output_section::sort_attached_input_sections): New function.
14858         * configure.ac: Check whether the compiler supports constructor
14859         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14860         * testsuite/initpri1.c: New file.
14861         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14862         CONSTRUCTOR_PRIORITY.
14863         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14864         (initpri1_LDFLAGS): New variable.
14865         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14866
14867 2008-03-27  Ian Lance Taylor  <iant@google.com>
14868
14869         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14870         * testsuite/common_test_1.c: New file.
14871         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14872         (common_test_1_SOURCES): New variable.
14873         (common_test_1_DEPENDENCIES): New variable.
14874         (common_test_1_LDFLAGS): New variable.
14875
14876         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14877         and commons_ correctly when NAME/VERSION does not override
14878         NAME/NULL.
14879         * testsuite/ver_test_6.c: New file.
14880         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14881         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14882         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14883
14884 2008-03-26  Ian Lance Taylor  <iant@google.com>
14885
14886         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14887         of an undefined symbol from a version script.
14888         * testsuite/Makefile.am (ver_test_5.so): New target.
14889         (ver_test_5.o): New target.
14890         (check_SCRIPTS): Add ver_test_5.sh.
14891         (check_DATA): Add ver_test_5.syms.
14892         (ver_test_5.syms): New target.
14893         * testsuite/ver_test_5.cc: New file.
14894         * testsuite/ver_test_5.script: New file.
14895         * testsuite/ver_test_5.sh: New file.
14896         * Makefile.in, testsuite/Makefile.in: Rebuild.
14897
14898         PR gold/5986
14899         Fix problems building gold with gcc 4.3.0.
14900         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14901         (gold_error_at_location, gold_warning_at_location): Use it.
14902         * configure.ac: Check whether we can compile and use a template
14903         function with a printf attribute.
14904         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14905         when jumping over bytes.
14906         * object.cc: Instantiate Object::read_section_data.
14907         * debug.h: Include <cstring>
14908         * dwarf_reader.cc: Include <algorithm>
14909         * main.cc: Include <cstring>.
14910         * options.cc: Include <cstring>.
14911         * output.cc: Include <cstring>.
14912         * script.cc: Include <cstring>.
14913         * script.h: Include <string>.
14914         * symtab.cc: Include <cstring> and <algorithm>.
14915         * target-select.cc: Include <cstring>.
14916         * version.cc: Include <string>.
14917         * testsuite/testmain.cc: Include <cstdlib>.
14918         * configure, config.in: Rebuild.
14919
14920 2008-03-25  Ian Lance Taylor  <iant@google.com>
14921
14922         * options.cc: Include "../bfd/bfdver.h".
14923         (options::help): Print bug reporting address.
14924
14925         * version.cc (print_version): Adjust output for current value of
14926         BFD_VERSION_STRING.
14927
14928         * NEWS: New file.
14929
14930         * options.cc (options::help): Print list of supported targets.
14931         * target-select.h: Include <vector>.
14932         (class Target_selector): Make machine_, size_, and is_big_endian_
14933         fields const.  Add bfd_name_ and instantiated_target_ fields.
14934         (Target_selector::Target_selector): Add bfd_name parameter.
14935         (Target_selector::recognize): Make non-virtual, call
14936         do_recognize.
14937         (Target_selector::recognize_by_name): Make non-virtual, call
14938         do_recognize_by_name.
14939         (Target_selector::supported_names): New function.
14940         (Target_selector::bfd_name): New function.
14941         (Target_selector::do_instantiate_target): New pure virtual
14942         function.
14943         (Target_selector::do_recognize): New virtual function.
14944         (Target_selector::do_recognize_by_name): New virtual function.
14945         (Target_selector::instantiate_target): New private function.
14946         (supported_target_names): Declare.
14947         * target-select.cc (Target_selector::Target_selector): Update for
14948         new parameter and fields.
14949         (select_target_by_name): Check that the name matches before
14950         calling recognize_by_name.
14951         (supported_target_names): New function.
14952         * i386.cc (class Target_selector_i386): Update Target_selector
14953         constructor call.  Remove recognize and recognize_by_name.  Add
14954         do_instantiate_target.
14955         * x86_64.cc (class Target_selector_x86_64): Likewise.
14956         * testsuite/testfile.cc (class Target_selector_test): Update for
14957         changes to Target_selector.
14958
14959         * README: Rewrite, with some notes on unsupported features.
14960
14961 2008-03-24  Cary Coutant  <ccoutant@google.com>
14962
14963         * i386.cc (Target_i386::Got_type): New enum declaration.
14964         (Target_i386::Scan::local): Updated callers of Output_data_got
14965         member functions.
14966         (Target_i386::Scan::global): Likewise.
14967         (Target_i386::Relocate::relocate): Likewise.
14968         (Target_i386::Relocate::relocate_tls): Likewise.
14969         * object.h (Got_offset_list): New class.
14970         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14971         (Sized_relobj::local_got_offset): Likewise.
14972         (Sized_relobj::set_local_got_offset): Likewise.
14973         (Sized_relobj::local_has_tls_got_offset): Removed.
14974         (Sized_relobj::local_tls_got_offset): Removed.
14975         (Sized_relobj::set_local_tls_got_offset): Removed.
14976         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14977         * output.cc (Output_data_got::add_global): Added got_type parameter.
14978         (Output_data_got::add_global_with_rel): Likewise.
14979         (Output_data_got::add_global_with_rela): Likewise.
14980         (Output_data_got::add_global_pair_with_rel): New function.
14981         (Output_data_got::add_global_pair_with_rela): New function.
14982         (Output_data_got::add_local): Added got_type parameter.
14983         (Output_data_got::add_local_with_rel): Likewise.
14984         (Output_data_got::add_local_with_rela): Likewise.
14985         (Output_data_got::add_local_pair_with_rel): New function.
14986         (Output_data_got::add_local_pair_with_rela): New function.
14987         (Output_data_got::add_global_tls): Removed.
14988         (Output_data_got::add_global_tls_with_rel): Removed.
14989         (Output_data_got::add_global_tls_with_rela): Removed.
14990         (Output_data_got::add_local_tls): Removed.
14991         (Output_data_got::add_local_tls_with_rel): Removed.
14992         (Output_data_got::add_local_tls_with_rela): Removed.
14993         * output.h (Output_data_got::add_global): Added got_type parameter.
14994         (Output_data_got::add_global_with_rel): Likewise.
14995         (Output_data_got::add_global_with_rela): Likewise.
14996         (Output_data_got::add_global_pair_with_rel): New function.
14997         (Output_data_got::add_global_pair_with_rela): New function.
14998         (Output_data_got::add_local): Added got_type parameter.
14999         (Output_data_got::add_local_with_rel): Likewise.
15000         (Output_data_got::add_local_with_rela): Likewise.
15001         (Output_data_got::add_local_pair_with_rel): New function.
15002         (Output_data_got::add_local_pair_with_rela): New function.
15003         (Output_data_got::add_global_tls): Removed.
15004         (Output_data_got::add_global_tls_with_rel): Removed.
15005         (Output_data_got::add_global_tls_with_rela): Removed.
15006         (Output_data_got::add_local_tls): Removed.
15007         (Output_data_got::add_local_tls_with_rel): Removed.
15008         (Output_data_got::add_local_tls_with_rela): Removed.
15009         * resolve.cc (Symbol::override_base_with_special): Removed
15010         reference to has_got_offset_ field.
15011         * symtab.cc (Symbol::init_fields): Replaced initialization
15012         of got_offset_ with got_offsets_.  Removed initialization
15013         of has_got_offset_
15014         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15015         (Symbol::got_offset): Likewise.
15016         (Symbol::set_got_offset): Likewise.
15017         (Symbol::has_tls_got_offset): Removed.
15018         (Symbol::tls_got_offset): Removed.
15019         (Symbol::set_tls_got_offset): Removed.
15020         (Symbol::got_offset_): Removed.
15021         (Symbol::tls_mod_got_offset_): Removed.
15022         (Symbol::tls_pair_got_offset_): Removed.
15023         (Symbol::got_offsets_): New field.
15024         (Symbol::has_got_offset): Removed.
15025         (Symbol::has_tls_mod_got_offset): Removed.
15026         (Symbol::has_tls_pair_got_offset): Removed.
15027         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15028         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15029         member functions.
15030         (Target_x86_64::Scan::global): Likewise.
15031         (Target_x86_64::Relocate::relocate): Likewise.
15032         (Target_x86_64::Relocate::relocate_tls): Likewise.
15033
15034 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15035
15036         * yyscript.y: Fix spelling error in comment.
15037
15038 2008-03-24  Ian Lance Taylor  <iant@google.com>
15039
15040         * options.h (class General_options): Define build_id option.
15041         * layout.h (class Layout): Declare write_build_id, create_note,
15042         create_build_id.  Add build_id_note_ member.
15043         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15044         "libiberty.h", "md5.h", "sha1.h".
15045         (Layout::Layout): Initialize eh_frame_data_,
15046         eh_frame_hdr_section_, and build_id_note_.
15047         (Layout::finalize): Call create_build_id.
15048         (Layout::create_note): New function, broken out of
15049         Layout::create_gold_note.
15050         (Layout::create_gold_note): Call create_note.
15051         (Layout::create_build_id): New function.
15052         (Layout::write_build_id): New function.
15053         (Close_task_runner::run): Call write_build_id.
15054
15055         * x86_64.cc: Correct license to GPLv3.
15056
15057 2008-03-23  Ian Lance Taylor  <iant@google.com>
15058
15059         * options.cc: Include "demangle.h".
15060         (parse_optional_string): New function.
15061         (parse_long_option): Handle takes_optional_argument.
15062         (parse_short_option): Update dash_z initializer.  Handle
15063         takes_optional_argument.
15064         (General_options::General_options): Initialize do_demangle_.
15065         (General_options::finalize): Set do_demangle_.  Handle demangling
15066         style.
15067         * options.h (parse_optional_string): Declare.
15068         (struct One_option): Add optional_arg field.  Update constructor.
15069         Update call constructor calls.  Add takes_optional_argument
15070         function.
15071         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15072         (DEFINE_optional_string): Define.
15073         (General_options::demangle): Change from DEFINE_bool to
15074         DEFINE_optional_string.
15075         (General_options::no_demangle): New function.
15076         (General_options::do_demangle): New function.
15077         (General_options::set_do_demangle): New function.
15078         (General_options::execstack_status_): Move definition to end of
15079         class definition.
15080         (General_options::static_): Likewise.
15081         (General_options::do_demangle_): New field.
15082         * object.cc (big_endian>::get_symbol_location_info): Call
15083         Options::do_demangle, not Options::demangle.
15084         * symtab.cc (demangle): Likewise.
15085
15086 2008-03-22  Ian Lance Taylor  <iant@google.com>
15087
15088         * gold.h: Include <cstddef> and <sys/types.h>
15089         * options.h: Include <cstring>.
15090
15091 2008-03-21  Ian Lance Taylor  <iant@google.com>
15092
15093         * Added source code to GNU binutils.
15094 \f
15095 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15096
15097 Copying and distribution of this file, with or without modification,
15098 are permitted in any medium without royalty provided the copyright
15099 notice and this notice are preserved.
15100
15101 Local Variables:
15102 mode: change-log
15103 left-margin: 8
15104 fill-column: 74
15105 version-control: never
15106 End: