Report overflow on PowerPC64 @h and @ha relocations.
[external/binutils.git] / gold / ChangeLog
1 2013-10-30  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
4         (Target_powerpc::Scan::global, local): Likewise.
5         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
6         on all ppc64 @h and @ha relocs.
7
8 2013-10-14  Alan Modra  <amodra@gmail.com>
9
10         * output.h (Output_data_got::add_constant): Tidy.
11         (Output_data_got::add_constant_pair): New function.
12         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
13         methods used so as to first call reserve_ent().
14
15 2013-10-11  Roland McGrath  <mcgrathr@google.com>
16
17         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
18         add_got_entry and add_got_entry_pair.
19
20         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
21         (HAVE_PUBNAMES): Likewise.
22         * configure: Regenerate.
23
24         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
25         * testsuite/Makefile.in: Regenerate.
26
27         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
28         Remove const from declaration.
29         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
30         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
31         * output.h (Output_file_header): Remove const from member target_
32         and corresponding constructor argument.
33         * output.cc (Output_file_header::Output_file_header): Update prototype.
34         (Output_file_header::do_sized_write): Use this->target_ in place
35         of parameters()->target().
36
37         * testsuite/undef_symbol.cc (Foo::get_a): New method.
38
39         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
40         * configure: Regenerate.
41         * Makefile.in: Regenerate.
42         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
43         * testsuite/merge_string_literals_2.c: Likewise.
44         * testsuite/Makefile.am
45         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
46         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
47         literal -fmerge-constants.
48         * testsuite/Makefile.in: Regenerate.
49
50         * i386.cc (Target_i386): Remove unused member dynbss_.
51         * arm.cc (Target_arm): Likewise.
52         * powerpc.cc (Target_powerpc): Likewise.
53         * sparc.cc (Target_sparc): Likewise.
54         * tilegx.cc (Target_tilegx): Likewise.
55         * x86_64.cc (Target_x86_64): Likewise.
56         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
57         type_signature_, type_offset_.
58         * plugin.h (Plugin_hook): Remove unused member layout_.
59         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
60         mapfile_.
61         (Read_member): Remove unused members input_objects_, symtab_,
62         mapfile_, layout_.
63         (Check_library): Remove unused member symtab_.
64         * archive.h (Lib_group): Remove unused member lib_.
65         * archive.cc (Lib_group::Lib_group): Update initializer.
66         * incremental.h (Incremental_binary): Remove unused member target_.
67         (Incremental_script_entry): Removed unused member script_.
68         * layout.h (Write_symbols_task): Remove unused member input_objects_.
69         * icf.h (Icf): Remove unused member num_tracked_relocs.
70
71         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
72         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
73         its only use.
74         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
75
76         * archive.h: Use struct rather than class for forward declaration
77         of Read_symbols_data.
78
79 2013-10-07  Cary Coutant  <ccoutant@google.com>
80
81         PR gold/16010
82         * testsuite/Makefile.am (icf_test): Fix dependencies.
83         (icf_safe_test): Likewise.
84         (icf_safe_so_test): Likewise.
85         (large_symbol_alignment): Add empty _LDADD rule.
86         * testsuite/Makefile.in: Regenerate.
87
88 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
89
90         PR gold/15927
91         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
92         relocation for R_X86_64_32 on x32.
93
94 2013-08-27  Roland McGrath  <mcgrathr@google.com>
95
96         * output.cc (Output_segment::set_section_addresses): Take new
97         Target* argument.  If target->isolate_execinstr() and the segment
98         is executable and starts at a target->abi_pagesize() boundary,
99         pad its end out to a target->abi_pagesize() boundary with code fill.
100         * output.h (Output_segment::set_section_addresses): Update decl.
101         * layout.h (Layout::check_output_data_for_reset_values): Take new
102         argument RELAX_OUTPUTS.
103         (Layout): New member relax_output_list_.
104         (Layout::add_relax_output): New method.
105         * layout.cc (Layout::Layout): Update constructor.
106         (Layout::reset_relax_output): New method.
107         (Layout::clean_up_after_relaxation): Call it.
108         (Layout::prepare_for_relaxation): Update caller.
109         (Layout::set_segment_offsets): Update callers of set_section_addresses.
110         Call reset_relax_output before re-processing segments for
111         isolate_execinstr case.
112         (Layout::write_data): Handle relax_output_list_.
113         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
114         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
115
116 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
117
118         PR binutils/15834
119         * object.h: Fix typos.
120
121 2013-08-16  Roland McGrath  <mcgrathr@google.com>
122
123         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
124         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
125
126 2013-08-07  Cary Coutant  <ccoutant@google.com>
127
128         Revert support for v2 DWP files:
129
130         2013-03-01  Cary Coutant  <ccoutant@google.com>
131
132             Add dwp support for v2 DWARF package file format.
133             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
134             tu_length parameter.  Adjust all callers.
135             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
136             * dwp.cc: Include dwarf.h.
137             (Section_bounds): New struct type.
138             (Unit_set): New struct type.
139             (Dwo_file::Dwo_file): Initialize new data member.
140             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
141             Combine and rename to...
142             (Dwo_file::read_unit_index): ...this.
143             (Dwo_file::sized_read_compunit_index)
144             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
145             (Dwo_file::sized_read_unit_index): ...this.
146             (Dwo_file::copy_section): Remove section_name, is_str_offsets
147             parameters; add section_id parameter.
148             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
149             (Dwo_file::add_unit_set): ...this.
150             (Dwo_file::shndx_map_): Remove.
151             (Dwo_file::sect_offsets_): New data member.
152             (Dwp_output_file::Dwp_output_file): Initialize new data members.
153             (Dwp_output_file::add_section): Rename to...
154             (Dwp_output_file::add_contribution): ...this.
155             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
156             (Dwp_output_file::add_tu_set): Likewise.
157             (Dwp_output_file::Contribution): New type.
158             (Dwp_output_file::Section::contributions): New data member.
159             (Dwp_output_file::Cu_or_tu_set): Remove.
160             (Dwp_output_file::Section::Section): New ctor.
161             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
162             (Dwp_output_file::Dwp_index::Section_table): New type.
163             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
164             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
165             parameter.
166             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
167             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
168             (Dwp_output_file::Dwp_index::section_table): New member function.
169             (Dwp_output_file::Dwp_index::section_table_end): New member function.
170             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
171             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
172             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
173             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
174             (Dwp_output_file::Dwp_index::section_table_): New data member.
175             (Dwp_output_file::Dwp_index::section_mask_): New data member.
176             (Dwp_output_file::add_output_section): New member function.
177             (Dwp_output_file::write_new_section): New member function.
178             (Dwp_output_file::write_contributions): New member function.
179             (Dwp_output_file::section_id_map_): New data member.
180             (class Dwo_id_info_reader): Remove.
181             (class Unit_reader): New class.
182             (get_dwarf_section_name): New function.
183             (Dwo_file::read_executable): Adjust initializations of class data.
184             (Dwo_file::read): Add support for v2 package file format.
185             (Dwo_file::read_unit_index): Likewise.
186             (Dwo_file::sized_read_unit_index): Likewise.
187             (Dwo_file::copy_section): Likewise.
188             (Dwo_file::add_unit_set): Likewise.
189             (Dwp_output_file::add_output_section): Likewise.
190             (Dwp_output_file::add_contribution): Likewise.
191             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
192             for empty slot.
193             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
194             file format.
195             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
196             slot.
197             (Dwp_output_file::initialize): Remove unused function.
198             (Dwp_output_file::finalize): Add support for v2 package file format.
199             (Dwp_output_file::write_index): Likewise.
200             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
201             function prototype.
202
203 2013-07-31  Cary Coutant  <ccoutant@google.com>
204
205         * object.cc (Sized_relobj::do_output_section_address): New function.
206         (Sized_relobj): Instantiate explicitly.
207         * object.h (Object::output_section_address): New function.
208         (Object::do_output_section_address): New function.
209         (Sized_relobj::do_output_section_address): New function.
210         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
211
212 2013-07-30  Cary Coutant  <ccoutant@google.com>
213             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
214
215         * parameters.cc (Parameters::entry): Return target-specific entry
216         symbol name.
217         * target.h (Target::entry_symbol_name): New function.
218         (Target_info::entry_symbol_name): New data member.
219
220         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
221         * i386.cc (Target_i386::i386_info): Likewise.
222         (Target_i386_nacl::i386_nacl_info): Likewise.
223         * sparc.cc (Target_sparc::sparc_info): Likewise.
224         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
225         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
226         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
227         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
228
229 2013-07-22  Sterling Augustine  <saugustine@google.com>
230
231         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
232         Convert parameter shndx to local variable. Add parameters symtab
233         and symtab_size.  Scan over section names.  Find relocation
234         section corresponding to current section.  Create and initialize
235         reloc_mapper_ and reloc_type_.
236         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
237         unit_length to off_t.  Initialize member unit_length_.  Fill in field
238         cu_offset_.
239         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
240         Initialize new fields unit_length_ and cu_offset_.
241         (Dwarf_pubnames_table::read_section): Update prototype.
242         (Dwarf_pubnames_table::cu_offset): New member function.
243         (Dwarf_pubnames_table::subsection_size): Likewise.
244         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
245         New fields.
246         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
247         member functions public.
248         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
249         Update comment.  Rework logic.  Move repeated parts to...
250         (Gdb_index_info_reader::read_pubtable): ...here. New function.
251         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
252         pubtypes_table_, and stmt_list_offset.
253         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
254         Gdb_index::find_pubtype_offset,
255         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
256         (Gdb_index::pubnames_read): Update prototype and rework logic.
257         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
258         Forward declare.
259         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
260         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
261         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
262         Gdb_index::map_pubtable_to_dies):
263         Declare functions.
264         (Gdb_index::pubnames_read): Update declaration.
265         (Gdb_index::Pubname_offset_map): New type.
266         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
267         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
268         Gdb_index::stmt_list_offset): Declare.
269         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
270         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
271         Gdb_index::pubtypes_offset_): Remove.
272
273 2013-07-19  Roland McGrath  <mcgrathr@google.com>
274
275         * options.h (General_options): Add -Trodata-segment option.
276         * parameters.cc (Parameters::check_rodata_segment): New function.
277         (Parameters::set_target_once): Call it.
278         * parameters.h (Parameters): Declare it (private member function).
279         * layout.cc (load_seg_unusable_for_headers): New function, broken
280         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
281         then validate rodata segment rather than text segment.
282         (relaxation_loop_body): Call that.
283         (is_text_segment): New function.  Don't admit a non-executable
284         segment if TARGET->isolate_execinstr().
285         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
286
287 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
288
289         PR gold/15070
290         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
291         * nacl.h (Sniff_file::View::View): Request aligned view.
292
293 2013-07-11  Cary Coutant  <ccoutant@google.com>
294
295         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
296         correct BRLT entry size.
297
298 2013-07-03  Alan Modra  <amodra@gmail.com>
299
300         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
301         comment.
302
303 2013-07-01  Cary Coutant  <ccoutant@google.com>
304
305         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
306         reloc_type_.
307         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
308         (Dwarf_ranges_table::lookup_reloc): New function.
309         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
310         reloc_type_.
311         (Dwarf_ranges_table::lookup_reloc): New function.
312         (Dwarf_ranges_table::reloc_type_): New data member.
313
314 2013-06-27  Jing Yu  <jingyu@google.com>
315
316         PR gold/15662
317         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
318         function.
319         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
320         (Target_powerpc::do_relax): Call the above.
321
322 2013-06-27  Cary Coutant  <ccoutant@google.com>
323
324         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
325         on garbage collected .opd section.
326
327 2013-06-27  Alan Modra  <amodra@gmail.com>
328
329         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
330         is non-zero.
331         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
332         (Target_powerpc::do_function_location): Likewise for loc->shndx.
333
334 2013-06-14  Cary Coutant  <ccoutant@google.com>
335
336         * resolve.cc (Symbol::override_base): Don't override st_type
337         from plugin placeholder symbols.
338         (Symbol_table::resolve): Likewise.
339         (Symbol_table::should_override): Don't complain about TLS mismatch
340         if the TO symbol is a plugin placeholder.
341         * testsuite/Makefile.am (plugin_test_tls): New test.
342         * testsuite/Makefile.in: Regenerate.
343         * testsuite/plugin_test_tls.sh: New test script.
344         * testsuite/two_file_test_2_tls.cc: New test source.
345         * testsuite/two_file_test_tls.cc: New test source.
346
347 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
348
349         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
350         the maximum segment alignment is larger than the page size.
351         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
352         correctly aligns the symbols with large alignemnt.
353         * testsuite/Makefile.in: Regenerate.
354         * testsuite/large_symbol_alignment.cc: New file.
355
356 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
357             Sriraman Tallam  <tmsriram@google.com>
358
359         * options.h (sort_section): New option.
360         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
361         Rename from Input_section_sort_section_name_special_ordering_compare.
362         (Input_section_sort_section_name_compare): New struct.
363         * output.cc (Output_section::Input_section_sort_section_name_compare::
364         operator()): New function.
365         (Output_section::sort_attached_input_sections): Use new sort function
366         for .text if --sort-section=name is specified.
367         * layout.cc (Layout::make_output_section):
368         Add sorting by name when --sort-section=name is specified.
369         * testsuite/Makefile.am (text_section_grouping): Test option
370         --sort-section=name.
371         * testsuite/Makefile.in: Regenerate.
372         * testsuite/section_sorting_name.cc: New file.
373         * testsuite/section_sorting_name.sh: New file.
374
375 2013-05-21  Cary Coutant  <ccoutant@google.com>
376
377         * symtab.h (Symbol::is_cxx_vtable): New function.
378         * target-reloc.h (relocate_section): Check for vtable symbol.
379         * testsuite/Makefile.am (missing_key_func.sh): New test case.
380         * testsuite/Makefile.in: Regenerate.
381         * testsuite/missing_key_func.cc: New test source.
382         * testsuite/missing_key_func.sh: New test script.
383
384 2013-05-21  Cary Coutant  <ccoutant@google.com>
385
386         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
387         type of enclosing symbol.
388         (Relocate_info::location): Check symbol type when describing symbol.
389         * object.h (Symbol_location_info): Remove unused line_number;
390         add enclosing_symbol_type.
391         * testsuite/debug_msg.sh: Adjust expected output.
392
393 2013-05-13  Cary Coutant  <ccoutant@google.com>
394
395         * configure.ac: Export DEFAULT_TARGET.
396         * configure: Regenerate.
397         * Makefile.in: Regenerate.
398         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
399         * testsuite/Makefile.in: Regenerate.
400         * testsuite/debug_msg.sh: Delete duplicate tests.
401         Don't check undef_int error message match for powerpc where the
402         source file and line number aren't available.
403
404 2013-05-10  Roland McGrath  <mcgrathr@google.com>
405
406         * options.h (General_options): Add --rosegment-gap option.
407         * options.cc (finalize): --rosegment-gap implies --rosegment.
408         * layout.cc (set_segment_offsets): Let user option override
409         target->rosegment_gap().
410
411 2013-05-10  Roland McGrath  <mcgrathr@google.com>
412
413         * options.h (General_options): Remove leading space from help
414         messages for -nostdlib and --rosegment.
415
416 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
417
418         PR ld/15365
419         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
420
421 2013-05-03  Alan Modra  <amodra@gmail.com>
422
423         * merge.cc (Output_merge_string::do_add_input_section): Correct
424         scan for number of strings.  Rename vars to avoid shadowing.
425         Include missing terminator in input_size_.
426
427 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
428
429         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
430         Restore empty string handling.
431
432 2013-05-01  Cary Coutant  <ccoutant@google.com>
433
434         * stringpool.cc (Stringpool_template::new_key_offset): Fix
435         uninitialized warning.
436
437 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
438
439         * output.cc (Output_section::add_merge_input_section): Allow
440         to merge sections if the alignment is more than character size.
441         * merge.h (Output_merge_string::Output_merge_string): Remove
442         assert.
443         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
444         only not-null strings. Check the alignment of strings.
445         * stringpool.h
446         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
447         alignment as the argument.
448         (Stringpool_template<Stringpool_char>::addralign_): New class member.
449         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
450         Align non-zero length strings according to the addralign_.
451         (Stringpool_template<Stringpool_char>::set_string_offsets):
452         Updating offsets according to the given alignment.
453         * testsuite/Makefile.am (text_section_grouping): Test if string
454         literals are getting merged.
455         * testsuite/Makefile.in: Regenerate.
456         * testsuite/merge_string_literals_1.c: New file.
457         * testsuite/merge_string_literals_2.c: Ditto.
458         * testsuite/merge_string_literals.sh: Ditto.
459
460 2013-04-26  Ian Lance Taylor  <iant@google.com>
461
462         * target-reloc.h (relocate_section): If the reloc offset is out of
463         range, pass VIEW as NULL to relocate.relocate.
464         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
465         * i386.cc (Target_i386::Relocate::relocate): Likewise.
466         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
467         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
468         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
469         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
470
471 2013-04-26  Geoff Pike  <gpike@chromium.org>
472
473         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
474         * layout.cc (Hash_task): New class.
475         (Layout::queue_build_id_tasks): New function.
476         (Layout::write_build_id): Handle single-thread portion of build ID
477         computation.  (In some cases, all of it is single-threaded.)  Replace
478         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
479         functionality in fewer lines of code.
480         * layout.h (Layout::queue_build_id_tasks): New function declaration.
481         * options.h (General_options): make "--build-id" default to tree
482         rather than sha1.  Add two new options related to --build-id=tree:
483         --build-id-chunk-size-for-treehash and
484         --build-id-min-file-size-for-treehash.
485         * Makefile.am: add testing of --build-id=tree and related new options
486         (these tests will be invoked by "make check").
487         * Makefile.in: Regenerate.
488
489 2013-04-25  Alan Modra  <amodra@gmail.com>
490
491         * configure.tgt: Add powerpcle and powerpc64le.
492
493 2013-04-22  Alan Modra  <amodra@gmail.com>
494
495         PR gold/15355
496         * layout.cc (Layout::segment_precedes): Allow more than one
497         segment with the same type and flags.
498
499 2013-04-15  Cary Coutant  <ccoutant@google.com>
500
501         * layout.cc (Layout::set_relocatable_section_offsets): Don't
502         allocate space in file for BSS sections.
503
504 2013-04-15  Cary Coutant  <ccoutant@google.com>
505
506         * script-sections.cc (Orphan_output_section): Reset address
507         to zero after each orphaned section for relocatable links.
508
509 2013-04-15  Cary Coutant  <ccoutant@google.com>
510
511         * symtab.cc (Symbol_table::sized_write_globals): Subtract
512         section starting address for relocatable link.
513         * testsuite/Makefile.am (script_test_11): New test.
514         * testsuite/Makefile.in: Regenerate.
515         * testsuite/script_test_11.c: New source file.
516         * testsuite/script_test_11.t: New linker script.
517
518 2013-04-13  Alan Modra  <amodra@gmail.com>
519
520         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
521         owner when sections are not adjacent and exceed group size.
522         (Target_powerpc::group_sections): Handle corner case.
523         (Target_powerpc::Branch_info::make_stub): Handle case where
524         stub table doesn't exist due to branches in non-exec sections.
525         (Target_powerpc::Relocate::relocate): Likewise.
526
527 2013-04-11  Alan Modra  <amodra@gmail.com>
528
529         PR gold/15354
530         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
531         .branch_lt to match bfd ld.  Adjust comments throughout file.
532
533 2013-04-04  Ian Lance Taylor  <iant@google.com>
534
535         GCC PR c++/56840
536         * object.cc (do_layout_deferred_sections): Handle .eh_frame
537         sections before checking whether they are included in the link.
538
539 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
540
541         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
542         object before calling the plugin claim_file handler.  Pass the elf
543         object of the archive to the plugin. Delete the elf object if the
544         plugin claims the file.
545
546 2013-03-21  Alan Modra  <amodra@gmail.com>
547
548         * layout.cc (Layout::set_segment_offsets): Accept writable .text
549         segment when omagic.
550
551 2013-03-21  Alan Modra  <amodra@gmail.com>
552
553         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
554         comparison warning.
555         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
556         uninitialized" warning.
557
558 2013-03-20  Alan Modra  <amodra@gmail.com>
559
560         * symtab.h (Symbol::clear_version): New function.
561         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
562         is_needed by weak references.  Clear version for symbols defined
563         in as-needed objects that are not needed.
564
565 2013-03-15  Alan Modra  <amodra@gmail.com>
566
567         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
568         static and public.  Add report_err param.  Return false for data refs.
569         (Target_powerpc::rela_dyn_section): New overloaded function.
570         (Target_powerpc::plt_, iplt_): Elucidate.
571         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
572         (Output_data_plt_powerpc::do_write): Don't write .iplt.
573         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
574         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
575         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
576         push_branch and make_plt_entry for ifunc syms when
577         reloc_needs_plt_for_ifunc.
578         (Target_powerpc::Relocate::relocate): Don't use plt entry value
579         for ifunc unless reloc_needs_plt_for_ifunc.
580
581 2013-03-15  Alan Modra  <amodra@gmail.com>
582
583         * gc.h (gc_process_relocs): Don't look through function descriptors.
584         * icf.cc (get_section_contents): Do so here instead.
585
586 2013-03-13  Alan Modra  <amodra@gmail.com>
587
588         * powerpc.cc (is_branch_reloc): Forward declare.
589         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
590         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
591         false for 64-bit, true for 32-bit non-branch relocs.
592         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
593         * testsuite/Makefile.am (icf_test): Use linker map file instead of
594         nm output.
595         (icf_safe_test): Generate linker map file as well as nm output.
596         (icf_safe_so_test): Likewise.
597         * testsuite/Makefile.in: Regenerate.
598         * testsuite/icf_test.sh: Parse linker map file to determine
599         section folding.
600         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
601         * testsuite/icf_safe_so_test.sh: Likewise.
602         (X86_32_or_ARM_specific_safe_fold): Merge into..
603         (arch_specific_safe_fold): ..this.
604         (X86_64_specific_safe_fold): Delete unused function.
605
606 2013-03-12  Alan Modra  <amodra@gmail.com>
607
608         * gc.h (gc_process_relocs): Look through function descriptors
609         to determine shndx, symvalue and addend used by ICF.  Tidy
610         variable duplication.
611
612 2013-03-11  Alan Modra  <amodra@gmail.com>
613
614         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
615         * layout.cc (Layout_task_runner::run): ..to here.
616         * symtab.h (struct Symbol_location): Extract from..
617         (class Symbol_table): ..here.
618         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
619         * target.h (class Target): Add function_location and
620         do_function_location functions.
621         (class Sized_target): Add do_function_location.
622         * object.h (class Sized_relobj_file): Move find_shdr..
623         (class Object): ..to here.
624         * object.cc: Likewise.  Update to suit.  Instantiate.
625         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
626         * powerpc.cc (class Powerpc_dynobj): New.
627         (Target_powerpc::do_function_location): New function.
628         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
629         (Powerpc_dynobj::do_read_symbols): New function.
630         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
631
632 2013-03-08  Ian Lance Taylor  <iant@google.com>
633
634         * options.cc (General_options::string_to_object_format): Accept
635         "default".
636
637 2013-03-08  Alan Modra  <amodra@gmail.com>
638
639         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
640         pointer to Post_fde.
641         (struct Post_fde): Move definition to here..
642         * ehframe.cc (struct Post_fde): ..from here.
643         (Cie::write): Don't alloc Post_fde.
644         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
645
646 2013-03-07  Alan Modra  <amodra@gmail.com>
647
648         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
649         relocation referencing .LC0.
650         * testsuite/discard_locals_test.sh: Remove FIXMEs.
651
652 2013-03-07  Alan Modra  <amodra@gmail.com>
653
654         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
655         always_inline.  Add assembly for powerpc to avoid GOT.
656
657 2013-03-07  Alan Modra  <amodra@gmail.com>
658
659         * testsuite/script_test_10.sh: Don't test .bss section
660         header number.
661
662 2013-03-06  Alan Modra  <amodra@gmail.com>
663
664         * powerpc.cc (class Powerpc_relobj): Move some member functions.
665         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
666         all callers.  Handle folded sections.
667         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
668         to Powerpc_relobj.
669         (Global_symbol_visitor_opd::operator()): Likewise.
670
671 2013-03-04  Alan Modra  <amodra@gmail.com>
672
673         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
674         * testsuite/Makefile.in: Regenerate.
675
676 2013-03-01  Cary Coutant  <ccoutant@google.com>
677
678         Add dwp support for v2 DWARF package file format.
679         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
680         tu_length parameter.  Adjust all callers.
681         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
682         * dwp.cc: Include dwarf.h.
683         (Section_bounds): New struct type.
684         (Unit_set): New struct type.
685         (Dwo_file::Dwo_file): Initialize new data member.
686         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
687         Combine and rename to...
688         (Dwo_file::read_unit_index): ...this.
689         (Dwo_file::sized_read_compunit_index)
690         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
691         (Dwo_file::sized_read_unit_index): ...this.
692         (Dwo_file::copy_section): Remove section_name, is_str_offsets
693         parameters; add section_id parameter.
694         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
695         (Dwo_file::add_unit_set): ...this.
696         (Dwo_file::shndx_map_): Remove.
697         (Dwo_file::sect_offsets_): New data member.
698         (Dwp_output_file::Dwp_output_file): Initialize new data members.
699         (Dwp_output_file::add_section): Rename to...
700         (Dwp_output_file::add_contribution): ...this.
701         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
702         (Dwp_output_file::add_tu_set): Likewise.
703         (Dwp_output_file::Contribution): New type.
704         (Dwp_output_file::Section::contributions): New data member.
705         (Dwp_output_file::Cu_or_tu_set): Remove.
706         (Dwp_output_file::Section::Section): New ctor.
707         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
708         (Dwp_output_file::Dwp_index::Section_table): New type.
709         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
710         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
711         parameter.
712         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
713         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
714         (Dwp_output_file::Dwp_index::section_table): New member function.
715         (Dwp_output_file::Dwp_index::section_table_end): New member function.
716         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
717         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
718         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
719         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
720         (Dwp_output_file::Dwp_index::section_table_): New data member.
721         (Dwp_output_file::Dwp_index::section_mask_): New data member.
722         (Dwp_output_file::add_output_section): New member function.
723         (Dwp_output_file::write_new_section): New member function.
724         (Dwp_output_file::write_contributions): New member function.
725         (Dwp_output_file::section_id_map_): New data member.
726         (class Dwo_id_info_reader): Remove.
727         (class Unit_reader): New class.
728         (get_dwarf_section_name): New function.
729         (Dwo_file::read_executable): Adjust initializations of class data.
730         (Dwo_file::read): Add support for v2 package file format.
731         (Dwo_file::read_unit_index): Likewise.
732         (Dwo_file::sized_read_unit_index): Likewise.
733         (Dwo_file::copy_section): Likewise.
734         (Dwo_file::add_unit_set): Likewise.
735         (Dwp_output_file::add_output_section): Likewise.
736         (Dwp_output_file::add_contribution): Likewise.
737         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
738         for empty slot.
739         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
740         file format.
741         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
742         slot.
743         (Dwp_output_file::initialize): Remove unused function.
744         (Dwp_output_file::finalize): Add support for v2 package file format.
745         (Dwp_output_file::write_index): Likewise.
746         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
747         function prototype.
748
749 2013-03-01  Cary Coutant  <ccoutant@google.com>
750
751         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
752         function into class definition in header file.
753         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
754         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
755         New function.
756         (Dwarf_info_reader::check_buffer): Move here from .cc file.
757
758 2013-02-28  Alan Modra  <amodra@gmail.com>
759
760         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
761         * target.cc (Target::do_plt_fde_location): New function.
762         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
763         accessor function, and constructor param.
764         (struct Post_fde, Post_fdes): Declare.
765         (Cie::write): Add post_fdes param.
766         * ehframe.cc (Fde::write): Use plt_fde_location.
767         (struct Post_fde): Define.
768         (Cie::write): Stash FDEs added post merge mapping.
769         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
770         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
771         (Eh_frame::do_sized_write): Arrange to write post map FDES after
772         other FDEs.
773         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
774         (Target_powerpc::has_glink): New function.
775         (Target_powerpc::do_relax): Add eh_frame info for stubs.
776         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
777         glink_eh_frame_fde_32, default_fde): New data.
778         (Stub_table::eh_frame_added_): New var.
779         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
780         Make const.
781         (Stub_table::add_eh_frame): New function.
782         (Output_data_glink::add_eh_frame): New function.
783         (Target_powerpc::make_glink_section): Call add_eh_frame.
784
785 2013-02-15  Ian Lance Taylor  <iant@google.com>
786
787         * options.h (DEFINE_uint64_alias): Define.
788         (class General_options): Add -Ttext-segment as an alias for
789         -Ttext.
790
791 2013-02-15  Alan Modra  <amodra@gmail.com>
792
793         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
794         (Stub_table::do_write): ..here, two places.
795         (Stub_table::plt_call_size): Use it here too.
796
797 2013-02-11  Ian Lance Taylor  <iant@google.com>
798
799         * descriptors.cc (Descriptors::close_all): New function.
800         * descriptors.h (class Descriptors): Declare close_all.
801         (close_all_descriptors): New inline function.
802         * plugin.cc: Include "descriptors.h".
803         (Plugin_manager::cleanup): Call close_all_descriptors.
804
805 2013-02-06  Alan Modra  <amodra@gmail.com>
806
807         * README: Update coding style link.
808
809 2013-01-28  Cary Coutant  <ccoutant@google.com>
810
811         * dwp.cc (File_list): New typedef.
812         (Dwo_name_info_reader): New class.
813         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
814         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
815         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
816         (Dwo_file::read_executable): New function.
817         (Dwo_file::read): Move common setup code to ...
818         (Dwo_file::make_object): ... here.
819         (dwp_options): Add --exec/-e.
820         (usage): Likewise.
821         (main): Likewise.
822
823 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
824
825         * layout.cc (Layout::layout): Check for option text_reorder.
826         (Layout::make_output_section): Ditto.
827         * options.h (text_reorder): New option.
828         * output.cc (Input_section_sort_compare): Remove special ordering
829         of section names.
830         (Output_section::
831          Input_section_sort_section_name_special_ordering_compare::
832          operator()): New function.
833         (Output_section::sort_attached_input_sections): Use new sort function
834         for .text.
835         * output.h (Input_section_sort_section_name_special_ordering_compare):
836         New struct.
837         * testsuite/Makefile.am (text_section_grouping): Test option
838         --no-text-reorder
839         * testsuite/Makefile.in: Regenerate.
840         * testsuite/text_section_grouping.sh: Check order of functions without
841         default text reordering.
842
843 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
844
845         * options.h (General_options): Change default to true for new_dtags.
846
847 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
848
849         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
850         when enable_new_dtags is false.  Only add DT_RUNPATH when
851         enable_new_dtags is true.
852
853 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
854
855         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
856         used in declaration and definition consistent.
857         (Target_powerpc::symval_for_branch): Ditto.
858
859 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
860
861         * testsuite/plugin_final_layout.cc: Fix comment.
862
863 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
864
865         * layout.cc (Layout::layout): Do not do default sorting for
866         text sections when section ordering is specified.
867         (make_output_section): Ditto.
868         * testsuite/plugin_final_layout.cc: Name the function sections
869         to catch reordering issues.
870
871 2013-01-15  Alan Modra  <amodra@gmail.com>
872
873         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
874         plt-thread-safe.
875
876 2013-01-15  Alan Modra  <amodra@gmail.com>
877
878         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
879         * testsuite/Makefile.in: Regenerate.
880
881 2013-01-14  Alan Modra  <amodra@gmail.com>
882
883         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
884         * testsuite/Makefile.in: Regenerate.
885
886 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
887
888         PR bfd/14430
889         Fix mingw gold build with plugins enabled
890         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
891         * configure.ac: Export DLOPEN_LIBS and add headers check.
892         * plugin.cc: Handle non-dlfcn case.
893         * Makefile.in: Regenerate.
894         * config.in: Regenerate.
895         * configure: Regenerate.
896         * testsuite/Makefile.in: Regenerate.
897
898 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
899
900         * output.h (sort_attached_input_sections): Change to be public.
901         * script-sections.cc
902         (Output_section_definition::set_section_addresses): Sort
903         attached input sections according to section order before linker
904         script assigns section addresses.
905         (Orphan_output_section::set_section_addresses): Sort
906         attached input sections according to section order before linker
907         script assigns section addresses.
908         * Makefile.am (final_layout.sh): Use a simple linker script to
909         check if section ordering still works.
910         * Makefile.in: Regenerate.
911
912 2013-01-09  Ben Cheng  <bccheng@google.com>
913
914         * arm.cc (Target_arm::attributes_accept_div): New function.
915         (Target_arm::attributes_forbid_div): New function.
916         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
917         attribute using the same new functions as what bfd/elf32_arm.c
918         does.
919
920 2013-01-07  Cary Coutant  <ccoutant@google.com>
921
922         PR gold/14993
923         * output.cc (Output_section::add_input_section): For incremental
924         updates, don't track input sections that are allocated from patch
925         space.
926
927 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
928             Ian Lance Taylor  <iant@google.com>
929
930         PR gold/14897
931         * configure.ac (--enable-ld): Removed.
932         (install_as_default): Set to yes only for --enable-gold=default
933         or --disable-ld.
934         * configure: Regenerated.
935
936 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
937
938         * options.h (General_options): Add -fuse-ld= for GCC linker
939         option compatibility.
940
941 2013-01-04  Cary Coutant  <ccoutant@google.com>
942
943         * configure.ac: Fix typo restoring CXXFLAGS.
944         * configure: Regenerate.
945
946 2013-01-04  Cary Coutant  <ccoutant@google.com>
947
948         * testsuite/Makefile.am (CXXLINK_S): New macro.
949         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
950         * testsuite/Makefile.in: Regenerate.
951
952 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
953
954         * version.cc (print_version): Update copyright year to 2013.
955
956 2012-12-20  Ian Lance Taylor  <iant@google.com>
957
958         * layout.cc (Layout::special_ordering_of_input_section): New
959         function.
960         (Layout::layout): If input section requires special ordering, must
961         sort input sections.
962         (Layout::make_output_section): May sort .text input sections.
963         (Layout::is_section_name_prefix_grouped): Remove.
964         * layout.h (class Layout): Declare
965         special_ordering_of_input_section.  Don't declare
966         is_section_name_prefix_grouped.
967         * output.cc (Output_section::add_input_section): Revert last
968         change.
969         (Output_section::Input_section_sort::match_file_name): Don't crash
970         if called on output section data.
971         (Output_section::Input_section_sort_compare): Sort based on
972         special ordering.
973         (Output_section::Input_section_sort_section_order_index_compare):
974         Revert last patch.
975         (Output_section::sort_attached_input_sections): Likewise.
976
977 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
978
979         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
980         * layout.h (Layout::is_section_name_prefix_grouped): New function.
981         * output.cc (Output_section::add_input_section): Check if section
982         name contains special prefix.  Keep input sections to sort such
983         sections.
984         (Output_section::Input_section_sort_section_order_index_compare
985          ::operator()): Group sections according to prefixes.
986         (Output_section::sort_attached_input_sections): Add condition to
987         Input_section_entry constructor call.
988         * testsuite/Makefile.am (text_section_grouping): New test.
989         * testsuite/Makefile.in: Regenerate.
990         * testsuite/text_section_grouping.cc: New file.
991         * testsuite/text_section_grouping.sh: New file.
992
993 2012-12-17  Nick Clifton  <nickc@redhat.com>
994
995         * Makefile.am: Add copyright notice.
996         * NEWS: Likewise.
997         * README: Likewise.
998         * configure.ac: Likewise.
999         * ftruncate.c: Likewise.
1000         * Makefile.in: Regenerate.
1001
1002 2012-12-14  Cary Coutant  <ccoutant@google.com>
1003
1004         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1005         --no-as-needed flag.
1006         (exception_separate_shared_12_test): Likewise.
1007         (incremental_copy_test): Likewise.
1008         * testsuite/Makefile.in: Regenerate.
1009
1010 2012-12-14  Cary Coutant  <ccoutant@google.com>
1011
1012         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1013         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1014
1015 2012-12-12  Alan Modra  <amodra@gmail.com>
1016
1017         * powerpc.cc (class Track_tls): New.
1018         (class Relocate, class Scan): Inherit Track_tls.
1019         (Target_powerpc::Scan::local, global): Track tls optimization
1020         and avoid creating plt entry for __tls_get_addr if all uses
1021         are optimized away.
1022         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1023
1024 2012-12-12  Alan Modra  <amodra@gmail.com>
1025
1026         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1027         Replace no_toc_optimize with toc_optimize.
1028         * output.h (Output_section::input_sections): Provide non-const variant.
1029         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1030         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1031         accessors.
1032         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1033         (class Sort_toc_sections): New.
1034         (Target_powerpc::do_finalize_sections): Sort toc sections.
1035         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1036
1037 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1038
1039         * testsuite/binary_unittest.cc (read_all): New function.
1040         (Sized_binary_test): Use it instead of ::read.
1041         * fileread.cc (do_read): Don't assume pread always reads the whole
1042         amount in a single call.
1043
1044 2012-12-10  Alan Modra  <amodra@gmail.com>
1045
1046         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1047         Set EM_PPC64 or EM_PPC here.
1048         (Target_selector_powerpc::do_recognize): Delete.
1049
1050 2012-12-10  Alan Modra  <amodra@gmail.com>
1051
1052         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1053         stub_table_.
1054         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1055
1056 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1057
1058         * testsuite/binary_unittest.cc (Sized_binary_test):
1059         Use open_descriptor rather than ::open.
1060
1061 2012-12-07  Alan Modra  <amodra@gmail.com>
1062
1063         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1064         typedef and invalid_address constant.
1065         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1066         instantiate constants.
1067
1068 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1069
1070         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1071         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1072         * aclocal.m4: Regenerate.
1073         * configure: Regenerate.
1074         * Makefile.in: Regenerate.
1075         * testsuite/Makefile.in: Regenerate.
1076
1077 2012-12-07  Alan Modra  <amodra@gmail.com>
1078
1079         * options.h (General_options): Add no_toc_optimize.
1080         * powerpc.cc (ok_lo_toc_insn): New function.
1081         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1082
1083 2012-12-06  Alan Modra  <amodra@gmail.com>
1084
1085         * options.h (General_options): Add plt_align, plt_static_chain,
1086         plt_thread_safe.  Update stub_group_size help text.
1087         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1088         for new plt_thread_safe_ var.
1089         (use_plt_offset): Correct comments.
1090         (Target_powerpc::do_relax): Look for thread creation symbols to
1091         determine default plt_thread_safe value.  Clear plt call stubs
1092         as well as branch stubs each iteration.
1093         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1094         insn constants.
1095         (l, hi, ha, write_insn): Move earlier.
1096         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1097         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1098         plt stubs too.
1099         (Stub_table::update_size): Adjust.
1100         (Stub_table::prev_size, set_prev_size): Delete.
1101         (Stub_table::stub_align): Let --plt-align affect result.
1102         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1103         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1104         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1105         (Stub_table::do_write): Support more stub variants.
1106
1107 2012-12-04  Alan Modra  <amodra@gmail.com>
1108
1109         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1110         (Target_powerpc::do_define_standard_symbols): New function.
1111
1112 2012-12-03  Alan Modra  <amodra@gmail.com>
1113
1114         * output.h: Formatting, whitespace.
1115
1116 2012-12-03  Alan Modra  <amodra@gmail.com>
1117
1118         * layout.h (Layout::get_executable_sections): Declare.
1119         * layout.cc (Layout::get_executable_sections): New function.
1120         * arm.cc (Target_arm::group_sections): Use it.
1121         (Arm_output_section::group_sections): Delete now redundant test.
1122         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1123         param to handle relative relocs.
1124         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1125         (Output_data_reloc::add_absolute): Adjust.
1126         (Output_data_reloc::add_relative): New function.
1127         (Output_data::reset_data_size): New function.
1128         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1129         (Output_section::set_addralign): New function.
1130         (Output_section::checkpoint_set_addralign): New function.
1131         (Output_section::clear_section_offsets_need_adjustment): New function.
1132         (Output_section::input_sections): Make public.
1133         * powerpc.cc (class Output_data_brlt_powerpc): New.
1134         (class Stub_table, class Stub_control): New.
1135         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1136         stub_table_, set_stub_table, stub_table): New vectors and accessor
1137         functions.
1138         (Target_powerpc::do_may_relax, do_relax, push_branch,
1139         new_stub_table, stub_tables, brlt_section, group_sections,
1140         add_branch_lookup_table, find_branch_lookup_table,
1141         write_branch_lookup_table, make_brlt_section): New functions.
1142         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1143         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1144         branch_info_): New vars.
1145         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1146         make call stubs here.
1147         (Output_data_glink): Remove all call stub handling from this class.
1148         (Target_powerpc::Scan::local, global): Save interesting branch
1149         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1150         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1151         functions on final link.
1152         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1153         Handle long branch destinations too.
1154         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1155         do_plt_address_for_local): Adjust lookup of plt call stubs.
1156
1157 2012-11-30  Alan Modra  <amodra@gmail.com>
1158
1159         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1160         relocs against protected symbols when building 32-bit shared libs.
1161
1162 2012-11-30  Alan Modra  <amodra@gmail.com>
1163
1164         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1165         param.  Call got_section() to make .got.  Update all callers
1166         and their callers and so on.
1167
1168 2012-11-30  Alan Modra  <amodra@gmail.com>
1169
1170         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1171         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1172         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1173         value if it already exists.
1174
1175 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1176
1177         PR gold/14858
1178         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1179
1180 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1181
1182         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1183         than bfc instruction for data sandboxing.
1184
1185 2012-11-08  Alan Modra  <amodra@gmail.com>
1186
1187         * po/POTFILES.in: Regenerate.
1188
1189 2012-11-05  Alan Modra  <amodra@gmail.com>
1190
1191         * configure.ac: Apply 2012-09-10 change to config.in here.
1192         * configure: Regenerate.
1193
1194 2012-11-05  Alan Modra  <amodra@gmail.com>
1195
1196         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1197         (struct Opd_ent): Use "Address" rather than "Offset".
1198         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1199         (Target_powerpc::got_section): Make public.
1200         (Target_powerpc::scan_relocs): Move code setting symbols..
1201         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1202         Create _SDA_BASE_ only when referenced.
1203
1204 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1205
1206         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1207         from last change.
1208
1209 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1210
1211         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1212         for offset_in_output_section parameter.
1213         (Sized_target::relocate_special_relocatable): Likewise.
1214         * arm.cc (Target_arm::relocate_relocs): Likewise.
1215         (Target_arm::relocate_special_relocatable): Likewise.
1216         * i386.cc (Target_i386::relocate_relocs): Likewise.
1217         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1218         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1219         * target-reloc.h (relocate_relocs): Likewise.
1220         * testsuite/testfile.cc (Target_test): Likewise.
1221         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1222         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1223
1224         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1225         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1226
1227         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1228         parameter, which is unused in the [!F_SETFD] case.
1229
1230         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1231         SYMNDX to off_t before comparing it to this->data_size().
1232         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1233         * incremental.cc (Output_section_incremental_inputs::do_write):
1234         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1235
1236         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1237
1238 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1239
1240         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1241         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1242         in EABI_VER5.
1243
1244 2012-10-29  Cary Coutant  <ccoutant@google.com>
1245
1246         * dwp.cc (usage): Add file and exit status parameters;
1247         add --help and --version options.
1248         (print_version): New function.
1249         (main): Add --help and --version options.
1250
1251 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1252
1253         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1254         final_layout_sequence.txt.
1255         * testsuite/Makefile.in: Regenerated.
1256
1257 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1258
1259         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1260         COMPILE generated by automake.
1261         (LINK1): Likewise.
1262         (CXXCOMPILE1): Likewise.
1263         (CXXLINK1): Likewise.
1264         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1265         (LINK): Likewise.
1266         (CXXCOMPILE): Likewise.
1267         (CXXLINK): Likewise.
1268         * testsuite/Makefile.in: Regenerated.
1269
1270 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1271
1272         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1273         on bad fwrite return.
1274
1275 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1276
1277         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1278         on val.
1279
1280 2012-10-23  Cary Coutant  <ccoutant@google.com>
1281
1282         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1283         * testsuite/Makefile.in: Regenerate.
1284         * testsuite/dwp_test.h: New source file.
1285         * testsuite/dwp_test_1.cc: New source file.
1286         * testsuite/dwp_test_1.s: New source file.
1287         * testsuite/dwp_test_1.sh: New source file.
1288         * testsuite/dwp_test_1b.cc: New source file.
1289         * testsuite/dwp_test_1b.s: New source file.
1290         * testsuite/dwp_test_2.cc: New source file.
1291         * testsuite/dwp_test_2.s: New source file.
1292         * testsuite/dwp_test_2.sh: New source file.
1293         * testsuite/dwp_test_main.cc: New source file.
1294         * testsuite/dwp_test_main.s: New source file.
1295
1296 2012-10-23  Cary Coutant  <ccoutant@google.com>
1297
1298         * dwp.h: New header file.
1299         * dwp.cc: New source file.
1300         * gold.h: Move shared declarations to system.h.
1301         * system.h: New header file.
1302         * Makefile.am: Add dwp.
1303         * Makefile.in: Regenerate.
1304
1305 2012-10-23  Cary Coutant  <ccoutant@google.com>
1306
1307         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1308         Dwarf_info_reader::read_from_pointer.
1309         (Dwarf_pubnames_table::read_header): Likewise.
1310         (Dwarf_pubnames_table::next_name): Likewise.
1311         (Dwarf_die::read_attributes): Likewise.
1312         (Dwarf_die::skip_attributes): Likewise.
1313         (Dwarf_info_reader::read_from_pointer): New function template.
1314         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1315         (Dwarf_pubnames_table): Likewise.
1316         (Dwarf_info_reader::read_from_pointer): New function template.
1317         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1318         Dwarf_pubnames_table ctor.
1319
1320 2012-10-23  Cary Coutant  <ccoutant@google.com>
1321
1322         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1323         abbrev_shndx.
1324         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1325         abbrev_shndx_.
1326         (Dwarf_info_reader::set_abbrev_shndx): New method.
1327         (Dwarf_info_reader::abbrev_shndx_): New data member.
1328
1329 2012-10-23  Cary Coutant  <ccoutant@google.com>
1330
1331         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1332         from object, not parameters.
1333         (Dwarf_info_reader::parse): Likewise.
1334         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1335         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1336         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1337         methods.
1338
1339 2012-10-23  Cary Coutant  <ccoutant@google.com>
1340
1341         * fileread.cc (Input_file::Input_file): New constructor.
1342         * fileread.h (class Input_file): Add new constructor.
1343
1344 2012-10-18  Alan Modra  <amodra@gmail.com>
1345
1346         PR gold/14727
1347         * object.cc (Relobj::is_section_name_included): Also match
1348         .sdata personality section.
1349
1350 2012-10-18  Alan Modra  <amodra@gmail.com>
1351
1352         * target-reloc.h (class Default_comdat_behavior): New, package up..
1353         (get_comdat_behaviour): ..this.
1354         (relocate_section): Add Relocate_comdat_behavior template arg,
1355         adjust code to suit.
1356         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1357         (Target_arm::scan_reloc_section): Likewise.
1358         * i386.cc (Target_i386::relocate_section): Likewise.
1359         * sparc.cc (Target_sparc::relocate_section): Likewise.
1360         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1361         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1362         * powerpc.cc (class Relocate_comdat_behavior): New.
1363         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1364         gold::relocate_section with new template arg.
1365
1366 2012-10-18  Alan Modra  <amodra@gmail.com>
1367
1368         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1369         dynamic relocs for GOT_TPREL got entries, without symbol if
1370         resolving locally.
1371         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1372         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1373         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1374
1375 2012-10-17  Alan Modra  <amodra@gmail.com>
1376
1377         PR gold/14726
1378         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1379
1380 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1381
1382         * layout.cc (Layout::include_section): Keep sections marked
1383         SHF_EXCLUDE when doing relocatable links.
1384
1385 2012-10-16  Alan Modra  <amodra@gmail.com>
1386
1387         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1388         (Target_powerpc::do_finalize_sections): Call it.
1389         (Output_data_save_res): New class and supporting functions.
1390         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1391         normal symbols defined in object files.
1392
1393 2012-10-12  Alan Modra  <amodra@gmail.com>
1394
1395         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1396         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1397         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1398         section if scan_opd_relocs not yet called.
1399         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1400
1401 2012-10-12  Alan Modra  <amodra@gmail.com>
1402
1403         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1404         add_local_ifunc_entry): Revert last change.
1405         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1406
1407 2012-10-05  Alan Modra  <amodra@gmail.com>
1408
1409         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1410         do_plt_address_for_global): New functions.
1411         (Output_data_got_powerpc::do_write): Don't segfault when linking
1412         statically.
1413         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1414         add_local_ifunc_entry): Return true on adding entry..
1415         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1416         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1417         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1418         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1419         set up symbols here.
1420         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1421         syms here.  Do so even when no .iplt.  Don't segfault when linking
1422         statically.
1423         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1424         new variants without reloc param.
1425         (Glink_sym_ent::Glink_sym_ent): Likewise.
1426         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1427         reloc when refs will resolve to plt call stub.
1428         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1429         R_PPC_PLTREL24 to resolve locally.
1430         (Target_powerpc::Scan::global): Correct ifunc handling.
1431         (Target_powerpc::Relocate::relocate): Correct local sym glink
1432         lookup.  Don't destroy "value" when we have a plt call stub,
1433         and when checking plt call validity.
1434         (Target_powerpc::do_dynsym_value): Simplify.
1435
1436 2012-10-05  Alan Modra  <amodra@gmail.com>
1437
1438         * i386.cc (Output_data_plt_i386::address_for_global,
1439         address_for_local): Add plt offset to returned value.  Adjust uses.
1440         * sparc.cc (Output_data_plt_sparc::address_for_global,
1441         address_for_local): Likewise.
1442         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1443         address_for_local): Likewise.
1444         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1445         address_for_local): Likewise.
1446         * target.h (Target::plt_address_for_global, plt_address_for_local):
1447         Update comment.
1448         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1449         (Output_data_got::Got_entry::write): Nor here.
1450         * output.h: Comment fix.
1451
1452 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1453
1454         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1455         global_offset_table_ value for larget got.
1456         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1457
1458 2012-09-29  Alan Modra  <amodra@gmail.com>
1459
1460         * powerpc.cc (Target_powerpc::iplt_): New output section.
1461         (Target_powerpc::iplt_section, make_iplt_section,
1462         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1463         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1464         Target_powerpc::plt_entry_count): Count iplt entries too.
1465         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1466         reloc section in constructor.  New params.
1467         (Target_powerpc::make_plt_section): Create reloc section here instead.
1468         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1469         functions.
1470         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1471         (Output_data_glink::add_entry, find_entry): New functions to
1472         deal with local syms.
1473         (Glink_sym_ent): Add support for local syms.
1474         (Output_data_glink::do_write): Handle ifunc plt entries.
1475         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1476         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1477         (Target_powerpc::Relocate::relocate): Likewise.
1478         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1479
1480 2012-09-25  Alan Modra  <amodra@gmail.com>
1481
1482         * object.h (Sized_relobj_file::adjust_local_symbol,
1483         do_adjust_local_symbol): New functions.
1484         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1485         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1486         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1487         and irregular opd entry spacing.
1488         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1489         (Global_symbol_visitor_opd): New functor.
1490         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1491         on deleted opd entries.
1492
1493 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1494
1495         * tilegx.cc: New file.
1496         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1497         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1498         * configure.tgt: Add entries for tilegx*.
1499         * configure.ac: Likewise.
1500         * Makefile.in: Rebuild.
1501         * configure: Likewise.
1502         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1503         tilegx.
1504
1505 2012-09-13  Alan Modra  <amodra@gmail.com>
1506
1507         * target-reloc.h (scan_relocs): Call scan.local for relocs
1508         against symbols in discarded sections.  Pass is_discarded
1509         param.
1510         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1511         Add is_discarded param.
1512         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1513         is_discarded to flag opd entry as discarded.  Don't emit dyn
1514         relocs on such entries.
1515         (Target_powerpc::Scan::global): Similarly detect and handle
1516         such opd entries.
1517         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1518         opd_ent_.  Update all uses.
1519         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1520         (Target_powerpc::relocate_section): Zero out discarded opd
1521         entry relocs.
1522
1523 2012-09-12  Ian Lance Taylor  <iant@google.com>
1524
1525         PR gold/14570
1526         * output.cc: Rename Output_data_got template parameter from size
1527         to got_size for all functions.  Compile all variants of
1528         Output_data_got.
1529         (Output_data_got::Got_entry::write): Correct use of size for
1530         symbol value.  Use local_is_tls rather than casting to
1531         Sized_relobj_file.
1532         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1533         (class Sized_relobj_file): Add do_local_is_tls.
1534         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1535
1536 2012-09-11  Alan Modra  <amodra@gmail.com>
1537
1538         PR gold/14566
1539         * layout.cc (Layout::set_segment_offsets): When using
1540         common-page-size alignment, ensure we are on a new max-page-size
1541         page.
1542         * output.cc (Output_segment::set_section_addresses): Use
1543         abi_pagesize, not common_pagesize for relro boundary.
1544         (Output_segment::set_offset): Likewise.
1545
1546 2012-09-11  Alan Modra  <amodra@gmail.com>
1547
1548         * output.h (Output_data_got::add_global_tls, add_local_tls,
1549         add_local_tls_pair): New functions.
1550         (Output_data_got::add_local_pair_with_rel): Remove second
1551         reloc param.  Expand comment.
1552         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1553         use_plt_or_tls_offset_, similarly for constructor param.
1554         (Output_data_got::Got_entry::write): Add got_index param.
1555         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1556         add_local_tls_pair): New functions.
1557         (Output_data_got::Got_entry::write): Handle tls symbols
1558         with use_plt_or_tls_offset_ set specially.
1559         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1560         (Output_data_got::do_write): Replace iterator with index, pass
1561         index to entry write function.
1562         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1563         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1564         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1565         call.
1566         * i386.cc (Target_i386::Scan::local): Likewise.
1567         * sparc.cc (Target_sparc::Scan::local): Likewise.
1568         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1569         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1570         do_tls_offset_for_global): New functions.
1571         (Target_powerpc::Scan::local): Correct TLS relocations and got
1572         entry values.
1573         (Target_powerpc::Scan::global): Don't emit unnecessary
1574         dynamic relocations on TLS GOT entries.
1575
1576 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1577
1578         * config.in: Disable sanity check for kfreebsd.
1579
1580 2012-09-10  Sterling Augustine  <saugustine@google.com>
1581
1582         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1583         (Gdb_index::pubtypes_read): New parameter.
1584         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1585         to calls.
1586         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1587         pubtypes_object_.
1588
1589 2012-09-09  Alan Modra  <amodra@gmail.com>
1590
1591         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1592         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1593         * gc.h (gc_process_relocs): Call target gc_add_reference.
1594         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1595         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1596         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1597         unnecessary cast.
1598         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1599         to cater for when we don't need code offset.  Update use.
1600         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1601         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1602         set_opd_valid): New functions.
1603         (Target_powerpc::do_gc_add_reference): New function.
1604         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1605         stashed refs.
1606         (Target_powerpc::do_gc_mark_symbol): New function.
1607
1608 2012-09-06  Cary Coutant  <ccoutant@google.com>
1609
1610         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1611         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1612         (Dwarf_die::skip_attributes): Likewise.
1613         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1614         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1615         (main): Call it.
1616         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1617
1618 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1619
1620         * testsuite/script_test_3.t: Add .got.plt output section
1621         statement.
1622         * testsuite/script_test_4.t: Likewise.
1623
1624 2012-09-05  Alan Modra  <amodra@gmail.com>
1625
1626         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1627         update all uses and lose "enum" when using type.
1628
1629 2012-09-05  Alan Modra  <amodra@gmail.com>
1630
1631         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1632         * configure: Regenerate.
1633         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1634         (plugin_final_layout.stdout): Likewise.
1635         (memory_test): Set page sizes to 0x1000.
1636         * testsuite/Makefile.in: Regenerate.
1637         * testsuite/discard_locals_test.sh: Add FIXME comment.
1638         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1639         * testsuite/pr14265.t: Add .got output section statement.
1640         * testsuite/script_test_2.t: Likewise.
1641         * testsuite/script_test_3.t: Likewise.
1642         * testsuite/script_test_4.t: Likewise.
1643         * testsuite/script_test_5.t: Likewise.
1644         * testsuite/script_test_6.t: Likewise.
1645         * testsuite/script_test_7.t: Likewise.
1646         * testsuite/script_test_9.t: Likewise.
1647
1648 2012-09-05  Alan Modra  <amodra@gmail.com>
1649
1650         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1651         (Powerpc_relocate_functions::Status): New typedef.
1652         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1653         (Target_powerpc::Scan::local): Handle REL64.
1654         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1655         for REL32 and REL64.
1656         (Target_powerpc::symval_for_branch): New function, extracted from..
1657         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1658         checks.  Report overflow errors.
1659
1660 2012-09-05  Alan Modra  <amodra@gmail.com>
1661
1662         * object.h (Sized_relobj_file::emit_relocs): Delete.
1663         (Sized_relobj_file::emit_relocs_reltype): Delete.
1664         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1665         relocate_relocs for --emit-relocs.
1666         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1667         * output.h: Update comment.
1668         (Output_segment::first_section): New function.
1669         (Output_segment::first_section_load_address): Use first_section.
1670         * output.cc (Output_segment::first_section): New function extracted..
1671         (Output_segment::first_section_load_address): ..from here.  Delete.
1672         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1673         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1674         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1675         adjust call to target.h function.
1676         * i386.cc (Target_i386): Likewise.
1677         * sparc.cc (Target_sparc): Likewise.
1678         * x86_64.cc (Target_x86_64): Likewise.
1679         * powerpc.cc (Target_powerpc): Likewise.
1680         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1681         first tls section has section symbol for optimised local dynamic
1682         output relocs.
1683         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1684         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1685         optimised tls code.
1686         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1687         Rename to relocate_relocs.  Update error message.
1688
1689 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1690
1691         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1692         --just-symbols.
1693
1694 2012-08-31  Alan Modra  <amodra@gmail.com>
1695
1696         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1697         (Powerpc_relobj::toc_base_offset): New stub function.
1698         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1699         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1700         (Target_powerpc::Relocate::enum skip_tls): New.
1701         (Target_powerpc::call_tls_get_addr_): New var.
1702         (Target_powerpc::is_branch_reloc): Move to file scope.
1703         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1704         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1705         New functions.
1706         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1707         (powerpc_info): Correct common_pagesize for ppc64.
1708         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1709         (Powerpc_relocate_functions): Add overflow check enums and functions.
1710         Add non-shift version of rela, rela_ua.  Delete all rel public
1711         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1712         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1713         addr16_ha3, addr14 functions.
1714         (Output_data_got_powerpc::add_constant_pair): New function.
1715         (Output_data_got_powerpc::got_base_offset): Likewise.
1716         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1717         (instruction constants): Sort, add some more.
1718         (Output_data_glink::do_write): Add and use Address typedef.  Use
1719         object->toc_base_offset() stub for 64-bit.
1720         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1721         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1722         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1723         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1724         Always treat .opd relocs as against locally defined symbol.
1725         Correct condition for RELATIVE relocs.
1726         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1727         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1728         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1729         calculations.  Handle TLS relocs, and more.  Add overflow
1730         checking and adjust for Powerpc_relocate_functions changes.
1731         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1732         Reinstate --emit-relocs code with FIXME.
1733
1734 2012-08-30  Alan Modra  <amodra@gmail.com>
1735
1736         * layout.cc (Layout::set_segment_offsets): Set p_align to
1737         abi_pagesize, not common_pagesize.
1738         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1739         to determine whether file header can go in segment.
1740
1741 2012-08-30  Alan Modra  <amodra@gmail.com>
1742
1743         * output.h (Output_reloc::Output_reloc <output section>): Add
1744         is_relative param.  Adjust calls.
1745         (Output_reloc::add_output_section_relative): New functions.
1746         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1747         is_relative.
1748         (Output_reloc::symbol_value): Handle SECTION_CODE.
1749
1750 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1751
1752         * gold.cc (queue_middle_tasks): Call layout again when unique
1753         segments for sections is desired.
1754         * layout.cc (Layout::Layout): Initialize new members.
1755         (Layout::get_output_section_flags): New function.
1756         (Layout::choose_output_section): Call get_output_section_flags.
1757         (Layout::layout): Make output section for mapping to a unique segment.
1758         (Layout::insert_section_segment_map): New function.
1759         (Layout::attach_allocated_section_to_segment): Make unique segment for
1760         output sections marked so.
1761         (Layout::segment_precedes): Check for unique segments when sorting.
1762         * layout.h (Layout::Unique_segment_info): New struct.
1763         (Layout::Section_segment_map): New typedef.
1764         (Layout::insert_section_segment_map): New function.
1765         (Layout::get_output_section_flags): New function.
1766         (Layout::is_unique_segment_for_sections_specified): New function.
1767         (Layout::set_unique_segment_for_sections_specified): New function.
1768         (Layout::unique_segment_for_sections_specified_): New member.
1769         (Layout::section_segment_map_): New member.
1770         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1771         Rename is_gc_pass_one to is_pass_one.
1772         Rename is_gc_pass_two to is_pass_two.
1773         Rename is_gc_or_icf to is_two_pass.
1774         Check for which pass based on whether symbols data is present.
1775         Make it two pass when unique segments for sections is desired.
1776         * output.cc (Output_section::Output_section): Initialize new
1777         members.
1778         * output.h (Output_section::is_unique_segment): New function.
1779         (Output_section::set_is_unique_segment): New function.
1780         (Output_section::is_unique_segment_): New member.
1781         (Output_section::extra_segment_flags): New function.
1782         (Output_section::set_extra_segment_flags): New function.
1783         (Output_section::extra_segment_flags_): New member.
1784         (Output_section::segment_alignment): New function.
1785         (Output_section::set_segment_alignment): New function.
1786         (Output_section::segment_alignment_): New member.
1787         (Output_segment::Output_segment): Initialize is_unique_segment_.
1788         (Output_segment::is_unique_segment): New function.
1789         (Output_segment::set_is_unique_segment): New function.
1790         (Output_segment::is_unique_segment_): New member.
1791         * plugin.cc (allow_unique_segment_for_sections): New function.
1792         (unique_segment_for_sections): New function.
1793         (Plugin::load): Add new functions to transfer vector.
1794         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1795         * Makefile.in: Regenerate.
1796         * testsuite/plugin_final_layout.sh: Check if unique segment
1797         functionality works.
1798         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1799         are available.
1800         (allow_unique_segment_for_sections): New global.
1801         (unique_segment_for_sections): New global.
1802         (claim_file_hook): Call allow_unique_segment_for_sections.
1803         (all_symbols_read_hook): Call unique_segment_for_sections.
1804
1805 2012-08-22  Cary Coutant  <ccoutant@google.com>
1806
1807         * layout.cc (Layout::include_section): Don't assert on GROUP
1808         sections with --emit-relocs.
1809
1810 2012-08-21  Cary Coutant  <ccoutant@google.com>
1811
1812         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1813         if --export-dynamic-symbol names an undef symbol.
1814
1815 2012-08-18  Alan Modra  <amodra@gmail.com>
1816
1817         * powerpc.cc: Formatting and white space.
1818         (Powerpc_relobj): Rename got2_section_ to special_.
1819         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1820         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1821         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1822         (Target_powerpc): Add Address typedef and invalid_address.  Use
1823         throughout.
1824         (Target_powerpc::is_branch_reloc): New function.
1825         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1826         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1827         for dst_mask, value and addend.
1828         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1829         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1830         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1831         uint16_t for 24-bit offset.  Use get_output_section_offset and
1832         check return.
1833         (Target_powerpc::Scan::local): Handle more relocs.
1834         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1835         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1836         Plug in toc restoring insn after plt calls.  Translate branches
1837         to function descriptor symbols to corresponding entry point.
1838         (Target_powerpc::relocate_for_relocatable): Check return from
1839         get_output_section_offset.
1840         * symtab.h: Comment typo.
1841
1842 2012-08-14  Ian Lance Taylor  <iant@google.com>
1843
1844         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1845         unsupported_relocal_local to call unsupported_reloc_global.
1846
1847 2012-08-14  Nick Clifton  <nickc@redhat.com>
1848
1849         PR ld/14265
1850         * script-sections.cc (Sections_element::output_section_name): Add
1851         keep return parameter.
1852         (Output_section_element::match_name): Add keep return parameter.
1853         Return the value of the keep_ member.
1854         * script-sections.h (class Output_section): Update
1855         output_section_name prototype.
1856         * layout.cc (Layout::keep_input_section): New public member
1857         function.
1858         (Layout::choose_output_section): Pass keep parameter to
1859         output_section_name.
1860         * layout.h (class Layout): Add keep_input_section.
1861         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1862         sections.
1863         * testsuite/Makefile.am: Add a test.
1864         * testsuite/Makefile.in: Regenerate.
1865         * testsuite/pr14265.c: Source file for the test.
1866         * testsuite/pr14265.t: Linker script for the test.
1867         * testsuite/pr14265.sh: Shell script for the test.
1868
1869 2012-08-14  Alan Modra  <amodra@gmail.com>
1870
1871         * target.h (Target::output_section_name): New function.
1872         (Target::do_output_section_name): New function.
1873         * layout.cc (Layout::choose_output_section): Call the above.
1874         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1875
1876 2012-08-14  Alan Modra  <amodra@gmail.com>
1877
1878         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1879         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1880         for replace_constant call.
1881         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1882         (Output_data_glink::do_print_to_mapfile): New function.
1883         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1884         (Target_powerpc::Relocate::relocate): Likewise.
1885
1886 2012-08-14  Alan Modra  <amodra@gmail.com>
1887
1888         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1889         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1890         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1891         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1892         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1893         here.
1894         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1895         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1896         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1897         here.
1898         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1899         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1900
1901 2012-08-12  Alan Modra  <amodra@gmail.com>
1902
1903         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1904         (glink insn constants): Use uint32_t.
1905         (Output_data_glink::add_entry): Use insert, not [] operator.
1906
1907 2012-08-11  Alan Modra  <amodra@gmail.com>
1908
1909         * object.h (Sized_relobj_file::find_shdr): New function.
1910         (Sized_relobj_file::find_special_sections): New function.
1911         * object.cc (Sized_relobj_file::find_shdr): New function.
1912         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1913         (Sized_relobj_file::find_special_sections): New function, split out..
1914         (Sized_relobj_file::do_read_symbols): ..from here.
1915         * output.h (Output_data_got::replace_constant): New function.
1916         (Output_data_got::num_entries): New function.
1917         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1918         (Output_data_got::got_offset): Protected rather than private.
1919         (Output_data_got::replace_got_entry): New function.
1920         * output.cc (Output_data_got::replace_got_entry): New function.
1921         * powerpc.cc (class Powerpc_relobj): New.
1922         (class Powerpc_relocate_functions): Delete all psymval variants or
1923         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1924         Implement _ha functions using corresponding _hi function.
1925         (Powerpc_relobj::find_special_sections): New function.
1926         (Target_powerpc::do_make_elf_object): New function.
1927         (class Output_data_got_powerpc): New.
1928         (class Output_data_glink): New.
1929         (class Powerpc_scan_relocatable_reloc): New.
1930         Many more changes througout file.
1931
1932 2012-08-09  Nick Clifton  <nickc@redhat.com>
1933
1934         * po/vi.po: Updated Vietnamese translation.
1935
1936 2012-08-07  Ian Lance Taylor  <iant@google.com>
1937
1938         * layout.cc (Layout::add_target_dynamic_tags): If
1939         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1940         plt_rel.
1941
1942 2012-07-30  Nick Clifton  <nickc@redhat.com>
1943
1944         * po/gold.pot: Updated template.
1945         * po/es.po: Updated Spanish translation.
1946
1947 2012-07-18  Cary Coutant  <ccoutant@google.com>
1948
1949         PR gold/14344
1950         * configure.ac: Add check for -gpubnames support.
1951         * configure: Regenerate.
1952         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1953         support; force -gno-pubnames.
1954         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1955         support.
1956         (gdb_index_test_4): New test.
1957         * testsuite/Makefile.in: Regenerate.
1958         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1959         * testsuite/gdb_index_test_2.sh: Likewise.
1960         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1961         * testsuite/gdb_index_test_4.sh: New script.
1962         * testsuite/gdb_index_test_comm.sh: New script with common code;
1963         don't look for space after colon.
1964
1965 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1966
1967         * gold.cc (queue_middle_tasks): Update function order only after
1968         deferred objects due to plugins are processed.
1969
1970 2012-07-11  Ian Lance Taylor  <iant@google.com>
1971
1972         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1973         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1974         (Target_arm::scan_reloc_for_stub): Likewise.
1975         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1976         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1977         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1978         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1979         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1980
1981 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1982             Ian Lance Taylor  <iant@google.com>
1983
1984         PR gold/14309
1985         * configure.ac: Test whether std::tr1::hash<off_t> works.
1986         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1987         needed.
1988         * output.h (class Output_fill): Add virtual destructor.
1989         * configure, config.in: Rebuild.
1990
1991 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1992
1993         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1994
1995 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1996
1997         * plugin.cc (Plugin::load): Handle position independent executables.
1998
1999 2012-06-06  Cary Coutant  <ccoutant@google.com>
2000
2001         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2002         add .debug_macro.
2003         (lines_only_debug_sections): Likewise.
2004         (gdb_fast_lookup_sections): New static array.
2005         (is_gdb_debug_section): Rename formal parameter.
2006         (is_lines_only_debug_section): Likewise.
2007         (is_gdb_fast_lookup_section): New function.
2008         (Layout::include_section): Check for ".zdebug_" prefix; pass
2009         section name suffix to is_gdb_debug_section, et al.; check for
2010         fast-lookup sections when building .gdb_index.
2011         * options.h (--strip-debug-gdb): Update GDB version number.
2012
2013 2012-06-06  Cary Coutant  <ccoutant@google.com>
2014
2015         * configure.ac: Add check for fallocate.
2016         * configure: Regenerate.
2017         * config.in: Regenerate.
2018
2019         * options.h (class General_options): Add --mmap-output-file and
2020         --posix-fallocate options.
2021         * output.cc: (posix_fallocate): Remove; replace with...
2022         (gold_fallocate): New function.
2023         (Output_file::map_no_anonymous): Call gold_fallocate.
2024         (Output_file::map): Check --mmap-output-file option.
2025
2026 2012-06-05  Jing Yu  <jingyu@google.com>
2027
2028         * gold.h (textdomain): Add do {} to empty while(0).
2029         (bindtextdomain): Likewise.
2030
2031 2012-06-04  Cary Coutant  <ccoutant@google.com>
2032
2033         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2034         has_dynsym_index.
2035
2036 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2037
2038         * symtab.cc (Symbol_table::define_special_symbol):
2039         Initialize *poldsym to prevent uninitialized variable errors.
2040
2041 2012-05-23  Cary Coutant  <ccoutant@google.com>
2042
2043         * layout.cc (Layout::section_name_mapping): Add rules to handle
2044         exact match on .data.rel.ro.local or .data.rel.ro.
2045         (Layout::output_section_name): Check for exact matches.
2046
2047 2012-05-23  Cary Coutant  <ccoutant@google.com>
2048
2049         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2050         more carefully.
2051
2052 2012-05-22  Cary Coutant  <ccoutant@google.com>
2053
2054         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2055         object before exporting symbol.
2056
2057 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2058
2059         * testsuite/tls_test.cc: Include "config.h" first.
2060         * testsuite/tls_test_c.c: Likewise.
2061
2062 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2063             Nick Clifton  <nickc@redhat.com>
2064
2065         PR 14072
2066         * configure.in: Add check that sysdep.h has been included before
2067         any system header files.
2068         * configure: Regenerate.
2069         * config.in: Regenerate.
2070
2071 2012-05-14  Cary Coutant  <ccoutant@google.com>
2072
2073         * layout.cc (Layout::make_output_section): Mark .tdata section
2074         as RELRO.
2075         * testsuite/relro_test.cc: Add a TLS variable.
2076
2077 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2078
2079         PR gold/14091
2080         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2081         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2082         R_X86_64_64.
2083
2084 2012-05-08  Cary Coutant  <ccoutant@google.com>
2085
2086         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2087         (lines_only_debug_sections): Likewise.
2088
2089 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2090
2091         * nacl.cc: New file.
2092         * nacl.h: New file.
2093         * Makefile.am (CCFILES, HFILES): Add them.
2094         * Makefile.in: Regenerate.
2095         * i386.cc (Output_data_plt_i386_nacl): New class.
2096         (Output_data_plt_i386_nacl_exec): New class.
2097         (Output_data_plt_i386_nacl_dyn): New class.
2098         (Target_i386_nacl): New class.
2099         (Target_selector_i386_nacl): New class.
2100         (target_selector_i386): Use it instead of Target_selector_i386.
2101         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2102         (Target_x86_64_nacl): New class.
2103         (Target_selector_x86_64_nacl): New class.
2104         (target_selector_x86_64, target_selector_x32): Use it instead of
2105         Target_selector_x86_64.
2106         * arm.cc (Output_data_plt_arm_nacl): New class.
2107         (Target_arm_nacl): New class.
2108         (Target_selector_arm_nacl): New class.
2109         (target_selector_arm, target_selector_armbe): Use it instead of
2110         Target_selector_arm.
2111
2112         * target-select.cc (select_target): Take new Input_file* and off_t
2113         arguments, pass them on to recognize method of selector.
2114         * object.cc (make_elf_sized_object): Update caller.
2115         * parameters.cc (parameters_force_valid_target): Likewise.
2116         * incremental.cc (make_sized_incremental_binary): Likewise.
2117         * target-select.h: Update decl.
2118         (Target_selector::recognize): Take new Input_file* argument,
2119         pass it on to do_recognize.
2120         (Target_selector::do_recognize): Take new Input_file* argument.
2121         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2122         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2123         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2124         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2125
2126         * target.h (Target::Target_info): New members isolate_execinstr
2127         and rosegment_gap.
2128         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2129         * arm.cc (Target_arm::arm_info): Update initializer.
2130         * i386.cc (Target_i386::i386_info): Likewise.
2131         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2132         * sparc.cc (Target_sparc::sparc_info): Likewise.
2133         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2134         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2135         * layout.cc (Layout::attach_allocated_section_to_segment):
2136         Take new const Target* argument.  If target->isolate_execinstr(), act
2137         like --rosegment.
2138         (Layout::find_first_load_seg): Take new const Target* argument;
2139         if target->isolate_execinstr(), reject PF_X segments.
2140         (Layout::relaxation_loop_body): Update caller.
2141         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2142         reset file offset to zero when we hit LOAD_SEG, and then do a second
2143         loop over the segments before LOAD_SEG to reassign offsets after
2144         addresses have been determined.  Handle target->rosegment_gap().
2145         (Layout::attach_section_to_segment): Take new const Target* argument;
2146         pass it to attach_allocated_section_to_segment.
2147         (Layout::make_output_section): Update caller.
2148         (Layout::attach_sections_to_segments): Take new const Target* argument;
2149         pass it to attach_section_to_segment.
2150         * gold.cc (queue_middle_tasks): Update caller.
2151         * layout.h (Layout): Update method decls with new arguments.
2152
2153         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2154         Target_info pointer to use.
2155         (Target_arm::do_make_data_plt): New virtual method.
2156         (Target_arm::make_data_plt): New method that calls it.
2157         (Target_arm::make_plt_entry): Use it.
2158         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2159         for the section alignment.
2160         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2161         method.
2162         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2163         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2164         method.
2165         (Output_data_plt_arm::get_plt_entry_size): Call it.
2166         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2167         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2168         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2169         method.
2170         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2171         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2172         method instead of sizeof(plt_entry).
2173         (Output_data_plt_arm::add_entry): Likewise.
2174         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2175         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2176         than static method.
2177         (Target_arm::plt_entry_size): Likewise.
2178         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2179         Move to ...
2180         (Output_data_plt_arm_standard): ... here, new class.
2181         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2182         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2183         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2184
2185         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2186         Take additional argument for the PLT entry size.
2187         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2188         Use get_plt_entry_size method rather than plt_entry_size variable.
2189         (Output_data_plt_x86_64::reserve_slot): Likewise.
2190         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2191         (Output_data_plt_x86_64::add_entry): Likewise.
2192         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2193         (Output_data_plt_x86_64::address_for_global): Likewise.
2194         (Output_data_plt_x86_64::address_for_local): Likewise.
2195         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2196         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2197         Make method non-static.
2198         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2199         method.
2200         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2201         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2202         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2203         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2204         virtual method.
2205         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2206         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2207         virtual method.
2208         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2209         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2210         virtual method.
2211         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2212         (Output_data_plt_x86_64::plt_entry_size)
2213         (Output_data_plt_x86_64::first_plt_entry)
2214         (Output_data_plt_x86_64::plt_entry)
2215         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2216         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2217         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2218         (Output_data_plt_x86_64_standard): ... here, new class.
2219         (Target_x86_64::Target_x86_64): Take optional argument for the
2220         Target_info pointer to use.
2221         (Target_x86_64::do_make_data_plt): New virtual method.
2222         (Target_x86_64::make_data_plt): New method to call it.
2223         (Target_x86_64::init_got_plt_for_update): Use that.
2224         Call this->plt_->add_eh_frame method here.
2225         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2226         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2227         rather than static method.
2228         (Target_x86_64::plt_entry_size): Likewise.
2229         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2230         rather than plt_entry_size variable.  Move guts of PLT filling to...
2231         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2232         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2233         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2234
2235         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2236         additional argument for the section alignment.
2237         Don't do add_eh_frame_for_plt here.
2238         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2239         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2240         variable.
2241         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2242         method.
2243         (Output_data_plt_i386::get_plt_entry_size): Call it.
2244         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2245         (Output_data_plt_i386::add_eh_frame): New method to call it.
2246         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2247         method.
2248         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2249         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2250         method.
2251         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2252         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2253         method instead of plt_entry_size.
2254         (Output_data_plt_i386::plt_entry_size)
2255         (Output_data_plt_i386::plt_eh_frame_fde_size)
2256         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2257         (Output_data_plt_i386_standard): ... here, new class.
2258         (Output_data_plt_i386_exec): New class.
2259         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2260         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2261         (Output_data_plt_i386::exec_plt_entry): Move to ...
2262         (Output_data_plt_i386_exec::plt_entry): ... here.
2263         (Output_data_plt_i386_dyn): New class.
2264         (Output_data_plt_i386::first_plt_entry): Move to ...
2265         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2266         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2267         (Output_data_plt_i386_dyn::plt_entry): ... here.
2268         (Target_i386::Target_i386): Take optional argument for the Target_info
2269         pointer to use.
2270         (Target_i386::do_make_data_plt): New virtual method.
2271         (Target_i386::make_data_plt): New method to call it.
2272         (Target_i386::make_plt_section): Use that.
2273         Call this->plt_->add_eh_frame method here.
2274         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2275         rather than plt_entry_size variable.
2276         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2277         (Output_data_plt_i386::address_for_local): Likewise.
2278         (Output_data_plt_i386::do_write): Likewise.
2279         Move guts of PLT filling to...
2280         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2281         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2282         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2283         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2284
2285 2012-05-01  Cary Coutant  <ccoutant@google.com>
2286
2287         * dwarf_reader.cc (Dwarf_die::read_attributes)
2288         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2289         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2290         * reduced_debug_output.cc
2291         (Output_reduced_debug_info_section::get_die_end): Remove
2292         DW_FORM_GNU_ref_index.  Add default case.
2293
2294 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2295
2296         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2297         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2298         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2299         DW_AT_high_pc as offset from DW_AT_low_pc.
2300
2301         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2302         * testsuite/Makefile.in: Regenerate.
2303         * testsuite/gdb_index_test_3.c: New test source file.
2304         * testsuite/gdb_index_test_3.sh: New test source file.
2305
2306 2012-04-25  Ian Lance Taylor  <iant@google.com>
2307
2308         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2309         pointer.
2310         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2311         as a class, not a struct.
2312         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2313         (Target_arm::apply_cortex_a8_workaround): Likewise.
2314         * gc.h: Declare Reloc_types as a struct, not a class.
2315         * object.h: Declare Symbols_data as a struct.
2316         * reloc.h: Declare Read_relocs_data as a struct.
2317         * target.h: Declare Relocate_info as a struct.
2318
2319 2012-04-24  David S. Miller  <davem@davemloft.net>
2320
2321         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2322         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2323         and R_SPARC_WPLT30.
2324
2325 2012-04-24  Cary Coutant  <ccoutant@google.com>
2326
2327         * incremental-dump.cc (find_input_containing_global): Replace
2328         magic number with symbolic constant.
2329         (dump_incremental_inputs): Update version number.
2330         * incremental.cc (Output_section_incremental_inputs): Update version
2331         number; import symbolic constants from Incremental_inputs_reader.
2332         (Incremental_inputs::create_data_sections): Align relocations
2333         section correctly for 64-bit targets.
2334         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2335         constants; add padding.
2336         (Output_section_incremental_inputs::write_header): Add assert for
2337         header_size.
2338         (Output_section_incremental_inputs::write_input_files): Add assert
2339         for input_entry_size.
2340         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2341         add assert for object_info_size, input_section_entry_size,
2342         global_sym_entry_size.
2343         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2344         for data structure sizes; use them.
2345         (Incremental_input_entry_reader): Import symbolic constants from
2346         Incremental_inputs_reader; use them.
2347
2348 2012-04-23  David S. Miller  <davem@davemloft.net>
2349
2350         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2351         and elf_flags_set_.
2352         (Target_sparc::Target_sparc): Initialize new fields.
2353         (Target_sparc::do_make_elf_object): New function.
2354         (Target_sparc::do_adjust_elf_header): New function.
2355
2356 2012-04-23  Cary Coutant  <ccoutant@google.com>
2357
2358         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2359         CU range table of gdb index.
2360
2361 2012-04-20  David S. Miller  <davem@davemloft.net>
2362
2363         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2364         instead of false.
2365
2366 2012-04-16  David S. Miller  <davem@davemloft.net>
2367
2368         * sparc.cc (Target_sparc::got_address): New function.
2369         (Sparc_relocate_functions::gdop_hix22): New function.
2370         (Sparc_relocate_functions::gdop_lox10): New function.
2371         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2372         relocs.
2373         (Target_sparc::Scan::local): Likewise if the global symbol is not
2374         preemptible and is not IFUNC.
2375         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2376         transformations for local and non-preemptible non-IFUNC global
2377         symbols.
2378
2379         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2380         writing out 64-bit part of ranges.
2381
2382         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2383         -fpic and -fpie respectively.
2384         * Makefile.in: Regenerate.
2385
2386         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2387         (Target_sparc::Target_sparc): Initialize new field.
2388         (Target_sparc::do_plt_section_for_global): New function.
2389         (Target_sparc::do_plt_section_for_local): New function.
2390         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2391         (Target_sparc::make_plt_section): New function, broken out of
2392         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2393         (Target_sparc::make_plt_entry): Call make_plt_section.
2394         (Target_sparc::make_local_ifunc_plt_entry): New function.
2395         (Target_sparc::rela_ifunc_section): New function.
2396         (Target_sparc::plt_section): Remove const.
2397         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2398         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2399         and ifunc_count_ fields.
2400         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2401         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2402         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2403         (Output_data_plt_sparc::rela_ifunc): New function.
2404         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2405         (Output_data_plt_sparc::has_ifunc_section): New function.
2406         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2407         (Output_data_plt_sparc::address_for_global): New function.
2408         (Output_data_plt_sparc::address_for_local): New function.
2409         (Output_data_plt_sparc::plt_index_to_offset): New function.
2410         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2411         and entry_count.
2412         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2413         entry_count.
2414         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2415         R_SPARC_JMP_IREL to switch.
2416         (Target_sparc::Scan::check_non_pic): Likewise.
2417         (Target_sparc::Scan::local): Handle IFUNC symbols.
2418         (Target_sparc::Scan::local): Likewise.
2419         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2420         and plt_address_for_local.
2421         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2422         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2423
2424         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2425         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2426         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2427         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2428         global relocs too.
2429         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2430         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2431         calls.
2432         * sparc.cc (Target_sparc::Scan::global): Likewise.
2433         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2434
2435 2012-04-16  Cary Coutant  <ccoutant@google.com>
2436
2437         * archive.cc (Library_base::should_include_member): Check for
2438         --export-dynamic-symbol.
2439         * options.h (class General_options): Add --export-dynamic-symbol.
2440         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2441         --export-dynamic-symbol.
2442         (Symbol_table::gc_mark_undef_symbols): Likewise.
2443         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2444
2445 2012-04-12  David S. Miller  <davem@davemloft.net>
2446
2447         * sparc.cc (Reloc::wdisp10): New relocation method.
2448         (Reloc::h34): Likewise.
2449         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2450         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2451         R_SPARC_WDISP10.
2452         (Target_sparc::Scan::local): Likewise.
2453         (Target_sparc::Scan::global): Likewise.
2454         (Target_sparc::Relocate::relocate): Likewise.
2455
2456 2012-04-09  Cary Coutant  <ccoutant@google.com>
2457
2458         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2459         low_pc == 0.
2460
2461 2012-04-06  Ian Lance Taylor  <iant@google.com>
2462
2463         * timer.cc: #include <unistd.h>.
2464
2465 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2466
2467         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2468         * config.in: Regenerate.
2469         * configure: Regenerate.
2470
2471 2012-04-05  Nick Clifton  <nickc@redhat.com>
2472
2473         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2474         (AM_LC_MESSAGES): Add.
2475         * aclocal.m4: Regenerate.
2476         * config.in: Regenerate.
2477         * configure: Regenerate.
2478
2479 2012-03-21  Cary Coutant  <ccoutant@google.com>
2480
2481         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2482         * Makefile.in: Regenerate.
2483         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2484         (Sized_elf_reloc_mapper::symbol_section): New function.
2485         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2486         (make_elf_reloc_mapper): New function.
2487         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2488         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2489         (Dwarf_abbrev_table::do_get_abbrev): New function.
2490         (Dwarf_ranges_table::read_ranges_table): New function.
2491         (Dwarf_ranges_table::read_range_list): New function.
2492         (Dwarf_pubnames_table::read_section): New function.
2493         (Dwarf_pubnames_table::read_header): New function.
2494         (Dwarf_pubnames_table::next_name): New function.
2495         (Dwarf_die::Dwarf_die): New function.
2496         (Dwarf_die::read_attributes): New function.
2497         (Dwarf_die::skip_attributes): New function.
2498         (Dwarf_die::set_name): New function.
2499         (Dwarf_die::set_linkage_name): New function.
2500         (Dwarf_die::attribute): New function.
2501         (Dwarf_die::string_attribute): New function.
2502         (Dwarf_die::int_attribute): New function.
2503         (Dwarf_die::uint_attribute): New function.
2504         (Dwarf_die::ref_attribute): New function.
2505         (Dwarf_die::child_offset): New function.
2506         (Dwarf_die::sibling_offset): New function.
2507         (Dwarf_info_reader::check_buffer): New function.
2508         (Dwarf_info_reader::parse): New function.
2509         (Dwarf_info_reader::do_parse): New function.
2510         (Dwarf_info_reader::do_read_string_table): New function.
2511         (Dwarf_info_reader::lookup_reloc): New function.
2512         (Dwarf_info_reader::get_string): New function.
2513         (Dwarf_info_reader::visit_compilation_unit): New function.
2514         (Dwarf_info_reader::visit_type_unit): New function.
2515         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2516         Sized_elf_reloc_mapper.
2517         (Sized_dwarf_line_info::symbol_section): Remove function.
2518         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2519         (Sized_dwarf_line_info::read_line_mappings): Remove object
2520         parameter, adjust callers.
2521         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2522         * dwarf_reader.h: Include <sys/types.h>.
2523         (class Track_relocs): Remove forward declaration.
2524         (class Elf_reloc_mapper): New class.
2525         (class Sized_elf_reloc_mapper): New class.
2526         (class Dwarf_abbrev_table): New class.
2527         (class Dwarf_range_list): New class.
2528         (class Dwarf_ranges_table): New class.
2529         (class Dwarf_pubnames_table): New class.
2530         (class Dwarf_die): New class.
2531         (class Dwarf_info_reader): New class.
2532         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2533         (Sized_dwarf_line_info::symbol_section): Remove member function.
2534         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2535         base class.
2536         * gdb-index.cc: New source file.
2537         * gdb-index.h: New source file.
2538         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2539         and .debug_types sections, call Layout::add_to_gdb_index.
2540         (Sized_relobj_incr::do_section_name): Implement.
2541         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2542         return type; Implement.
2543         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2544         return type.
2545         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2546         parameter list and return type.
2547         (Sized_incr_dynobj::do_section_contents): Likewise.
2548         * layout.cc: Include gdb-index.h.
2549         (Layout::Layout): Initialize gdb_index_data_.
2550         (Layout::init_fixed_output_section): Check for .gdb_index section.
2551         (Layout::add_to_gdb_index): New function. Instantiate.
2552         * layout.h: Add forward declaration for class Gdb_index.
2553         (Layout::add_to_gdb_index): New member function.
2554         (Layout::gdb_index_data_): New data member.
2555         * main.cc: Include gdb-index.h.
2556         (main): Print statistics for gdb index.
2557         * object.cc (Object::section_contents): Move code into
2558         do_section_contents.
2559         (need_decompressed_section): Check for sections needed when building
2560         gdb index.
2561         (build_compressed_section_map): Likewise.
2562         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2563         gdb index.
2564         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2565         sections; call Layout::add_to_gdb_index.
2566         (Sized_relobj_file::do_decompressed_section_contents): Call
2567         do_section_contents directly.
2568         * object.h (Object::do_section_contents): Adjust parameter list and
2569         return type.
2570         (Object::do_decompressed_section_contents): Call do_section_contents
2571         directly.
2572         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2573         return type.
2574         * options.h (class General_options): Add --gdb-index option.
2575         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2576         list and return type.
2577         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2578         * reloc.h (Track_relocs::checkpoint): New function.
2579         (Track_relocs::reset): New function.
2580
2581         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2582         New test cases.
2583         * testsuite/Makefile.in: Regenerate.
2584         * testsuite/gdb_index_test.cc: New test source file.
2585         * testsuite/gdb_index_test_1.sh: New test source file.
2586         * testsuite/gdb_index_test_2.sh: New test source file.
2587
2588 2012-03-19  Doug Kwan  <dougkwan@google.com>
2589
2590         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2591         (Target_arm::do_finalize_sections): Remove code which defines
2592         __exidx_start and __exidx_end.  Make symbol table parameter
2593         anonymous as it is not used.
2594         * gold.cc (queue_middle_tasks): Call target hook to define any
2595         target-specific symbols.
2596         * target.h (Target::define_standard_symbols): New method.
2597         (Target::do_define_standard_symbols): Same.
2598         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2599         * testsuite/Makefile.in: Regenerate.
2600         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2601         and __exidx_end.
2602         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2603         relocations are generated for __exidx_start and __exidx_end.
2604
2605 2012-03-16  Doug Kwan  <dougkwan@google.com>
2606
2607         * testsuite/Makefile.am: Disable test initpri3b.
2608         * testsuite/Makefile.in: Regenerate.
2609
2610 2012-03-15  Doug Kwan  <dougkwan@google.com>
2611
2612         * arm.cc (Target_arm::got_section): Make .got section read-only
2613         if -z now is given.
2614
2615 2012-03-15  Ian Lance Taylor  <iant@google.com>
2616
2617         PR gold/13850
2618         * layout.cc (Layout::make_output_section): Correctly mark
2619         SHT_INIT_ARRAY, et. al., as relro.
2620
2621 2012-03-14  Doug Kwan  <dougkwan@google.com>
2622
2623         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2624         dynamic relocations for protected symbols in shared objects.
2625
2626 2012-03-13  Ian Lance Taylor  <iant@google.com>
2627
2628         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2629         keep the larger alignment.
2630
2631 2012-03-12  Cary Coutant  <ccoutant@google.com>
2632
2633         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2634         handling of DW_LNE_define_file.
2635
2636 2012-03-12  Cary Coutant  <ccoutant@google.com>
2637
2638         * reduced_debug_output.cc
2639         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2640         codes to switch.
2641
2642 2012-02-29  Cary Coutant  <ccoutant@google.com>
2643
2644         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2645
2646 2012-02-29  Cary Coutant  <ccoutant@google.com>
2647
2648         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2649         Call Object::decompressed_section_contents.
2650         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2651         New dtor.
2652         (Sized_dwarf_line_info::buffer_start_): New data member.
2653         * merge.cc (Output_merge_data::do_add_input_section): Call
2654         Object::decompressed_section_contents.
2655         (Output_merge_string::do_add_input_section): Likewise.
2656         * object.cc (need_decompressed_section): New function.
2657         (build_compressed_section_map): Decompress sections needed later.
2658         (Sized_relobj_file::do_decompressed_section_contents): New function.
2659         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2660         * object.h (Object::decompressed_section_contents): New function.
2661         (Object::discard_decompressed_sections): New function.
2662         (Object::do_decompressed_section_contents): New function.
2663         (Object::do_discard_decompressed_sections): New function.
2664         (Compressed_section_info): New type.
2665         (Compressed_section_map): Include decompressed section contents.
2666         (Sized_relobj_file::do_decompressed_section_contents): New function.
2667         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2668
2669 2012-02-16  Cary Coutant  <ccoutant@google.com>
2670
2671         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2672         * testsuite/Makefile.in: Regenerate.
2673
2674 2012-02-14  Cary Coutant  <ccoutant@google.com>
2675
2676         * options.cc (General_options::finalize): Disallow -pie and -static.
2677
2678 2012-02-03  Doug Kwan  <dougkwan@google.com>
2679
2680         * arm.cc (Arm_relocate_functions::abs8,
2681         Arm_relocate_functions::abs16): Use
2682         Bits::has_signed_unsigned_overflow32.
2683         (Arm_relocate_functions::thm_abs8): Correct range of
2684         overflow check.
2685         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2686         in assertions.
2687
2688 2012-02-02  Doug Kwan  <dougkwan@google.com>
2689
2690         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2691         position independent outputs, not just shared objects.
2692
2693 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2694
2695         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2696         * configure: Regenerated.
2697
2698 2012-01-27  Ian Lance Taylor  <iant@google.com>
2699
2700         * reloc.h (Bits): New class with static functions, copied from
2701         namespace utils in arm.cc.
2702         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2703         instead.
2704
2705 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2706
2707         * incremental.cc (write_info_blocks): Correct relocation offset.
2708
2709 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2710
2711         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2712         (Relocate::tls_gd_to_le): Likewise.
2713
2714 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2715
2716         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2717
2718 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2719
2720         * configure.ac: Check if -mcmodel=medium works.
2721         * configure: Regenerated.
2722
2723 2012-01-24  Cary Coutant  <ccoutant@google.com>
2724
2725         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2726         definition and ...
2727         (read_unsigned_LEB_128_x): ... this new function.
2728         (read_signed_LEB_128): Replaced with inline definition and ...
2729         (read_signed_LEB_128_x): ... this new function.
2730         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2731         (read_unsigned_LEB_128): Add inline definition.
2732         (read_signed_LEB_128_x): New function.
2733         (read_signed_LEB_128): Add inline definition.
2734         * testsuite/Makefile.am (leb128_unittest): New unit test.
2735         * testsuite/Makefile.in: Regenerate.
2736         * testsuite/leb128_unittest.cc: New unit test.
2737
2738 2012-01-23  Ian Lance Taylor  <iant@google.com>
2739
2740         PR gold/13617
2741         * i386.cc (Target_i386::do_code_fill): When using a jmp
2742         instruction, pad with nop instructions.
2743         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2744
2745 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2746
2747         * x86_64.cc (gc_process_relocs): Add typename on types used in
2748         template.
2749         (scan_relocs): Likewise.
2750         (relocate_section): Likewise.
2751         (apply_relocation): Likewise.
2752
2753 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2754
2755         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2756         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2757         under x32.
2758
2759 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2760
2761         * x86_64.cc: Initial support for x32.
2762
2763 2012-01-03  Cary Coutant  <ccoutant@google.com>
2764
2765         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2766         Use abstract base class for GOT.
2767         * gold/output.h (class Output_data_got_base): New abstract base class.
2768         (class Output_data_got): Derive from new base class, adjust ctors.
2769         (Output_data_got::reserve_slot): Make virtual; rename to
2770         do_reserve_slot; Adjust callers.
2771         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2772         pointer to abstract base class.
2773         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2774
2775 2011-12-18  Ian Lance Taylor  <iant@google.com>
2776
2777         * object.h (Relobj::local_symbol_value): New function.
2778         (Relobj::local_plt_offset): New function.
2779         (Relobj::local_has_got_offset): New function.
2780         (Relobj::local_got_offset): New function.
2781         (Relobj::set_local_got_offset): New function.
2782         (Relobj::do_local_symbol_value): New pure virtual function.
2783         (Relobj::do_local_plt_offset): Likewise.
2784         (Relobj::do_local_has_got_offset): Likewise.
2785         (Relobj::do_local_got_offset): Likewise.
2786         (Relobj::do_set_local_got_offset): Likewise.
2787         (Sized_relobj::do_local_has_got_offset): Rename from
2788         local_has_got_offset.
2789         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2790         (Sized_relobj::do_set_local_got_offset): Rename from
2791         set_local_got_offset.
2792         (Sized_relobj_file::do_local_plt_offset): Rename from
2793         local_plt_offset.
2794         (Sized_relobj_file::do_local_symbol_value): New function.
2795         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2796         local_plt_offset.
2797         * output.cc (Output_data_got::Got_entry::write): Change object to
2798         Relobj.  Use local_symbol_value.
2799         (Output_data_got::add_global_with_rel): Change rel_dyn to
2800         Output_data_reloc_generic*.  Use add_global_generic.
2801         (Output_data_got::add_global_with_rela): Remove.  Change all
2802         callers to use add_global_with_rel.
2803         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2804         Output_data_reloc_generic*.  Use add_global_generic.
2805         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2806         callers to use add_global_pair_with_rel.
2807         (Output_data_got::add_local): Change object to Relobj*.
2808         (Output_data_got::add_local_plt): Likewise.
2809         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2810         change rel_dyn to Output_data_reloc_generic*.  Use
2811         add_local_generic.
2812         (Output_data_got::add_local_with_rela): Remove.  Change all
2813         callers to use all_local_with_rel.
2814         (Output_data_got::add_local_pair_with_rel): Change object to
2815         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2816         add_output_section_generic.
2817         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2818         callers to use add_local_pair_with_rel.
2819         (Output_data_got::reserve_local): Change object to Relobj*.
2820         * output.h: (class Output_data_reloc_generic): Add pure virtual
2821         declarations for add_global_generic, add_local_generic,
2822         add_output_section_generic.
2823         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2824         functions for Output_data_reloc_generic.  Update declarations for
2825         changes listed in output.cc.
2826         (class Output_data_got): Change template parameter to got_size.
2827         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2828         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2829         function.
2830         (Sized_relobj_incr::do_local_plt_offset): New function.
2831         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2832         add_global_generic.
2833
2834 2011-12-17  Cary Coutant  <ccoutant@google.com>
2835
2836         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2837         * resolve.cc (Symbol_table::resolve): Likewise.
2838         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2839         arrays.
2840         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2841
2842 2011-12-16  Ian Lance Taylor  <iant@google.com>
2843
2844         * output.h (Output_data_reloc_generic::add): Only call
2845         add_dynamic_reloc if this is a dynamic reloc section.
2846
2847 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2848
2849         PR gold/13505
2850         * target-reloc.h (apply_relocation): Replace <64, false> with
2851         <size, big_endian>.
2852
2853 2011-11-25  Nick Clifton  <nickc@redhat.com>
2854
2855         * po/it.po: New Italian translation.
2856
2857 2011-11-17  Sterling Augustine  <saugustine@google.com>
2858
2859         * script.cc (script_include_directive): Implement.
2860         (read_script_file): New local variables name and search_path. Update
2861         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2862         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2863         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2864
2865 2011-11-11  Sterling Augustine  <saugustine@google.com>
2866
2867         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2868         (file_or_sections_cmd): Likewise.
2869
2870 2011-11-11  Doug Kwan  <dougkwan@google.com>
2871
2872         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2873         if --just-symbols is given.
2874
2875 2011-11-10  Doug Kwan  <dougkwan@google.com>
2876
2877         PR gold/13362
2878         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2879         when processing data relocs.
2880         * reloc.h (Relocate_functions::rel_unaligned): New method.
2881         (Relocate_functions::pcrel_unaligned): Ditto.
2882         (Relocate_functions::rel32_unaligned): Ditto.
2883         (Relocate_functions::pcrel32_unaligned): Ditto.
2884
2885 2011-11-09  Doug Kwan  <dougkwan@google.com>
2886
2887         PR gold/13362
2888         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2889         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2890         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2891         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2892         (Relocate_functions::rel_unaligned): New.
2893         (Relocate_functions::rel32_unaligned): New.
2894         * target-reloc.h (relocate_for_relocatable): Add code to handle
2895         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2896         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2897         arm_unaligned_reloc_r): New targets.
2898         * testsuite/Makefile.in: Regenerate.
2899         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2900         linking.
2901
2902 2011-11-02  Ian Lance Taylor  <iant@google.com>
2903
2904         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2905         NATIVE_LINKER.
2906         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2907         * options.cc (General_options::finalize): Use library search path
2908         from configure script if specified.  If not native and no sysroot,
2909         only search TOOLLIBDIR.
2910         * options.h (Search_directory::Search_directory): Change name to
2911         const std::string&.
2912         (General_options::add_to_library_path_with_sysroot): Change arg to
2913         const std::string&.
2914         * configure, Makefile.in, config.in: Rebuild.
2915
2916 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2917
2918         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2919         we are working around the ARM1176 Erratum.
2920         * options.h (General_options::fix_arm1176): Add option.
2921         * testsuite/Makefile.am: Add testcases, and keep current ones
2922         working.
2923         * testsuite/Makefile.in: Regenerate.
2924         * testsuite/arm_fix_1176.s: New file.
2925         * testsuite/arm_fix_1176.sh: Likewise.
2926
2927 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2928
2929         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2930         may_use_blx_.
2931         (Target_arm::may_use_blx): Remove method.
2932         (Target_arm::set_may_use_blx): Likewise.
2933         (Target_arm::may_use_v4t_interworking): New method.
2934         (Target_arm::may_use_v5t_interworking): Likewise.
2935         (Target_arm::may_use_blx_): Remove member variable.
2936         (Arm_relocate_functions::arm_branch_common): Check for v5T
2937         interworking.
2938         (Arm_relocate_functions::thumb_branch_common): Likewise.
2939         (Reloc_stub::stub_type_for_reloc): Likewise.
2940         (Target_arm::do_finalize_sections): Correct interworking checks.
2941         * testsuite/Makefile.am: Add new tests.
2942         * testsuite/Makefile.in: Regenerate.
2943         * testsuite/arm_farcall_arm_arm.s: New test.
2944         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2945         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2946         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2947         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2948         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2949         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2950         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2951
2952 2011-10-31  Cary Coutant  <ccoutant@google.com>
2953
2954         PR gold/13023
2955         * expression.cc (Expression::eval_with_dot): Add
2956         is_section_dot_assignment parameter.
2957         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2958         absolute and assigning to dot within a section.
2959         * script-sections.cc
2960         (Output_section_element_assignment::set_section_addresses): Pass
2961         dot_section to set_if_absolute.
2962         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2963         as is_section_dot_assignment flag to eval_with_dot.
2964         (Output_section_element_dot_assignment::set_section_addresses):
2965         Likewise.
2966         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2967         parameter.  Also set value if relative to dot_section; set the
2968         symbol's output_section.
2969         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2970         parameter.  Adjust all callers.
2971         (Expression::eval_maybe_dot): Likewise.
2972         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2973         Adjust all callers.
2974         * testsuite/script_test_2.t: Test assignment of an absolute value
2975         to dot within an output section element.
2976
2977 2011-10-31  Cary Coutant  <ccoutant@google.com>
2978
2979         * options.h (class General_options): Add --[no-]gnu-unique options.
2980         * symtab.cc (Symbol_table::sized_write_globals): Convert
2981         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2982
2983 2011-10-31  Cary Coutant  <ccoutant@google.com>
2984
2985         PR gold/13359
2986         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2987         unnecessary assertion.
2988         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2989
2990 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2991
2992         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2993         gc_mark_symbol.
2994         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2995         gc_mark_symbol.
2996         Change to just keep the section associated with symbol.
2997         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2998         they are externally visible and --export-dynamic is turned on.
2999         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3000
3001 2011-10-19  Ian Lance Taylor  <iant@google.com>
3002
3003         PR gold/13163
3004         * script-sections.cc
3005         (Output_section_element_dot_assignment::needs_output_section): New
3006         function.
3007
3008 2011-10-19  Ian Lance Taylor  <iant@google.com>
3009
3010         PR gold/13204
3011         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3012         --section-start option was seen.
3013         * options.h (General_options::any_section_start): New function.
3014
3015 2011-10-18  David S. Miller  <davem@davemloft.net>
3016
3017         PR binutils/13301
3018         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3019         member to track relocation locations that have moved during TLS
3020         reloc optimizations.
3021         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3022         (Target_sparc::Relocate::relocate): Adjust view down by 4
3023         bytes if it matches reloc_adjust_addr_.
3024         (Target_sparc::Relocate::relocate_tls): Always move the
3025         __tls_get_addr call delay slot instruction forward 4 bytes when
3026         performing relaxation.
3027
3028 2011-10-18  Cary Coutant  <ccoutant@google.com>
3029
3030         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3031         (Output_file::map_no_anonymous): Check for non-zero
3032         return code from posix_fallocate.
3033
3034 2011-10-17  Cary Coutant  <ccoutant@google.com>
3035
3036         PR gold/13245
3037         * plugin.cc (is_visible_from_outside): Check for symbols
3038         referenced from dynamic objects.
3039         * resolve.cc (Symbol_table::resolve): Don't count references
3040         from dynamic objects as references from real ELF files.
3041         * testsuite/plugin_test_2.sh: Adjust expected result.
3042
3043 2011-10-17  Cary Coutant  <ccoutant@google.com>
3044
3045         * gold.cc: Include timer.h.
3046         (queue_middle_tasks): Stamp time.
3047         (queue_final_tasks): Likewise.
3048         * main.cc (main): Store timer in parameters.  Print timers
3049         for each pass.
3050         * parameters.cc (Parameters::Parameters): Initialize timer_.
3051         (Parameters::set_timer): New function.
3052         (set_parameters_timer): New function.
3053         * parameters.h (Parameters::set_timer): New function.
3054         (Parameters::timer): New function.
3055         (Parameters::timer_): New data member.
3056         (set_parameters_timer): New function.
3057         * timer.cc (Timer::stamp): New function.
3058         (Timer::get_pass_time): New function.
3059         * timer.h (Timer::stamp): New function.
3060         (Timer::get_pass_time): New function.
3061         (Timer::pass_times_): New data member.
3062
3063 2011-10-17  Cary Coutant  <ccoutant@google.com>
3064
3065         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3066         task for members of lib groups.
3067
3068 2011-10-17  Cary Coutant  <ccoutant@google.com>
3069
3070         PR gold/13288
3071         * fileread.cc (File_read::find_view): Add assert.
3072         (File_read::make_view): Move bounds check (replace with assert)...
3073         (File_read::find_or_make_view): ... to here.
3074
3075 2011-10-12  Cary Coutant  <ccoutant@google.com>
3076
3077         * output.cc (Output_file::open_base_file): Handle case where
3078         ::read returns less than requested size.
3079
3080 2011-10-10  Cary Coutant  <ccoutant@google.com>
3081
3082         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3083         Initialize defined_count_.
3084         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3085         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3086         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3087         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3088         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3089         * incremental.h (Sized_relobj_incr::defined_count_): New data
3090         member.
3091         (Sized_incr_dynobj::defined_count_): New data member.
3092         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3093         Return zeroes instead of internal error.
3094
3095 2011-10-10  Cary Coutant  <ccoutant@google.com>
3096
3097         PR gold/13249
3098         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3099         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3100         * output.h (class Output_reloc): Add use_plt_offset flag.
3101         (Output_reloc::type_): Adjust size of bit field.
3102         (Output_reloc::use_plt_offset_): New bit field.
3103         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3104         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3105         flag.  Adjust all callers.
3106         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3107         creating RELATIVE relocations.
3108
3109 2011-10-10  Nick Clifton  <nickc@redhat.com>
3110
3111         * po/es.po: Updated Spanish translation.
3112         * po/fi.po: Updated Finnish translation.
3113
3114 2011-10-03   Diego Novillo  <dnovillo@google.com>
3115
3116         * options.cc (parse_uint): Fix dereference of RETVAL.
3117
3118 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3119
3120         * layout.h (section_order_map_): New member.
3121         (get_section_order_map): New member function.
3122         * output.cc (Output_section::add_input_section): Check for patterns
3123         only when --section-ordering-file is specified.
3124         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3125         output_sections have been formed.
3126         * layout.cc (Layout_Layout): Initialize section_order_map_.
3127         * plugin.cc (update_section_order): Store order in order_map. Do not
3128         update the order.
3129         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3130         * testsuite/Makefile.in: Regenerate.
3131         * testsuite/plugin_section_order.c: New file.
3132         * testsuite/plugin_final_layout.cc: New file.
3133         * testsuite/plugin_final_layout.sh: New file.
3134
3135 2011-09-29  Cary Coutant  <ccoutant@google.com>
3136
3137         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3138         Check for NULL.
3139         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3140         symbols during incremental update.
3141         (Symbol_table::add_from_dynobj): Likewise.
3142
3143 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3144             Ian Lance Taylor  <iant@google.com>
3145
3146         * symtab.cc (Symbol_table::define_special_symbol): Always
3147         canonicalize version string.
3148
3149 2011-09-26  Cary Coutant  <ccoutant@google.com>
3150
3151         * gold.cc (queue_initial_tasks): Move option checks ...
3152         * options.cc (General_options::finalize): ... to here. Disable
3153         some options; make others fatal.
3154
3155 2011-09-26  Cary Coutant  <ccoutant@google.com>
3156
3157         gcc PR lto/47247
3158         * plugin.cc (get_symbols_v2): New function.
3159         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3160         (is_referenced_from_outside): New function.
3161         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3162         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3163         (get_symbols): Pass version parameter.
3164         (get_symbols_v2): New function.
3165         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3166         parameter.
3167         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3168         (onload): Add LDPT_GET_SYMBOLS_V2.
3169         (all_symbols_read_hook): Use get_symbols_v2; check for
3170         LDPR_PREVAILING_DEF_IRONLY_EXP.
3171         * testsuite/plugin_test_3.sh: Update expected results.
3172
3173 2011-09-23  Simon Baldwin  <simonb@google.com>
3174
3175         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3176         configuration options.
3177         * configure: Regenerate.
3178         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3179         * Makefile.in: Regenerate.
3180         * testsuite/Makefile.in: Regenerate.
3181
3182 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3183
3184         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3185
3186 2011-09-19  Cary Coutant  <ccoutant@google.com>
3187
3188         * incremental.cc (can_incremental_update): Fix typo in comment.
3189         * incremental.h (can_incremental_update): Likewise.
3190
3191 2011-09-18  Cary Coutant  <ccoutant@google.com>
3192
3193         * incremental.cc (can_incremental_update): New function.
3194         * incremental.h (can_incremental_update): New function.
3195         * layout.cc (Layout::init_fixed_output_section): Call it.
3196         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3197         * object.cc (Sized_relobj_file::do_layout): Call
3198         can_incremental_update.
3199
3200 2011-09-13  Cary Coutant  <ccoutant@google.com>
3201
3202         * configure.ac: Check for glibc support for gnu_indirect_function
3203         support with static linking, setting automake conditional
3204         IFUNC_STATIC.
3205         * Makefile.in: Regenerate.
3206         * configure: Regenerate.
3207
3208         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3209         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3210         for IFUNC_STATIC.
3211         * testsuite/Makefile.in: Regenerate.
3212
3213 2011-09-13  Cary Coutant  <ccoutant@google.com>
3214
3215         * incremental.cc (Sized_relobj_incr::do_layout): Call
3216         report_comdat_group for kept comdat sections.
3217         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3218         * testsuite/Makefile.in: Regenerate.
3219         * testsuite/incr_comdat_test_1.cc: New source file.
3220         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3221         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3222         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3223
3224 2011-09-13  Ian Lance Taylor  <iant@google.com>
3225
3226         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3227         variable external_symbols_offset.
3228
3229 2011-09-12  Ian Lance Taylor  <iant@google.com>
3230
3231         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3232         triggered if object has no symbols.
3233
3234 2011-09-09  David S. Miller  <davem@davemloft.net>
3235
3236         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3237         (Output_fill_debug_line::do_write): Likewise.
3238
3239 2011-08-29  Cary Coutant  <ccoutant@google.com>
3240
3241         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3242         casts to match formatting specs.
3243         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3244
3245 2011-08-26  Cary Coutant  <ccoutant@google.com>
3246
3247         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3248         remaining hole size when allocating.
3249         (Layout::make_output_section): Set fill methods for debug sections.
3250         * layout.h (Free_list::Free_list_node): Move from private to
3251         public.
3252         (Free_list::set_min_hole_size): New function.
3253         (Free_list::begin, Free_list::end): New functions.
3254         (Free_list::min_hole_): New data member.
3255         * output.cc: Include dwarf.h.
3256         (Output_fill_debug_info::do_minimum_hole_size): New function.
3257         (Output_fill_debug_info::do_write): New function.
3258         (Output_fill_debug_line::do_minimum_hole_size): New function.
3259         (Output_fill_debug_line::do_write): New function.
3260         (Output_section::Output_section): Initialize new data member.
3261         (Output_section::set_final_data_size): Ensure patch space is larger
3262         than minimum hole size.
3263         (Output_section::do_write): Fill holes in debug sections.
3264         * output.h (Output_fill): New class.
3265         (Output_fill_debug_info): New class.
3266         (Output_fill_debug_line): New class.
3267         (Output_section::set_free_space_fill): New function.
3268         (Output_section::free_space_fill_): New data member.
3269         * testsuite/Makefile.am (incremental_test_3): Add
3270         --incremental-patch option.
3271         (incremental_test_4): Likewise.
3272         (incremental_test_5): Likewise.
3273         (incremental_test_6): Likewise.
3274         (incremental_copy_test): Likewise.
3275         (incremental_common_test_1): Likewise.
3276         * testsuite/Makefile.in: Regenerate.
3277
3278 2011-08-26  Nick Clifton  <nickc@redhat.com>
3279
3280         * po/es.po: Updated Spanish translation.
3281
3282 2011-08-01  Cary Coutant  <ccoutant@google.com>
3283
3284         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3285         * gold/testsuite/Makefile.in: Regenerate.
3286         * gold/testsuite/justsyms_exec.c: New source file.
3287         * gold/testsuite/justsyms_lib.c: New source file.
3288
3289 2011-08-01  Cary Coutant  <ccoutant@google.com>
3290
3291         * layout.cc (Layout::set_segment_offsets): Don't realign text
3292         segment if -Ttext was specified.
3293         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3294         file type.
3295         * object.h (Sized_relobj_file::e_type): New function.
3296         (Sized_relobj_file::e_type_): New data member.
3297         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3298         base address for ET_EXEC files.
3299         * target.cc (Target::do_make_elf_object_implementation): Allow
3300         ET_EXEC files with --just-symbols option.
3301
3302 2011-07-28  Cary Coutant  <ccoutant@google.com>
3303
3304         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3305         Add thread_number parameter.
3306         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3307         * workqueue-threads.cc
3308         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3309         current thread if its thread number is greater than desired thread
3310         count.
3311         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3312         Add thread_number parameter.
3313         (Workqueue::should_cancel_thread): Likewise.
3314         (Workqueue::find_runnable_or_wait): Pass thread_number to
3315         should_cancel_thread.
3316         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3317         parameter.
3318
3319 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3320
3321         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3322         only after checking if it cannot be forced local.
3323         * symtab.h (is_externally_visible): Check if the symbol is not forced
3324         local.
3325
3326 2011-07-15  Ian Lance Taylor  <iant@google.com>
3327
3328         * options.h (class General_options): Add --print-output-format.
3329         Move -EL next to -EB, for  better --help output.
3330         * target-select.cc: Include <cstdio>, "options.h", and
3331         "parameters.h".
3332         (Target_selector::do_target_bfd_name): New function.
3333         (print_output_format): New function.
3334         * target-select.h (class Target_selector): Update declarations.
3335         (Target_selector::target_bfd_name): New function.
3336         (print_output_format): Declare.
3337         * main.cc: Include "target-select.h".
3338         (main): Handle --print-output-format.
3339         * gold.cc: Include "target-select.h".
3340         (queue_initial_tasks): Handle --print-output-format when there are
3341         no input files.
3342         * parameters.cc (parameters_force_valid_target): Give a better
3343         error message if -EB/-EL does not match target.
3344         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3345         function.
3346
3347 2011-07-15  Ian Lance Taylor  <iant@google.com>
3348
3349         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3350         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3351         (Output_data_plt_i386::do_write): Write address of .dynamic
3352         section to first entry in .got.plt section.
3353         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3354         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3355         Initialize layout_.
3356         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3357         section to first entry in .got.plt section.
3358         * layout.h (Layout::dynamic_section): New function.
3359
3360 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3361
3362         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3363         to claim_file call.
3364         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3365         input_section_position_, and input_section_glob_.
3366         (read_layout_from_file): Call function section_ordering_specified.
3367         * layout.h (is_section_ordering_specified): New function.
3368         (section_ordering_specified): New function.
3369         (section_ordering_specified_): New boolean member.
3370         * main.cc(main): Call load_plugins after layout object is defined.
3371         * output.cc (Output_section::add_input_section): Use
3372         function section_ordering_specified to check if section ordering is
3373         needed.
3374         * output.cc (Output_section::add_relaxed_input_section): Use
3375         function section_ordering_specified to check if section ordering is
3376         needed.
3377         (Output_section::update_section_layout): New function.
3378         (Output_section::sort_attached_input_sections): Check if input section
3379         must be reordered.
3380         * output.h (Output_section::update_section_layout): New function.
3381         * plugin.cc (get_section_count): New function.
3382         (get_section_type): New function.
3383         (get_section_name): New function.
3384         (get_section_contents): New function.
3385         (update_section_order): New function.
3386         (allow_section_ordering): New function.
3387         (Plugin::load): Add the new interfaces to the transfer vector.
3388         (Plugin_manager::load_plugins): New parameter.
3389         (Plugin_manager::all_symbols_read): New parameter.
3390         (Plugin_manager::claim_file): New parameter. Save the elf object for
3391         unclaimed objects.
3392         (Plugin_manager::get_elf_object): New function.
3393         (Plugin_manager::get_view): Change to directly use the bool to check
3394         if get_view is called from claim_file_hook.
3395         * plugin.h (input_objects): New function
3396         (Plugin__manager::load_plugins): New parameter.
3397         (Plugin_manager::claim_file): New parameter.
3398         (Plugin_manager::get_elf_object): New function.
3399         (Plugin_manager::in_claim_file_handler): New function.
3400         (Plugin_manager::in_claim_file_handler_): New member.
3401         (layout): New function.
3402         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3403         handler with an extra parameter. Make the elf object before calling
3404         claim_file handler.
3405         * testsuite/plugin_test.c (get_section_count): New function pointer.
3406         (get_section_type): New function pointer.
3407         (get_section_name): New function pointer.
3408         (get_section_contents): New function pointer.
3409         (update_section_order): New function pointer.
3410         (allow_section_ordering): New function pointer.
3411         (onload): Check if the new interfaces exist.
3412
3413 2011-07-13  Ian Lance Taylor  <iant@google.com>
3414
3415         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3416         relro section.
3417         * x86_64.cc (Target_x86_64::got_section): Likewise.
3418         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3419         (relro_now_test_SOURCES): New variable.
3420         (relro_now_test_DEPENDENCIES): New variable.
3421         (relro_now_test_LDFLAGS): New variable.
3422         (relro_now_test_LDADD): New variable.
3423         (relro_now_test.so): New target.
3424         * testsuite/Makefile.in: Rebuild.
3425
3426 2011-07-12  Ian Lance Taylor  <iant@google.com>
3427
3428         PR gold/12980
3429         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3430         GLOB_DAT relocation rather than a RELATIVE relocation for a
3431         protected symbol when creating a shared library.
3432         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3433         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3434         * testsuite/protected_main_1.cc (main): Test that protected
3435         function has same address.
3436
3437 2011-07-11  Ian Lance Taylor  <iant@google.com>
3438
3439         PR gold/12979
3440         * options.h (class General_options): Add -Bgroup.
3441         * options.cc (General_options::finalize): If -Bgroup is set,
3442         default to --unresolved-symbols=report-all.
3443         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3444         * target-reloc.h (issue_undefined_symbol_error): Handle
3445         --unresolved-symbols=report-all.
3446
3447 2011-07-08  Ian Lance Taylor  <iant@google.com>
3448
3449         PR gold/11985
3450         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3451         if linker script discards key sections.
3452         (Layout::create_dynamic_symtab): Likewise.
3453         (Layout::assign_local_dynsym_offsets): Likewise.
3454         (Layout::sized_create_version_sections): Likewise.
3455         (Layout::create_interp): Likewise.
3456         (Layout::finish_dynamic_section): Likewise.
3457         (Layout::set_dynamic_symbol_size): Likewise.
3458
3459 2011-07-08  Ian Lance Taylor  <iant@google.com>
3460
3461         PR gold/12386
3462         * options.h (class General_options): Add --unresolved-symbols.
3463         * target-reloc.h (issue_undefined_symbol_error): Check
3464         --unresolved-symbols.  Add comments.
3465
3466 2011-07-08  Ian Lance Taylor  <iant@google.com>
3467
3468         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3469         expression more complex.
3470
3471 2011-07-08  Ian Lance Taylor  <iant@google.com>
3472
3473         PR gold/11317
3474         * target-reloc.h (issue_undefined_symbol_error): New inline
3475         function, broken out of relocate_section.
3476         (relocate_section): Call issue_undefined_symbol_error.
3477         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3478         there is no TLS segment if we are about to issue an undefined
3479         symbol error.
3480         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3481
3482 2011-07-08  Ian Lance Taylor  <iant@google.com>
3483
3484         PR gold/12279
3485         * resolve.cc (Symbol_table::should_override): Add fromtype
3486         parameter.  Change all callers.  Give error when linking together
3487         TLS and non-TLS symbol.
3488         (Symbol_table::should_override_with_special): Add fromtype
3489         parameter.  Change all callers.
3490         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3491         there is no TLS segment if we have reported some errors.
3492         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3493
3494 2011-07-08  Ian Lance Taylor  <iant@google.com>
3495
3496         PR gold/12372
3497         * target.h (Target::plt_address_for_global): New function.
3498         (Target::plt_address_for_local): New function.
3499         (Target::plt_section_for_global): Remove.
3500         (Target::plt_section_for_local): Remove.
3501         (Target::do_plt_address_for_global): New virtual function.
3502         (Target::do_plt_address_for_local): New virtual function.
3503         (Target::do_plt_section_for_global): Remove.
3504         (Target::do_plt_section_for_local): Remove.
3505         (Target::register_global_plt_entry): Add Symbol_table and Layout
3506         parameters.
3507         * output.cc (Output_data_got::Got_entry::write): Use
3508         plt_address_for_global and plt_address_for_local.
3509         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3510         address of output section.
3511         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3512         got_irelative_, and irelative_count_ fields.  Update
3513         declarations.
3514         (Output_data_plt_i386::has_irelative_section): New function.
3515         (Output_data_plt_i386::entry_count): Add irelative_count_.
3516         (Output_data_plt_i386::set_final_data_size): Likewise.
3517         (class Target_i386): Add got_irelative_ and rel_irelative_
3518         fields.  Update declarations.
3519         (Target_i386::Target_i386): Initialize new fields.
3520         (Target_i386::do_plt_address_for_global): New function replacing
3521         do_plt_section_for_global.
3522         (Target_i386::do_plt_address_for_local): New function replacing
3523         do_plt_section_for_local.
3524         (Target_i386::got_section): Create got_irelative_.
3525         (Target_i386::rel_irelative_section): New function.
3526         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3527         fields.  Don't define __rel_iplt_{start,end}.
3528         (Output_data_plt_i386::add_entry): Add symtab and layout
3529         parameters.  Change all callers.  Use different PLT and GOT for
3530         IFUNC symbols.
3531         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3532         layout parameters.  Change all callers.  Use different PLT and
3533         GOT.
3534         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3535         (Output_data_plt_i386::rel_irelative): New function.
3536         (Output_data_plt_i386::address_for_global): New function.
3537         (Output_data_plt_i386::address_for_local): New function.
3538         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3539         IRELATIVE GOT when changing IFUNC GOT entries.
3540         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3541         reloc.
3542         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3543         if we didn't create an IRELATIVE GOT.
3544         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3545         plt_address_for_local.
3546         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3547         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3548         got_irelative_, and irelative_count_ fields.  Update
3549         declarations.
3550         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3551         Initialize new fields.  Remove symtab parameter.  Change all
3552         callers.
3553         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3554         irelative_count_.
3555         (Output_data_plt_x86_64::has_irelative_section): New function.
3556         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3557         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3558         fields.  Update declarations.
3559         (Target_x86_64::Target_x86_64): Initialize new fields.
3560         (Target_x86_64::do_plt_address_for_global): New function replacing
3561         do_plt_section_for_global.
3562         (Target_x86_64::do_plt_address_for_local): New function replacing
3563         do_plt_section_for_local.
3564         (Target_x86_64::got_section): Create got_irelative_.
3565         (Target_x86_64::rela_irelative_section): New function.
3566         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3567         all callers.  Don't create __rel_iplt_{start,end}.
3568         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3569         parameters.  Change all callers.  Use different PLT and GOT for
3570         IFUNC symbols.
3571         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3572         layout parameters.  Change all callers.  Use different PLT and
3573         GOT.
3574         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3575         parameters.  Change all callers.  Use different PLT and GOT for
3576         IFUNC symbols.
3577         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3578         (Output_data_plt_x86_64::rela_irelative): New function.
3579         (Output_data_plt_x86_64::address_for_global): New function.
3580         (Output_data_plt_x86_64::address_for_local): New function.
3581         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3582         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3583         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3584         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3585         parameters.
3586         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3587         reloc.
3588         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3589         symbols if we didn't create an IRELATIVE GOT.
3590         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3591         plt_address_for_local.
3592         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3593         * testsuite/ifuncvar1.c: New test file.
3594         * testsuite/ifuncvar2.c: New test file.
3595         * testsuite/ifuncvar3.c: New test file.
3596         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3597         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3598         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3599         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3600         * testsuite/Makefile.in: Rebuild.
3601
3602 2011-07-07  Cary Coutant  <ccoutant@google.com>
3603
3604         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3605         (two_file_test_1_ndebug.o): Likewise.
3606         (two_file_test_1b_ndebug.o): Likewise.
3607         (two_file_test_2_ndebug.o): Likewise.
3608         (two_file_test_main_ndebug.o): Likewise.
3609         (incremental_test_2): Link with no-debug versions.
3610
3611 2011-07-06  Cary Coutant  <ccoutant@google.com>
3612
3613         * gold/incremental.cc
3614         (Output_section_incremental_inputs::write_info_blocks): Check for
3615         hidden and internal symbols.
3616
3617 2011-07-06  Cary Coutant  <ccoutant@google.com>
3618
3619         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3620         Check disposition for startup file.
3621         (Incremental_inputs::report_command_line): Ignore
3622         --incremental-startup-unchanged option.
3623         * options.cc (General_options::parse_incremental_startup_unchanged):
3624         New function.
3625         (General_options::General_options): Initialize new data member.
3626         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3627         (General_options): Add --incremental-startup-unchanged option.
3628         (General_options::incremental_startup_disposition): New function.
3629         (General_options::incremental_startup_disposition_): New data member.
3630
3631 2011-07-06  Cary Coutant  <ccoutant@google.com>
3632
3633         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3634         input file index to Script_info ctor.
3635         (Sized_incremental_binary::do_file_has_changed): Find the
3636         command-line argument for files named in scripts.
3637         * incremental.h (Script_info::Script_info): New ctor
3638         with input file index.
3639         (Script_info::input_file_index): New function.
3640         (Script_info::input_file_index_): New data member.
3641         (Incremental_binary::get_library): Add const.
3642         (Incremental_binary::get_script_info): Add const.
3643         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3644         * testsuite/Makefile.am (incremental_test_5): New test case.
3645         (incremental_test_6): New test case.
3646         * testsuite/Makefile.in: Regenerate.
3647
3648 2011-07-06  Cary Coutant  <ccoutant@google.com>
3649
3650         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3651         debug output when command lines differ.
3652
3653 2011-07-06  Cary Coutant  <ccoutant@google.com>
3654
3655         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3656         --incremental-patch option.
3657         * layout.cc (Free_list::allocate): Extend allocation beyond original
3658         end if enabled.
3659         (Layout::make_output_section): Mark sections that should get
3660         patch space.
3661         * options.cc (parse_percent): New function.
3662         * options.h (parse_percent): New function.
3663         (DEFINE_percent): New macro.
3664         (General_options): Add --incremental-patch option.
3665         * output.cc (Output_section::Output_section): Initialize new data
3666         members.
3667         (Output_section::add_input_section): Print section name when out
3668         of patch space.
3669         (Output_section::add_output_section_data): Likewise.
3670         (Output_section::set_final_data_size): Add patch space when
3671         doing --incremental-full.
3672         (Output_section::do_reset_address_and_file_offset): Remove patch
3673         space.
3674         (Output_segment::set_section_list_addresses): Print debug output
3675         only if --incremental-update.
3676         * output.h (Output_section::set_is_patch_space_allowed): New function.
3677         (Output_section::is_patch_space_allowed_): New data member.
3678         (Output_section::patch_space_): New data member.
3679         * parameters.cc (Parameters::incremental_full): New function.
3680         * parameters.h (Parameters::incremental_full): New function
3681         * testsuite/Makefile.am (incremental_test_2): Add test for
3682         --incremental-patch option.
3683         * testsuite/Makefile.in: Regenerate.
3684         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3685         (t18): Remove function body.
3686
3687 2011-07-05  Doug Kwan  <dougkwan@google.com>
3688
3689         PR gold/12771
3690         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3691         Arm_Address type for relocation result.
3692         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3693         overflow check.
3694         (Arm_relocate_functions::abs32): Use unaligned access.
3695         (Arm_relocate_functions::rel32): Ditto.
3696         (Arm_relocate_functions::prel31): Ditto.
3697         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3698         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3699         static data relocations.
3700         * testsuite/Makefile.in: Regnerate.
3701         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3702
3703 2011-07-05  Ian Lance Taylor  <iant@google.com>
3704
3705         PR gold/12392
3706         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3707         symbols if necessary.
3708         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3709
3710 2011-07-05  Ian Lance Taylor  <iant@google.com>
3711
3712         PR gold/12952
3713         * resolve.cc (Symbol::override_base_with_special): Simply override
3714         version with special symbol version, ignoring previous version.
3715
3716 2011-07-05  Ian Lance Taylor  <iant@google.com>
3717
3718         * object.cc (Sized_relobj_file::include_section_group): Add
3719         information to comment about signature location.
3720
3721 2011-07-02  Ian Lance Taylor  <iant@google.com>
3722
3723         PR gold/12957
3724         * options.h (class General_options): Add -f and -F.
3725         * options.cc (General_options::finalize): Fatal error if -f/-F
3726         are used without -shared.
3727         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3728
3729 2011-07-02  Ian Lance Taylor  <iant@google.com>
3730
3731         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3732
3733 2011-07-01  Ian Lance Taylor  <iant@google.com>
3734
3735         PR gold/12525
3736         PR gold/12952
3737         * resolve.cc (Symbol::override_base_with_special): Don't override
3738         the version if the overriding symbol has a different name.
3739         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3740         all callers.  If we give an error about an undefined version,
3741         define the base version if necessary.
3742         * dynobj.h (class Versions): Update declaration.
3743         * testsuite/weak_alias_test_5.cc: New file.
3744         * testsuite/weak_alias_test.script: New file.
3745         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3746         and versioned_alias have the right value, and call t2.
3747         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3748         weak_alias_test_5.so.
3749         (weak_alias_test_LDADD): Likewise.
3750         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3751         * testsuite/Makefile.in: Rebuild.
3752
3753 2011-07-01  Ian Lance Taylor  <iant@google.com>
3754
3755         PR gold/12525
3756         * options.h (class General_options): Support -z notext.
3757         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3758         -Wl,-z,notext.
3759         (two_file_shared_nonpic.so): Likewise.
3760         (two_file_shared_mixed.so): Likewise.
3761         (two_file_shared_mixed_1.so): Likewise.
3762         (weak_undef_lib_nonpic.so): Likewise.
3763         (alt/weak_undef_lib_nonpic.so): Likewise.
3764         (tls_test_shared_nonpic.so): Likewise.
3765         * testsuite/Makefile.in: Rebuild.
3766
3767 2011-07-01  Ian Lance Taylor  <iant@google.com>
3768
3769         PR gold/12525
3770         * configure.ac: Test whether static linking works, setting
3771         the automake conditional HAVE_STATIC.
3772         * testsuite/Makefile.am: Disable tests using -static if
3773         HAVE_STATIC is not true.
3774         * configure, testsuite/Makefile.in: Rebuild.
3775
3776 2011-07-01  Ian Lance Taylor  <iant@google.com>
3777
3778         PR gold/12525
3779         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3780         Assert if we see DW_EH_PE_indirect.
3781         * target.h (Target::ehframe_datarel_base): New function.
3782         (Target::do_ehframe_datarel_base): New target function.
3783         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3784         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3785         function.
3786
3787 2011-07-01  Ian Lance Taylor  <iant@google.com>
3788
3789         PR gold/12571
3790         * options.h (class General_options): Add
3791         --ld-generated-unwind-info.
3792         * ehframe.cc (Fde::write): Add address parameter.  Change all
3793         callers.  If associated with PLT, fill in address and size.
3794         (Cie::set_output_offset): Only add merge mapping if there is an
3795         object.
3796         (Cie::write): Add address parameter.  Change all callers.
3797         (Eh_frame::add_ehframe_for_plt): New function.
3798         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3799         input_offset_ fields into union u_, with new plt field.
3800         (Fde::Fde): Adjust for new union field.
3801         (Fde::Fde) [Output_data version]: New constructor.
3802         (Fde::add_mapping): Only add merge mapping if there is an object.
3803         (class Cie): Update declarations.
3804         (class Eh_frame): Declare add_ehframe_for_plt.
3805         * layout.cc (Layout::layout_eh_frame): Break out code into
3806         make_eh_frame_section, and call it.
3807         (Layout::make_eh_frame_section): New function.
3808         (Layout::add_eh_frame_for_plt): New function.
3809         * layout.h (class Layout): Update declarations.
3810         * merge.cc (Merge_map::add_mapping): Add assertion.
3811         * i386.cc: Include "dwarf.h".
3812         (class Output_data_plt_i386): Make first_plt_entry,
3813         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3814         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3815         and plt_eh_frame_fde.
3816         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3817         boundary.  Call add_eh_frame_for_plt if appropriate.
3818         * x86_64.cc: Include "dwarf.h".
3819         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3820         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3821         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3822         and plt_eh_frame_fde.
3823         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3824         appropriate.
3825
3826 2011-06-29  Ian Lance Taylor  <iant@google.com>
3827
3828         PR gold/12629
3829         * object.cc (Sized_relobj_file::layout_section): Change shdr
3830         parameter to be const.
3831         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3832         out of do_layout.
3833         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3834         appropriate.  Call layout_eh_frame_section.
3835         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3836         sections.
3837         * object.h (class Sized_relobj_file): Update declarations.
3838
3839 2011-06-29  Ian Lance Taylor  <iant@google.com>
3840
3841         PR gold/12652
3842         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3843         modifier.
3844         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3845
3846 2011-06-29  Ian Lance Taylor  <iant@google.com>
3847
3848         PR gold/12675
3849         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3850         SHT_X86_64_UNWIND.
3851         * layout.cc (Layout::layout_eh_frame): Likewise.
3852
3853 2011-06-29  Ian Lance Taylor  <iant@google.com>
3854
3855         PR gold/12695
3856         * layout.cc (Layout::symtab_section_shndx): New function.
3857         * layout.h (class Layout): Declare symtab_section_shndx.
3858         * output.cc (Output_section::write_header): Call it.
3859
3860 2011-06-29  Ian Lance Taylor  <iant@google.com>
3861
3862         PR gold/12818
3863         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3864         symbols which are not used in a relocation.
3865
3866 2011-06-28  Ian Lance Taylor  <iant@google.com>
3867
3868         PR gold/12898
3869         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3870         script create indistinguishable segments.
3871         (Layout::set_segment_offsets): Use stable_sort when sorting
3872         segments.  Pass this to Compare_segments constructor.
3873         * layout.h (class Layout): Make segment_precedes non-static.
3874         (class Compare_segments): Change from struct to class.  Add
3875         layout_ field.  Add constructor.
3876         * script-sections.cc
3877         (Script_sections::attach_sections_using_phdrs_clause): Rename
3878         local orphan to is_orphan.  Don't report failure to put empty
3879         section in segment.  On attachment failure, report name of
3880         section, and attach to first PT_LOAD segment.
3881
3882 2011-06-28  Ian Lance Taylor  <iant@google.com>
3883
3884         PR gold/12934
3885         * target-select.cc (Target_selector::Target_selector): Add
3886         emulation parameter.  Change all callers.
3887         (select_target_by_bfd_name): Rename from select_target_by_name.
3888         Change all callers.
3889         (select_target_by_emulation): New function.
3890         (supported_emulation_names): New function.
3891         * target-select.h (class Target_selector): Add emulation_ field.
3892         Update declarations.
3893         (Target_selector::recognize_by_bfd_name): Rename from
3894         recognize_by_name.  Change all callers.
3895         (Target_selector::supported_bfd_names): Rename from
3896         supported_names.  Change all callers.
3897         (Target_selector::recognize_by_emulation): New function.
3898         (Target_selector::supported_emulations): New function.
3899         (Target_selector::emulation): New function.
3900         (Target_selector::do_recognize_by_bfd_name): Rename from
3901         do_recognize_by_name.  Change all callers.
3902         (Target_selector::do_supported_bfd_names): Rename from
3903         do_supported_names.  Change all callers.
3904         (Target_selector::do_recognize_by_emulation): New function.
3905         (Target_selector::do_supported_emulations): New function.
3906         (select_target_by_bfd_name): Change name in declaration.
3907         (select_target_by_emulation): Declare.
3908         (supported_emulation_names): Declare.
3909         * parameters.cc (parameters_force_valid_target): Try to find
3910         target based on emulation from -m option.
3911         * options.h (class General_options): Change doc string for -m.
3912         * options.cc (help): Print emulations.
3913         (General_options::parse_V): Likewise.
3914         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3915         Add emulation parameter.  Change all callers.
3916
3917 2011-06-28  Ian Lance Taylor  <iant@google.com>
3918
3919         * target.h (class Target): Add osabi_ field.
3920         (Target::osabi): New function.
3921         (Target::set_osabi): New function.
3922         (Target::Target): Initialize osabi_.
3923         (Target::do_adjust_elf_header): Make pure virtual.
3924         (Sized_target::do_adjust_elf_header): Declare.
3925         * target.cc (Sized_target::do_adjust_elf_header): New function.
3926         (class Sized_target): Instantiate all versions.
3927         * freebsd.h (class Target_freebsd): Remove.
3928         (Target_selector_freebsd::do_recognize): Call set_osabi on
3929         Target.
3930         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3931         (Target_selector_freebsd::set_osabi): Remove.
3932         * i386.cc (class Target_i386): Inherit from Sized_target rather
3933         than Target_freebsd.
3934         * x86_64.cc (class Target_x86_64): Likewise.
3935
3936 2011-06-28  Ian Lance Taylor  <iant@google.com>
3937
3938         * target.h (Target::can_check_for_function_pointers): Rewrite.
3939         Make non-virtual.
3940         (Target::can_icf_inline_merge_sections): Likewise.
3941         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3942         (Target::Target_info): Add can_icf_inline_merge_sections field.
3943         (Target::do_can_check_for_function_pointers): New virtual
3944         function.
3945         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3946         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3947         from can_check_for_function_pointers, move in file.
3948         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3949         section_may_have_icf_unsafe_poineters, move in file.
3950         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3951         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3952         Rename from can_check_for_function_pointers, move in file.
3953         (Target_i386::can_icf_inline_merge_sections): Remove.
3954         (Target_i386::i386_info): Initialize
3955         can_icf_inline_merge_sections.
3956         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3957         Initialize can_icf_inline_merge_sections.
3958         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3959         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3960         Rename from can_check_for_function_pointers, move in file.
3961         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3962         (Target_x86_64::x86_64_info): Initialize
3963         can_icf_inline_merge_sections.
3964         * testsuite/testfile.cc (Target_test::test_target_info):
3965         Likewise.
3966         * icf.cc (get_section_contents): Correct formatting.
3967
3968 2011-06-27  Ian Lance Taylor  <iant@google.com>
3969
3970         * symtab.cc (Symbol::versioned_name): New function.
3971         (Symbol_table::add_to_final_symtab): Use versioned_name when
3972         appropriate.
3973         (Symbol_table::sized_write_symbol): Likewise.
3974         * symtab.h (class Symbol): Declare versioned_name.
3975         * stringpool.h (class Stringpool_template): Add variant of add
3976         which takes a std::basic_string.
3977         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3978         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3979         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3980         (ver_test_12.o): New target.
3981         * testsuite/Makefile.in: Rebuild.
3982
3983 2011-06-27  Doug Kwan  <dougkwan@google.com>
3984
3985         * arm.cc (Arm_relocate_functions::thm_jump8,
3986         Arm_relocate_functions::thm_jump11): Use a wider signed
3987         type to compute offset.
3988         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3989         arm_thm_jump8.
3990         * testsuite/Makefile.in: Regenerate.
3991         * testsuite/arm_branch_in_range.sh: Check test results of
3992         arm_thm_jump11 and arm_thm_jump8.
3993         * testsuite/arm_thm_jump11.s: New test source file.
3994         * testsuite/arm_thm_jump11.t: New linker script.
3995         * testsuite/arm_thm_jump8.s: New test source file.
3996         * testsuite/arm_thm_jump8.t: New linker script.
3997
3998 2011-06-24  Ian Lance Taylor  <iant@google.com>
3999
4000         * layout.cc: Include "object.h".
4001         (ctors_sections_in_init_array): New static variable.
4002         (Layout::is_ctors_in_init_array): New function.
4003         (Layout::layout): Add entry to ctors_sections_in_init_array if
4004         appropriate.
4005         * layout.h (class Layout): Declare is_ctors_in_init_array.
4006         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4007         is_ctors_reverse_view is set.
4008         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4009         all callers.  Set is_ctors_reverse_view field of View_size.
4010         (Sized_relobj_file::reverse_words): New function.
4011         * object.h (Sized_relobj_file::View_size): Add
4012         is_ctors_reverse_view field.
4013         (class Sized_relobj_file): Update declarations.
4014         * testsuite/initpri3.c: New test.
4015         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4016         initpri3b.
4017         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4018         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4019         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4020         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4021         * testsuite/Makefile.in: Rebuild.
4022
4023 2011-06-24  Cary Coutant  <ccoutant@google.com>
4024
4025         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4026         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4027         (debug_msg_cdebug.err): New targets.
4028         * testsuite/Makefile.in: Regenerate.
4029         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4030         Fix checks for link with shared library.
4031
4032 2011-06-24  Doug Kwan  <dougkwan@google.com>
4033
4034         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4035         skip empty text sections.
4036         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4037
4038 2011-06-22  Ian Lance Taylor  <iant@google.com>
4039
4040         PR gold/12910
4041         * options.h (class General_options): Add --ctors-in-init-array.
4042         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4043         friends as SHT_PROGBITS for merging sections.
4044         (Layout::layout): Remove special handling of .init_array and
4045         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4046         and .dtors if ctors_in_init_array.
4047         (Layout::make_output_section): Force correct section types for
4048         .init_array and friends.  Don't sort if doing relocatable link,
4049         Don't sort .ctors and .dtors if ctors_in_init_array.
4050         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4051         (Layout::output_section_name): Add relobj parameter.  Change all
4052         callers.  Handle .ctors. and .dtors. in code rather than table.
4053         Handle .ctors and .dtors if ctors_in_init_array.
4054         (Layout::match_file_name): New function, moved from output.cc.
4055         * layout.h (class Layout): Update declarations.
4056         * output.cc: Include "layout.h".
4057         (Input_section_sort_entry::get_priority): New function.
4058         (Input_section_sort_entry::match_file_name): Just call
4059         Layout::match_file_name.
4060         (Output_section::Input_section_sort_init_fini_compare::operator()):
4061         Handle .ctors and .dtors.  Sort by explicit priority rather than
4062         by name.
4063         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4064         * testsuite/initpri2.c: New test.
4065         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4066         (check_PROGRAMS): Add initpri2.
4067         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4068         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4069         * configure, testsuite/Makefile.in: Rebuild.
4070
4071 2011-06-19  Ian Lance Taylor  <iant@google.com>
4072
4073         PR gold/12880
4074         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4075         .interp section to a PT_INTERP segment even if we have seen a
4076         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4077         clause in a linker script.
4078         (Layout::finalize): Don't create a .interp section if we've
4079         already create a PT_INTERP segment.
4080         (Layout::create_interp): Always call choose_output_section (revert
4081         patch of 2011-06-17).  Don't create PT_INTERP segment.
4082         * script-sections.cc
4083         (Script_sections::create_note_and_tls_segments): Add a .interp
4084         section to a PT_INTERP segment even if we have seen a
4085         --dynamic-linker option.
4086
4087 2011-06-18  Ian Lance Taylor  <iant@google.com>
4088
4089         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4090         merely because a non-PT_LOAD segment has a dynamic reloc.
4091
4092 2011-06-18  Ian Lance Taylor  <iant@google.com>
4093
4094         * layout.cc (Layout::finish_dynamic_section): Don't create
4095         DT_FLAGS entry if not needed.
4096
4097 2011-06-18  Ian Lance Taylor  <iant@google.com>
4098
4099         PR gold/12745
4100         * layout.cc (Layout::layout_eh_frame): Correct handling of
4101         writable .eh_frame section.
4102
4103 2011-06-17  Ian Lance Taylor  <iant@google.com>
4104
4105         PR gold/12893
4106         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4107         symbol is redefined with the exact same object and value.
4108
4109 2011-06-17  Ian Lance Taylor  <iant@google.com>
4110
4111         PR gold/12880
4112         * layout.h (class Layout): Add interp_segment_ field.
4113         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4114         (Layout::attach_allocated_section_to_segment): If making shared
4115         library, put .interp section in PT_INTERP segment.
4116         (Layout::finalize): Also call create_interp if -dynamic-linker
4117         option was used.
4118         (Layout::create_interp): Assert that there is no PT_INTERP
4119         segment.  If not using a SECTIONS clause, use make_output_section.
4120         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4121         * script-sections.cc
4122         (Script_sections::create_note_and_tls_segments): If making shared
4123         library, put .interp section in PT_INTERP segment.
4124
4125 2011-06-17  Ian Lance Taylor  <iant@google.com>
4126
4127         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4128         when making a shared library.
4129
4130 2011-06-17  Ian Lance Taylor  <iant@google.com>
4131
4132         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4133         parameter.  Change all callers.  Don't issue warning about PC32
4134         against locally defined symbol.
4135
4136 2011-06-16  Ian Lance Taylor  <iant@google.com>
4137
4138         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4139         occurs in same object.
4140
4141 2011-06-14  Alan Modra  <amodra@gmail.com>
4142
4143         * po/POTFILES.in: Regenerate.
4144
4145 2011-06-09  Ian Lance Taylor  <iant@google.com>
4146
4147         * script-sections.cc
4148         (Orphan_output_section::set_section_addresses): For a relocatable
4149         link set address to 0.
4150
4151 2011-06-09  Cary Coutant  <ccoutant@google.com>
4152
4153         PR gold/12804
4154         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4155         used with --compress-debug-sections.
4156         * gold/object.cc (Sized_relobj_file::do_layout): Report
4157         uncompressed size of compressed input sections.
4158
4159 2011-06-08  Cary Coutant  <ccoutant@google.com>
4160
4161         PR gold/12804
4162         * testsuite/two_file_test_2_v1.cc: Change initialization of
4163         v2 to keep it in .data.
4164
4165 2011-06-07  Cary Coutant  <ccoutant@google.com>
4166
4167         * common.cc (Symbol_table::do_allocate_commons_list): Call
4168         gold_fallback.
4169         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4170         (Errors::fallback): New function.
4171         (gold_fallback): New function.
4172         * errors.h (Errors::fallback): New function.
4173         * gold.cc (gold_exit): Change status parameter to enum; adjust
4174         all callers.
4175         (queue_initial_tasks): Call gold_fallback.
4176         * gold.h: Include cstdlib.
4177         (Exit_status): New enum type.
4178         (gold_exit): Change status parameter to enum.
4179         (gold_fallback): New function.
4180         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4181         (Layout::create_symtab_sections): Likewise.
4182         (Layout::create_shdrs): Likewise.
4183         * main.cc (main): Adjust call to gold_exit.
4184         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4185         (Output_data_got::add_got_entry_pair): Likewise.
4186         (Output_section::add_input_section): Likewise.
4187         (Output_section::add_output_section_data): Likewise.
4188         (Output_segment::set_section_list_addresses): Likewise.
4189         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4190
4191 2011-06-07  Cary Coutant  <ccoutant@google.com>
4192
4193         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4194         for incremental links.
4195         * output.cc (Output_segment::set_section_list_addresses): Remove
4196         FIXME and test for TLS or BSS.
4197
4198 2011-06-07  Cary Coutant  <ccoutant@google.com>
4199
4200         * testsuite/Makefile.am: Add incremental_copy_test,
4201         incremental_common_test_1.
4202         * testsuite/Makefile.in: Regenerate.
4203         * testsuite/common_test_1_v1.c: New source file.
4204         * testsuite/common_test_1_v2.c: New source file.
4205         * testsuite/copy_test_v1.cc: New source file.
4206
4207 2011-06-07  Cary Coutant  <ccoutant@google.com>
4208
4209         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4210         update, allocate common from bss section's free list.
4211         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4212         linker-defined symbols.
4213         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4214         Skip GOT and PLT entries that are no longer referenced.
4215         (Output_section_incremental_inputs::write_info_blocks): Mark
4216         linker-defined symbols.
4217         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4218         * output.cc (Output_section::allocate): New function.
4219         * output.h (Output_section::allocate): New function.
4220         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4221         linker-defined symbols.
4222         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4223         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4224         (Symbol::init_base_output_data): Likewise.
4225         (Symbol::init_base_output_segment): Likewise.
4226         (Symbol::init_base_constant): Likewise.
4227         (Sized_symbol::init_output_data): Likewise.
4228         (Sized_symbol::init_output_segment): Likewise.
4229         (Sized_symbol::init_constant): Likewise.
4230         (Symbol_table::do_define_in_output_data): Likewise.
4231         (Symbol_table::do_define_in_output_segment): Likewise.
4232         (Symbol_table::do_define_as_constant): Likewise.
4233         * symtab.h (Symbol::is_predefined): New function.
4234         (Symbol::init_base_output_data): Add is_predefined parameter.
4235         (Symbol::init_base_output_segment): Likewise.
4236         (Symbol::init_base_constant): Likewise.
4237         (Symbol::is_predefined_): New data member.
4238         (Sized_symbol::init_output_data): Add is_predefined parameter.
4239         (Sized_symbol::init_output_segment): Likewise.
4240         (Sized_symbol::init_constant): Likewise.
4241         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4242
4243 2011-06-07  Cary Coutant  <ccoutant@google.com>
4244
4245         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4246         instead of emit_copy_reloc.
4247         (Copy_relocs::emit_copy_reloc): Refactor.
4248         (Copy_relocs::make_copy_reloc): New function.
4249         (Copy_relocs::add_copy_reloc): Remove.
4250         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4251         section.
4252         (Copy_relocs::make_copy_reloc): New function.
4253         (Copy_relocs::add_copy_reloc): Remove.
4254         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4255         unchanged input files.
4256         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4257         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4258         Reserve BSS space for COPY relocations.
4259         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4260         (Output_section_incremental_inputs::write_info_blocks): Record
4261         whether a symbol is copied from a shared object.
4262         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4263         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4264         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4265         (Incremental_input_entry_reader::get_output_symbol_index): Add
4266         is_copy parameter.
4267         (Incremental_binary::emit_copy_relocs): New function.
4268         (Incremental_binary::do_emit_copy_relocs): New function.
4269         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4270         new data member.
4271         (Sized_incremental_binary::add_copy_reloc): New function.
4272         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4273         (Sized_incremental_binary::Copy_reloc): New struct.
4274         (Sized_incremental_binary::Copy_relocs): New typedef.
4275         (Sized_incremental_binary::copy_relocs_): New data member.
4276         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4277         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4278         * target.h (Sized_target::emit_copy_reloc): New function.
4279         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4280
4281 2011-06-02  Cary Coutant  <ccoutant@google.com>
4282
4283         PR gold/12163
4284         * gold/archive.cc (Archive::Archive): Initialize new data member.
4285         (Archive::include_all_members): Return if archive has already been
4286         included.
4287         * gold/archive.h (Archive::include_all_members_): New data member.
4288
4289 2011-06-02  Nick Clifton  <nickc@redhat.com>
4290
4291         * dynobj.h: Fix spelling mistake in comment.
4292         * output.cc: Likewise.
4293
4294 2011-05-31  Doug Kwan  <dougkwan@google.com>
4295             Asier Llano
4296
4297         PR gold/12826
4298         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4299         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4300         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4301         redundant arm_exidx_test.so.
4302         * testsuite/Makefile.in: Regenerate.
4303         (check_SCRIPTS): Add pr12826.sh
4304         (check_DATA): Add pr12826.stdout
4305         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4306         * testsuite/pr12826.sh: New file.
4307         * testsuite/pr12826_1.s: Ditto.
4308         * testsuite/pr12826_1.s: Ditto.
4309
4310 2011-05-30  Ian Lance Taylor  <iant@google.com>
4311
4312         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4313         sections.
4314
4315 2011-05-29  Ian Lance Taylor  <iant@google.com>
4316
4317         PR gold/12804
4318         * testsuite/Makefile.am: Use different file name for two_file_test
4319         temporary file for each incremental test.
4320         * testsuite/Makefile.in: Rebuild.
4321
4322 2011-05-29  Ian Lance Taylor  <iant@google.com>
4323
4324         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4325         binary input file is empty.
4326
4327 2011-05-27  Ian Lance Taylor  <iant@google.com>
4328
4329         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4330         (ver_test_9.so): Likewise.
4331         * testsuite/Makefile.in: Rebuild.
4332
4333 2011-05-26 Cary Coutant  <ccoutant@google.com>
4334
4335         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4336         * incremental.cc (Incremental_inputs::report_input_section): Fix
4337         comment, indentation.
4338         (Incremental_inputs::report_comdat_group): New function.
4339         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4340         of data for incremental input file entry.
4341         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4342         group count, COMDAT group signatures.
4343         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4344         an unchanged input file.
4345         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4346         Initialize new data member.
4347         (Incremental_object_entry::add_comdat_group): New function.
4348         (Incremental_object_entry::get_comdat_group_count): New function.
4349         (Incremental_object_entry::get_comdat_signature_key): New function.
4350         (Incremental_object_entry::groups_): New data member.
4351         (Incremental_inputs::report_comdat_group): New function.
4352         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4353         data for incremental input file entry.
4354         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4355         (Incremental_input_entry_reader::get_input_section): Adjust size of
4356         data for incremental input file entry.
4357         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4358         (Incremental_input_entry_reader::get_comdat_group_signature): New
4359         function.
4360         * object.cc (Sized_relobj::include_section_group): Report kept
4361         COMDAT groups for incremental links.
4362
4363 2011-05-24  David Meyer  <pdox@google.com>
4364
4365         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4366         with name parameter.  Add found_name parameter.
4367         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4368         * dirsearch.h (class Dirsearch): Update declaration.
4369
4370 2011-05-24  Ian Lance Taylor  <iant@google.com>
4371
4372         * archive.cc (Library_base::should_include_member): Pull in object
4373         from archive if it defines the entry symbol.
4374         * parameters.cc (Parameters::entry): New function.
4375         * parameters.h (class Parameters): Declare entry.
4376         * output.h (class Output_file_header): Remove entry_ field.
4377         * output.cc (Output_file_header::Output_file_header): Remove entry
4378         parameter.  Change all callers.
4379         (Output_file_header::entry): Use parameters->entry.
4380         * gold.cc (queue_middle_tasks): Likewise.
4381         * plugin.cc (Plugin_hook::run): Likewise.
4382
4383 2011-05-24 Cary Coutant  <ccoutant@google.com>
4384
4385         * gold.cc (queue_initial_tasks): Pass incremental base filename
4386         to Output_file::open_base_file; don't print error message.
4387         * incremental-dump.cc (main): Adjust call to
4388         Output_file::open_for_modification.
4389         * incremental-dump.cc (main): Likewise.
4390         * incremental.cc (Incremental_inputs::report_command_line):
4391         Ignore --incremental-base option when comparing command lines.
4392         Ignore parameter when given as separate argument.
4393         * options.h (class General_options): Add --incremental-base.
4394         * output.cc (Output_file::Output_file):
4395         (Output_file::open_base_file): Add base_name and writable parameters;
4396         read base file into new file; print error message here.
4397         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4398         callers.
4399         * output.h (Output_file::open_for_modification): Rename to...
4400         (Output_file::open_base_file): ...this; add base_name and
4401         writable parameters; adjust all callers.
4402         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4403         callers.
4404         * testsuite/Makefile.am (incremental_test_4): Test
4405         --incremental-base.
4406         * testsuite/Makefile.in: Regenerate.
4407
4408 2011-05-24 Cary Coutant  <ccoutant@google.com>
4409
4410         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4411         incremental_test_4.
4412         * testsuite/Makefile.in: Regenerate.
4413         * testsuite/two_file_test_1_v1.cc: New test source file.
4414         * testsuite/two_file_test_1b_v1.cc: New test source file.
4415         * testsuite/two_file_test_2_v1.cc: New test source file.
4416
4417 2011-05-24 Cary Coutant  <ccoutant@google.com>
4418
4419         * dynobj.h (Dynobj::do_dynobj): New function.
4420         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4421         flag and soname for shared objects.
4422         * incremental.cc (Incremental_inputs::report_object): Make
4423         either Incremental_object_entry or Incremental_dynobj_entry; add
4424         soname to string table.
4425         (Incremental_inputs::report_input_section): Add assertion.
4426         (Output_section_incremental_inputs::set_final_data_size): Adjust
4427         type of input file entry for shared libraries; adjust size of
4428         shared library info entry.
4429         (Output_section_incremental_inputs::write_input_files): Write
4430         as_needed flag for shared libraries.
4431         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4432         of input file entry for shared libraries; write soname.
4433         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4434         soname from incremental info.
4435         * incremental.h (enum Incremental_input_flags): Add
4436         INCREMENTAL_INPUT_AS_NEEDED.
4437         (Incremental_input_entry::Incremental_input_entry): Initialize new
4438         data member.
4439         (Incremental_input_entry::set_as_needed): New function.
4440         (Incremental_input_entry::as_needed): New function.
4441         (Incremental_input_entry::do_dynobj_entry): New function.
4442         (Incremental_input_entry::as_needed_): New data member.
4443         (Incremental_object_entry::Incremental_object_entry): Don't check
4444         for shared library.
4445         (Incremental_object_entry::do_type): Likewise.
4446         (class Incremental_dynobj_entry): New class.
4447         (Incremental_input_entry_reader::as_needed): New function.
4448         (Incremental_input_entry_reader::get_soname): New function.
4449         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4450         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4451         size of shared library info entry.
4452         * layout.cc (Layout::finish_dynamic_section): Don't test for
4453         incremental link when adding DT_NEEDED entries.
4454         * object.h (Object::Object): Initialize new data member.
4455         (Object::dynobj): New function.
4456         (Object::set_as_needed): New function.
4457         (Object::as_needed): New function.
4458         (Object::do_dynobj): New function.
4459         (Object::as_needed_): New data member.
4460
4461 2011-05-24 Cary Coutant  <ccoutant@google.com>
4462
4463         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4464         info; adjust display of GOT entries.
4465         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4466         vector of input objects; remove file_status_.
4467         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4468         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4469         got_plt reader; call target hooks to reserve GOT entries.
4470         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4471         of input file info header and GOT info entry.
4472         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4473         relocation info.
4474         (Got_plt_view_info::got_descriptor): Remove.
4475         (Got_plt_view_info::sym_index): New data member.
4476         (Got_plt_view_info::input_index): New data member.
4477         (Local_got_offset_visitor::visit): Write input file index.
4478         (Global_got_offset_visitor::visit): Write 0 for input file index.
4479         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4480         with sym_index and input_index.
4481         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4482         incremental info GOT entry; replace got_descriptor with input_index.
4483         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4484         map from input file index to object.
4485         (Sized_relobj_incr::do_layout): Replace direct data member reference
4486         with accessor function.
4487         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4488         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4489         Adjust size of input file info header.
4490         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4491         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4492         (Incremental_input_entry_reader::get_input_section): Adjust size of
4493         input file info header.
4494         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4495         of incremental info GOT entry.
4496         (Incremental_got_plt_reader::get_got_desc): Remove.
4497         (Incremental_got_plt_reader::get_got_symndx): New function.
4498         (Incremental_got_plt_reader::get_got_input_index): New function.
4499         (Sized_incremental_binary::Sized_incremental_binary): Remove
4500         file_status_; add input_objects_.
4501         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4502         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4503         (Sized_incremental_binary::file_is_unchanged): Remove.
4504         (Sized_incremental_binary::set_input_object): New function.
4505         (Sized_incremental_binary::input_object): New function.
4506         (Sized_incremental_binary::file_status_): Remove.
4507         (Sized_incremental_binary::input_objects_): New data member.
4508         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4509         references.
4510         (Sized_relobj_incr::invalid_address): Move to base class.
4511         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4512         class.
4513         (Sized_relobj_incr::do_output_section_offset): Likewise.
4514         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4515         (Sized_relobj_incr::section_offsets_): Likewise.
4516         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4517         function.
4518         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4519         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4520         with accessor function.
4521         (Sized_relobj_file::do_layout): Likewise.
4522         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4523         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4524         (Sized_relobj_file::compute_final_local_value): Replace refs to
4525         section_offsets_ with accessor function.
4526         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4527         * object.h (Relobj::Relobj): Initialize new data members.
4528         (Relobj::add_dyn_reloc): New function.
4529         (Relobj::first_dyn_reloc): New function.
4530         (Relobj::dyn_reloc_count): New function.
4531         (Relobj::first_dyn_reloc_): New data member.
4532         (Relobj::dyn_reloc_count_): New data member.
4533         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4534         references.
4535         (Sized_relobj::Address): New typedef.
4536         (Sized_relobj::invalid_address): Move here from child class.
4537         (Sized_relobj::Sized_relobj): Initialize new data members.
4538         (Sized_relobj::sized_relobj): New function.
4539         (Sized_relobj::is_output_section_offset_invalid): Move here from
4540         child class.
4541         (Sized_relobj::get_output_section_offset): Likewise.
4542         (Sized_relobj::local_has_got_offset): Likewise.
4543         (Sized_relobj::local_got_offset): Likewise.
4544         (Sized_relobj::set_local_got_offset): Likewise.
4545         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4546         (Sized_relobj::clear_got_offsets): New function.
4547         (Sized_relobj::section_offsets): Move here from child class.
4548         (Sized_relobj::do_output_section_offset): Likewise.
4549         (Sized_relobj::do_set_section_offset): Likewise.
4550         (Sized_relobj::Local_got_offsets): Likewise.
4551         (Sized_relobj::local_got_offsets_): Likewise.
4552         (Sized_relobj::section_offsets_): Likewise.
4553         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4554         references.
4555         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4556         class.
4557         (Sized_relobj_file::sized_relobj): New function
4558         (Sized_relobj_file::local_has_got_offset): Move to base class.
4559         (Sized_relobj_file::local_got_offset): Likewise.
4560         (Sized_relobj_file::set_local_got_offset): Likewise.
4561         (Sized_relobj_file::get_output_section_offset): Likewise.
4562         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4563         (Sized_relobj_file::do_output_section_offset): Likewise.
4564         (Sized_relobj_file::do_set_section_offset): Likewise.
4565         (Sized_relobj_file::Local_got_offsets): Likewise.
4566         (Sized_relobj_file::local_got_offsets_): Likewise.
4567         (Sized_relobj_file::section_offsets_): Likewise.
4568         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4569         (all constructors).
4570         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4571         (Output_reloc::get_symbol_index): Likewise.
4572         (Output_reloc::local_section_offset): Likewise.
4573         (Output_reloc::get_address): Likewise.
4574         (Output_reloc::symbol_value): Likewise.
4575         (Output_data_got::reserve_slot): Move to class definition.
4576         (Output_data_got::reserve_local): New function.
4577         (Output_data_got::reserve_slot_for_global): Remove.
4578         (Output_data_got::reserve_global): New function.
4579         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4580         (all constructors, two instantiations).
4581         (Output_reloc::get_relobj): New function (two instantiations).
4582         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4583         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4584         (Output_data_reloc::add_global): Adjust type of relobj.
4585         (Output_data_reloc::add_global_relative): Likewise.
4586         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4587         (Output_data_reloc::add_local): Likewise.
4588         (Output_data_reloc::add_local_relative): Likewise.
4589         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4590         (Output_data_reloc::add_local_section): Likewise.
4591         (Output_data_reloc::add_output_section): Likewise.
4592         (Output_data_reloc::add_absolute): Likewise.
4593         (Output_data_reloc::add_target_specific): Likewise.
4594         (Output_data_got::reserve_slot): Move definition here.
4595         (Output_data_got::reserve_local): New function.
4596         (Output_data_got::reserve_global): New function.
4597         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4598         section_offsets_ with accessor function.
4599         (Sized_relobj_file::write_sections): Likewise.
4600         (Sized_relobj_file::do_relocate_sections): Likewise.
4601         * target.h (Sized_target::reserve_local_got_entry): New function.
4602         (Sized_target::reserve_global_got_entry): New function.
4603         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4604         (Target_x86_64::reserve_global_got_entry): New function.
4605         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4606
4607 2011-05-23 Cary Coutant  <ccoutant@google.com>
4608
4609         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4610         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4611         bit when checking got_type.
4612         * incremental.cc (Sized_incremental_binary::setup_readers):
4613         Store symbol table and string table locations; initialize bit vector
4614         of file status flags.
4615         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4616         unchanged files.
4617         (Sized_incremental_binary::do_process_got_plt): New function.
4618         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4619         (Output_section_incremental_inputs::set_final_data_size): Record
4620         file index for each input file.
4621         (Output_section_incremental_inputs::write_got_plt): Store file index
4622         instead of input entry offset for each GOT entry.
4623         * incremental.h
4624         (Incremental_input_entry::Incremental_input_entry): Initialize new
4625         data member.
4626         (Incremental_input_entry::set_offset): Store file index.
4627         (Incremental_input_entry::get_file_index): New function.
4628         (Incremental_input_entry::file_index_): New data member.
4629         (Incremental_binary::process_got_plt): New function.
4630         (Incremental_binary::do_process_got_plt): New function.
4631         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4632         data members.
4633         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4634         (Sized_incremental_binary::set_file_is_unchanged): New function.
4635         (Sized_incremental_binary::file_is_unchanged): New function.
4636         (Sized_incremental_binary::do_process_got_plt): New function.
4637         (Sized_incremental_binary::file_status_): New data member.
4638         (Sized_incremental_binary::main_symtab_loc_): New data member.
4639         (Sized_incremental_binary::main_strtab_loc_): New data member.
4640         * output.cc (Output_data_got::Got_entry::write): Add case
4641         RESERVED_CODE.
4642         (Output_data_got::add_global): Call add_got_entry.
4643         (Output_data_got::add_global_plt): Likewise.
4644         (Output_data_got::add_global_with_rel): Likewise.
4645         (Output_data_got::add_global_with_rela): Likewise.
4646         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4647         (Output_data_got::add_global_pair_with_rela): Likewise.
4648         (Output_data_got::add_local): Call add_got_entry.
4649         (Output_data_got::add_local_plt): Likewise.
4650         (Output_data_got::add_local_with_rel): Likewise.
4651         (Output_data_got::add_local_with_rela): Likewise.
4652         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4653         (Output_data_got::add_local_pair_with_rela): Likewise.
4654         (Output_data_got::reserve_slot): New function.
4655         (Output_data_got::reserve_slot_for_global): New function.
4656         (Output_data_got::add_got_entry): New function.
4657         (Output_data_got::add_got_entry_pair): New function.
4658         (Output_section::add_output_section_data): Edit FIXME.
4659         * output.h
4660         (Output_section_data_build::Output_section_data_build): New
4661         constructor with size parameter.
4662         (Output_data_space::Output_data_space): Likewise.
4663         (Output_data_got::Output_data_got): Initialize new data member; new
4664         constructor with size parameter.
4665         (Output_data_got::add_constant): Call add_got_entry.
4666         (Output_data_got::reserve_slot): New function.
4667         (Output_data_got::reserve_slot_for_global): New function.
4668         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4669         (Output_data_got::add_got_entry): New function.
4670         (Output_data_got::add_got_entry_pair): New function.
4671         (Output_data_got::free_list_): New data member.
4672         * target.h (Sized_target::init_got_plt_for_update): New function.
4673         (Sized_target::register_global_plt_entry): New function.
4674         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4675         Initialize new data member; call init; add constructor with PLT count.
4676         (Output_data_plt_x86_64::init): New function.
4677         (Output_data_plt_x86_64::add_relocation): New function.
4678         (Output_data_plt_x86_64::reserve_slot): New function.
4679         (Output_data_plt_x86_64::free_list_): New data member.
4680         (Target_x86_64::init_got_plt_for_update): New function.
4681         (Target_x86_64::register_global_plt_entry): New function.
4682         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4683         incremental updates.
4684         (Output_data_plt_x86_64::add_relocation): New function.
4685         * testsuite/object_unittest.cc (Object_test): Set default options.
4686
4687 2011-05-16  Ian Lance Taylor  <iant@google.com>
4688
4689         * options.h (class General_options): Make -i a synonym for -r.
4690
4691 2011-05-16  Ian Lance Taylor  <iant@google.com>
4692
4693         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4694
4695 2011-05-10 Cary Coutant  <ccoutant@google.com>
4696
4697         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4698         strip_all (-s).
4699
4700 2011-05-06  Ian Lance Taylor  <iant@google.com>
4701
4702         * layout.cc (Layout::layout): If the output section flags change,
4703         update the ordering.
4704
4705 2011-04-25 Cary Coutant  <ccoutant@google.com>
4706
4707         * incremental-dump.cc (dump_incremental_inputs): Print local
4708         symbol info for each input file.
4709         * incremental.cc
4710         (Output_section_incremental_inputs::set_final_data_size): Add local
4711         symbol info to input file entries in incremental info.
4712         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4713         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4714         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4715         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4716         implementation.
4717         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4718         (Sized_incr_relobj::do_relocate): Write the local symbols.
4719         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4720         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4721         Adjust size of input file header.
4722         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4723         (Incremental_inputs_reader::get_local_symbol_count): New function.
4724         (Incremental_inputs_reader::get_input_section): Adjust size of input
4725         file header.
4726         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4727         (Sized_incr_relobj::This): New typedef.
4728         (Sized_incr_relobj::sym_size): New const data member.
4729         (Sized_incr_relobj::Local_symbol): New struct.
4730         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4731         (Sized_incr_relobj::do_local_symbol_offset): New function.
4732         (Sized_incr_relobj::local_symbol_count_): New data member.
4733         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4734         (Sized_incr_relobj::local_symbol_index_): New data member.
4735         (Sized_incr_relobj::local_symbol_offset_): New data member.
4736         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4737         (Sized_incr_relobj::local_symbols_): New data member.
4738         * object.h (Relobj::output_local_symbol_count): New function.
4739         (Relobj::local_symbol_offset): New function.
4740         (Relobj::do_output_local_symbol_count): New function.
4741         (Relobj::do_local_symbol_offset): New function.
4742         (Sized_relobj::do_output_local_symbol_count): New function.
4743         (Sized_relobj::do_local_symbol_offset): New function.
4744
4745 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4746
4747         * descriptors.cc (set_close_on_exec): New function.
4748         (Descriptors::open): Use set_close_on_exec.
4749         * output.cc (S_ISLNK): Define if not defined.
4750
4751 2011-04-22 Cary Coutant  <ccoutant@google.com>
4752
4753         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4754         global symbol map.
4755         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4756         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4757         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4758         relocations.
4759         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4760         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4761         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4762         * incremental.h
4763         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4764         function.
4765         (Incremental_binary::apply_incremental_relocs): New function.
4766         (Incremental_binary::do_apply_incremental_relocs): New function.
4767         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4768         data member.
4769         (Sized_incremental_binary::add_global_symbol): New function.
4770         (Sized_incremental_binary::global_symbol): New function.
4771         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4772         (Sized_incremental_binary::symbol_map_): New data member.
4773         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4774         * target.h (Sized_target::apply_relocation): New function.
4775         * target-reloc.h (apply_relocation): New function.
4776         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4777
4778 2011-04-22  Doug Kwan  <dougkwan@google.com>
4779
4780         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4781         flag of a SHT_ARM_EXIDX section.
4782         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4783         * testsuite/Makefile.in: Regenerate.
4784         * testsuite/arm_exidx_test.s: New file.
4785         * testsuite/arm_exidx_test.sh: Same.
4786
4787 2011-04-20 Cary Coutant  <ccoutant@google.com>
4788
4789         PR gold/12689
4790         * archive.h (Incremental_archive_entry::Archive_member):
4791         Initialize arg_serial_ (second constructor).
4792
4793 2011-04-17  Ian Lance Taylor  <iant@google.com>
4794
4795         * object.cc (Relocate_info::location): Simplify location string.
4796         * errors.cc (Errors::error_at_location): Don't print program
4797         name.
4798         (Errors::warning_at_location): Likewise.
4799         (Errors::undefined_symbol): Likewise.
4800         * testsuite/debug_msg.sh: Update accordingly.
4801
4802 2011-04-14 Cary Coutant  <ccoutant@google.com>
4803
4804         * gold/layout.cc (Layout::symtab_section_offset): New function.
4805         * gold/layout.h (Layout::symtab_section_offset): New function.
4806         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4807
4808 2011-04-12  Ian Lance Taylor  <iant@google.com>
4809
4810         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4811         with MREMAP_MAYMOVE.
4812         * output.h (class Output_file): Add map_is_allocated_ field.
4813         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4814         not available, provide stubs.  If mremap is not available, #define
4815         it to gold_mremap.
4816         (MREMAP_MAYMOVE): Define if not defined.
4817         (Output_file::Output_file): Initialize map_is_allocated_.
4818         (Output_file::resize): Check map_is_allocated_.
4819         (Output_file::map_anonymous): If mmap fails, use malloc.
4820         (Output_file::unmap): Don't do anything for an anonymous map.
4821         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4822         is not available, provide stubs.
4823         (File_read::View::~View): Use free rather than delete[].
4824         (File_read::make_view): Use malloc rather than new[].  If mmap
4825         fails, use malloc.
4826         (File_read::find_or_make_view): Use malloc rather than new[].
4827         * gold.h: Remove HAVE_REMAP code.
4828         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4829         exists.  Rename mremap to gold_mremap.  If mmap is not available
4830         don't do anything.
4831         * configure, config.in: Rebuild.
4832
4833 2011-04-11  Ian Lance Taylor  <iant@google.com>
4834
4835         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4836         initialize local variable v.
4837
4838 2011-04-11  Cary Coutant  <ccoutant@google.com>
4839
4840         * archive.cc (Archive::include_member): Adjust call to
4841         report_object.
4842         (Add_archive_symbols::run): Track argument serial numbers.
4843         (Lib_group::include_member): Likewise.
4844         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4845         * archive.h (Incremental_archive_entry::Archive_member):
4846         Initialize arg_serial_.
4847         (Archive_member::arg_serial_): New data member.
4848         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4849         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4850         incremental link.
4851         (Sized_dynobj::do_for_all_local_got_entries): New function.
4852         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4853         function.
4854         * fileread.cc (get_mtime): New function.
4855         * fileread.h (get_mtime): New function.
4856         * gold.cc (queue_initial_tasks): Check for incremental update.
4857         (process_incremental_input): New function.
4858         (queue_middle_tasks): Don't force valid target for incremental
4859         update.
4860         * incremental-dump.cc (find_input_containing_global): Adjust
4861         size of symbol info entry.
4862         (dump_incremental_inputs): Dump argument serial number and
4863         in_system_directory flag; bias shndx by 1; print symbol names
4864         when dumping per-file symbol lists; use new symbol info readers.
4865         * incremental.cc
4866         (Output_section_incremental_inputs:update_data_size): New function.
4867         (Sized_incremental_binary::setup_readers): Setup input readers
4868         for each input file; build maps for files added from libraries
4869         and scripts.
4870         (Sized_incremental_binary::check_input_args): New function.
4871         (Sized_incremental_binary::do_check_inputs): Build map of argument
4872         serial numbers to input arguments.
4873         (Sized_incremental_binary::do_file_has_changed): Rename
4874         do_file_is_unchanged to this; compare file modification times.
4875         (Sized_incremental_binary::do_init_layout): New function.
4876         (Sized_incremental_binary::do_reserve_layout): New function.
4877         (Sized_incremental_binary::do_get_input_reader): Remove.
4878         (Sized_incremental_binary::get_symtab_view): New function.
4879         (Incremental_checker::can_incrementally_link_output_file): Remove.
4880         (Incremental_inputs::report_command_line): Exclude --debug options.
4881         (Incremental_inputs::report_archive_begin): Add parameter; track
4882         argument serial numbers; don't put input file entry for archive
4883         before archive members.
4884         (Incremental_inputs::report_archive_end): Put input file entry
4885         for archive after archive members.
4886         (Incremental_inputs::report_object): Add parameter; track argument
4887         serial numbers and in_system_directory flag.
4888         (Incremental_inputs::report_script): Add parameter; track argument
4889         serial numbers.
4890         (Output_section_incremental_inputs::set_final_data_size): Adjust
4891         size of symbol info entry; check for forwarding symbols.
4892         (Output_section_incremental_inputs::write_input_files): Write
4893         in_system_directory flag and argument serial number.
4894         (Output_section_incremental_inputs::write_info_blocks): Map section
4895         indices between incremental info and original input file; store
4896         input section index for each symbol.
4897         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4898         change operator() to visit().
4899         (class Global_got_offset_visitor): Likewise.
4900         (class Global_symbol_visitor_got_plt):
4901         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4902         classes.
4903         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4904         (Sized_incr_relobj::do_read_symbols): New function.
4905         (Sized_incr_relobj::do_layout): New function.
4906         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4907         (Sized_incr_relobj::do_add_symbols): New function.
4908         (Sized_incr_relobj::do_should_include_member): New function.
4909         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4910         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4911         (Sized_incr_relobj::do_section_size): New function.
4912         (Sized_incr_relobj::do_section_name): New function.
4913         (Sized_incr_relobj::do_section_contents): New function.
4914         (Sized_incr_relobj::do_section_flags): New function.
4915         (Sized_incr_relobj::do_section_entsize): New function.
4916         (Sized_incr_relobj::do_section_address): New function.
4917         (Sized_incr_relobj::do_section_type): New function.
4918         (Sized_incr_relobj::do_section_link): New function.
4919         (Sized_incr_relobj::do_section_info): New function.
4920         (Sized_incr_relobj::do_section_addralign): New function.
4921         (Sized_incr_relobj::do_initialize_xindex): New function.
4922         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4923         (Sized_incr_relobj::do_read_relocs): New function.
4924         (Sized_incr_relobj::do_gc_process_relocs): New function.
4925         (Sized_incr_relobj::do_scan_relocs): New function.
4926         (Sized_incr_relobj::do_count_local_symbols): New function.
4927         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4928         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4929         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4930         (Sized_incr_relobj::do_relocate): New function.
4931         (Sized_incr_relobj::do_set_section_offset): New function.
4932         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4933         (Sized_incr_dynobj::do_read_symbols): New function.
4934         (Sized_incr_dynobj::do_layout): New function.
4935         (Sized_incr_dynobj::do_add_symbols): New function.
4936         (Sized_incr_dynobj::do_should_include_member): New function.
4937         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4938         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4939         (Sized_incr_dynobj::do_section_size): New function.
4940         (Sized_incr_dynobj::do_section_name): New function.
4941         (Sized_incr_dynobj::do_section_contents): New function.
4942         (Sized_incr_dynobj::do_section_flags): New function.
4943         (Sized_incr_dynobj::do_section_entsize): New function.
4944         (Sized_incr_dynobj::do_section_address): New function.
4945         (Sized_incr_dynobj::do_section_type): New function.
4946         (Sized_incr_dynobj::do_section_link): New function.
4947         (Sized_incr_dynobj::do_section_info): New function.
4948         (Sized_incr_dynobj::do_section_addralign): New function.
4949         (Sized_incr_dynobj::do_initialize_xindex): New function.
4950         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4951         (make_sized_incremental_object): New function.
4952         (Incremental_library::copy_unused_symbols): New function.
4953         (Incremental_library::do_for_all_unused_symbols): New function.
4954         * incremental.h (enum Incremental_input_flags): New type.
4955         (class Incremental_checker): Remove.
4956         (Incremental_input_entry::Incremental_input_entry): Add argument
4957         serial number.
4958         (Incremental_input_entry::arg_serial): New function.
4959         (Incremental_input_entry::set_is_in_system_directory): New function.
4960         (Incremental_input_entry::is_in_system_directory): New function.
4961         (Incremental_input_entry::arg_serial_): New data member.
4962         (Incremental_input_entry::is_in_system_directory_): New data member.
4963         (class Script_info): Move here from script.h.
4964         (Script_info::Script_info): Add filename parameter.
4965         (Script_info::filename): New function.
4966         (Script_info::filename_): New data member.
4967         (Incremental_script_entry::Incremental_script_entry): Add argument
4968         serial number.
4969         (Incremental_object_entry::Incremental_object_entry): Likewise.
4970         (Incremental_object_entry::add_input_section): Build list of input
4971         sections with map to original shndx.
4972         (Incremental_object_entry::get_input_section_index): New function.
4973         (Incremental_object_entry::shndx_): New data member.
4974         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4975         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4976         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4977         serial number.
4978         (Incremental_inputs::report_archive_begin): Likewise.
4979         (Incremental_inputs::report_object): Likewise.
4980         (Incremental_inputs::report_script): Likewise.
4981         (class Incremental_global_symbol_reader): New class.
4982         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4983         and store flags and input file type.
4984         (Incremental_input_entry_reader::arg_serial): New function.
4985         (Incremental_input_entry_reader::type): Extract type from flags.
4986         (Incremental_input_entry_reader::is_in_system_directory): New function.
4987         (Incremental_input_entry_reader::get_input_section_count): Call
4988         accessor function for type.
4989         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4990         function for type; adjust size of global symbol entry.
4991         (Incremental_input_entry_reader::get_global_symbol_count): Call
4992         accessor function for type.
4993         (Incremental_input_entry_reader::get_object_count): Likewise.
4994         (Incremental_input_entry_reader::get_object_offset): Likewise.
4995         (Incremental_input_entry_reader::get_member_count): Likewise.
4996         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4997         (Incremental_input_entry_reader::get_member_offset): Likewise.
4998         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4999         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5000         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5001         (Incremental_input_entry_reader::get_global_symbol_reader): New
5002         function.
5003         (Incremental_input_entry_reader::get_output_symbol_index): New
5004         function.
5005         (Incremental_input_entry_reader::type_): Remove.
5006         (Incremental_input_entry_reader::flags_): New data member.
5007         (Incremental_inputs_reader::input_file_offset): New function.
5008         (Incremental_inputs_reader::input_file_index): New function.
5009         (Incremental_inputs_reader::input_file): Call input_file_offset.
5010         (Incremental_inputs_reader::input_file_at_offset): New function.
5011         (Incremental_relocs_reader::get_r_type): Reformat.
5012         (Incremental_relocs_reader::get_r_shndx): Reformat.
5013         (Incremental_relocs_reader::get_r_offset): Reformat.
5014         (Incremental_relocs_reader::data): New function.
5015         (Incremental_binary::Incremental_binary): Initialize new data members.
5016         (Incremental_binary::check_inputs): Add cmdline parameter.
5017         (Incremental_binary::file_is_unchanged): Remove.
5018         (Input_reader::arg_serial): New function.
5019         (Input_reader::get_unused_symbol_count): New function.
5020         (Input_reader::get_unused_symbol): New function.
5021         (Input_reader::do_arg_serial): New function.
5022         (Input_reader::do_get_unused_symbol_count): New function.
5023         (Input_reader::do_get_unused_symbol): New function.
5024         (Incremental_binary::input_file_count): New function.
5025         (Incremental_binary::get_input_reader): Change signature to use
5026         index instead of filename.
5027         (Incremental_binary::file_has_changed): New function.
5028         (Incremental_binary::get_input_argument): New function.
5029         (Incremental_binary::get_library): New function.
5030         (Incremental_binary::get_script_info): New function.
5031         (Incremental_binary::init_layout): New function.
5032         (Incremental_binary::reserve_layout): New function.
5033         (Incremental_binary::output_file): New function.
5034         (Incremental_binary::do_check_inputs): New function.
5035         (Incremental_binary::do_file_is_unchanged): Remove.
5036         (Incremental_binary::do_file_has_changed): New function.
5037         (Incremental_binary::do_init_layout): New function.
5038         (Incremental_binary::do_reserve_layout): New function.
5039         (Incremental_binary::do_input_file_count): New function.
5040         (Incremental_binary::do_get_input_reader): Change signature.
5041         (Incremental_binary::input_args_map_): New data member.
5042         (Incremental_binary::library_map_): New data member.
5043         (Incremental_binary::script_map_): New data member.
5044         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5045         new data members.
5046         (Sized_incremental_binary::output_section): New function.
5047         (Sized_incremental_binary::inputs_reader): Add const.
5048         (Sized_incremental_binary::symtab_reader): Add const.
5049         (Sized_incremental_binary::relocs_reader): Add const.
5050         (Sized_incremental_binary::got_plt_reader): Add const.
5051         (Sized_incremental_binary::get_symtab_view): New function.
5052         (Sized_incremental_binary::Inputs_reader): New typedef.
5053         (Sized_incremental_binary::Input_entry_reader): New typedef.
5054         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5055         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5056         (Sized_incremental_binary::do_file_has_changed): New function.
5057         (Sized_incremental_binary::do_init_layout): New function.
5058         (Sized_incremental_binary::do_reserve_layout): New function.
5059         (Sized_input_reader::Inputs_reader): Remove.
5060         (Sized_input_reader::Input_entry_reader): Remove.
5061         (Sized_input_reader::do_arg_serial): New function.
5062         (Sized_input_reader::do_get_unused_symbol_count): New function.
5063         (Sized_input_reader::do_get_unused_symbol): New function.
5064         (Sized_incremental_binary::do_input_file_count): New function.
5065         (Sized_incremental_binary::do_get_input_reader): Change signature;
5066         use index instead of filename.
5067         (Sized_incremental_binary::section_map_): New data member.
5068         (Sized_incremental_binary::input_entry_readers_): New data member.
5069         (class Sized_incr_relobj): New class.
5070         (class Sized_incr_dynobj): New class.
5071         (make_sized_incremental_object): New function.
5072         (class Incremental_library): New class.
5073         * layout.cc (Free_list::num_lists): New static data member.
5074         (Free_list::num_nodes): New static data member.
5075         (Free_list::num_removes): New static data member.
5076         (Free_list::num_remove_visits): New static data member.
5077         (Free_list::num_allocates): New static data member.
5078         (Free_list::num_allocate_visits): New static data member.
5079         (Free_list::init): New function.
5080         (Free_list::remove): New function.
5081         (Free_list::allocate): New function.
5082         (Free_list::dump): New function.
5083         (Free_list::print_stats): New function.
5084         (Layout_task_runner::run): Resize output file for incremental updates.
5085         (Layout::Layout): Initialize new data members.
5086         (Layout::set_incremental_base): New function.
5087         (Layout::init_fixed_output_section): New function.
5088         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5089         incremental updates.
5090         (Layout::create_gold_note): Do not create gold note section for
5091         incremental updates.
5092         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5093         for incremental updates.
5094         (Layout::set_section_offsets): For incremental updates, allocate space
5095         from free list.
5096         (Layout::create_symtab_sections): Layout with offsets relative to
5097         start of section; for incremental updates, allocate space from free
5098         list.
5099         (Layout::create_shdrs): For incremental updates, allocate space from
5100         free list.
5101         (Layout::finish_dynamic_section): For incremental updates, do not
5102         check --as-needed (fixed in subsequent patch).
5103         * layout.h (class Free_list): New class.
5104         (Layout::set_incremental_base): New function.
5105         (Layout::incremental_base): New function.
5106         (Layout::init_fixed_output_section): New function.
5107         (Layout::allocate): New function.
5108         (Layout::incremental_base_): New data member.
5109         (Layout::free_list_): New data member.
5110         * main.cc (main): Print Free_list statistics.
5111         * object.cc (Relobj::finalize_incremental_relocs): Add
5112         clear_counts parameter; clear counts only when clear_counts is set.
5113         (Sized_relobj::Sized_relobj): Initialize new base class.
5114         (Sized_relobj::do_layout): Don't report special sections.
5115         (Sized_relobj::do_for_all_local_got_entries): New function.
5116         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5117         symtab_off to all symbol table offsets.
5118         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5119         * object.h (class Got_offset_list): Move to top of file.
5120         (Object::Object): Allow case where input_file == NULL.
5121         (Object::~Object): Likewise.
5122         (Object::input_file): Assert that input_file != NULL.
5123         (Object::lock): Allow case where input_file == NULL.
5124         (Object::unlock): Likewise.
5125         (Object::is_locked): Likewise.
5126         (Object::token): Likewise.
5127         (Object::release): Likewise.
5128         (Object::is_incremental): New function.
5129         (Object::get_mtime): New function.
5130         (Object::for_all_local_got_entries): New function.
5131         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5132         (Object::set_is_in_system_directory): New function.
5133         (Object::is_in_system_directory): New function.
5134         (Object::do_is_incremental): New function.
5135         (Object::do_get_mtime): New function.
5136         (Object::do_for_all_local_got_entries): New function.
5137         (Object::is_in_system_directory_): New data member.
5138         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5139         (class Sized_relobj_base): New class.
5140         (class Sized_relobj): Derive from Sized_relobj_base.
5141         (class Sized_relobj::Symbols): Redeclare from base class.
5142         (class Sized_relobj::local_got_offset_list): Remove.
5143         (class Sized_relobj::Output_sections): Redeclare from base class.
5144         (class Sized_relobj::do_for_all_local_got_entries): New function.
5145         (class Sized_relobj::write_local_symbols): Add offset parameter.
5146         (class Sized_relobj::local_symbol_offset_): Update comment.
5147         (class Sized_relobj::local_dynsym_offset_): Update comment.
5148         * options.cc (Input_arguments::add_file): Remove const.
5149         * options.h (Input_file_argument::Input_file_argument):
5150         Initialize arg_serial_ (all constructors).
5151         (Input_file_argument::set_arg_serial): New function.
5152         (Input_file_argument::arg_serial): New function.
5153         (Input_file_argument::arg_serial_): New data member.
5154         (Input_arguments::Input_arguments): Initialize file_count_.
5155         (Input_arguments::add_file): Remove const.
5156         (Input_arguments::number_of_input_files): New function.
5157         (Input_arguments::file_count_): New data member.
5158         (Command_line::number_of_input_files): Call
5159         Input_arguments::number_of_input_files.
5160         * output.cc (Output_segment_headers::Output_segment_headers):
5161         Set current size.
5162         (Output_section::Input_section::current_data_size): New function.
5163         (Output_section::Output_section): Initialize new data members.
5164         (Output_section::add_input_section): Don't do merge sections for
5165         an incremental link; allocate space from free list for an
5166         incremental update.
5167         (Output_section::add_output_section_data): Allocate space from
5168         free list for an incremental update.
5169         (Output_section::update_data_size): New function.
5170         (Output_section::set_fixed_layout): New function.
5171         (Output_section::reserve): New function.
5172         (Output_segment::set_section_addresses): Remove const.
5173         (Output_segment::set_section_list_addresses): Remove const; allocate
5174         space from free list for an incremental update.
5175         (Output_segment::set_offset): Adjust size of RELRO segment for an
5176         incremental update.
5177         * output.h (Output_data::current_data_size): Move here from
5178         child classes.
5179         (Output_data::pre_finalize_data_size): New function.
5180         (Output_data::update_data_size): New function.
5181         (Output_section_headers::update_data_size): new function.
5182         (Output_section_data_build::current_data_size): Move to Output_data.
5183         (Output_data_strtab::update_data_size): New function.
5184         (Output_section::current_data_size): Move to Output_data.
5185         (Output_section::set_fixed_layout): New function.
5186         (Output_section::has_fixed_layout): New function.
5187         (Output_section::reserve): New function.
5188         (Output_section::update_data_size): New function.
5189         (Output_section::has_fixed_layout_): New data member.
5190         (Output_section::free_list_): New data member.
5191         (Output_segment::set_section_addresses): Remove const.
5192         (Output_segment::set_section_list_addresses): Remove const.
5193         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5194         New function.
5195         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5196         New function.
5197         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5198         parameter when calling Add_symbols constructor; store argument
5199         serial number for members of a lib group.
5200         (Add_symbols::locks): Allow case where token == NULL.
5201         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5202         (Read_member::~Read_member): New function.
5203         (Read_member::is_runnable): New function.
5204         (Read_member::locks): New function.
5205         (Read_member::run): New function.
5206         (Check_script::~Check_script): New function.
5207         (Check_script::is_runnable): New function.
5208         (Check_script::locks): New function.
5209         (Check_script::run): New function.
5210         (Check_library::~Check_library): New function.
5211         (Check_library::is_runnable): New function.
5212         (Check_library::locks): New function.
5213         (Check_library::run): New function.
5214         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5215         (Add_symbols::library_): New data member.
5216         (class Read_member): New class.
5217         (class Check_script): New class.
5218         (class Check_library): New class.
5219         * reloc.cc (Read_relocs::is_runnable): Allow case where
5220         token == NULL.
5221         (Read_relocs::locks): Likewise.
5222         (Scan_relocs::locks): Likewise.
5223         (Relocate_task::locks): Likewise.
5224         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5225         to clear counters.
5226         (Sized_relobj::incremental_relocs_scan): Fix comment.
5227         (Sized_relobj::do_relocate): Pass output file offset to
5228         write_local_symbols.
5229         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5230         from class declaration.
5231         * script.cc (read_input_script): Allocate Script_info; pass
5232         argument serial number to report_script.
5233         * script.h (class Script_info): Move to incremental.h.
5234         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5235         * symtab.h (Symbol_table::add_from_incrobj): New function.
5236         (Symbol_table::set_file_offset): New function.
5237
5238 2011-04-05  Cary Coutant  <ccoutant@google.com>
5239
5240         * incremental-dump.cc (dump_incremental_inputs): Change signature
5241         to take a Sized_incremental_binary; change caller.  Use readers
5242         in Sized_incremental_binary.
5243         * incremental.cc
5244         (Sized_incremental_binary::find_incremental_inputs_sections):
5245         Rename do_find_incremental_inputs_sections to this.
5246         (Sized_incremental_binary::setup_readers): New function.
5247         (Sized_incremental_binary::do_check_inputs): Check
5248         has_incremental_info_ flag; move setup code to setup_readers;
5249         use input readers.
5250         (Sized_incremental_binary::do_file_is_unchanged): New function.
5251         (Sized_incremental_binary::do_get_input_reader): New function.
5252         * incremental.h (class Incremental_binary): Move to end of file.
5253         (Incremental_binary::file_is_unchanged): New function.
5254         (Incremental_binary::do_file_is_unchanged): New function.
5255         (Incremental_binary::Input_reader): New class.
5256         (Incremental_binary::get_input_reader): New function.
5257         (class Sized_incremental_binary): Move to end of file.
5258         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5259         input section reader classes.
5260         (Sized_incremental_binary::has_incremental_info): New function.
5261         (Sized_incremental_binary::inputs_reader): New function.
5262         (Sized_incremental_binary::symtab_reader): New function.
5263         (Sized_incremental_binary::relocs_reader): New function.
5264         (Sized_incremental_binary::got_plt_reader): New function.
5265         (Sized_incremental_binary::do_file_is_unchanged): New function.
5266         (Sized_incremental_binary::Sized_input_reader): New class.
5267         (Sized_incremental_binary::get_input_reader): New function.
5268         (Sized_incremental_binary::find_incremental_inputs_sections):
5269         Rename do_find_incremental_inputs_sections to this.
5270         (Sized_incremental_binary::setup_readers): New function.
5271         (Sized_incremental_binary::has_incremental_info_): New data member.
5272         (Sized_incremental_binary::inputs_reader_): New data member.
5273         (Sized_incremental_binary::symtab_reader_): New data member.
5274         (Sized_incremental_binary::relocs_reader_): New data member.
5275         (Sized_incremental_binary::got_plt_reader_): New data member.
5276         (Sized_incremental_binary::current_input_file_): New data member.
5277
5278 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5279
5280         PR gold/12640
5281         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5282         violation.
5283
5284 2011-03-30  Cary Coutant  <ccoutant@google.com>
5285
5286         * archive.cc (Archive::include_member): Adjust call to report_object.
5287         (Add_archive_symbols::run): Add script_info to call to
5288         report_archive_begin.
5289         (Lib_group::include_member): Adjust call to report_object.
5290         (Add_lib_group_symbols::run): Adjust call to report_object.
5291         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5292         blocks.  Add object count for script input files.
5293         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5294         script_info parameter; change all callers.
5295         (Incremental_inputs::report_object): Add script_info parameter;
5296         change all callers.
5297         (Incremental_inputs::report_script): Store backpointer to
5298         incremental info entry.
5299         (Output_section_incremental_inputs::set_final_data_size): Record
5300         additional information for scripts.
5301         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5302         * incremental.h (Incremental_script_entry::add_object): New function.
5303         (Incremental_script_entry::get_object_count): New function.
5304         (Incremental_script_entry::get_object): New function.
5305         (Incremental_script_entry::objects_): New data member; adjust
5306         constructor.
5307         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5308         (Incremental_inputs::report_object): Add script_info parameter.
5309         (Incremental_inputs_reader::get_object_count): New function.
5310         (Incremental_inputs_reader::get_object_offset): New function.
5311         * options.cc (Input_arguments::add_file): Return reference to
5312         new input argument.
5313         * options.h (Input_argument::set_script_info): New function.
5314         (Input_argument::script_info): New function.
5315         (Input_argument::script_info_): New data member; adjust all
5316         constructors.
5317         (Input_file_group::add_file): Return reference to new input argument.
5318         (Input_file_lib::add_file): Likewise.
5319         (Input_arguments::add_file): Likewise.
5320         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5321         * script.cc (Parser_closure::Parser_closure): Add script_info
5322         parameter; adjust all callers.
5323         (Parser_closure::script_info): New function.
5324         (Parser_closure::script_info_): New data member.
5325         (read_input_script): Report scripts earlier to incremental info.
5326         (script_add_file): Set script_info in Input_argument.
5327         (script_add_library): Likewise.
5328         * script.h (Script_options::Script_info): Rewrite class.
5329
5330 2011-03-29  Cary Coutant  <ccoutant@google.com>
5331
5332         * archive.cc (Library_base::should_include_member): Move
5333         method here from class Archive.
5334         (Archive::Archive): Initialize base class.
5335         (Archive::should_include_member): Move to base class.
5336         (Archive::do_for_all_unused_symbols): New function.
5337         (Add_archive_symbols::run): Remove redundant access to
5338         incremental_inputs.
5339         (Lib_group::Lib_group): Initialize base class.
5340         (Lib_group::do_filename): New function.
5341         (Lib_group::include_member): Pass pointer to Lib_group to
5342         report_object.
5343         (Lib_group::do_for_all_unused_symbols): New function.
5344         (Add_lib_group_symbols::run): Report archive information for
5345         incremental links.
5346         * archive.h (class Library_base): New base class.
5347         (class Archive): Derive from Library_base.
5348         (Archive::filename): Move to base class.
5349         (Archive::set_incremental_info): Likewise.
5350         (Archive::incremental_info): Likewise.
5351         (Archive::Should_include): Likewise.
5352         (Archive::should_include_member): Likewise.
5353         (Archive::Armap_entry): Remove.
5354         (Archive::Unused_symbol_iterator): Remove.
5355         (Archive::unused_symbols_begin): Remove.
5356         (Archive::unused_symbols_end): Remove.
5357         (Archive::do_filename): New function.
5358         (Archive::do_get_mtime): New function.
5359         (Archive::do_for_all_unused_symbols): New function.
5360         (Archive::task_): Move to base class.
5361         (Archive::incremental_info_): Likewise.
5362         (class Lib_group): Derive from Library_base.
5363         (Lib_group::do_filename): New function.
5364         (Lib_group::do_get_mtime): New function.
5365         (Lib_group::do_for_all_unused_symbols): New function.
5366         (Lib_group::task_): Move to base class.
5367         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5368         function.
5369         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5370         function.
5371         * incremental.cc (Incremental_inputs::report_archive_begin):
5372         Use Library_base; call library's get_mtime; add incremental inputs
5373         entry before members.
5374         (class Unused_symbol_visitor): New class.
5375         (Incremental_inputs::report_archive_end): Use Library_base; use
5376         visitor class to record unused symbols; don't add incremental inputs
5377         entry after members.
5378         (Incremental_inputs::report_object): Use Library_base.
5379         * incremental.h
5380         (Incremental_archive_entry::Incremental_archive_entry): Remove
5381         unused Archive parameter.
5382         (Incremental_inputs::report_archive_begin): Use Library_base.
5383         (Incremental_inputs::report_archive_end): Likewise.
5384         (Incremental_inputs::report_object): Likewise.
5385         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5386         function.
5387         * object.h (Object::for_all_global_symbols): New function.
5388         (Object::do_for_all_global_symbols): New function.
5389         (Sized_relobj::do_for_all_global_symbols): New function.
5390         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5391         function.
5392         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5393         function.
5394
5395 2011-03-27  Ian Lance Taylor  <iant@google.com>
5396
5397         * archive.cc (Archive::interpret_header): Return -1 if something
5398         goes wrong.  Change callers accordingly.
5399
5400 2011-03-25  Cary Coutant  <ccoutant@google.com>
5401
5402         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5403         * testsuite/Makefile.in: Regenerate.
5404
5405 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5406
5407         * plugin.cc (get_view): New.
5408         (Plugin::load): Pass get_view to the plugin.
5409         (Plugin_manager::get_view): New.
5410
5411 2011-03-21  Ian Lance Taylor  <iant@google.com>
5412
5413         * testsuite/final_layout.sh: Rewrite to not use dc.
5414         * testsuite/relro_test.sh: Fail if dc is not present.
5415
5416 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5417
5418         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5419         Change == to -eq.
5420         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5421         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5422         Change == to -eq.
5423         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5424         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5425
5426 2011-03-14  Ian Lance Taylor  <iant@google.com>
5427
5428         * script-sections.cc (Sort_output_sections::script_compare):
5429         Rename from is_before, change return type.
5430         (Sort_output_sections::operator()): Adjust accordingly.
5431
5432 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5433
5434         PR gold/12572
5435         * testsuite/odr_violation2.cc: Add comment to make all error line
5436         numbers double digits.
5437         * testsuite/debug_msg.sh: Adjust expected errors.
5438
5439 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5440
5441         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5442         but mark earlier ones as non-canonical
5443         (offset_to_iterator): Update search target and example
5444         (do_addr2line): Return extra lines in a vector*
5445         (format_file_lineno): Extract from do_addr2line
5446         (one_addr2line): Add vector* out-param
5447         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5448         when a lineno entry appeared last for its instruction
5449         (Dwarf_line_info): Add vector* out-param
5450         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5451         * symtab.cc (Odr_violation_compare): Include the lineno in the
5452         comparison again.
5453         (linenos_from_loc): New. Combine the canonical line for an
5454         address with its other lines.
5455         (True_if_intersect): New. Helper functor to make
5456         std::set_intersection a query.
5457         (detect_odr_violations): Compare sets of lines instead of just
5458         one line for each function. This became less deterministic, but
5459         has fewer false positives.
5460         * symtab.h: Declarations.
5461         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5462         mix an optimized and non-optimized object in the same binary
5463         (odr_violation2.so): Same.
5464         * testsuite/Makefile.in: Regenerate from Makefile.am.
5465         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5466         * testsuite/debug_msg.sh: Update line numbers and add
5467         assertions.
5468         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5469         non-optimized context.
5470         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5471         isn't inlined, and use OdrDerived in an optimized context.
5472         * testsuite/odr_header1.h: Defines OdrDerived, where
5473         optimization will change the
5474         first-instruction-in-the-destructor's file and line number.
5475         * testsuite/odr_header2.h: Defines OdrBase.
5476
5477 2011-03-09  Ian Lance Taylor  <iant@google.com>
5478
5479         * fileread.cc (File_read::clear_views): Don't delete the whole
5480         file view.
5481
5482 2011-03-08  Ian Lance Taylor  <iant@google.com>
5483
5484         PR gold/12525
5485         * fileread.cc: #include <climits>.
5486         (GOLD_IOV_MAX): Define.
5487         (File_read::read_multiple): Limit number of entries by iov_max.
5488         * fileread.h (class File_read): Always set max_readv_entries to
5489         128.
5490
5491 2011-03-07  Ian Lance Taylor  <iant@google.com>
5492
5493         PR gold/12525
5494         * options.h (class General_options): Add -dy and -dn.
5495
5496 2011-03-02  Cary Coutant  <ccoutant@google.com>
5497
5498         * testsuite/script_test_9.t: Add TLS segment.
5499
5500 2011-03-02  Simon Baldwin  <simonb@google.com>
5501
5502         * configure.ac: Add check for gnu_indirect_function support in
5503         the toolchain building binutils.
5504         * configure: Rebuild.
5505
5506 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5507
5508         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5509         plugin only symbols.
5510         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5511         in plugin files as not needed in the symbol table.
5512
5513 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5514
5515         * output.cc (Output_section::add_input_section): Delay fill
5516         generation for section ordering.
5517
5518 2011-02-09  Ian Lance Taylor  <iant@google.com>
5519
5520         PR gold/12316
5521         * object.h (class Sized_relobj): Remove clear_local_symbols.
5522         * reloc.cc (Sized_relobj::do_relocate): Don't call
5523         clear_local_symbols.
5524
5525 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5526
5527         * plugin.cc (is_visible_from_outside): Return true for symbols
5528         in the -u option.
5529
5530 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5531
5532         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5533         filename.
5534
5535 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5536
5537         * icf.h (is_section_foldable_candidate): Change type of parameter
5538         to std::string.
5539         * icf.cc (Icf::find_identical_sections): Change type of local variable
5540         section_name to be std::string.
5541         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5542
5543 2011-01-25  Ian Lance Taylor  <iant@google.com>
5544
5545         * script.cc (script_add_extern): Rewrite to use
5546         add_symbol_reference.
5547
5548 2011-01-25  Doug Kwan  <dougkwan@google.com>
5549
5550         * icf.cc (get_section_contents): Always lock section's object.
5551
5552 2011-01-24  Ian Lance Taylor  <iant@google.com>
5553
5554         * options.h (class General_options): Accept
5555         --no-detect-odr-violations.
5556
5557 2011-01-24  Ian Lance Taylor  <iant@google.com>
5558
5559         * version.cc (version_string): Bump to 1.11.
5560
5561 2011-01-24  Ian Lance Taylor  <iant@google.com>
5562
5563         * plugin.cc (class Plugin_rescan): Define new class.
5564         (Plugin_manager::claim_file): Set any_claimed_.
5565         (Plugin_manager::save_archive): New function.
5566         (Plugin_manager::save_input_group): New function.
5567         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5568         necessary.
5569         (Plugin_manager::new_undefined_symbol): New function.
5570         (Plugin_manager::rescan): New function.
5571         (Plugin_manager::rescannable_defines): New function.
5572         (Plugin_manager::add_input_file): Set any_added_.
5573         * plugin.h (class Plugin_manager): define new fields rescannable_,
5574         undefined_symbols_, any_claimed_, and any_added_.  Declare
5575         Plugin_rescan as friend.  Declare new functions.
5576         (Plugin_manager::Rescannable): Define type.
5577         (Plugin_manager::Rescannable_list): Define type.
5578         (Plugin_manager::Undefined_symbol_list): Define type.
5579         (Plugin_manager::Plugin_manager): Initialize new fields.
5580         * archive.cc (Archive::defines_symbol): New function.
5581         (Add_archive_symbols::run): Pass archive to plugins if any.
5582         * archive.h (class Archive): Declare defines_symbol.
5583         * readsyms.cc (Input_group::~Input_group): New function.
5584         (Finish_group::run): Pass input_group to plugins if any.
5585         * readsyms.h (class Input_group): Declare destructor.
5586         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5587         any.
5588
5589 2011-01-10  Ian Lance Taylor  <iant@google.com>
5590
5591         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5592         section as relro.
5593         (Layout::set_segment_offsets): Reset increase_relro before calling
5594         set_section_addresses a second time.
5595
5596 2011-01-04  Cary Coutant  <ccoutant@google.com>
5597
5598         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5599         sections before NOBITS sections.
5600
5601 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5602
5603         * version.cc (print_version): Update copyright to 2011.
5604
5605 2010-12-23  Cary Coutant  <ccoutant@google.com>
5606
5607         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5608         of OS to this->add.  Add OD parameter to second form of the function.
5609
5610 2010-12-20  Ian Lance Taylor  <iant@google.com>
5611
5612         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5613         second of two consecutive entries with same offset.
5614
5615 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5616
5617         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5618         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5619         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5620         to avoid unneeded links against $(LDADD).
5621         * testsuite/Makefile.in: Regenerate.
5622
5623 2010-12-15  Ian Lance Taylor  <iant@google.com>
5624
5625         PR gold/12324
5626         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5627         for R_X86_64_32 and R_X86_64_PC32.
5628         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5629         ver_matching_def_pic.o.
5630         (ver_matching_def_pic.o): New target.
5631
5632 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5633
5634         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5635         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5636         Move definition before File_read::View member definitions.
5637         (File_read::View::~View): Initialize and hold lock before
5638         updating current_mapped_bytes.
5639
5640 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5641
5642         * dwarf_reader.cc: Remove outdated comment.
5643         * gold-threads.cc: Fix typo in error message.
5644         * archive.cc: Fix typos in comments.
5645         * archive.h: Likewise.
5646         * arm-reloc-property.cc: Likewise.
5647         * arm-reloc-property.h: Likewise.
5648         * arm-reloc.def: Likewise.
5649         * arm.cc: Likewise.
5650         * attributes.h: Likewise.
5651         * cref.cc: Likewise.
5652         * ehframe.cc: Likewise.
5653         * fileread.h: Likewise.
5654         * gold.h: Likewise.
5655         * i386.cc: Likewise.
5656         * icf.cc: Likewise.
5657         * incremental.h: Likewise.
5658         * int_encoding.cc: Likewise.
5659         * layout.h: Likewise.
5660         * main.cc: Likewise.
5661         * merge.h: Likewise.
5662         * object.cc: Likewise.
5663         * object.h: Likewise.
5664         * options.cc: Likewise.
5665         * readsyms.cc: Likewise.
5666         * reduced_debug_output.cc: Likewise.
5667         * reloc.cc: Likewise.
5668         * script-sections.cc: Likewise.
5669         * sparc.cc: Likewise.
5670         * symtab.h: Likewise.
5671         * target-reloc.h: Likewise.
5672         * target.cc: Likewise.
5673         * target.h: Likewise.
5674         * timer.cc: Likewise.
5675         * timer.h: Likewise.
5676         * x86_64.cc: Likewise.
5677
5678 2010-12-09  Cary Coutant  <ccoutant@google.com>
5679
5680         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5681         stack.
5682         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5683         parameter; change all callers.
5684         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5685         * options.h (warn_execstack): New option.
5686
5687 2010-12-07  Doug Kwan  <dougkwan@google.com>
5688
5689         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5690         like function call relocations.
5691
5692 2010-12-07  Ian Lance Taylor  <iant@google.com>
5693
5694         * archive.cc (Archive::get_elf_object_for_member): Permit
5695         punconfigured to be NULL.
5696         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5697         (Archive::include_member): Pass NULL to get_elf_object_for_member
5698         if we searched for the archive and this is the first included
5699         object.
5700
5701 2010-12-01  Ian Lance Taylor  <iant@google.com>
5702
5703         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5704         track_relocs_type_ field.
5705         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5706         Set track_relocs_type_.
5707         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5708         contents when using RELA relocs.
5709         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5710         reloc_map_.
5711         * reloc.cc (Track_relocs::next_addend): New function.
5712         * reloc.h (class Track_relocs): Declare next_addend.
5713
5714 2010-12-01  Ian Lance Taylor  <iant@google.com>
5715
5716         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5717         virtual destructor.
5718
5719 2010-12-01  Ian Lance Taylor  <iant@google.com>
5720
5721         * README: Update compilers known to work and fail.
5722
5723 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5724
5725         * configure.in: For --enable-gold, handle value `default' instead of
5726         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5727         not the default.
5728         * configure: Regenerate.
5729
5730 2010-11-18  Doug Kwan  <dougkwan@google.com>
5731
5732         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5733         and right_alignment to be zero.  Store result alignment only if it is
5734         greater than existing alignment.
5735
5736 2010-11-16  Cary Coutant  <ccoutant@google.com>
5737
5738         PR gold/12220
5739         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5740         Check for ".zdebug_line".
5741
5742 2010-11-16  Doug Kwan  <dougkwan@google.com>
5743             Cary Coutant  <ccoutant@google.com>
5744
5745         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5746         by reference; adjust all callers.
5747         * output.cc (Output_segment::set_section_addresses): Adjust references
5748         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5749         list is empty.
5750         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5751         end at page boundary.
5752
5753 2010-11-16  Cary Coutant  <ccoutant@google.com>
5754
5755         PR gold/12220
5756         * layout.cc (Layout::choose_output_section): Transform names of
5757         compressed sections even when using a script with a SECTIONS clause.
5758         (Layout::output_section_name): Remove code to transform
5759         compressed debug section names.
5760         * output.cc (Output_section::add_input_section): Use uncompressed
5761         section size when tracking input sections.
5762
5763 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5764
5765         * symtab.h (Symbol::NON_PIC_REF): Remove.
5766         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5767         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5768         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5769         (Symbol::use_plt_offset): Take a flags argument and pass it
5770         directly to needs_dynamic_reloc.  Restrict check for undefined
5771         weak symbols to function calls.
5772         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5773         (Target_arm::Scan::global): Use it.
5774         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5775         (Target_arm::Relocate::relocate): Likewise.
5776         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5777         parameter with an r_type parameter.  Use get_reference_flags
5778         to get the flags.
5779         (Target_arm::Relocate::relocate): Update accordingly.
5780         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5781         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5782         (Target_i386::Scan::global): Likewise.
5783         (Target_i386::Relocate::relocate): Likewise.
5784         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5785         parameter with an r_type parameter.  Use get_reference_flags
5786         to get the flags.
5787         (Target_i386::Relocate::relocate): Update accordingly.
5788         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5789         (Target_powerpc::Scan::global): Use it.
5790         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5791         (Target_powerpc::Relocate::relocate): Likewise.
5792         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5793         (Target_sparc::Scan::global): Use it.
5794         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5795         (Target_sparc::Relocate::relocate): Likewise.
5796         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5797         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5798         (Target_x86_64::Scan::global): Likewise.
5799         (Target_x86_64::Relocate::relocate): Likewise.
5800
5801 2010-11-08  Doug Kwan  <dougkwan@google.com>
5802             Cary Coutant  <ccoutant@google.com>
5803
5804         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5805         (Arm_exidx_merge_section::section_contents_): New data member.
5806         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5807         (Arm_input_section::~Arm_input_section): De-allocate memory.
5808         (Arm_input_section::original_contents_): New data member.
5809         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5810         in parameters instead of calling Object::section_contents without
5811         locking.
5812         (Arm_output_section::group_section): New parameter TASK.  Pass it
5813         to callees that need locking objects.
5814         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5815         to lock EXIDX input sections.  Fix a formatting issue.  Call
5816         Arm_exidx_merged_section::build_contents to create merged section
5817         contents.
5818         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5819         to lock object of stub table owner.
5820         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5821         TEXT_SIZE to initialize data member TEXT_SIZE_.
5822         (Arm_exidx_input_section::addralign): Fix typo in comment.
5823         (Arm_exidx_input_section::text_size): New method.
5824         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5825         that require locking objects.  Lock objects before scanning for stubs
5826         and updating local symbols.
5827         (Arm_input_section<big_endian>::init): Copy contents of original
5828         input section.
5829         (Arm_input_section<big_endian>::do_write): Use saved contents of
5830         original input section instead of calling Object::section_contents
5831         without locking.
5832         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5833         size without calling Object::section_size().
5834         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5835         for size.  Allocate a buffer for merged EXIDX entries.
5836         (Arm_exidx_merged_section::build_contents): New method.
5837         (Arm_exidx_merged_section::do_write): Move merge section contents
5838         building code to Arm_exidx_merged_section::build_contetns.  Write
5839         out contetns in buffer instead of building it on the fly.
5840         (Arm_relobj::make_exidx_input_section): Also pass text section size
5841         to Arm_exidx_input_section constructor.
5842         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5843         (Arm_dynobj::do_read_symbols): Fix memory leak.
5844         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5845         * target.h: (class Task): Add forward declaration.
5846         (Target::relax): Add new parameter TASK and pass it to
5847         Target::do_relax().
5848         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5849
5850 2010-11-05  Cary Coutant  <ccoutant@google.com>
5851
5852         PR gold/10708
5853         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5854         object when reading from the file.
5855         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5856         second layout pass.
5857         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5858         when reading section contents.
5859         (get_section_contents): Likewise.
5860         (icf::find_identical_sections): Likewise.
5861         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5862         object when reading from the file.
5863         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5864         the object when doing deferred section layout.
5865
5866 2010-11-03  Nick Clifton  <nickc@redhat.com>
5867
5868         PR gold/12001
5869         * script.h (class Symbol_assignment: name): New member.  Returns
5870         the name of the symbol.
5871         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5872         Returns true if the given symbol name is on the list of
5873         assignments wating to be processed.
5874         * archive.cc (should_incldue_member): If the symbol is undefined,
5875         check to see if it is on the list of symbols pending assignment.
5876
5877 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5878
5879         * script-sections.cc (Script_sections::find_memory_region): Check
5880         for a NULL output section pointer.
5881
5882 2010-10-29  Doug Kwan  <dougkwan@google.com>
5883
5884         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5885         Output_section::add_relaxed_input_section.
5886         * output.cc (Output_section::add_relaxed_input_section): Add new
5887         arguments LAYOUT and NAME.  Set section order index.
5888         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5889         Copy section order index.
5890         * output.h (Output_section::add_relaxed_input_section): Add new
5891         arguments LAYOUT and NAME.
5892
5893 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5894
5895         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5896         NATIVE_OR_CROSS_LINKER.
5897         * testsuite/Makefile.in: Regenerate.
5898
5899 2010-10-20  Doug Kwan  <dougkwan@google.com>
5900
5901         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5902         without SHF_LINK_ORDER flags.
5903         * layout.cc (Layout::choose_output_section): Do not filter
5904         SHF_LINK_ORDER flag in a relocatable link.
5905
5906 2010-10-17  Cary Coutant  <ccoutant@google.com>
5907
5908         * output.h (Output_segment::set_section_addresses): Change function
5909         signature.  Update all callers.
5910         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5911         sections.
5912         (Output_segment::set_section_addresses): Align after last TLS
5913         section.  Add padding before last relro section instead of after.
5914
5915 2010-10-17  Doug Kwan  <dougkwan@google.com>
5916
5917         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5918         GOT output section to be writable.
5919
5920 2010-10-14  Cary Coutant  <ccoutant@google.com>
5921
5922         * debug.h (DEBUG_INCREMENTAL): New flag.
5923         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5924         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5925         mode.
5926         * incremental.cc (report_command_line): Ignore all forms of
5927         --incremental.
5928         * layout.cc (Layout::Layout): Check parameters for incremental link
5929         mode.
5930         * options.cc (General_options::parse_incremental): New function.
5931         (General_options::parse_no_incremental): New function.
5932         (General_options::parse_incremental_full): New function.
5933         (General_options::parse_incremental_update): New function.
5934         (General_options::incremental_mode_): New data member.
5935         (General_options::finalize): Check incremental_mode_.
5936         * options.h (General_options): Update help text for --incremental.
5937         Add --no-incremental, --incremental-full, --incremental-update.
5938         (General_options::Incremental_mode): New enum type.
5939         (General_options::incremental_mode): New function.
5940         (General_options::incremental_mode_): New data member.
5941         * parameters.cc (Parameters::incremental_mode_): New data member.
5942         (Parameters::set_options): Set incremental_mode_.
5943         (Parameters::set_incremental_full): New function.
5944         (Parameters::incremental): New function.
5945         (Parameters::incremental_update): New function.
5946         (set_parameters_incremental_full): New function.
5947         * parameters.h (Parameters::set_incremental_full): New function.
5948         (Parameters::incremental): New function.
5949         (Parameters::incremental_update): New function.
5950         (Parameters::incremental_mode_): New data member.
5951         (set_parameters_incremental_full): New function.
5952         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5953         incremental link mode.
5954         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5955         (Sized_relobj::do_relocate_sections): Likewise.
5956         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5957         option.
5958         * testsuite/Makefile.in: Regenerate.
5959         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5960
5961 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5962
5963         * script-sections.h (class Script_sections): Make
5964         Sections_elements typedef public.
5965         * script-sections.cc (class Sort_output_sections): Add elements_
5966         field.  Add constructor which sets it; change all callers.
5967         (Sort_output_sections::is_before): New function.
5968         (Sort_output_sections::operator()): Call is_before.
5969         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5970         conditional.
5971         * testsuite/script_test_10.sh: New test. Test script section
5972         order.
5973         * testsuite/script_test_10.t: Likewise.
5974         * testsuite/script_test_10.s: Likewise.
5975         * testsuite/Makefile.am: Wrap the cross linker tests and the
5976         common tests into NATIVE_OR_CROSS_LINKER.
5977         (check_SCRIPTS): Add script_test_10.sh.
5978         (check_DATA): Add script_test_10.stdout.
5979         (script_test_10.o, script_test_10): New targets.
5980         (script_test_10.stdout): New target.
5981         * configure, testsuite/Makefile.in: Regenerate.
5982
5983 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5984
5985         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5986         error for the deprecated relocations.
5987         (Target_arm::Scan::global): Likewise.
5988         (Target_arm::Relocate::relocate): Likewise.
5989
5990 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5991
5992         * fileread.cc (Input_file::find_file): Initialize *found_name
5993         and *namep when using the fallback search for case 4.
5994
5995 2010-10-11  Cary Coutant  <ccoutant@google.com>
5996
5997         * options.h (class General_options): Redefine -z lazy as an alias for
5998         the negation of -z now.
5999
6000 2010-10-11  Ian Lance Taylor  <iant@google.com>
6001
6002         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6003         binding.
6004
6005 2010-10-06  Nick Clifton  <nickc@redhat.com>
6006
6007         * script-sections.cc(class Memory_region): Remove
6008         current_lma_offset_ field.  Rename current_vma_offset_ to
6009         current_offset_.  Add last_section_ field.
6010         (Memory_region::get_current_vma_address): Rename to
6011         get_current_address.
6012         (Memory_region::get_current_lma_address): Delete.
6013         (Memory_region::increment_vma_offset): Rename to
6014         increment_offset.
6015         (Memory_region::increment_lma_offset): Delete.
6016         (Memory_region::attributes_compatible): New method.  Returns
6017         true if the provided section is compatible with the region.
6018         (Memory_region::get_last_section): New method.  Returns the last
6019         section to use the region.
6020         (Memory_region::set_last_section): New method.  Stores the last
6021         section to use the region.
6022         (Script_sections::block_in_region): New method.  Returns true if
6023         a block of memory is contained within a region.
6024         (Script_sections::find_memory_region): New method.  Locates a
6025         memory region to be used to set a VMA or LMA address.
6026         (Output_section_definition::set_section_addresses): Add code to
6027         check for addresses set by memory regions.
6028         (Output_segment::set_section_addresses): Remove memory region
6029         walking code.
6030         (Script_sections::create_segment): Add a warning if a header
6031         segment is created outside of any region.
6032         * script-sections.h (class Script_sections): Add prototypes for
6033         find_memory_region and block_in_region methods.
6034         * testsuite/memory_test.s: Use .long instead of .word.
6035         * testsuite/memory_test.t: Add some more output sections.
6036         * testsuite/memory_test.sh: Update expected output.
6037
6038 2010-10-02  Doug Kwan  <dougkwan@google.com>
6039
6040         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6041         defintion to symtab.h
6042         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6043         declaration to defintion.
6044
6045 2010-10-01  Nick Clifton  <nickc@redhat.com>
6046
6047         * expression.cc (eval): Replace dummy argument with NULL.
6048         (eval_maybe_dot): Check for a NULL result section pointer.
6049         (Symbol_expression::value): Likewise.
6050         (Dot_expression::value): Likewise.
6051         (BINARY_EXPRESSION): Likewise.
6052         (Max_expression::value): Likewise.
6053         (Min_expression::value): Likewise.
6054         (Absolute_expression::value): Likewise.
6055         (Addr_expression::value_from_output_section): Likewise.
6056         (Loaddddr_expression::value_from_output_section): Likewise.
6057         (Segment_start_expression::value): Likewise.
6058         * script-sections.cc
6059         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6060         argument with NULL.
6061         (Sections_elememt_dot_assignment::set_section_addresses):
6062         Likewise.
6063         (Output_data_expression::do_write_to_buffer): Likewise.
6064         (Output_section_definition::finalize_symbols): Likewise.
6065         (Output_section_definition::set_section_addresses): Likewise.
6066
6067 2010-09-30  Doug Kwan  <dougkwan@google.com>
6068
6069         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6070
6071 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6072
6073         * target.h (Target::can_icf_inline_merge_sections): New virtual
6074         function.
6075         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6076         virtual function.
6077         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6078         virtual function.
6079         * icf.cc (get_section_contents): Inline merge sections only when
6080         target allows it.
6081
6082 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6083
6084         * configure: Regenerate.
6085
6086 2010-09-17  Ian Lance Taylor  <iant@google.com>
6087
6088         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6089         * testsuite/Makefile.am (memory_test.o): New target.
6090         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6091         memory_test.t.
6092         * testsuite/Makefile.in: Rebuild.
6093
6094 2010-09-17  Doug Kwan  <dougkwan@google.com>
6095
6096         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6097         defintion if relocation uses GOT entries of the symbol.
6098         * testsuite/icf_safe_test.sh: Fix test.
6099         * testsuite/icf_safe_so_test.sh: Fix test.
6100
6101 2010-09-16  Cary Coutant  <ccoutant@google.com>
6102
6103         * script_sections.cc (class Memory_region): Remove "NULL" from
6104         vector initializations.
6105
6106 2010-09-15  Cary Coutant  <ccoutant@google.com>
6107
6108         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6109         Resolve forwarding symbols.
6110
6111 2010-09-15  Doug Kwan  <dougkwan@google.com>
6112
6113         * gold/testsuite/script_test_3.t: Add ARM special sections.
6114         * gold/testsuite/script_test_4.t: Same.
6115         * gold/testsuite/script_test_5.t: Same.
6116         * gold/testsuite/script_test_6.t: Same.
6117         * gold/testsuite/script_test_7.t: Same.
6118         * gold/testsuite/script_test_7.t: Same.
6119         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6120
6121 2010-09-14  Cary Coutant  <ccoutant@google.com>
6122
6123         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6124         (Target_x86_64::Relocate::relocate_tls): Replace check for
6125         saw_tls_block_reloc_ with test for executable section.
6126
6127 2010-09-12  Cary Coutant  <ccoutant@google.com>
6128
6129         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6130         position-independent executables to shared libraries need dynamic
6131         relocations.
6132         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6133         position-independent executables.
6134         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6135         * testsuite/Makefile.in: Regenerate.
6136
6137 2010-09-10  Nick Clifton  <nickc@redhat.com>
6138
6139         PR gold/11997
6140         * testsuite/memory_test.t: Discard any sections that are not
6141         needed.
6142
6143 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6144
6145         PR gold/11996
6146         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6147         "This::" to work around a bug in gcc 4.2.
6148
6149         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6150
6151 2010-09-09  Rafael Espindola  <espindola@google.com>
6152
6153         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6154         sections with different PF_X flags in the same segment.
6155         (Layout::find_first_load_seg): Search all segments to find the first
6156         one.
6157         * options.h (rosegment): New.
6158
6159 2010-09-08  Rafael Espindola  <espindola@google.com>
6160
6161         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6162
6163 2010-09-08  Doug Kwan  <dougkwan@google.com>
6164
6165         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6166         (Arm_relobj::do_relocate_sections): Add new parameter for output
6167         file to match the parent.
6168         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6169         of local symbols instead of input values.  Update code to track
6170         changes in gold::relocate_section.
6171         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6172         (Sized_relobj::compute_final_local_value_internal): New methods.
6173         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6174         body into private version of Sized_relobj::compute_final_local_value.
6175         Call the inline method.
6176         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6177         merged symbol value if there is one.
6178         (Symbol_value::has_output_value): New method defintiion.
6179         (Sized_relobj::Compute_final_local_value_status): New enum type.
6180         (Sized_relobj::compute_final_local_value): New methods.
6181         (Sized_relobj::compute_final_local_value_internal): New methods.
6182         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6183         and arm_cortex_a8.sh.
6184         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6185         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6186         New tests.
6187         * Makefile.in: Regenerate.
6188         * testsuite/arm_bl_out_of_range.s: Update test.
6189         * testsuite/thumb_bl_out_of_range.s: Ditto.
6190         * testsuite/thumb_blx_out_of_range.s: Ditto.
6191         * testsuite/arm_branch_out_of_range.sh: New file.
6192         * testsuite/arm_cortex_a8.sh: Ditto.
6193         * testsuite/arm_cortex_a8_b.s: Ditto.
6194         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6195         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6196         * testsuite/arm_cortex_a8_bl.s: Ditto.
6197         * testsuite/arm_cortex_a8_blx.s: Ditto.
6198         * testsuite/arm_cortex_a8_local.s: Ditto.
6199         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6200         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6201
6202 2010-09-08  Rafael Espindola  <espindola@google.com>
6203
6204         * Makefile.am (memory_test.stdout): Run readelf with -W.
6205         * Makefile.in: Regenerate.
6206         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6207         64 bit output.
6208
6209 2010-09-08  Rafael Espindola  <espindola@google.com>
6210
6211         * script-sections.cc (Script_sections::add_memory_region): Convert
6212         field precision to int.
6213         * script.cc (script_set_section_region, script_set_section_region):
6214         Convert field precision to int.
6215
6216 2010-09-08  Rafael Espindola  <espindola@google.com>
6217
6218         * arm.cc (do_finalize_sections): Create the __exidx_start and
6219         __exdix_end symbols even when the section is missing.
6220
6221 2010-09-08  Nick Clifton  <nickc@redhat.com>
6222
6223         * README: Remove claim that MEMORY is not supported.
6224         * expression.cc (script_exp_function_origin)
6225         (script_exp_function_length): Move from here to ...
6226         * script.cc: ... here.
6227         (script_set_section_region, script_add_memory)
6228         (script_parse_memory_attr, script_include_directive): New
6229         functions.
6230         * script-sections.cc
6231         (class Memory_region): New class.
6232         (class Output_section_definition): Add set_memory_region,
6233         set_section_vma, set_section_lma and get_section_name methods.
6234         (class Script_Sections): Add add_memory_region,
6235         find_memory_region, find_memory_region_origin,
6236         find_memory_region_length and set_memory_region methods.
6237         Have set_section_addresses method walk the list of set memory
6238         regions.
6239         Extend the print methos to display memory regions.
6240         * script-sections.h: Add prototypes for new methods.
6241         Add enum for MEMORY region attributes.
6242         * yyscript.y: Add support for parsing MEMORY regions.
6243         * script-c.h: Add prototypes for new functions.
6244         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6245         * testsuite/Makefile.in: Regenerate.
6246         * testsuite/memory_test.sh: New script.
6247         * testsuite/memory_test.s: New assembler source file.
6248         * testsuite/memory_test.t: New linker script.
6249
6250 2010-08-27  Doug Kwan  <dougkwan@google.com>
6251
6252         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6253         reference override an existing dynamic weak reference.
6254         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6255         * testsuite/Makefile.in: Regenerate.
6256         * testsuite/dyn_weak_ref.sh: New file.
6257         * testsuite/dyn_weak_ref_1.c: Ditto.
6258         * testsuite/dyn_weak_ref_2.c: Ditto.
6259
6260 2010-08-27  Ian Lance Taylor  <iant@google.com>
6261
6262         * incremental.h (class Incremental_input_entry): Add virtual
6263         destructor.
6264
6265 2010-08-27  Ian Lance Taylor  <iant@google.com>
6266
6267         * testsuite/start_lib_test_3.c: Mark t3 as used.
6268
6269 2010-08-27  Nick Clifton  <nickc@redhat.com>
6270
6271         * options.cc (version_script): Fix small typo in previous
6272         whitespace tidyup.
6273
6274 2010-08-25  Nick Clifton  <nickc@redhat.com>
6275
6276         * archive.cc: Formatting fixes: Remove whitespace between
6277         typename and following asterisk.  Remove whitespace between
6278         function name and opening parenthesis.
6279         * archive.h: Likewise.
6280         * arm.cc: Likewise.
6281         * attributes.cc: Likewise.
6282         * attributes.h: Likewise.
6283         * common.cc: Likewise.
6284         * copy-relocs.cc: Likewise.
6285         * dirsearch.h: Likewise.
6286         * dynobj.cc: Likewise.
6287         * ehframe.cc: Likewise.
6288         * ehframe.h: Likewise.
6289         * expression.cc: Likewise.
6290         * fileread.cc: Likewise.
6291         * fileread.h: Likewise.
6292         * gc.h: Likewise.
6293         * gold-threads.cc: Likewise.
6294         * gold.cc: Likewise.
6295         * i386.cc: Likewise.
6296         * icf.h: Likewise.
6297         * incremental-dump.cc: Likewise.
6298         * incremental.cc: Likewise.
6299         * layout.cc: Likewise.
6300         * layout.h: Likewise.
6301         * main.cc: Likewise.
6302         * merge.cc: Likewise.
6303         * merge.h: Likewise.
6304         * object.cc: Likewise.
6305         * object.h: Likewise.
6306         * options.cc: Likewise.
6307         * options.h: Likewise.
6308         * output.cc: Likewise.
6309         * output.h: Likewise.
6310         * plugin.cc: Likewise.
6311         * plugin.h: Likewise.
6312         * powerpc.cc: Likewise.
6313         * reloc.cc: Likewise.
6314         * script-c.h: Likewise.
6315         * script-sections.cc: Likewise.
6316         * script.cc: Likewise.
6317         * stringpool.cc: Likewise.
6318         * symtab.cc: Likewise.
6319         * symtab.h: Likewise.
6320         * target.cc: Likewise.
6321         * timer.cc: Likewise.
6322         * timer.h: Likewise.
6323         * version.cc: Likewise.
6324         * x86_64.cc: Likewise.
6325
6326 2010-08-24  Nick Clifton  <nickc@redhat.com>
6327
6328         PR 11899
6329         * layout.cc (segment_precedes): Sort segments by their physical
6330         addresses, if they have been set.
6331
6332 2010-08-23  Cary Coutant  <ccoutant@google.com>
6333
6334         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6335         symbols data.
6336         (Lib_group::include_member): Unlock object after deleting its
6337         symbols data.
6338         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6339         the bug fixed here.
6340
6341 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6342             Cary Coutant  <ccoutant@google.com>
6343
6344         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6345         constructor, and set_blocker.
6346         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6347         readsyms_blocker_.
6348         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6349         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6350         * testsuite/Makefile.am (start_lib_test): New test case.
6351         * testsuite/Makefile.in: Regenerate.
6352         * testsuite/start_lib_test_main.c: New file.
6353         * testsuite/start_lib_test_1.c: New file.
6354         * testsuite/start_lib_test_2.c: New file.
6355         * testsuite/start_lib_test_3.c: New file.
6356
6357 2010-08-19  Ian Lance Taylor  <iant@google.com>
6358
6359         * Makefile.in: Rebuild with automake 1.11.1.
6360         * aclocal.m4: Likewise.
6361         * testsuite/Makefile.in: Likewise.
6362
6363 2010-08-19  Ian Lance Taylor  <iant@google.com>
6364
6365         PR 10893
6366         * i386.cc (class Output_data_plt_i386): Update declarations.
6367         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6368         local_ifuncs_ fields.
6369         (Target_i386::do_plt_section_for_global): New function.
6370         (Target_i386::do_plt_section_for_local): New function.
6371         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6372         parameter; change all callers.  Initialize global_ifuncs_ and
6373         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6374         __rel_iplt_end.
6375         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6376         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6377         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6378         symbols.
6379         (Target_i386::make_plt_section): New function, broken out of
6380         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6381         (Target_i386::make_plt_entry): Call make_plt_section.
6382         (Target_i386::make_local_ifunc_plt_entry): New function.
6383         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6384         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6385         R_386_IRELATIVE to switch.
6386         (Target_i386::Scan::global): Likewise.
6387         (Target_i386::Relocate::relocate): Likewise.
6388         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6389         switch.
6390         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6391         (Target_x86_64::do_plt_section_for_global): New function.
6392         (Target_x86_64::do_plt_section_for_local): New function.
6393         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6394         parameter; change all callers.  If doing a static link define
6395         __rela_iplt_start and __rela_iplt_end.
6396         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6397         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6398         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6399         to point to .plt.
6400         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6401         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6402         switch.
6403         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6404         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6405         R_X86_64_IRELATIVE to switch.
6406         (Target_x86_64::Scan::global): Likewise.
6407         (Target_x86_64::Relocate::relocate): Likewise.
6408         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6409         switch.
6410         * target.h (class Target): Add plt_section_for_global and
6411         plt_section_for_local functions.  Add do_plt_section_for_global
6412         and do_plt_section_for_local virtual functions.
6413         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6414         clarifying comments.
6415         (Symbol::use_plt_offset): Handle IFUNC symbol.
6416         * object.cc (Sized_relobj::Sized_relobj): Initialize
6417         local_plt_offsets_.
6418         (Sized_relobj::local_has_plt_offset): New function.
6419         (Sized_relobj::local_plt_offset): New function.
6420         (Sized_relobj::set_local_plt_offset): New function.
6421         (Sized_relobj::do_count): Handle IFUNC symbol.
6422         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6423         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6424         is_ifunc_symbol functions.
6425         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6426         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6427         local_plt_offsets_ field.
6428         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6429         * output.h (class Output_section_data): Add non-const
6430         output_section function.
6431         (class Output_data_got): Update declarations.
6432         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6433         Add use_plt_offset parameter to global and local constructors.
6434         Change all callers.  Change local_sym_index_ field to 31 bits.
6435         Change GSYM_CODE and CONSTANT_CODE accordingly.
6436         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6437         doing a static link don't set sh_link field.
6438         (Output_data_got::Got_entry::write): Use PLT offset if
6439         appropriate.
6440         (Output_data_got::add_global_plt): New function.
6441         (Output_data_got::add_local_plt): New function.
6442         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6443         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6444         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6445         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6446         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6447         IFUNC conditional.
6448         * testsuite/ifunc-sel.h: New file.
6449         * testsuite/ifuncmain1.c: New file.
6450         * testsuite/ifuncmain1vis.c: New file.
6451         * testsuite/ifuncmod1.c: New file.
6452         * testsuite/ifuncdep2.c: New file.
6453         * testsuite/ifuncmain2.c: New file.
6454         * testsuite/ifuncmain3.c: New file.
6455         * testsuite/ifuncmod3.c: New file.
6456         * testsuite/ifuncmain4.c: New file.
6457         * testsuite/ifuncmain5.c: New file.
6458         * testsuite/ifuncmod5.c: New file.
6459         * testsuite/ifuncmain6pie.c: New file.
6460         * testsuite/ifuncmod6.c: New file.
6461         * testsuite/ifuncmain7.c: New file.
6462         * configure, testsuite/Makefile.in: Rebuild.
6463
6464 2010-08-18  Ian Lance Taylor  <iant@google.com>
6465
6466         * incremental.cc
6467         (Output_section_incremental_inputs::write_input_files): Add cast
6468         to avoid signed/unsigned comparison warning.
6469         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6470
6471 2010-08-12  Cary Coutant  <ccoutant@google.com>
6472
6473         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6474
6475 2010-08-13  Ian Lance Taylor  <iant@google.com>
6476
6477         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6478
6479 2010-08-12  Cary Coutant  <ccoutant@google.com>
6480             Doug Kwan  <dougkwan@google.com>
6481
6482         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6483         defintion overrides non-weak undef, remember that the original undef
6484         is not weak.
6485         * symtab.cc (Symbol_table::sized_write_global): For undef without
6486         an original weak binding, set binding to global in output.
6487         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6488         * testsuite/Makefile.in: Regenerate.
6489         * testsuite/strong_ref_weak_def.sh: New file.
6490         * testsuite/strong_ref_weak_def_1.c: Ditto.
6491         * testsuite/strong_ref_weak_def_2.c: Ditto.
6492
6493 2010-08-12  Cary Coutant  <ccoutant@google.com>
6494
6495         * testsuite/incremental_test.sh: Rewrite.
6496         * testsuite/incremental_test_1.c: Rewrite.
6497         * testsuite/incremental_test_2.c: Rewrite.
6498
6499 2010-08-12  Cary Coutant  <ccoutant@google.com>
6500
6501         * arm.cc (Target_arm::got_size): Add const.
6502         (Target_arm::got_entry_count): New function.
6503         (Target_arm::plt_entry_count): New function.
6504         (Target_arm::first_plt_entry_offset): New function.
6505         (Target_arm::plt_entry_size): New function.
6506         (Output_data_plt_arm::entry_count): New function.
6507         (Output_data_plt_arm::first_plt_entry_offset): New function.
6508         (Output_data_plt_arm::get_plt_entry_size): New function.
6509         * i386.cc (Target_i386::got_size): Add const.
6510         (Target_i386::got_entry_count): New function.
6511         (Target_i386::plt_entry_count): New function.
6512         (Target_i386::first_plt_entry_offset): New function.
6513         (Target_i386::plt_entry_size): New function.
6514         (Output_data_plt_i386::entry_count): New function.
6515         (Output_data_plt_i386::first_plt_entry_offset): New function.
6516         (Output_data_plt_i386::get_plt_entry_size): New function.
6517         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6518         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6519         * incremental.cc: Include target.h.
6520         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6521         parameter.  Adjust all callers.  Find incremental_got_plt section.
6522         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6523         section.
6524         (Output_section_incremental_inputs::set_final_data_size): Calculate
6525         size of incremental_got_plt section.
6526         (Output_section_incremental_inputs::do_write): Write the
6527         incremental_got_plt section.
6528         (Got_plt_view_info): New struct.
6529         (Local_got_offset_visitor): New class.
6530         (Global_got_offset_visitor): New class.
6531         (Global_symbol_visitor_got_plt): New class.
6532         (Output_section_incremental_inputs::write_got_plt): New function.
6533         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6534         Add parameter.  Adjust all callers.
6535         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6536         (Incremental_inputs::got_plt_section): New function.
6537         (Incremental_inputs::got_plt_section_): New data member.
6538         (Incremental_got_plt_reader): New class.
6539         * layout.cc (Layout::create_incremental_info_sections): Add the
6540         incremental_got_plt section.
6541         * object.h (Got_offset_list::get_list): New function.
6542         (Got offset_list::for_all_got_offsets): New function.
6543         (Sized_relobj::local_got_offset_list): New function.
6544         * powerpc.cc (Target_powerpc::got_size): Add const.
6545         (Target_powerpc::got_entry_count): New function.
6546         (Target_powerpc::plt_entry_count): New function.
6547         (Target_powerpc::first_plt_entry_offset): New function.
6548         (Target_powerpc::plt_entry_size): New function.
6549         (Output_data_plt_powerpc::entry_count): New function.
6550         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6551         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6552         * sparc.cc (Target_sparc::got_size): Add const.
6553         (Target_sparc::got_entry_count): New function.
6554         (Target_sparc::plt_entry_count): New function.
6555         (Target_sparc::first_plt_entry_offset): New function.
6556         (Target_sparc::plt_entry_size): New function.
6557         (Output_data_plt_sparc::entry_count): New function.
6558         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6559         (Output_data_plt_sparc::get_plt_entry_size): New function.
6560         * symtab.h (Symbol::got_offset_list): New function.
6561         (Symbol_table::for_all_symbols): New function.
6562         * target.h (Sized_target::got_entry_count): New function.
6563         (Sized_target::plt_entry_count): New function.
6564         (Sized_target::plt_entry_size): New function.
6565         * x86_64.cc (Target_x86_64::got_size): Add const.
6566         (Target_x86_64::got_entry_count): New function.
6567         (Target_x86_64::plt_entry_count): New function.
6568         (Target_x86_64::first_plt_entry_offset): New function.
6569         (Target_x86_64::plt_entry_size): New function.
6570         (Output_data_plt_x86_64::entry_count): New function.
6571         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6572         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6573
6574 2010-08-12  Cary Coutant  <ccoutant@google.com>
6575
6576         * archive.cc: Include incremental.h.
6577         (Archive::Archive): Initialize incremental_info_.
6578         (Archive::include_member): Record archive members in incremental info.
6579         (Add_archive_symbols::run): Record begin and end of an archive in
6580         incremental info.
6581         (Lib_group::include_member): Record objects in incremental info.
6582         * archive.h (Incremental_archive_entry): Forward declaration.
6583         (Archive::set_incremental_info): New member function.
6584         (Archive::incremental_info): New member function.
6585         (Archive::Unused_symbol_iterator): New class.
6586         (Archive::unused_symbols_begin): New member function.
6587         (Archive::unused_symbols_end): New member function.
6588         (Archive::incremental_info_): New data member.
6589         * incremental-dump.cc (find_input_containing_global): New function.
6590         (dump_incremental_inputs): Dump new incremental info sections.
6591         * incremental.cc: Include symtab.h.
6592         (Output_section_incremental_inputs): New class.
6593         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6594         new incremental info sections.
6595         (Sized_incremental_binary::do_check_inputs): Likewise.
6596         (Incremental_inputs::report_archive): Remove.
6597         (Incremental_inputs::report_archive_begin): New function.
6598         (Incremental_inputs::report_archive_end): New function.
6599         (Incremental_inputs::report_object): New function.
6600         (Incremental_inputs::finalize_inputs): Remove.
6601         (Incremental_inputs::report_input_section): New function.
6602         (Incremental_inputs::report_script): Rewrite.
6603         (Incremental_inputs::finalize): Do nothing but finalize string table.
6604         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6605         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6606         (Incremental_inputs::create_data_sections): New function.
6607         (Incremental_inputs::relocs_entsize): New function.
6608         (Output_section_incremental_inputs::set_final_data_size): New function.
6609         (Output_section_incremental_inputs::do_write): New function.
6610         (Output_section_incremental_inputs::write_header): New function.
6611         (Output_section_incremental_inputs::write_input_files): New function.
6612         (Output_section_incremental_inputs::write_info_blocks): New function.
6613         (Output_section_incremental_inputs::write_symtab): New function.
6614         * incremental.h (Incremental_script_entry): Forward declaration.
6615         (Incremental_object_entry): Forward declaration.
6616         (Incremental_archive_entry): Forward declaration.
6617         (Incremental_inputs): Forward declaration.
6618         (Incremental_inputs_header_data): Remove.
6619         (Incremental_inputs_header): Remove.
6620         (Incremental_inputs_header_write): Remove.
6621         (Incremental_inputs_entry_data): Remove.
6622         (Incremental_inputs_entry): Remove.
6623         (Incremental_inputs_entry_write): Remove.
6624         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6625         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6626         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6627         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6628         Likewise.
6629         (Incremental_input_entry): New class.
6630         (Incremental_script_entry): New class.
6631         (Incremental_object_entry): New class.
6632         (Incremental_archive_entry): New class.
6633         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6634         (Incremental_inputs::report_inputs): Remove.
6635         (Incremental_inputs::report_archive): Remove.
6636         (Incremental_inputs::report_archive_begin): New function.
6637         (Incremental_inputs::report_archive_end): New function.
6638         (Incremental_inputs::report_object): Change prototype.
6639         (Incremental_inputs::report_input_section): New function.
6640         (Incremental_inputs::report_script): Change prototype.
6641         (Incremental_inputs::get_reloc_count): New function.
6642         (Incremental_inputs::set_reloc_count): New function.
6643         (Incremental_inputs::create_data_sections): New function.
6644         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6645         (Incremental_inputs::inputs_section): New function.
6646         (Incremental_inputs::symtab_section): New function.
6647         (Incremental_inputs::relocs_section): New function.
6648         (Incremental_inputs::get_stringpool): Add const.
6649         (Incremental_inputs::command_line): Add const.
6650         (Incremental_inputs::inputs): Remove.
6651         (Incremental_inputs::command_line_key): New function.
6652         (Incremental_inputs::input_file_count): New function.
6653         (Incremental_inputs::input_files): New function.
6654         (Incremental_inputs::relocs_entsize): New function.
6655         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6656         (Incremental_inputs::finalize_inputs): Remove.
6657         (Incremental_inputs::Input_info): Remove.
6658         (Incremental_inputs::lock_): Remove.
6659         (Incremental_inputs::inputs_): Change type.
6660         (Incremental_inputs::inputs_map_): Remove.
6661         (Incremental_inputs::current_object_entry_): New data member.
6662         (Incremental_inputs::inputs_section_): New data member.
6663         (Incremental_inputs::symtab_section_): New data member.
6664         (Incremental_inputs::relocs_section_): New data member.
6665         (Incremental_inputs::reloc_count_): New data member.
6666         (Incremental_inputs_reader): New class.
6667         (Incremental_symtab_reader): New class.
6668         (Incremental_relocs_reader): New class.
6669         * layout.cc (Layout::finalize): Move finalization of incremental info
6670         and creation of incremental info sections to follow finalization of
6671         symbol table.  Set offsets for postprocessing sections.
6672         (Layout::create_incremental_info_sections): Call
6673         Incremental_inputs::create_data_sections.  Add incremental symtab
6674         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6675         sections to layout after input sections.
6676         * layout.h (struct Timespec): Forward declaration.
6677         (Layout::incremental_inputs): Add const.
6678         (Layout::create_incremental_info_sections): Add parameter.
6679         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6680         * object.cc: Include incremental.h.
6681         (Relobj::finalize_incremental_relocs): New function.
6682         (Sized_relobj::do_layout): Record input sections in incremental info.
6683         * object.h (Object::output_section): New function.
6684         (Object::output_section_offset): Moved from Relobj.
6685         (Object::get_incremental_reloc_base): New function.
6686         (Object::get_incremental_reloc_count): New function.
6687         (Object::do_output_section): New function.
6688         (Object::do_output_section_offset): Moved from Relobj.
6689         (Object::do_get_incremental_reloc_base): New function.
6690         (Object::do_get_incremental_reloc_count): New function.
6691         (Object::Object): Initialize new data members.
6692         (Relobj::output_section): Renamed do_output_section and moved to
6693         protected.
6694         (Relobj::output_section_offset): Moved to Object.
6695         (Relobj::do_get_incremental_reloc_base): New function.
6696         (Relobj::do_get_incremental_reloc_count): New function.
6697         (Relobj::allocate_incremental_reloc_counts): New function.
6698         (Relobj::count_incremental_reloc): New function.
6699         (Relobj::finalize_incremental_relocs): New function.
6700         (Relobj::next_incremental_reloc_index): New function.
6701         (Relobj::reloc_counts_): New data member.
6702         (Relobj::reloc_bases_): New data member.
6703         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6704         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6705         (Sized_relobj::incremental_relocs_scan): New function.
6706         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6707         (Sized_relobj::incremental_relocs_write): New function.
6708         (Sized_relobj::incremental_relocs_write_reltype): New function.
6709         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6710         incremental link.
6711         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6712         archives and object files elsewhere.
6713         (Add_symbols::run): Report object files here.
6714         (Finish_group::run): Report end of archive at end of group.
6715         * reloc.cc: Include layout.h, incremental.h.
6716         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6717         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6718         (Sized_relobj::incremental_relocs_scan): New function.
6719         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6720         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6721         (Sized_relobj::incremental_relocs_write): New function.
6722         (Sized_relobj::incremental_relocs_write_reltype): New function.
6723         * script.cc (read_input_script): Rewrite test for incremental link.
6724         Change call to Incremental_inputs::report_script.
6725         * symtab.h (Symbol_table::first_global_index): New function.
6726         (Symbol_table::output_count): New function.
6727
6728 2010-08-12  Doug Kwan  <dougkwan@google.com>
6729
6730         * arm.cc (Target_arm::merge_object_attributes): Check command line
6731         options --no-wchar-size-warning and --no-enum-size-warning.
6732         * options.h (General_options): Add ld-compatible options
6733         --no-enum-size-warning and --no-wchar-size-warning.
6734
6735 2010-08-04  Ian Lance Taylor  <iant@google.com>
6736
6737         * x86_64.cc (Target_x86_64::Scan::local): Use
6738         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6739         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6740         (Target_x86_64::Scan::global): Likewise.
6741         (Target_x86_64::Relocate::relocate): Likewise.
6742         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6743         Likewise.
6744
6745 2010-08-03  Cary Coutant  <ccoutant@google.com>
6746
6747         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6748         to reserve space in merged_strings vector. Keep total input size
6749         for stats.
6750         (Output_merge_string::do_print_merge_stats): Print total input size.
6751         * merge.h (Output_merge_string): Add input_size_ field.
6752         * stringpool.cc (Stringpool_template::string_length): Move
6753         implementations out of Stringpool_template class and place in
6754         stringpool.h.
6755         * stringpool.h (string_length): Move out of Stringpool_template.
6756
6757 2010-08-03  Ian Lance Taylor  <iant@google.com>
6758
6759         PR 11712
6760         * layout.cc (relaxation_loop_body): If address of load segment is
6761         set, adjust address to include headers if possible.
6762
6763 2010-08-03  Ian Lance Taylor  <iant@google.com>
6764
6765         * version.cc (version_string): Bump to 1.10.
6766
6767 2010-08-03  Ian Lance Taylor  <iant@google.com>
6768
6769         PR 11805
6770         * layout.h (enum Output_section_order): Define.
6771         (class Layout): Update declarations.
6772         * layout.cc (Layout::get_output_section): Add order parameter.
6773         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6774         is_first_non_relro parameters.  Change all callers.
6775         (Layout::choose_output_section): Likewise.
6776         (Layout::add_output_section_data): Likewise.
6777         (Layout::make_output_section): Likewise.  Set order.
6778         (Layout::default_section_order): New function.
6779         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6780         * output.cc (Output_section::Output_section): Initialize order_.
6781         Don't initialize deleted fields.
6782         (Output_segment::Output_segment): Don't initialize deleted
6783         fields.
6784         (Output_segment::add_output_section_to_load): New function
6785         replacing add_output_section.  Change all callers to call this or
6786         add_output_section_to_nonload.
6787         (Output_segment::add_output_section_to_nonload): New function.
6788         (Output_segment::remove_output_section): Rewrite.
6789         (Output_segment::add_initial_output_data): Likewise.
6790         (Output_segment::has_any_data_sections): Likewise.
6791         (Output_segment::is_first_section_relro): Likewise.
6792         (Output_segment::maximum_alignment): Likewise.
6793         (Output_segment::has_dynamic_reloc): New function replacing
6794         dynamic_reloc_count.  Change all callers.
6795         (Output_segment::has_dynamic_reloc_list): New function replacing
6796         dynamic_reloc_count_list.  Change all callers.
6797         (Output_segment::set_section_addresses): Rewrite.
6798         (Output_segment::set_offset): Rewrite.
6799         (Output_segment::find_first_and_last_list): Remove.
6800         (Output_segment::set_tls_offsets): Rewrite.
6801         (Output_segment::first_section_load_address): Likewise.
6802         (Output_segment::output_section_count): Likewise.
6803         (Output_segment::section_with_lowest_load_address): Likewise.
6804         (Output_segment::write_section_headers): Likewise.
6805         (Output_segment::print_sections_to_map): Likewise.
6806         * output.h (class Output_data): Remove dynamic_reloc_count_
6807         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6808         (Output_data::add_dynamic_reloc): Rewrite.
6809         (Output_data::has_dynamic_reloc): New function.
6810         (Output_data::dynamic_reloc_count): Remove.
6811         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6812         is_last_relro_, is_first_non_relro_, is_interp_,
6813         is_dynamic_linker_section_ fields.  Add order and set_order
6814         functions.  Remove is_relro_local, set_is_relro_local,
6815         is_last_relro, set_is_last_relro, is_first_non_relro,
6816         set_is_first_non_relro functions, is_interp, set_is_interp,
6817         is_dynamic_linker_section, and set_is_dynamic_linker_section
6818         functions.
6819         (class Output_segment): Change Output_data_list from std::list to
6820         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6821         output_bss_ fields.  Update declarations.
6822
6823 2010-08-02  Ian Lance Taylor  <iant@google.com>
6824
6825         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6826         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6827         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6828
6829 2010-08-02  Ian Lance Taylor  <iant@google.com>
6830
6831         PR 11855
6832         * script.cc (Script_options::Script_options): Initialize
6833         symbol_definitions_ and symbol_references_.
6834         (Script_options::add_symbol_assignment): Update
6835         symbol_definitions_ and symbol_references_.
6836         (Script_options::add_symbol_reference): New function.
6837         (script_symbol): New function.
6838         * script.h (class Script_options): Add symbol_definitions_ and
6839         symbol_references_ fields.
6840         (Script_options::referenced_const_iterator): New type.
6841         (Script_options::referenced_begin): New function.
6842         (Script_options::referenced_end): New function.
6843         (Script_options::is_referenced): New function.
6844         (Script_options::any_unreferenced): New function.
6845         * script-c.h (script_symbol): Declare.
6846         * yyscript.y (exp): Call script_symbol.
6847         * symtab.cc: Include "script.h".
6848         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6849         Change all callers.  Check symbols referenced by scripts.
6850         (Symbol_table::add_undefined_symbols_from_command_line): Add
6851         layout parameter.  Change all callers.
6852         (Symbol_table::do_add_undefined_symbols_from_command_line):
6853         Likewise.  Break out loop body.  Check symbols referenced by
6854         scripts.
6855         (Symbol_table::add_undefined_symbol_from_command_line): New
6856         function broken out of
6857         do_add_undefined_symbols_from_command_line.
6858         * symtab.h (class Symbol_table): Update declarations.
6859         * archive.cc: Include "layout.h".
6860         (Archive::should_include_member): Add layout parameter.  Change
6861         all callers.  Check for symbol mentioned in expression.
6862         * archive.h (class Archive): Update declaration.
6863         * object.cc (Sized_relobj::do_should_include_member): Add layout
6864         parameter.
6865         * object.h (Object::should_include_member): Add layout parameter.
6866         Change all callers.
6867         (Object::do_should_include_member): Add layout parameter.
6868         (class Sized_relobj): Update declaration.
6869         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6870         parameter.
6871         * dynobj.h (class Sized_dynobj): Update declaration.
6872         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6873         layout parameter.
6874         * plugin.h (class Sized_pluginobj): Update declaration.
6875
6876 2010-08-02  Ian Lance Taylor  <iant@google.com>
6877
6878         PR 11866
6879         * output.cc (Output_segment::set_offset): Search for the first and
6880         last sections rather than assuming that the list is in order.
6881         (Output_segment::find_first_and_last_list): New function.
6882         * output.h (class Output_segment): Update declarations.
6883         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6884         (relro_strip_test_SOURCES): New variable.
6885         (relro_strip_test_DEPENDENCIES): New variable.
6886         (relro_strip_test_LDFLAGS): New variable.
6887         (relro_strip_test_LDADD): New variable.
6888         (relro_strip_test.so): New target.
6889
6890 2010-08-02  Ian Lance Taylor  <iant@google.com>
6891
6892         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6893         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6894         (Target_i386::got_tlsdesc_section): New function.
6895         (Target_i386::got_section): Create space for GOT entries for
6896         TLSDESC relocations.
6897         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6898         R_386_TLS_GOTDESC.
6899         (Target_i386::Scan::global): Likewise.
6900         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6901         using TLSDESC GOT.
6902         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6903         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6904         (Target_x86_64::got_tlsdesc_section): New function.
6905         (Target_x86_64::got_section): Create space for GOT entries for
6906         TLSDESC relocations.
6907         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6908         R_386_TLS_GOTDESC.
6909         (Target_x86_64::Scan::global): Likewise.
6910         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6911         using TLSDESC GOT.
6912
6913 2010-08-02  Ian Lance Taylor  <iant@google.com>
6914
6915         * testsuite/final_layout.sh: Use dc to convert from hex to
6916         decimal.
6917
6918 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6919
6920         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6921         paramter to the call to gold::gc_process_relocs.
6922         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6923         paramter to the call to gold::gc_process_relocs.
6924         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6925         parameter to the call to gold::gc_process_relocs.
6926         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6927         template parameter to the call to gold::gc_process_relocs.
6928         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6929         paramter to the call to gold::gc_process_relocs.
6930         * gc.h (get_embedded_addend_size): New function.
6931         (gc_process_relocs): Save the size of the reloc for use by ICF.
6932         * icf.cc (get_section_contents): Get the addend from the text section
6933         for SHT_REL relocation sections.
6934         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6935         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6936         * int_encoding.h (read_from_pointer): New overloaded function.
6937         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6938         * testsuite/icf_sht_rel_addend_test.sh: New file.
6939         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6940         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6941
6942 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6943
6944         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6945         * Makefile.in: Regenerate.
6946         * testsuite/Makefile.in: Regenerate.
6947
6948 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6949
6950         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6951         * gold/testsuite/debug_msg.cc: Likewise.
6952         * gold/testsuite/odr_violation1.cc
6953         * gold/testsuite/odr_violation2.cc
6954
6955 2010-07-21  Cary Coutant  <ccoutant@google.com>
6956
6957         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6958         string, and length fields.
6959         (Output_merge_string::Merged_strings_list): New type.
6960         (Output_merge_string::Merged_strings_lists): New typedef.
6961         (Output_merge_string): Replace merged_strings_ with
6962         merged_strings_lists_.
6963         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6964         Merged_strings_list per input object and section.  Don't store pointer
6965         to the string.  Don't store length with each merged string entry.
6966         (Output_merge_string::finalize_merged_data): Loop over list of merged
6967         strings lists.  Recompute length of each merged string.
6968
6969 2010-07-15  Cary Coutant  <ccoutant@google.com>
6970
6971         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6972         here.
6973
6974 2010-07-14  Ian Lance Taylor  <iant@google.com>
6975
6976         * descriptors.cc (Descriptors::open): Report correct name in error
6977         message.
6978
6979 2010-07-13  Doug Kwan  <dougkwan@google.com>
6980
6981         * arm.cc (Arm_input_section::Arm_input_section): For a
6982         SHT_ARM_EXIDX section, always keeps the input sections.
6983         (Arm_input_section::set_exidx_section_link): New method.
6984         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6985         has_errors_ to false.
6986         (Arm_exidx_input_section::has_errors,
6987         Arm_exidx_input_section::set_has_errors): New methods.
6988         (Arm_exidx_input_section::has_errors_): New data member.
6989         (Arm_relobj::get_exidx_shndx_list): New method.
6990         (Arm_output_section::append_text_sections_to_list): Do not skip
6991         section without SHF_EXECINSTR.
6992         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6993         errors.
6994         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6995         section header.  Make error messages more verbose.  Check for
6996         a non-executable section linked to an EXIDX section.
6997         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6998         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6999         check that there is no deferred EXIDX section if we exit early.
7000         Instead of not making an EXIDX section in case of an error, make one
7001         and set the has_errors flag of it.
7002         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7003         in a relocatable link.
7004         (Target_arm::do_relax): Look for the EXIDX output section instead of
7005         assuming that it is called .ARM.exidx.
7006         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7007         section list.  Do not check for SHF_EXECINSTR section flags but
7008         skip any input section with errors.
7009         * output.cc (Output_section::Output_section): Initialize
7010         always_keeps_input_sections_ to false.
7011         (Output_section::add_input_section): Check for
7012         always_keeps_input_sections_.
7013         *  output.h (Output_section::always_keeps_input_sections,
7014         Output_section::set_always_keeps_input_sections): New methods.
7015         (Output_section::always_keeps_input_sections): New data member.
7016
7017 2010-07-13  Rafael Espindola  <espindola@google.com>
7018
7019         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7020         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7021
7022 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7023             Ian Lance Taylor  <iant@google.com>
7024
7025         * output.h (Output_section_lookup_maps::add_merge_section):
7026         Correct check of whether value was inserted.
7027         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7028         (Output_section_lookup_maps::add_relaxed_input_section):
7029         Likewise.
7030         * arm.cc (Target_arm::got_section): Remove used local os.
7031         * i386.cc (Target_i386::got_section): Likewise.
7032         * x86_64.cc (Target_x86_64::got_section): Likewise.
7033         * sparc.cc (Target_sparc::got_section): Likewise.
7034         (Target_sparc::relocate): Remove unused local have_got_offset.
7035         * powerpc.cc (Target_powerpc::relocate): Likewise.
7036
7037 2010-07-13  Ian Lance Taylor  <iant@google.com>
7038
7039         * compressed_output.cc (zlib_decompress): Fix signature in
7040         !HAVE_ZLIB_H case.
7041
7042         * archive.cc (Archive::include_member): Unlock an external member
7043         of a thin archive.  Don't bother to delete an object we know is
7044         NULL.
7045
7046 2010-07-12  Cary Coutant  <ccoutant@google.com>
7047
7048         * compressed_output.cc (zlib_decompress): New function.
7049         (get_uncompressed_size): New function.
7050         (decompress_input_section): New function.
7051         * compressed_output.h (get_uncompressed_size): New function.
7052         (decompress_input_section): New function.
7053         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7054         Handle compressed debug sections.
7055         * layout.cc (is_compressed_debug_section): New function.
7056         (Layout::output_section_name): Map compressed section names to
7057         canonical names.
7058         * layout.h (is_compressed_debug_section): New function.
7059         (is_debug_info_section): Recognize compressed debug sections.
7060         * merge.cc: Include compressed_output.h.
7061         (Output_merge_data::do_add_input_section): Handle compressed
7062         debug sections.
7063         (Output_merge_string::do_add_input_section): Handle compressed
7064         debug sections.
7065         * object.cc: Include compressed_output.h.
7066         (Sized_relobj::Sized_relobj): Initialize new data members.
7067         (build_compressed_section_map): New function.
7068         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7069         * object.h (Object::section_is_compressed): New method.
7070         (Object::do_section_is_compressed): New method.
7071         (Sized_relobj::Compressed_section_map): New type.
7072         (Sized_relobj::do_section_is_compressed): New method.
7073         (Sized_relobj::compressed_sections_): New data member.
7074         * output.cc (Output_section::add_input_section): Handle compressed
7075         debug sections.
7076         * reloc.cc: Include compressed_output.h.
7077         (Sized_relobj::write_sections): Handle compressed debug sections.
7078
7079 2010-07-08  Cary Coutant  <ccoutant@google.com>
7080
7081         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7082         weak when resolving to a dynamic def.
7083         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7084         for weak undef/dynamic def cases. Adjust callers.
7085         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7086         undef_binding_weak_.
7087         (Symbol_table::sized_write_globals): Adjust symbol binding.
7088         (Symbol_table::sized_write_symbol): Add binding parameter.
7089         * symtab.h (Symbol::set_undef_binding): New method.
7090         (Symbol::is_undef_binding_weak): New method.
7091         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7092         (Symbol_table::should_override): Add new parameter.
7093         (Symbol_table::sized_write_symbol): Add new parameter.
7094
7095         * testsuite/weak_undef_file1.cc: Add new test case.
7096         * testsuite/weak_undef_file2.cc: Fix header comment.
7097         * testsuite/weak_undef_test.cc: Add new test case.
7098
7099 2010-06-29  Doug Kwan  <dougkwan@google.com>
7100
7101         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7102         Initialize USE_SYMBOL_.
7103         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7104         definition.
7105         (Arm_reloc_property::uses_symbol_): New data member declaration.
7106         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7107         uses symbol value and symbol is undefined but not weakly undefined.
7108
7109 2010-06-28  Rafael Espindola  <espindola@google.com>
7110
7111         * plugin.cc (Plugin::load): Use dlerror.
7112
7113 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7114
7115         * symtab.cc (detect_odr_violations): When reporting an ODR
7116         violation, report an object where the symbol is defined.
7117
7118 2010-06-25  Doug Kwan  <dougkwan@google.com>
7119
7120         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7121         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7122         definition.
7123         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7124         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7125         target hook to detect function points.
7126         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7127         * icf.h (Icf::check_section_for_function_pointers): Change type of
7128         parameter SECTION_NAME to const reference to std::string.  Use
7129         target hook to determine if section may have unsafe pointers.
7130         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7131         method definition.
7132
7133 2010-06-21  Rafael Espindola  <espindola@google.com>
7134
7135         * fileread.cc (Input_file::find_fie): New
7136         (Input_file::open): Use Input_file::find_fie.
7137         * fileread.h (Input_file::find_fie): New
7138         * plugin.cc (set_extra_library_path): New.
7139         (Plugin::load): Add set_extra_library_path to the transfer vector.
7140         (Plugin_manager::set_extra_library_path): New.
7141         (Plugin_manager::add_input_file): Use the extra search path if set.
7142         (set_extra_library_path(): New.
7143         * plugin.h (Plugin_manager): Add set_extra_library_path and
7144         extra_search_path_.
7145
7146 2010-06-19  Cary Coutant  <ccoutant@google.com>
7147
7148         * layout.cc (gdb_sections): Add .debug_types.
7149         (lines_only_debug_sections): Likewise.
7150
7151 2010-06-18  Rafael Espindola  <espindola@google.com>
7152
7153         * plugin.cc (add_input_file,add_input_library)
7154         (Plugin_manager::add_input_file): Make filename arguments const.
7155         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7156         const.
7157
7158 2010-06-16  Doug Kwan  <dougkwan@google.com>
7159
7160         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7161         .ARM.attributes section if we have not merged any input
7162         attributes sections.
7163
7164 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7165
7166         * arm.cc: Allow combining objects with no EABI version
7167         information.
7168
7169 2010-06-15  Rafael Espindola  <espindola@google.com>
7170
7171         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7172
7173 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7174
7175         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7176         (struct iovec): Correct !HAVE_READV definition.
7177
7178 2010-06-10  Cary Coutant  <ccoutant@google.com>
7179
7180         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7181         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7182         reloc sections.
7183         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7184
7185         PR 11683
7186         * symtab.h (Symbol::is_placeholder): New member function.
7187         * target-reloc.h (relocate_section): Check for placeholder symbols.
7188
7189         * testsuite/Makefile.am (plugin_test_8): New test.
7190         (plugin_test_9): New test.
7191         * testsuite/Makefile.in: Regenerate.
7192
7193 2010-06-09  Nick Clifton  <nickc@redhat.com>
7194
7195         * yyscript.y (input_list_element): Allow strings prefixed with
7196         the '-' character.  Treat these as libraries.
7197         * script.cc (script_add_library): New function.  Adds a library
7198         specified by "-l<name>" found in an input script.
7199         * script-c.h: Add prototype for script_add_library.
7200
7201 2010-06-07  Doug Kwan  <dougkwan@google.com>
7202
7203         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7204         Restrict stub-group size to be within long conditional branch
7205         range when working around cortex-A8 erratum.
7206
7207 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7208
7209         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7210         #ifdef typo.
7211
7212 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7213
7214         PR gold/11658
7215         * output.cc
7216         (Output_section::Input_section_sort_entry::compare_section_ordering):
7217         Change to return non-zero correctly.
7218         (Output_section::Input_section_sort_section_order_index_compare
7219         ::operator()): Change to fix ambiguity in comparisons.
7220
7221 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7222
7223         * gold.h (is_wildcard_string): New function.
7224         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7225         (Layout::layout_eh_frame): Ditto.
7226         (Layout::find_section_order_index): New method.
7227         (Layout::read_layout_from_file): New method.
7228         * layout.h (Layout::find_section_order_index): New method.
7229         (Layout::read_layout_from_file): New method.
7230         (Layout::input_section_position_): New private member.
7231         (Layout::input_section_glob_): New private member.
7232         * main.cc (main): Call read_layout_from_file here.
7233         * options.h (--section-ordering-file): New option.
7234         * output.cc (Output_section::input_section_order_specified_): New
7235         member.
7236         (Output_section::Output_section): Initialize new member.
7237         (Output_section::add_input_section): Add new parameter.
7238         Keep input sections when --section-ordering-file is used.
7239         (Output_section::set_final_data_size): Sort input sections when
7240         section ordering file is specified.
7241         (Output_section::Input_section_sort_entry): Add new parameter.
7242         Check sorting type.
7243         (Output_section::Input_section_sort_entry::compare_section_ordering):
7244         New method.
7245         (Output_section::Input_section_sort_compare::operator()): Change to
7246         consider section_order_index.
7247         (Output_section::Input_section_sort_init_fini_compare::operator()):
7248         Change to consider section_order_index.
7249         (Output_section::Input_section_sort_section_order_index_compare
7250         ::operator()): New method.
7251         (Output_section::sort_attached_input_sections): Change to sort
7252         according to section order when specified.
7253         (Output_section::add_input_section<32, true>): Add new parameter.
7254         (Output_section::add_input_section<64, true>): Add new parameter.
7255         (Output_section::add_input_section<32, false>): Add new parameter.
7256         (Output_section::add_input_section<64, false>): Add new parameter.
7257         * output.h (Output_section::add_input_section): Add new parameter.
7258         (Output_section::input_section_order_specified): New
7259         method.
7260         (Output_section::set_input_section_order_specified): New method.
7261         (Input_section::Input_section): Initialize section_order_index_.
7262         (Input_section::section_order_index): New method.
7263         (Input_section::set_section_order_index): New method.
7264         (Input_section::section_order_index_): New member.
7265         (Input_section::Input_section_sort_section_order_index_compare): New
7266         struct.
7267         (Output_section::input_section_order_specified_): New member.
7268         * script-sections.cc (is_wildcard_string): Delete and move modified
7269         method to gold.h.
7270         (Output_section_element_input::Output_section_element_input): Modify
7271         call to is_wildcard_string.
7272         (Output_section_element_input::Input_section_pattern
7273         ::Input_section_pattern): Ditto.
7274         (Output_section_element_input::Output_section_element_input): Ditto.
7275         * testsuite/Makefile.am (final_layout): New test case.
7276         * testsuite/Makefile.in: Regenerate.
7277         * testsuite/final_layout.cc: New file.
7278         * testsuite/final_layout.sh: New file.
7279
7280 2010-06-01  Rafael Espindola  <espindola@google.com>
7281
7282         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7283
7284 2010-06-01  Rafael Espindola  <espindola@google.com>
7285
7286         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7287         visibility of symbols.
7288
7289 2010-05-27  Doug Kwan  <dougkwan@google.com>
7290
7291         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7292         from start of output section instead of address for a local symbol
7293         in a merged or relaxed section when doing a relocatable link.
7294
7295 2010-05-26  Rafael Espindola  <espindola@google.com>
7296
7297         PR 11604
7298         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7299         adding sections the garbage collector removed.
7300         * gold/testsuite/Makefile.am: Add test.
7301         * gold/testsuite/Makefile.in: Regenerate.
7302         * gold/testsuite/plugin_test_7.sh: New.
7303         * gold/testsuite/plugin_test_7_1.c: New.
7304         * gold/testsuite/plugin_test_7_2.c: New.
7305
7306 2010-05-26  Rafael Espindola  <espindola@google.com>
7307
7308         * script-sections.cc (Output_section_definition::set_section_addresses):
7309         Check for --section-start.
7310
7311 2010-05-26  Doug Kwan  <dougkwan@google.com>
7312
7313         * arm.cc (Arm_scan_relocatable_relocs): New class.
7314         (Target_arm::relocate_special_relocatable): New method.
7315         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7316         (Arm_relocate_functions::thumb_branch_common): Same.
7317         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7318         instead of Default_scan_relocatable_relocs.
7319         * target-reloc.h (relocate_for_relocatable): Let target handle
7320         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7321         * target.h (Sized_target::relocate_special_relocatable): New method.
7322
7323 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7324
7325         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7326
7327 2010-05-23  Doug Kwan  <dougkwan@google.com>
7328
7329         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7330         instead of a cast.
7331         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7332         with a direct branch, not a conditional branch, to a stub.
7333         * merge.cc (Output_merge_base::record_input_section): New method
7334         defintion.
7335         (Output_merge_data::do_add_input_section): Record input section if
7336         keeps-input-sections flag is set.
7337         (Output_merge_string::do_add_input_section): Ditto.
7338         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7339         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7340         INPUT_SECTIONS_.
7341         (Output_merge_base::keeps_input_sections,
7342         Output_merge_base::set_keeps_input_sections,
7343         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7344         method definitions.
7345         (Output_merge_base::Input_sections): New type declaration.
7346         (Output_merge_base::input_sections_begin,
7347         Output_merge_base::input_sections_end,
7348         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7349         (Output_merge_base::bool keeps_input_sections_,
7350         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7351         Output_merge_base::input_sections_): New data members.
7352         (Output_merge_data::do_set_keeps_input_sections): New method
7353         defintion.
7354         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7355         * output.cc (Output_section::Input_section::relobj): Move method
7356         defintion from class declaration to here and handle merge sections.
7357         (Output_section::Input_section::shndx): Ditto.
7358         (Output_section::Output_section): Remove initializations of removed
7359         data members and initialize new data member LOOKUP_MAPS_.
7360         (Output_section::add_input_section): Set keeps-input-sections flag
7361         for a newly created merge output section as appropriate.  Adjust code
7362         to use Output_section_lookup_maps class.
7363         (Output_section::add_relaxed_input_section): Adjst code for lookup
7364         maps code refactoring.
7365         (Output_section::add_merge_input_section): Add a new parameter
7366         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7367         class.  If adding input section to a newly created merge output
7368         section fails, remove the new merge section.
7369         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7370         Adjust code for use of the Output_section_lookup_maps class.
7371         (Output_section::find_merge_section): Ditto.
7372         (Output_section::build_lookup_maps): New method defintion.
7373         (Output_section::find_relaxed_input_section): Adjust code to use
7374         Output_section_lookup_maps class.
7375         (Output_section::get_input_sections): Export merge sections.  Adjust
7376         code to use Output_section_lookup_maps class.
7377         (Output_section:::add_script_input_section): Adjust code to use
7378         Output_section_lookup_maps class.  Update lookup maps for merge
7379         sections also.
7380         (Output_section::discard_states): Use Output_section_lookup_maps.
7381         (Output_section::restore_states): Same.
7382         * output.h (Merge_section_properties): Move class defintion out of
7383         Output_section.
7384         (Output_section_lookup_maps): New class.
7385         (Output_section::Input_section::is_merge_section): New method
7386         defintion.
7387         (Output_section::Input_section::relobj): Move defintion out of class
7388         defintion.  Declare method only.
7389         (Output_section::Input_section::shndx): Ditto.
7390         (Output_section::Input_section::output_merge_base): New method defintion.
7391         (Output_section::Input_section::u2_.pomb): New union field.
7392         (Output_section::Merge_section_by_properties_map,
7393         Output_section::Output_section_data_by_input_section_map,
7394         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7395         Remove types.
7396         (Output_section::add_merge_input_section): Add new parameter
7397         KEEPS_INPUT_SECTIONS.
7398         (Output_section::build_lookup_maps): New method declaration.
7399         (Output_section::merge_section_map_,
7400         Output_section::merge_section_by_properties_map_,
7401         Output_section::relaxed_input_section_map_,
7402         Output_section::is_relaxed_input_section_map_valid_): Remove data
7403         members.
7404         (Output_section::lookup_maps_): New data member.
7405
7406 2010-05-21  Doug Kwan  <dougkwan@google.com>
7407
7408         PR gold/11619
7409         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7410         avoid a compilation error.
7411
7412 2010-05-19  Rafael Espindola  <espindola@google.com>
7413
7414         * script-sections.cc (Output_section_definition::allocate_to_segment):
7415         Update the phdrs_list even when the output section is NULL.
7416         * testsuite/Makefile.am: Add test.
7417         * testsuite/Makefile.in: Regenerate.
7418         * testsuite/script_test_9.cc: New.
7419         * testsuite/script_test_9.sh: New.
7420         * testsuite/script_test_9.t: New.
7421
7422 2010-05-19  Doug Kwan  <dougkwan@google.com>
7423
7424         * arm.cc (Arm_input_section::original_size): New method.
7425         (Arm_input_section::do_addralign): Add a cast.
7426         (Arm_input_section::do_output_offset): Remove static cast.
7427         (Arm_input_section::original_addralign,
7428          Arm_input_section::original_size_): Change type to uint32_t.
7429         (Arm_input_section::init): Add safe casts for section alignment
7430         and size.
7431         (Arm_input_section::set_final_data_size): Do not set address and
7432         offset of stub table.
7433         (Arm_output_section::fix_exidx_coverage): Change use of of
7434         Output_section::Simple_input_section to that of
7435         Output_section::Input_section.
7436         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7437         except for the first pass.
7438         * output.cc (Output_section::get_input_sections): Change type of
7439         input_sections to std::list<Input_section>.
7440         (Output_section::add_script_input_section): Rename from
7441         Output_section::add_simple_input_section.  Change type of SIS
7442         parameter from Simple_input_section to Input_section.
7443         * output.h (Output_section::Simple_input_section): Remove class.
7444         (Output_section::Input_section): Change class visibility to public.
7445         (Output_section::Input_section::addralign): Use stored alignments
7446         for special input sections if set.
7447         (Output_section::Input_section::set_addralign): New method.
7448         (Output_section::get_input_sections): Change parameter type from
7449         list of Simple_input_section to list of Input_section.
7450         (Output_section::add_script_input_section): Rename from
7451         Output_section::add_simple_input_section. Change first parameter's
7452         type from Simple_input_section to Input_section and remove the
7453         second and third parameters.
7454         * script-sections.cc (Input_section::Input_section_list): Change
7455         type to list of Output_section::Input_section/
7456         (Input_section_info::Input_section_info): Change parameter type of
7457         INPUT_SECTION to Output_section::Input_section.
7458         (Input_section_info::input_section): Change return type.
7459         (Input_section_info::input_section_): Change type to
7460         Output_section::Input_section.
7461         (Output_section_element_input::set_section_addresses): Adjust code
7462         to use Output_section::Input_section instead of
7463         Output_section::Simple_input_section.  Adjust code for renaming
7464         of Output_section::add_simple_input_section.
7465         (Orphan_output_section::set_section_addresses): Ditto.
7466
7467 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7468
7469         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7470         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7471
7472 2010-05-18  Rafael Espindola  <espindola@google.com>
7473
7474         * options.cc (General_options::finalize): Handle -nostdlib.
7475         * options.h (nostdlib): New option.
7476         * script.cc (script_add_search_dir): Handle -nostdlib.
7477
7478 2010-05-12  Doug Kwan  <dougkwan@google.com>
7479
7480         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7481         attributes section only if there no attributes section after merging.
7482         (Target_arm::merge_object_attributes): Move value of
7483         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7484         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7485         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7486         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7487         and arm_attr_merge_7.stdout.
7488         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7489         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7490         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7491         arm_attr_merge_7b.o): New rules.
7492         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7493         arm_attr_merge_7
7494         * testsuite/Makefile.in: Regenerate.
7495         * testsuite/arm_attr_merge.sh: New file.
7496         * testsuite/arm_attr_merge_[67][ab].s: Same.
7497
7498 2010-05-05  Nick Clifton  <nickc@redhat.com>
7499
7500         * po/es.po: Updated Spanish translation.
7501
7502 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7503
7504         * Makefile.am (install-exec-local): Properly install gold as
7505         default cross linker.
7506         * Makefile.in: Regenerated.
7507
7508 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7509             Nick Clifton  <nickc@redhat.com>
7510
7511         * configure.ac (install_as_default): Define and set to false
7512         unless --enable-gold or --enable-gold=both/gold has been
7513         specified.
7514         * configure: Regenerate.
7515
7516         * Makefile.am (install-exec-local): Install the executable as
7517         'ld.gold'.  If install_as_default is true then also install it as
7518         'ld'.
7519         * Makefile.in: Regenerated.
7520
7521 2010-04-24  Ian Lance Taylor  <iant@google.com>
7522
7523         * layout.cc (Layout::layout_reloc): In relocatable link don't
7524         combine reloc sections for grouped sections.
7525
7526 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7527
7528         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7529         sections that are not ordinary to icf.
7530         * icf.cc (get_section_contents): Handle relocation pointing to section
7531         with no object or shndx information.
7532         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7533         * testsuite/Makefile.in: Regenerate.
7534         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7535         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7536
7537 2010-04-22  Ian Lance Taylor  <iant@google.com>
7538
7539         * expression.cc (Expression::Expression_eval_info): Add
7540         result_alignment_pointer field.
7541         (Expression::eval_with_dot): Add result_alignment_pointer
7542         parameter.  Change all callers.
7543         (Expression::eval_maybe_dot): Likewise.
7544         (class Binary_expression): Add alignment_pointer parameter to
7545         left_value and right_value.  Change all callers.
7546         (BINARY_EXPRESSION): Set result alignment.
7547         (class Trinary_expression): Add alignment_pointer parameter to
7548         arg2_value and arg3_value.  Change all callers.
7549         (Trinary_cond::value): Set result alignment.
7550         (Max_expression::value, Min_expression::value): Likewise.
7551         (Align_expression::value): Likewise.
7552         * script-sections.cc (class Sections_element): Add dot_alignment
7553         parameter to set_section_addresses virtual function.  Update
7554         instantiations.
7555         (class Output_section_element): Likewise.
7556         (Script_sections::create_segments): Add dot_alignment parameter.
7557         Change all callers.
7558         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7559         (Script_sections::set_phdrs_clause_addresses): Likewise.
7560         * script-sections.h: Update declarations.
7561         * script.h: Update declarations.
7562         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7563         min_p_align.
7564         * testsuite/script_test_3.t: Set large alignment.
7565         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7566         segment has expected alignment.
7567
7568 2010-04-22  Nick Clifton  <nickc@redhat.com>
7569
7570         * po/gold.pot: Updated by the Translation project.
7571         * po/vi.po: Updated Vietnamese translation.
7572
7573 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7574
7575         * testsuite/Makefile.am (check_PROGRAMS): Add
7576         icf_virtual_function_folding_test.
7577         * testsuite/Makefile.in: Regenerated.
7578
7579 2010-04-15  Andrew Haley  <aph@redhat.com>
7580
7581         * options.h (merge_exidx_entries): New option.
7582         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7583         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7584         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7585         (Target_arm::merge_exidx_entries): New function.
7586         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7587         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7588         to Arm_exidx_fixup constructor.
7589         Add new arg, merge_exidx_entries.
7590         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7591         Arm_output_section::fix_exidx_coverage.
7592
7593 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7594
7595         * icf.cc (get_section_contents): Check for preemptible functions.
7596         Ignore addend when appropriate.
7597         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7598         section folded.
7599         (add_from_relobj): Check for section folded.
7600         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7601         * symtab.h (should_add_dynsym_entry): Add new parameter.
7602         * target-reloc.h (scan_relocs): Check for section folded.
7603         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7604         Check reloc types for function pointers in shared objects.
7605         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7606         case.
7607         (icf_preemptible_functions_test): New test case.
7608         (icf_string_merge_test): New test case.
7609         * testsuite.Makefile.in: Regenerate.
7610         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7611         bar_glob.  Refactor code.
7612         * testsuite/icf_preemptible_functions_test.cc: New file.
7613         * testsuite/icf_preemptible_functions_test.sh: New file.
7614         * testsuite/icf_string_merge_test.cc: New file.
7615         * testsuite/icf_string_merge_test.sh: New file.
7616         * testsuite/icf_virtual_function_folding_test.cc: New file.
7617         * testsuite/icf_virtual_function_folding_test.sh: New file.
7618
7619 2010-04-14  Doug Kwan  <dougkwan@google.com>
7620
7621         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7622         for local symbol recounting if we remove a section due to ICF.
7623         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7624         there are no regular objects in input.
7625
7626 2010-04-13  Doug Kwan  <dougkwan@google.com>
7627
7628         * arm.cc (Arm_input_section::set_final_data_size): Compute
7629         accurate final data size instead of using current data size.
7630
7631 2010-04-09  Doug Kwan  <dougkwan@google.com>
7632
7633         * layout.cc (Layout::choose_output_section): Handle script section
7634         types.
7635         (Layout::make_output_section_for_script): Add section type parameter.
7636         Handle script section types.
7637         * layout.h (Layout::make_output_section_for_script): Add section
7638         type parameter.
7639         * output.cc (Output_section::Output_section): Initialize data member
7640         is_noload_.
7641         (Output_section::do_reset_address_and_file_offset): Do not set address
7642         to 0 if section is a NOLOAD section.
7643         * output.h (Output_section::is_noload): New method.
7644         (Output_section::set_is_noload): Ditto.
7645         (Output_section::is_noload_): New data member.
7646         * script-c.h (Script_section_type): New enum type.
7647         (struct Parser_output_section_header): Add new file section_type.
7648         * script-sections.cc (Sections_element::output_section_name): Add
7649         parameter for returning script section type.
7650         (Output_section_definition::output_section_name): Ditto.
7651         (Output_section_definition::section_type)P; New method.
7652         (Output_section_definiton::script_section_type_name): Ditto.
7653         (Output_section_definition::script_section_type_): New data member.
7654         (Output_section_definition::Output_section_definition): Initialize
7655         data member Output_section_definition::script_section_type_.
7656         (Output_section_definition::create_sections): Pass script section type
7657         to Layout::make_output_section_for_script.
7658         (Output_section_definition::output_section_name): Return script
7659         section type to caller.
7660         (Output_section_definition::set_section_address): Do not advance
7661         dot value and load address if section type is NOLOAD.  Set address
7662         of NOLOAD sections regardless of section flags.
7663         (Output_section_definition::print): Print section type if it is
7664         not SCRIPT_SECTION_TYPE_NONE.
7665         (Output_section_definition::section_type): New method.
7666         (Output_section_definition::script_section_type_name): Ditto.
7667         (Script_sections::output_section_name): Add new parameter
7668         PSECTION_TYPE for returning script section type.  Pass it to
7669         section elements.  Handle discard sections.
7670         (Sort_output_sections::operator()): Handle NOLOAD sections.
7671         * script-sections.h (Script_sections::Section_type): New enum type.
7672         (Script_sections::output_section_name): Add a new parameter for
7673         returning script section type.
7674         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7675         INFO and NOLOAD.
7676         * yyscript.y (union): Add new field SECTION_TYPE.
7677         (COPY, DSECT, INFO, NOLOAD): New tokens.
7678         (opt_address_and_section_type): Change type to output_section_header.
7679         (section_type): New non-terminal
7680         (section_header): Handle section type.
7681         (opt_address_and_section_type): Return section type value.
7682
7683 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7684
7685         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7686         * testsuite/plugin_common_test_2.c (foo): Likewise.
7687
7688 2010-04-08  Doug Kwan  <dougkwan@google.com>
7689
7690         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7691         Output_merge_data.
7692         * output.cc (Output_section::add_merge_input_section): Simplify
7693         code and return status of Output_merge_base::add_input_section.
7694         Update merge section map only if Output_merge_base::add_input_section
7695         returns true.
7696
7697 2010-04-07  Doug Kwan  <dougkwan@google.com>
7698
7699         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7700         if section is marked as containing instructions but has no mapping
7701         symbols.
7702         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7703         correct section index.
7704         (Arm_relobj::find_linked_text_section): Ditto.
7705
7706 2010-04-07  Cary Coutant  <ccoutant@google.com>
7707
7708         * archive.cc (include_member): Destroy Read_symbols_data object before
7709         releasing file.
7710         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7711         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7712         (Read_symbols_data::~Read_symbols_data) New destructor.
7713         (Section_relocs::Section_relocs) New constructor.
7714         (Section_relocs::~Section_relocs) New destructor.
7715         (Read_relocs_data::Read_relocs_data) New constructor.
7716         (Read_relocs_data::~Read_relocs_data) New destructor.
7717         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7718         pointers to NULL after deleting.
7719
7720 2010-04-07  Doug Kwan  <dougkwan@google.com>
7721
7722         * arm.cc: Replace "endianity" with "endianness" in comments.
7723         (Arm_exidx_cantunwind): Ditto.
7724         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7725         (Arm_relobj::merge_flags_and_attributes): New method.
7726         (Arm_relobj::merge_flags_and_attributes_): New data member.
7727         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7728         (Arm_relobj::scan_sections_for_stubs): Ditto.
7729         (Arm_relobj::do_read_symbols): Check to see if we really want to
7730         merge processor-specific flags and attributes.  Exit early if
7731         an object is empty except for section names and the undefined symbol.
7732         (Target_arm::do_finalize_sections): Move check for ELF format to
7733         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7734         attributes from a regular object only when we have determined that
7735         it is aapropriate.  Do not create an .ARM.attributes section in
7736         output if there is no regular input object.
7737         (Target_arm::merge_processor_specific_flags): Check
7738         --warn-mismatch before printing any error.
7739         (Target_arm::merge_object_attributes): Ditto.
7740         * gold.cc (queue_middle_tasks): Handle the case in which there is
7741         no regular object in input.
7742         * options.cc (General_options::parse_EB): New method.
7743         (General_options::parse_EL): Same.
7744         (General_options::General_options): Initialize endianness_.
7745         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7746         New options.
7747         (General_options::Endianness): New enum.
7748         (General_options::endianness): New method.
7749         (General_options::endianness_): New data member.
7750         * parameters.cc (Parameters::set_options): Check target endianness.
7751         (Parameters::set_target_once): Ditto.
7752         (Parameters::check_target_endianness): New method.
7753         (parameters_force_valid_target): If either -EL or -EB is specified,
7754         use it to define endianness of default target.
7755         * parameters.h (Parameters::check_target_endianness): New method
7756         declaration.
7757         * target.h (class Target): Change "endianity" to "endianness"
7758         in comments.
7759
7760 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7761
7762         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7763         * configure: Regenerate.
7764         * Makefile.in: Regenerate.
7765         * testsuite/Makefile.in: Regenerate.
7766
7767 2010-04-06  Cary Coutant  <ccoutant@google.com>
7768
7769         gcc PR lto/42757
7770         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7771         prevailing definitions of common symbols.
7772         * testsuite/plugin_test_6.sh: New test case.
7773         * testsuite/plugin_common_test_1.c: New test case.
7774         * testsuite/plugin_common_test_2.c: New test case.
7775         * testsuite/Makefile.am (plugin_test_6): New test case.
7776         * testsuite/Makefile.in: Regenerate.
7777
7778 2010-04-06  Nick Clifton  <nickc@redhat.com>
7779
7780         * po/vi.po: New Vietnamese translation.
7781
7782 2010-03-30  Doug Kwan  <dougkwan@google.com>
7783
7784         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7785
7786 2010-03-25  Doug Kwan  <dougkwan@google.com>
7787
7788         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7789         to avoid a conversion warning on a 32-bit host.
7790
7791 2010-03-24  Ian Lance Taylor  <iant@google.com>
7792
7793         * testsuite/script_test_3.t: Add a TLS segment.
7794         * testsuite/Makefile.am (check_PROGRAMS): Add
7795         tls_phdrs_script_test.
7796         (tls_phdrs_script_test_SOURCES): Define.
7797         (tls_phdrs_script_test_DEPENDENCIES): Define.
7798         (tls_phdrs_script_test_LDFLAGS): Define.
7799         (tls_phdrs_script_test_LDADD): Define.
7800         * testsuite/Makefile.in: Rebuild.
7801
7802 2010-03-23  Cary Coutant  <ccoutant@google.com>
7803
7804         * fileread.cc (find_or_make_view): Fix comment.
7805
7806 2010-03-23  Ian Lance Taylor  <iant@google.com>
7807
7808         * script-sections.cc (class Orphan_section_placement): Define
7809         PLACE_TLS and PLACE_TLS_BSS.
7810         (Orphan_section_placement::Orphan_section_placement): Initialize
7811         new places.
7812         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7813         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7814         (tls_script_test_SOURCES): Define.
7815         (tls_script_test_DEPENDENCIES): Define.
7816         (tls_script_test_LDFLAGS): Define.
7817         (tls_script_test_LDADD): Define.
7818         * testsuite/Makefile.in: Rebuild.
7819
7820 2010-03-22  Doug Kwan  <dougkwan@google.com>
7821
7822         * arm.cc (Arm_relocate_functions::abs8,
7823         Arm_relocate_functions::abs16): Use correct check for overflow
7824         specified in the ARM ELF specs.
7825         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7826         target of a BLX instruction specially.
7827         (Reloc_stub::stub_type_for_reloc): Ditto.
7828         (Relocate::relocate): Use symbolic names instead of numeric relocation
7829         codes to report error.
7830         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7831         workaround.
7832         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7833         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7834         thumb2_blx_out_of_range.stdout
7835         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7836         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7837         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7838         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7839         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7840         thumb2_blx_in_range, thumb2_blx_in_range.o,
7841         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7842         thumb2_blx_out_of_range.o): New rules.
7843         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7844         thumb2_blx_in_range and thumb2_blx_out_of_range.
7845         * testsuite/Makefile.in: Regenerate.
7846         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7847         * testsuite/thumb_blx_in_range.s: New file.
7848         * testsuite/thumb_blx_out_of_range.s: New file.
7849
7850 2010-03-22  Rafael Espindola  <espindola@google.com>
7851
7852         * archive.cc (Should_include): Move to archive.h.
7853         (should_include_member): Make it a member of Archive.
7854         (Lib_group): New.
7855         (Add_lib_group_symbols): New.
7856         * archive.h: Include options.h.
7857         (Archive_member): Moved from Archive.
7858         (Should_include): Moved from archive.cc.
7859         (Lib_group): New.
7860         (Add_lib_group_symbols): New.
7861         * dynobj.cc (do_should_include_member): New.
7862         * dynobj.h (do_should_include_member): New.
7863         * gold.cc (queue_initial_tasks): Update call to queue.
7864         * main.cc (main): Print lib group stats.
7865         * object.cc (do_should_include_member): New.
7866         * object.h: Include archive.h.
7867         (Object::should_include_member): New.
7868         (Object::do_should_include_member): New.
7869         (Sized_relobj::do_should_include_member): New.
7870         * options.cc (General_options::parse_start_lib): New.
7871         (General_options::parse_end_lib): New.
7872         (Input_arguments::add_file): Handle lib groups.
7873         (Input_arguments::start_group): Check we are not in a lib.
7874         (Input_arguments::start_lib): New.
7875         (Input_arguments::end_lib): New.
7876         * options.h (General_options): Add start_lib and end_lib.
7877         (Input_argument::lib_): New.
7878         (Input_argument::lib): New.
7879         (Input_argument::is_lib): New.
7880         (Input_file_lib): New.
7881         (Input_arguments::in_lib_): New.
7882         (Input_arguments::in_lib): New.
7883         (Input_arguments::start_lib): New.
7884         (Input_arguments::end_lib_): New.
7885         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7886         in unused members as preempted.
7887         (Sized_pluginobj::do_should_include_member): New.
7888         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7889         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7890         return the blocker.
7891         (Read_symbols::do_whole_lib_group): New.
7892         (Read_symbols::do_lib_group): New.
7893         (Read_symbols::do_read_symbols): Handle lib groups.
7894         (Read_symbols::get_name): Handle lib groups.
7895         * readsyms.h (Read_symbols): Add an archive member pointer.
7896         (Read_symbols::do_whole_lib_group): New.
7897         (Read_symbols::do_lib_group): New.
7898         (Read_symbols::member_): New.
7899         * script.cc (read_input_script): Update call to queue_soon.
7900
7901 2010-03-19  Doug Kwan  <dougkwan@google.com>
7902
7903         * arm.cc (Stub_table::Stub_table): Initialize new data members
7904         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7905         (Stub_table::add_reloc_stub): Assign stub offset and update
7906         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7907         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7908         New data members.
7909         (Stub_table::update_data_size_and_addralign): Use
7910         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7911         instead of going over all reloc stubs.
7912         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7913         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7914         Stringpool_template::offset_ to size of Stringpool_char.
7915         (Stringpool_template::new_key_offset): Remove code to initialize
7916         Stringpool_template::offset_.
7917         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7918         Stringpool_template::offset_ to zero.
7919
7920 2010-03-15  Doug Kwan  <dougkwan@google.com>
7921
7922         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7923         offset_.
7924         (Stringpool_template::new_key_offset): New method.
7925         (Stringpool_template::add_string): Assign offsets when adding new
7926         strings.
7927         (Stringpool_template::set_string_offsets): Do not set string offsets
7928         when not optimizing.
7929         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7930         member size_.
7931         (Chunked_vector::clear): Clear size_.
7932         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7933         (Chunked_vector::size): Return size_.
7934         (Chunked_vector::push_back): Use size_ to find insert position.
7935         (Chunked_vector::size_): New data member.
7936         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7937         (Stringpool_template::new_key_offset): New method declaration.
7938         (Stringpool_template::offset_): New data member.
7939
7940 2010-03-15   Rafael Espindola  <espindola@google.com>
7941
7942         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7943         Add_symbols' constructor.
7944         * readsyms.h (Add_symbols): Remove the input_group member.
7945
7946 2010-03-10  Ian Lance Taylor  <iant@google.com>
7947
7948         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7949         target to ask whether a reference to a symbol requires a stack
7950         split.
7951         * target.h (Target::is_call_to_non_split): New function.
7952         (Target::do_is_call_to_non_split): Declare virtual function.
7953         * target.cc: Include "symtab.h".
7954         (Target::do_is_call_to_non_split): New function.
7955         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7956
7957 2010-03-10  Cary Coutant  <ccoutant@google.com>
7958
7959         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7960         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7961         (File_read::open[2]): Add whole_file_view_ to list of views.
7962         (File_read::make_view): Remove test of whole_file_view_.
7963         (File_read::find_or_make_view): Create whole_file_view_ if
7964         necessary.
7965         (File_read::clear_views): Replace bool parameter with enum;
7966         adjust all callers.  Don't delete views with permanent data;
7967         do delete cached views and views from archives if
7968         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7969         if clearing the corresponding view.
7970         * fileread.h (File_read::Clear_views_mode): New enum.
7971         (File_read::View::is_permanent_view): New method.
7972         (File_read::clear_views): Replace bool parameter
7973         with enum; adjust all callers.
7974         * options.h (General_options): Change keep_files_mapped option;
7975         add map_whole_files.
7976         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7977         releasing the file.
7978         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7979         the file.
7980
7981 2010-03-10  David S. Miller  <davem@davemloft.net>
7982
7983         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7984
7985 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7986
7987         * icf.cc (get_section_contents): Add '@' marker after processing the
7988         merge reloc.
7989
7990 2010-03-08  Doug Kwan  <dougkwan@google.com>
7991
7992         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7993         due to a conversion warning.
7994         (Arm_relobj::update_output_local_symbol_count): Check for local
7995         symbol with unset output index.
7996
7997 2010-03-05  Ian Lance Taylor  <iant@google.com>
7998
7999         * options.h (class General_options): Add --spare-dynamic-tags.
8000         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8001         --spare-dynamic-tags.
8002
8003 2010-03-05  Ian Lance Taylor  <iant@google.com>
8004
8005         * incremental.cc: Include "libiberty.h".
8006
8007 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8008
8009         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8010         function, is_info_ member.
8011         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8012         (Versions::Versions): Update caller.
8013         (Versions::define_base_version): Likewise.
8014         (Versions::add_def): Likewise.
8015
8016 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8017
8018         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8019         (Scan::possible_function_pointer_reloc): New function.
8020         (Scan::local_reloc_may_be_function_pointer): Change to call
8021         possible_function_pointer_reloc.
8022         (Scan::global_reloc_may_be_function_pointer): Ditto.
8023         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8024         relocations in ".data.rel.ro._ZTV" section.
8025         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8026         * testsuite/icf_safe_so_test.cc: Ditto.
8027         * testsuite/icf_safe_test.cc: Ditto.
8028         * testsuite/icf_safe_test.sh: Ditto.
8029
8030 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8031             Ian Lance Taylor  <iant@google.com>
8032
8033         * target-reloc.h (relocate_section): Check the symbol table index
8034         for -1U before setting the local symbol index.
8035         (scan_relocatable_relocs): If copying the relocation, record that
8036         the local symbol is required.
8037         * object.h (Symbol_value::is_output_symtab_index_set): New
8038         function.
8039         (Symbol_value::may_be_discarded_from_output_symtab): New
8040         function.
8041         (Symbol_value::has_output_symtab_entry): New function.
8042         (Symbol_value::needs_output_symtab_entry): Remove.
8043         (Symbol_value::output_symtab_index): Make sure the symbol index is
8044         set.
8045         (Symbol_value::set_output_symtab_index): Make sure the symbol
8046         index is not set.  Make sure the new index is valid.
8047         (Symbol_value::set_must_have_output_symtab_entry): New function.
8048         (Symbol_value::has_output_dynsym_entry): New function.
8049         (Symbol_value::set_output_dynsym_index): Make sure the new index
8050         is valid.
8051         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8052         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8053         local symbol if permitted.
8054         (Sized_relobj::do_finalize_local_symbols): Call
8055         is_output_symtab_index_set rather than needs_output_symtab_entry.
8056         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8057         rather than needs_output_symtab_entry.  Call
8058         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8059         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8060         is_output_symtab_index_set rather than needs_output_symtab_entry.
8061         * testsuite/discard_locals_relocatable_test.c: New file.
8062         * testsuite/discard_locals_test.sh: Test -r.
8063         * testsuite/Makefile.am (check_DATA): Add
8064         discard_locals_relocatable_test1.syms,
8065         discard_local_relocatable_test2.syms.
8066         (MOSTLYCLEANFILES): Likewise.  Also add
8067         discard_locals_relocatable_test1.lout and
8068         discard_locals_relocatable_test2.out.
8069         (discard_locals_relocatable_test1.syms): New target.
8070         (discard_locals_relocatable_test.o): New target.
8071         (discard_locals_relocatable_test1.out): New target.
8072         (discard_locals_relocatable_test2.syms): New target.
8073         (discard_locals_relocatable_test2.out): New target.
8074         (various): Add missing ../ld-new dependencies.
8075         * testsuite/Makefile.in: Rebuild.
8076
8077 2010-03-03  Nick Clifton  <nickc@redhat.com>
8078
8079         * po/fi.po: New Finnish translation.
8080
8081 2010-03-01  Doug Kwan  <dougkwan@google.com>
8082
8083         * layout.cc (Layout::Layout): Force section types of .init_array*,
8084         .preinit_array* and .fini_array* sections.
8085         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8086         Fix check of return value of std::string::find.().
8087         (Output_section::Input_section_sort_compare::operator()): Remove
8088         comment about .init_array.
8089         (Output_section::Input_section_sort_init_fini_compare::operator()):
8090         New method.
8091         (Output_section::sort_attached_input_sections): Handle .init_array
8092         and .fini_array specially.
8093         * output.h (Output_section::Inut_section_sort_compare): Update
8094         comment.
8095         (Output_section::Input_section_sort_init_fini_compare): New struct.
8096
8097 2010-02-26  Doug Kwan  <dougkwan@google.com>
8098
8099         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8100         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8101         * testsuite/debug_msg.sh: Avoid matching source line number for
8102         use of global variable undef_int.
8103
8104 2010-02-26  Doug Kwan  <dougkwan@google.com>
8105
8106         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8107         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8108         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8109         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8110         * options.cc (General_options::General_options): Initialize member
8111         fix_v4bx_.
8112         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8113         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8114         and rm_no_fix_v4bx.stdout
8115         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8116         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8117         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8118         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8119         and arm_no_fix_v4bx.
8120         * Makefile.in: Regenerate.
8121         * testsuite/arm_fix_v4bx.s: New file.
8122         * testsuite/arm_fix_v4bx.sh: Ditto.
8123
8124 2010-02-24  Doug Kwan  <dougkwan@google.com>
8125
8126         * arm.cc (Target_arm::got_section): Make the .got section the first
8127         non RELRO section in the data segment.
8128         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8129         suffixes of section names.
8130
8131 2010-02-24  Doug Kwan  <dougkwan@google.com>
8132
8133         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8134         flags and attributes merging if an input file is a binary file.
8135         * fileread.cc (Input_file::open): Record format of original file.
8136         * fileread.h (Input_file::Format): New enum type.
8137         (Input_file::Input_file): Initialize data member format_.
8138         (Input_file::format): New method definition.
8139         (Input_file::format_):: New data member.
8140
8141 2010-02-24  Doug Kwan  <dougkwan@google.com>
8142
8143         * arm.cc (Arm_output_data_got): New class.
8144         (ARM_TCB_SIZE): New constant
8145         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8146         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8147         If user uses a script with a SECTIONS clause, issue only a warning
8148         for a misplaced EXIDX input section.  Otherwise, issue an error.
8149         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8150         garbage collection.
8151         (Target_arm::got_mode_index_entry): Handle static linking.
8152         (Target_arm::Scan::local): Ditto.
8153         (Target_arm::Scan::global): Ditto.
8154         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8155         all incorrectly implemented relocations.
8156         (Target_arm::fix_exidx_coverage): Pass layout to
8157         Arm_output_section::fix_exidx_coverage.
8158         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8159         from ".ARM.exidx." and ".ARM.extab.".
8160
8161 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8162
8163         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8164         section if it does not already exist.
8165         * attributes.cc (Attributes_section_data::Attributes_section_data):
8166         Don't crash if size is zero.
8167
8168 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8169             Ian Lance Taylor  <iant@google.com>
8170
8171         * gold.cc (queue_middle_tasks): If no input files were opened,
8172         exit.
8173         * workqueue.h (Task_function::Task_function): Assert that there is
8174         a blocker.
8175
8176 2010-02-22  Doug Kwan  <dougkwan@google.com>
8177
8178         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8179         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8180         types to avoid warnings due to different uint64_t implementations
8181         on different hosts.
8182
8183 2010-02-21  Doug Kwan  <dougkwan@google.com>
8184
8185         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8186         handling of the maximum backward branch offset.
8187         (Arm_relocate_functions::thumb_branch_common): Ditto.
8188         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8189         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8190         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8191         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8192         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8193         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8194         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8195         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8196         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8197         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8198         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8199         thumb2_bl_out_of_range.o): New rules.
8200         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8201         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8202         thumb2_bl_out_of_range
8203         * testsuite/Makefile.in: Regenerate.
8204         * testsuite/arm_bl_in_range.s: New file.
8205         * testsuite/arm_bl_out_of_range.s: Ditto.
8206         * testsuite/arm_branch_in_range.sh: Ditto.
8207         * testsuite/arm_branch_range.t: Ditto.
8208         * testsuite/thumb2_branch_range.t: Ditto.
8209         * testsuite/thumb_bl_in_range.s: Ditto.
8210         * testsuite/thumb_bl_out_of_range.s: Ditto.
8211         * testsuite/thumb_branch_range.t: Ditto.
8212
8213 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8214
8215         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8216         Add reloc offset information.
8217         * icf.cc (get_section_contents): Change iterators to point to the new
8218         vectors. Add reloc offset information to the contents.
8219         * icf.h (Icf::Sections_reachable_info): New typedef.
8220         (Icf::Sections_reachable_list): New typedef.
8221         (Icf::Offset_info): New typedef.
8222         (Icf::Reloc_info): New struct typedef.
8223         (Icf::Reloc_info_list): New typedef.
8224         (Icf::symbol_reloc_list): Delete method.
8225         (Icf::addend_reloc_list): Delete method.
8226         (Icf::section_reloc_list): Delete method.
8227         (Icf::reloc_info_list): New method.
8228         (Icf::reloc_info_list_): New member.
8229
8230 2010-02-19  Doug Kwan  <dougkwan@google.com>
8231
8232         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8233         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8234         * arm.cc (Arm_relocation_functions): New forward declaration.
8235         (Target_arm::Target_arm): Initialize new data members
8236         got_mod_index_offset_ and tls_base_symbol_defined_.
8237         (Target_arm::Relocate::relocate_tls): New method.
8238         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8239          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8240         New methods.
8241         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8242         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8243         (Target_arm::got_mod_index_offset_,
8244         Target_arm::tls_base_symbol_defined_): New data members.
8245         (Target_arm::Scan::local, Target::Scan::global,
8246         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8247         relocations.
8248
8249 2010-02-18  Doug Kwan  <dougkwan@google.com>
8250
8251         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8252         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8253         text section as a parameter becuase some broken tools may not set
8254         the link in section header.
8255         (Target_arm::has_got_section): New method.
8256         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8257         without any mapping symbol as data only.  Remove warning.
8258         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8259         link in its section header, try to discover the link by inspecting the
8260         REL31 relocation at the beginning of the section.
8261         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8262         in error message.
8263         (Target_arm::Scan::global): Treat any reference to the symbol
8264         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8265
8266 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8267
8268         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8269         (Scan::global_reloc_may_be_function_pointer): New function.
8270         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8271         (Scan::global_reloc_may_be_function_pointer): New function.
8272         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8273         (Scan::global_reloc_may_be_function_pointer): New function.
8274         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8275         (Scan::global_reloc_may_be_function_pointer): New function.
8276         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8277         (Scan::global_reloc_may_be_function_pointer): New function.
8278         (Scan::possible_function_pointer_reloc): New function.
8279         (Target_x86_64::can_check_for_function_pointers): New function.
8280         * gc.h (gc_process_relocs): Scan relocation types to determine if
8281         function pointers were taken for targets that support it.
8282         * icf.cc (Icf::find_identical_sections): Include functions for
8283         folding in safe ICF whose pointer is not taken.
8284         * icf.h (Secn_fptr_taken_set): New typedef.
8285         (fptr_section_id_): New member.
8286         (section_has_function_pointers): New function.
8287         (set_section_has_function_pointers): New function.
8288         (check_section_for_function_pointers): New function.
8289         * options.h: Fix comment for safe ICF option.
8290         * target.h (can_check_for_function_pointers): New function.
8291         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8292         Modify icf_safe_test for X86-64.
8293         * testsuite/Makefile.in: Regenerate.
8294         * testsuite/icf_safe_so_test.cc: New file.
8295         * testsuite/icf_safe_so_test.sh: New file.
8296         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8297         (main): Change to take pointer to function kept_func_3.
8298         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8299         folding is done correctly for X86-64.
8300
8301 2010-02-12  David S. Miller  <davem@davemloft.net>
8302
8303         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8304         is_symbolless parameter.
8305         (Output_reloc<SHT_REL>::is_symbolless): New.
8306         (Output_reloc<SHT_REL>::is_symbolless_): New.
8307         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8308         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8309         (Output_reloc<SHT_RELA>::is_symbolless): New.
8310         (Output_data_reloc::add_global): Handle is_symbolless.
8311         (Output_data_reloc::add_global_relative): Likewise.
8312         (Output_data_reloc::add_local): Likewise.
8313         (Output_data_reloc::add_local_relative): Likewise.
8314         (Output_data_reloc::add_symbolless_global_addend): New.
8315         (Output_data_reloc::add_symbolless_local_addend): New.
8316         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8317         is_symbolless.
8318         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8319         instead of ->is_relative_
8320         (Output_reloc::write): Likewise.
8321         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8322         (Output_reloc::write_rel): Simplify.
8323
8324         * sparc.cc (Target_sparc::Scan::local): Use
8325         ->add_symbolless_local_addend as needed.
8326         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8327         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8328         based upon relocation offset.
8329
8330 2010-02-11  Doug Kwan  <dougkwan@google.com>
8331
8332         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8333         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8334         beginning of function.
8335         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8336         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8337         parameter is_32bit in calls to should_apply_static_reloc.
8338         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8339         (check_DATA): Add arm_abs_global.stdout.
8340         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8341         arm_abs_global.stdout): New rules.
8342         (MOSTLLYCLEANFILES): Add arm_abs_global
8343         * Makefile.in: Regenerate.
8344         * testsuite/arm_abs_global.s: New file.
8345         * testsuite/arm_abs_global.sh: Ditto.
8346         * testsuite/arm_abs_lib.s: Ditto.
8347
8348 2010-02-11  Ian Lance Taylor  <iant@google.com>
8349
8350         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8351         Read_relocs task.
8352         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8353         Allocate_commons_task first.
8354         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8355         task, rather than symtab_lock_.
8356         (Gc_process_relocs::~Gc_process_relocs): New function.
8357         (Gc_process_relocs::is_runnable): Check this_blocker_.
8358         (Gc_process_relocs::locks): Use next_blocker_ rather than
8359         blocker_.
8360         (Scan_relocs::~Scan_relocs): New function.
8361         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8362         symtab_lock_.
8363         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8364         next_blocker_.
8365         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8366         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8367         constructor accordingly.
8368         (class Gc_process_relocs): Likewise.
8369         (class Scan_relocs): Likewise.
8370         * common.h (class Allocate_commons_task): Remove symtab_lock_
8371         field, and corresponding constructor parameter.
8372         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8373         symtab_lock_.
8374         (Allocate_commons_task::locks): Likewise.
8375
8376 2010-02-11  Ian Lance Taylor  <iant@google.com>
8377
8378         * gold-threads.h (class Once): Define.
8379         (class Initialize_lock): Rewrite as child of Once.
8380         * gold-threads.cc (class Once_initialize): Define.
8381         (once_pointer_control): New static variable.
8382         (once_pointer, once_arg): New static variables.
8383         (c_run_once): New static function.
8384         (Once::Once, Once::run_once, Once::internal_run): New functions.
8385         (class Initialize_lock_once): Remove.
8386         (initialize_lock_control): Remove.
8387         (initialize_lock_pointer): Remove.
8388         (initialize_lock_once): Remove.
8389         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8390         (Initialize_lock::initialize): Rewrite.
8391         (Initialize_lock::do_run_once): New function.
8392         * archive.cc (Archive::interpret_header): Only clear name if it is
8393         not already empty.
8394         * fileread.cc: Include "gold-threads.h"
8395         (file_counts_lock): New static variable.
8396         (file_counts_initialize_lock): Likewise.
8397         (File_read::release): Only increment counts when using --stats.
8398         Use a lock around the increment.
8399         * parameters.cc (class Set_parameters_target_once): Define.
8400         (set_parameters_target_once): New static variable.
8401         (Parameters::Parameters): Move here from parameters.h.
8402         (Parameters::set_target): Rewrite.
8403         (Parameters::set_target_once): New function.
8404         (Parameters::clear_target): Move here and rewrite.
8405         * parameters.h (class Parameters): Update declarations.  Add
8406         set_parameters_target_once_ field.
8407         (Parameters::Parameters): Move to parameters.cc.
8408         (Parameters::clear_target): Likewise.
8409         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8410         task.
8411         (Start_group::~Start_group): New function.
8412         (Start_group::is_runnable): New function.
8413         (Start_group::locks, Start_group::run): New functions.
8414         (Finish_group::run): Change saw_undefined to size_t.
8415         * readsyms.h (class Start_group): Define.
8416         (class Finish_group): Change saw_undefined_ field to size_t.
8417         (Finish_group::Finish_group): Remove saw_undefined and
8418         this_blocker parameters.  Change all callers.
8419         (Finish_group::set_saw_undefined): New function.
8420         (Finish_group::set_blocker): New function.
8421         * symtab.h (class Symbol_table): Change saw_undefined to return
8422         size_t.  Change saw_undefined_ field to size_t.
8423         * target-select.cc (Set_target_once::do_run_once): New function.
8424         (Target_selector::Target_selector): Initialize set_target_once_
8425         field.  Don't initialize lock_ and initialize_lock_ fields.
8426         (Target_selector::instantiate_target): Rewrite.
8427         (Target_selector::set_target): New function.
8428         * target-select.h (class Set_target_once): Define.
8429         (class Target_selector): Update declarations.  Make
8430         Set_target_once a friend.  Remove lock_ and initialize_lock_
8431         fields.  Add set_target_once_ field.
8432
8433 2010-02-10  Ian Lance Taylor  <iant@google.com>
8434
8435         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8436         queueing any tasks.
8437         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8438         (queue_middle_tasks): Add all blockers before queueing any tasks.
8439         (queue_final_tasks): Likewise.
8440         * token.h (Task_token::add_blockers): New function.
8441         * object.h (Input_objects::number_of_relobjs): New function.
8442
8443 2010-02-10  Ian Lance Taylor  <iant@google.com>
8444
8445         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8446         shared, not if not position independent.
8447         * x86_64.cc (Relocate::relocate_tls): Likewise.
8448         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8449         (tls_pie_pic_test): New target.
8450         * testsuite/Makefile.in: Rebuild.
8451
8452         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8453         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8454         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8455         * testsuite/Makefile.in: Rebuild.
8456
8457 2010-02-09  David S. Miller  <davem@davemloft.net>
8458
8459         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8460         R_SPARC_RELATIVE using ->add_local_relative().
8461         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8462
8463         * output.h (Output_data_dynamic::add_section_size): New method
8464         that takes two Output_data objects.
8465         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8466         entry param.  Handle it in initializers.
8467         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8468         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8469         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8470         arg.
8471         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8472         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8473         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8474         for dynrel_includes_plt.
8475         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8476         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8477         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8478         before .rela.plt
8479         (Target_sparc::do_finalize_sections): Update to pass true for
8480         dynrel_includes_plt.
8481         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8482         output before .rela.plt
8483         (Target_powerpc::do_finalize_sections): Update to pass true for
8484         dynrel_includes_plt when 32-bit.
8485
8486 2010-02-08  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8489         method.
8490         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8491         Arm_relobj::scan_section_for_cortex_a8_stubs,
8492         Arm_relobj::do_relocation_section): Instead of calling
8493         Output_section::output_address, use faster
8494         Arm_relobj::simple_input_section_output_address.
8495
8496 2010-02-08  David S. Miller  <davem@davemloft.net>
8497
8498         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8499         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8500         relocation helper function.
8501
8502         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8503         just like R_SPARC_GOT{10,13,22}.
8504         (Target_sparc::Scan::local): Likewise.
8505         (Target_sparc::Relocate:relocate): Likewise.
8506
8507 2010-02-06  Ian Lance Taylor  <iant@google.com>
8508
8509         * configure.ac: Rewrite targetobjs duplicate removal code to use
8510         only shell constructs.
8511         * configure: Rebuild.
8512
8513 2010-02-05  Doug Kwan  <dougkwan@google.com>
8514
8515         PR 11247
8516         * arm.cc (Arm_relobj::section_is_scannable): New method.
8517         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8518         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8519
8520 2010-02-04  Doug Kwan  <dougkwan@google.com>
8521
8522         PR 11247
8523         * arm-reloc-property.cc (cstdio): Include.
8524         * configure.ac (targetobjs): Remove duplicates.
8525         * configure: Regenerate.
8526         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8527         big and little endian version for a given address size.
8528
8529 2010-02-03  Doug Kwan  <dougkwan@google.com>
8530
8531         * arm-reloc-property.cc
8532         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8533         definition.
8534         * arm-reloc-property.h
8535         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8536         New method definition.
8537         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8538         declaration.
8539         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8540         overflow to N.
8541         (GOT_PREL): Change implemented to Y.
8542         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8543         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8544         (Arm_relocate_functions::movw_abs_nc): Remove method.
8545         (Arm_relocate_functions::movt_abs): Ditto.
8546         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8547         (Arm_relocate_functions::thm_movt_abs): Ditto.
8548         (Arm_relocate_functions::movw_rel_nc): Ditto.
8549         (Arm_relocate_functions::movw_rel): Ditto.
8550         (Arm_relocate_functions::movt_rel): Ditto.
8551         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8552         (Arm_relocate_functions:thm_movw_rel): Ditto.
8553         (Arm_relocate_functions:thm_movt_rel): Ditto.
8554         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8555         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8556         New method definitions.
8557         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8558         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8559         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8560         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8561         (Target_arm::Relocate::relocate): Check for non-static or
8562         unimplemented relocation code and exit early.  Change calls to
8563         Target_arm::reloc_uses_thumb_bit and
8564         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8565         instead.  Refactor code to handle similar relocations to increase
8566         code sharing.  Remove check for unsupported relocation code in switch
8567         statement.
8568         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8569         relocation property table to find out size.  Change error message to
8570         print out the name of a relocation code instead of the numeric value.
8571         (Target_arm::scan_reloc_for_stub): Use relocation property table
8572         instead of calling Target_arm::reloc_uses_thumb_bit().
8573
8574 2010-02-02  Doug Kwan  <dougkwan@google.com>
8575
8576         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8577         types of relaxed input section.
8578
8579 2010-02-02  Doug Kwan  <dougkwan@google.com>
8580
8581         * Makefile.am (HFILES): Add arm-reloc-property.h.
8582         (DEFFILES): New.
8583         (TARGETSOURCES): Add arm-reloc-property.cc
8584         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8585         (libgold_a_SOURCES): $(DEFFILES)
8586         * Makefile.in: Regenerate.
8587         * arm-reloc-property.cc: New file.
8588         * arm-reloc-property.h: New file.
8589         * arm-reloc.def: New file.
8590         * arm.cc: Update comments.
8591         (arm-reloc-property.h): New included header.
8592         (arm_reloc_property_table): New global variable.
8593         (Target_arm::do_select_as_default_target): New method definition.
8594         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8595         arm-reloc-property to targ_extra_obj.
8596         * parameters.cc (set_parameters_target): Call
8597         Target::select_as_default_target().
8598         * target.h (Target::select_as_default_target): New method definition.
8599         (Target::do_select_as_default_target): Same.
8600
8601 2010-02-01  Doug Kwan  <dougkwan@google.com>
8602
8603         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8604         first_output_text_section_.
8605         (Arm_exidx_fixup::first_output_text_section): New method definition.
8606         (Arm_exidx_fixup::first_output_text_section_): New data member.
8607         (Arm_exidx_fixup::process_exidx_section): Record the first text
8608         output section seen.
8609         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8610         and entsize in output section header.
8611
8612 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8613
8614         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8615         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8616         (Arm_relocate_functions::thm_alu11): New Method.
8617         (Arm_relocate_functions::thm_pc8): New Method.
8618         (Arm_relocate_functions::thm_pc12): New Method.
8619         (Target_arm::Scan::local): Handle the relocations.
8620         (Target_arm::Scan::global): Likewise.
8621         (Target_arm::Relocate::relocate): Likewise.
8622         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8623
8624 2010-01-29  Doug Kwan  <dougkwan@google.com>
8625
8626         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8627         of relocation types as ld.
8628
8629 2010-01-29  Doug Kwan  <dougkwan@google.com>
8630
8631         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8632         to public.
8633         (Arm_relocate_functions::thumb_branch_common): Ditto.
8634         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8635         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8636         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8637         Arm_relocate_functions::jump24): Remove.
8638         (Target_arm::Relocate::relocate): Adjust code to call
8639         Arm_relocation_functions::arm_branch_common and
8640         Arm_relocation_functions::thumb_branch_common instead of their removed
8641         wrappers.  Merge switch-cases together to reduce source code size.
8642
8643 2010-01-29  Doug Kwan  <dougkwan@google.com>
8644
8645         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8646         output_local_symbol_count_needs_update_.
8647         (Arm_relobj::output_local_symbol_count_needs_update,
8648          Arm_relobj::set_output_local_symbol_count_needs_update,
8649          Arm_relobj::update_output_local_symbol_count): New methods.
8650         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8651         member.
8652         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8653         of pointed function as in a R_ARM_PREL31 relocation.
8654         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8655         for output local symbol count updating.
8656         (Target_arm::do_relax): Update output local symbol counts in objects
8657         if necessary.
8658         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8659
8660 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8661
8662         * arm.cc: Added support for the ARM relocations:
8663         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8664         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8665         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8666         movw_prel_nc).
8667         (Arm_relocate_functions::movw_rel): New method.
8668         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8669         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8670         thm_movw_prel_nc).
8671         (Arm_relocate_functions::thm_movw_rel): New method.
8672         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8673         thm_movt_prel).
8674         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8675         relocations.
8676         (Target_arm::Scan::global): Likewise.
8677         (Target_arm::Relocate::relocate): Likewise.
8678         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8679         Likewise.
8680
8681 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8682
8683         * arm.cc: Added support for ARM group relocations.
8684         (Target_arm::reloc_needs_sym_origin): New method.
8685         (Arm_relocate_functions::calc_grp_kn): New method.
8686         (Arm_relocate_functions::calc_grp_residual): New method.
8687         (Arm_relocate_functions::calc_grp_gn): New method.
8688         (Arm_relocate_functions::arm_grp_alu): New Method.
8689         (Arm_relocate_functions::arm_grp_ldr): New Method.
8690         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8691         (Arm_relocate_functions::arm_grp_ldc): New Method.
8692         (Target_arm::Scan::local): Handle the ARM group relocations.
8693         (Target_arm::Scan::global): Likewise.
8694         (Target_arm::Relocate::relocate): Likewise.
8695         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8696         Likewise.
8697
8698 2010-01-26  Doug Kwan  <dougkwan@google.com>
8699
8700         * arm.cc (set): Include.
8701         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8702         pointer type.
8703         (Arm_output_section::Text_section_list): New type.
8704         (Arm_output_section::append_text_sections_to_list): New method.
8705         (Arm_output_section::fix_exidx_coverage): Ditto.
8706         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8707         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8708         Relobj::set_section_offset() instead of
8709         Sized_relobj::invalidate_section_offset().
8710         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8711         parameter for section headers. Ignore relocation sections for
8712         unallocated sections and EXIDX sections.
8713         (Target_arm::fix_exidx_coverage): New method.
8714         (Target_arm::output_section_address_less_than): New type.
8715         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8716         linked text section instead of the EXIDX section.
8717         (Arm_output_section::create_stub_group): Add an assertion to check
8718         that this is not an EXIDX output section.
8719         (Arm_output_section::append_text_sections_to_list): New method.
8720         (Arm_output_section::fix_exidx_coverage): Ditto.
8721         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8722         Arm_relobj::section_needs_reloc_stub_scanning.
8723         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8724         first pass.
8725         (Target_arm::fix_exidx_coverage): New method.
8726         * object.h (Relobj::set_output_section): New method.
8727         (Sized_relobj::invalidate_section_offset): Remove method.
8728         (Sized_relobj::do_invalidate_section_offset): Remove method.
8729         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8730
8731 2010-01-25  Doug Kwan  <dougkwan@google.com>
8732
8733         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8734         Fix warning due to signed and unsigned comparison on a 32-bit host.
8735
8736 2010-01-22  Doug Kwan  <dougkwan@google.com>
8737
8738         * arm.cc (Target_arm::do_relax): Record an output section for section
8739         offset adjustment it contains any stub table that has changed.
8740         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8741         offsets in an output section if necessary.
8742         * output.cc (Output_section::Output_section): Initialize
8743         section_offsets_need_adjustments_.
8744         (Output_section::add_input_section_for_script): Renamed to
8745         Output_section::add_simple_input_section.
8746         (Output_section::save_states): Add a comment.
8747         (Output_section::discard_states): New method defintion.
8748         (Output_section::adjust_section_offsets): Same.
8749         * output.h (Output_section::add_input_section_for_script): Renamed to
8750         Output_section::add_simple_input_section.
8751         (Output_section::discard_states): New method declaration.
8752         (Output_section::adjust_section_offsets): Same.
8753         (Output_section::section_offsets_need_adjustment,
8754         Output_section::set_section_offsets_need_adjustment): New method
8755         definitions.
8756         (Output_section::section_offsets_need_adjustment_): New data member.
8757         * script-sections.cc
8758         (Output_section_element_input::set_section_address): Adjust code for
8759         renaming of Output_section::add_input_section_for_script.
8760         (Orphan_output_section::set_section_address): Same.
8761
8762 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8763
8764         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8765         Fix_v4bx enum values .
8766         * gold/options.h (General_options): New option definitions.
8767         (General_options::fix_v4bx): New method.
8768         (General_options::Fix_v4bx): New enum.
8769         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8770         (General_options::parse_fix_v4bx_interworking): New method.
8771
8772 2010-01-22  Doug Kwan  <dougkwan@google.com>
8773
8774         * arm.cc (Arm_exidx_fixup): New class.
8775
8776 2010-01-21  Doug Kwan  <dougkwan@google.com>
8777
8778         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8779         classes.
8780         (Arm_exidx_section_offset_map): New type.
8781
8782 2010-01-21  Doug Kwan  <dougkwan@google.com>
8783
8784         * arm.cc (Arm_exidx_input_section): New class.
8785         (Arm_relobj::exidx_input_section_by_link,
8786         Arm_relobj::exidx_input_section_by_shndx,
8787         Arm_relobj::make_exidx_input_section): New methods.
8788         (read_arm_attributes_section): Remove.
8789         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8790         information about them.
8791         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8792         to here.
8793
8794 2010-01-20  Doug Kwan  <dougkwan@google.com>
8795
8796         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8797         Input_section_specifier to Section_id.
8798         (Target_arm::new_arm_input_section: Adjust code for change of key
8799         type.
8800         (Target_arm::find_arm_input_section): Ditto.
8801         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8802         (Section_id): Remove.
8803         (Garbage_collection::Section_id_hash): Remove.
8804         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8805         (Section_id): Remove.
8806         (Icf::Section_id_hash): Remove.
8807         * object.h (Section_id, Const_section_id, Section_id_hash,
8808         Const_section_id_hash): New type definitions.
8809         * output.cc (Output_section::add_relaxed_input_section): Change to
8810         use Const_section_id instead of Input_section_specifier as key type.
8811         (Output_section::add_merge_input_section): Ditto.
8812         (Output_section::build_relaxation_map): Change to use Section_id
8813         instead of Input_section_specifier as key type.
8814         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8815         Ditto.
8816         (Output_section::convert_input_sections_to_relaxed_sections): Change
8817         to use Const_section_id instead of Input_section_specifier as key type.
8818         (Output_section::find_merge_section): Ditto.
8819         (Output_section::find_relaxed_input_section): Ditto.
8820         * output.h (Input_section_specifier): Remove class.
8821         (Output_section::Output_section_data_by_input_section_map): Change
8822         key type to Const_section_id.
8823         (Output_section::Output_relaxed_input_section_by_input_section_map):
8824         Ditto.
8825         (Output_section::Relaxation_map): Change key type to Section_id.
8826
8827 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8828
8829         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8830         (class Arm_v4bx_stub): New class.
8831         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8832         (Stub_factory::make_arm_v4bx_stub): New method.
8833         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8834         (Stub_table::empty): Handle v4bx stubs.
8835         (Stub_table::add_arm_v4bx_stub): New method.
8836         (Stub_table::find_arm_v4bx_stub): New method.
8837         (Arm_relocate_functions::v4bx): New method.
8838         (Target_arm::fix_v4bx): New method.
8839         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8840         (Stub_table::relocate_stubs): Likewise.
8841         (Stub_table::do_write): Likewise.
8842         (Stub_table::update_data_size_and_addralign): Likewise.
8843         (Stub_table::finalize_stubs):  Likewise.
8844         (Target_arm::Scan::local): Likewise.
8845         (Target_arm::Scan::global): Likewise.
8846         (Target_arm::do_finalize_sections): Likewise.
8847         (Target_arm::Relocate::relocate): Likewise.
8848         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8849         Likewise.
8850         (Target_arm::scan_reloc_for_stub): Likewise.
8851         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8852
8853 2010-01-19  Ian Lance Taylor  <iant@google.com>
8854
8855         * output.cc (Output_section_headers::do_sized_write): Write large
8856         segment count to sh_info field.
8857         (Output_file_header::do_sized_write): For large segment count,
8858         write PN_XNUM to e_phnum field.
8859
8860 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8861
8862         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8863         (Arm_relocate_functions::thm_jump8): New function.
8864         (Arm_relocate_functions::thm_jump11): New function.
8865         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8866         R_ARM_THM_JUMP11.
8867         (Target_arm::Scan::global): Likewise.
8868         (Target_arm::Relocate::relocate): Likewise.
8869         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8870         Likewise.
8871
8872 2010-01-14  Doug Kwan  <dougkwan@google.com>
8873
8874         * arm.cc (map, utility): Include headers.
8875         (Target_arm::apply_cortex_a8_workaround): New method.
8876         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8877         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8878         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8879         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8880         the --[no-]fix-cortex-a8 command line options.
8881         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8882         (Target_arm::relocate_stub): Use addend in instruction template.
8883         * options.h (DEFINE_bool): Set the user-set flag.
8884         (General_options): Add --[no-]-fix-cortex options.
8885         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8886         : Update fast look-up map after conversion.
8887
8888 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8889
8890         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8891         in the first pass of do_layout.
8892
8893 2010-01-13  Doug Kwan  <dougkwan@google.com>
8894
8895         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8896         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8897         apparent compiler problem of not folding static constant integral
8898         data members of elfcpp::Elf_sizes<32>.
8899
8900 2010-01-13  Doug Kwan  <dougkwan@google.com>
8901
8902         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8903         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8904         Arm_relobj::scan_section_for_cortex_a8_erratum,
8905         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8906         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8907         sections to scan for relocation stubs into a new method
8908         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8909         relocation and Cortex-A8 stub scanning.
8910         (Target_arm::do_relax): Force stubs to be after stubbed sections
8911         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8912         the beginning of a new relaxation pass.  Update a comment.
8913         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8914
8915 2010-01-12  Ian Lance Taylor  <iant@google.com>
8916
8917         * target-reloc.h (visibility_error): New inline function.
8918         (relocate_section): Call visibility_error.
8919         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8920         (MOSTLYCLEANFILES): Likewise.
8921         (protected_4_pic.o, protected_3.err): New targets.
8922         * testsuite/protected_4.cc: New file.
8923
8924 2010-01-12  Doug Kwan  <dougkwan@google.com>
8925
8926         * arm.cc (Cortex_a8_reloc): New class.
8927         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8928         and cortex_a8_relocs_info_.
8929         (Target_arm::fix_cortex_a8): New method definition.
8930         (Target_arm::Cortex_a8_relocs_info): New type.
8931         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8932         New data member declarations.
8933         (Target_arm::scan_reloc_for_stub): Record information about
8934         relocations for THUMB branches that might be exempted from the
8935         Cortex-A8 workaround.
8936         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8937         at the beginning of a relaxation pass.
8938
8939 2010-01-12  Doug Kwan  <dougkwan@google.com>
8940
8941         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8942         (Arm_relobj::Mapping_symbol_position,
8943          Arm_reloj::Mapping_symbol_position_less,
8944          Arm_relobj::Mapping_symbols_info): New types.
8945         (Target_arm::is_mapping_symbol_name): New method definition.
8946         (Arm_relobj::do_count_local_symbols): Save information about mapping
8947         symbols.
8948
8949 2010-01-11  Doug Kwan  <dougkwan@google.com>
8950
8951         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8952         Arm_relocate_functions::thumb32_branch_upper,
8953         Arm_relocate_functions::thumb32_branch_lower,
8954         Arm_relocate_functions::thumb32_cond_branch_offset,
8955         Arm_relocate_functions::thumb32_cond_branch_upper,
8956         Arm_relocate_functions::thumb32_cond_branch_lower,
8957         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8958         branch offset encoding.
8959         (Arm_relocate_functions::thumb_branch_common): Use new branch
8960         offset encoding methods to avoid code duplication.
8961         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8962         (Stub_addend_reader::operator()): Use new branch encoding method
8963         to avoid code duplication.
8964
8965 2010-01-11  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8968         (Target_arm::do_finalize_sections): Define special EXIDX section
8969         symbols only if referenced.
8970         * gc.h (Garbage_collection::add_reference): New method.
8971         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8972         code duplication.
8973
8974 2010-01-11  Ian Lance Taylor  <iant@google.com>
8975
8976         * script.cc (Version_script_info::build_expression_list_lookup):
8977         Change complaing about duplicate wildcard match from error to
8978         warning.
8979
8980         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8981         of 2009-12-30.
8982         (Version_script_info::Version_script_info): Initialize globs_,
8983         default_version_, default_is_global_, and exact_.  Don't
8984         initialize globals_ or locals_.
8985         (Version_script_info::build_lookup_tables): Build local symbols
8986         first.
8987         (Version_script_info::unquote): New function.
8988         (Version_script_info::add_exact_match): New function.
8989         (Version_script_info::build_expression_list_lookup): Remove lookup
8990         parameter.  Add is_global parameter.  Change all callers.  Handle
8991         wildcard pattern specially.  Unquote pattern.  Call
8992         add_exact_match.
8993         (Version_script_info::get_name_to_match): New function.
8994         (Version_script_info::get_symbol_version): New function.
8995         (Version_script_info::get_symbol_version_helper): Remove.
8996         (Version_script_info::check_unmatched_names): Call unquote.
8997         * script.h (class Version_script_info): Change get_symbol_version
8998         to be non-inline and add is_global parameter; change all callers.
8999         Rewrite symbol_is_local.  Update declarations.  Define struct
9000         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9001         Remove globals_ and locals_ members.  Add exact_, globs_,
9002         default_version_, is_global_.
9003         (Version_script_info::Glob): Remove pattern, add expression and
9004         is_global.  Update constructor.  Change all callers.
9005         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9006         default version.
9007         (Versions::symbol_section_contents): If a symbol is undefined, or
9008         defined in a dynamic object, set the version index to
9009         VER_NDX_LOCAL.
9010         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9011         symbol_is_local.
9012         (Symbol_table::add_from_pluginobj): Likewise.
9013         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9014
9015 2010-01-11  Doug Kwan  <dougkwan@google.com>
9016
9017         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9018         (incremental_dump_LDADD): Add linking option for libintl.
9019         * Makefile.in: Regenerate.
9020
9021 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9022
9023         PR gold/11144
9024         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9025         instead of -Ds.
9026         * testsuite/Makefile.in: Regenerated.
9027
9028 2010-01-10  Doug Kwan  <dougkwan@google.com>
9029
9030         * options.h (DEFINE_var): Use parentheses around argument varname__
9031         in macro body to avoid any unintended subsequent substitutions.
9032
9033 2010-01-10  Ian Lance Taylor  <iant@google.com>
9034
9035         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9036         candidates before doing symbol resolution.
9037
9038         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9039         ODR candidates if only one is weak.
9040
9041 2010-01-08  Ian Lance Taylor  <iant@google.com>
9042
9043         * script.cc (Version_script_info::build_expression_list_lookup):
9044         Don't warn about ambiguous version, just record the ambiguity.
9045         (Version_script_info::get_symbol_version_helper): Give error if
9046         version is ambiguous.
9047
9048 2010-01-08  Doug Kwan  <dougkwan@google.com>
9049
9050         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9051         prev_data_size_ and prev_addralign_.  Remove initializer for
9052         deleted data member has_been_changed_.
9053         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9054         to determine if the table is empty.
9055         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9056         Remove.
9057         (Stub_table::add_reloc_stub): Define method in class definition
9058         instead of just declaring it there.
9059         (Stub_table::add_cortex_a8_stub): New method definition.
9060         (Stub_table::update_data_size_and_addralign): Ditto.
9061         (Stub_table::finalize_stubs): Ditto.
9062         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9063         (Stub_table::do_addralign_): Return address alignment in the
9064         (Stub_table::do_reset_address_and_file_offset): Define method in
9065         class definition instead of declaring it there.  Set current data
9066         size to be the data size of the previous pass.
9067         (Stub_table::set_final_data_size): Use current data size as the
9068         final data size.
9069         (Stub_table::relocate_stub): Change parameter type of stub from
9070         Reloc_stub pointer to Stub pointer.
9071         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9072         (Stub_table::Cortex_a8_stub_list): New typedef.
9073         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9074          Stub_table::prev_addralign_): New data member.
9075         (Arm_relobj::Arm_relobj): Initialize data member
9076         section_has_cortex_a8_workaround_.
9077         (Arm_relobj::section_has_cortex_a8_workaround,
9078          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9079          definitions.
9080         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9081         declarations.
9082         (Target_arm::relocate_stub): Change parameter type of stub from
9083         Reloc_stub pointer to Stub pointer.
9084         (Insn_template::size, Insn_template::alignment): Handle
9085         THUMB16_SPECIAL_TYPE.
9086         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9087          Stub_table::update_data_size_and_addralign,
9088          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9089         definitions.
9090         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9091         (Stub_table::do_write): Ditto.
9092         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9093
9094 2010-01-08  Ian Lance Taylor  <iant@google.com>
9095
9096         PR 11108
9097         * symtab.h (class Symbol): Remove fields is_target_special_ and
9098         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9099         (Symbol::is_defined_in_discarded_section): New function.
9100         (Symbol::set_is_defined_in_discarded_section): New function.
9101         (Symbol::has_plt_offset): Rewrite.
9102         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9103         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9104         Don't initialize is_target_special_ or has_plt_offset_.
9105         Initialize is_defined_in_discarded_section_.
9106         (Symbol_table::add_from_relobj): If appropriate, set
9107         is_defined_in_discarded_section.
9108         * resolve.cc (Symbol::override_base_with_special): Don't test
9109         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9110         * target-reloc.h (relocate_section): Do special handling for
9111         symbols defined in discarded sections for global symbols as well
9112         as local symbols.
9113
9114 2010-01-08  Ian Lance Taylor  <iant@google.com>
9115
9116         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9117         the SHT_SYMTAB case.
9118
9119 2010-01-08  Ian Lance Taylor  <iant@google.com>
9120
9121         * object.cc (Sized_relobj::do_layout): Don't get confused if
9122         layout_eh_frame returns NULL.
9123
9124 2010-01-08  Ian Lance Taylor  <iant@google.com>
9125
9126         PR 11084
9127         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9128         dynamic symbol table, use the normal symbol table.
9129         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9130         symbol table.
9131
9132 2010-01-08  Ian Lance Taylor  <iant@google.com>
9133
9134         PR 11072
9135         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9136         sections.
9137
9138 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9139
9140         * version.cc (print_version): Change to "Copyright 2010".
9141
9142 2010-01-08  Ian Lance Taylor  <iant@google.com>
9143
9144         PR 10287
9145         PR 11063
9146         * i386.cc (class Target_i386): Change return type of plt_section
9147         to be non-const.
9148         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9149         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9150         tls_desc_rel_ field.
9151         (Output_data_plt_i386::rel_tls_desc): New function.
9152         (Target_i386::rel_tls_desc_section): New function.
9153         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9154         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9155         R_386_TLS_DESC reloc in rel_tls_desc_section.
9156         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9157         Define struct Tlsdesc_info.
9158         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9159         (Target_x86_64::do_reloc_symbol_index): New function.
9160         (Target_x86_64::add_tlsdesc_info): New function.
9161         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9162         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9163         tlsdesc_rel_ field.
9164         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9165         all callers.
9166         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9167         (Target_x86_64::rela_tlsdesc_section): New function.
9168         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9169         handling.
9170         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9171         (Target_x86_64::do_reloc_addend): New function.
9172         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9173         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9174         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9175         (Output_reloc::type): New function.
9176         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9177         (Output_reloc::is_target_specific): New function.
9178         (Output_reloc::target_arg): New function.
9179         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9180         absolute relocs and target specific relocs.
9181         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9182         add_target_specific.
9183         (class Output_data_reloc) [SHT_RELA]: Likewise.
9184         * output.cc (Output_reloc::Output_reloc): Add four new versions
9185         for absolute relocs and target specific relocs.
9186         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9187         (Output_reloc::get_symbol_index): Likewise.
9188         (Output_reloc::local_section_offset): Check that local_sym_index_
9189         is not TARGET_CODE or 0.
9190         (Output_reloc::symbol_value): Likewise.
9191         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9192         reloc.
9193         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9194         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9195         functions.
9196         * layout.cc (add_target_dynamic_tags): Use output section for
9197         DT_PLTRELSZ and DT_JMPREL.
9198
9199 2010-01-07  Ian Lance Taylor  <iant@google.com>
9200
9201         PR 11061
9202         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9203         function.
9204         (class Output_data_reloc_generic): Define.
9205         (class Output_data_reloc_base): Change base class to
9206         Output_data_reloc_generic.  Change add() method to call
9207         bump_relative_reloc_count for a relative reloc.  Remove
9208         sort_relocs_ field.
9209         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9210         to sort_relocs().
9211         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9212         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9213         appropriate.
9214         * layout.h (class Layout): Update declaration.
9215
9216 2010-01-07  Ian Lance Taylor  <iant@google.com>
9217
9218         * output.h (class Output_data): Add const version of
9219         output_section and do_output_section.
9220         (class Output_section_data): Add const version of
9221         do_output_section.
9222         (class Output_section): Likewise.
9223         * layout.cc (Layout::add_target_dynamic_tags): New function.
9224         * layout.h (class Layout): Update declarations.
9225         * arm.cc (Target_arm::do_finalize_sections): Use
9226         add_target_dynamic_tags.
9227         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9228         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9229         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9230         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9231
9232 2010-01-07  Ian Lance Taylor  <iant@google.com>
9233
9234         PR 11042
9235         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9236         object as needed.
9237
9238 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9239             Ian Lance Taylor  <iant@google.com>
9240
9241         PR 11019
9242         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9243         Xindex::read_symtab_xindex.
9244
9245 2010-01-07  Doug Kwan  <dougkwan@google.com>
9246
9247         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9248         (Insn_template::thumb16_bcond_insn): New method declaration.
9249         (Insn_template): Fix spelling.
9250         (Stub::thumb16_special): New method declaration.
9251         (Stub::do_write): Define virtual method which was previously pure
9252         virtual.
9253         (Stub::do_thumb16_special): New method declaration.
9254         (Stub::do_fixed_endian_write): New template member.
9255         (Reloc_stub::do_write): Remove.
9256         (Reloc_stub::do_fixed_endian_write): Remove.
9257         (Cortex_a8_stub): New class definition.
9258         (Stub_factory::make_cortex_a8_stub): New method definition.
9259         (Stub_factory::Stub_factory): Add missing static storage class
9260         qualifier for elf32_arm_stub_a8_veneer_blx.
9261
9262 2010-01-07  Ian Lance Taylor  <iant@google.com>
9263
9264         PR 10980
9265         * options.h (class General_options): Add --warn-unresolved-symbols
9266         and --error-unresolved-symbols.
9267         * errors.cc (Errors::undefined_symbol): Implement
9268         --warn-unresolved-symbols.
9269
9270         * options.h (class General_options): Add -z text and -z textoff.
9271         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9272
9273 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9274
9275         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9276         (Garbage_collection::cident_sections): New function.
9277         (Garbage_collection::add_cident_section): New function.
9278         (Garbage_collection::cident_sections_): New member.
9279         (gc_process_relocs): Add references to sections whose names are C
9280         identifiers.
9281         * gold.h (cident_section_start_prefix): New constant.
9282         (cident_section_stop_prefix): New constant.
9283         (is_cident): New function.
9284         * layout.cc (Layout::define_section_symbols): Replace string constants
9285         with the newly defined constants.
9286         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9287         C identifiers.
9288         * testsuite/Makefile.am: Add gc_orphan_section_test.
9289         * testsuite/Makefile.in: Regenerate.
9290         * testsuite/gc_orphan_section_test.cc: New file.
9291         * testsuite/gc_orphan_section_test.sh: New file.
9292
9293 2010-01-06  Ian Lance Taylor  <iant@google.com>
9294
9295         PR 10980
9296         * options.h (class General_options): Add --warn-shared-textrel.
9297         * layout.cc (Layout::finish_dynamic_section): Implement
9298         --warn-shared-textrel.
9299
9300         PR 10980
9301         * options.h (class General_options): Add --warn-multiple-gp.
9302
9303 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9304
9305         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9306         $(THREADSLIB) and $(LIBDL).
9307         * Makefile.in: Rebuild.
9308
9309 2010-01-06  Ian Lance Taylor  <iant@google.com>
9310
9311         PR 10980
9312         * options.cc (General_options::parse_section_start): New function.
9313         (General_options::section_start): New function.
9314         (General_options::General_options): Initialize all members.
9315         * options.h: Include <map>
9316         (class General_options): Add --section-start.  Add section_starts_
9317         member.
9318         * layout.cc (Layout::attach_allocated_section_to_segment): If
9319         --section-start was used, set the address of the segment.  Remove
9320         local sort_sections.
9321         (Layout::relaxation_loop_body): If the address of the load segment
9322         has been set by --section-start, don't use it.
9323         * output.h (Output_segment::update_flags_for_output_section): New
9324         function.
9325         * output.cc (Output_segment::add_output_section): Call
9326         update_flags_for_output_section.
9327
9328 2010-01-05  Ian Lance Taylor  <iant@google.com>
9329
9330         PR 10980
9331         * options.h (class General_options): Add --undefined-version.
9332         * script.cc (struct Version_expression): Add was_matched_by_symbol
9333         field.
9334         (Version_script_info::matched_symbol): New function.
9335         (Version_script_info::get_symbol_version_helper): Call
9336         matched_symbol.
9337         (Version_script_info::check_unmatched_names): New function.
9338         * script.h (class Version_script_info): Update declarations.
9339         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9340
9341         * options.h (class General_options): Use DEFINE_bool_alias for
9342         allow_multiple_definition.
9343         * resolve.cc (Symbol_table::should_override): Don't test
9344         allow_multiple_definition.
9345
9346         PR 10980
9347         * options.h (class General_options): Add --cref.
9348         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9349         until after printing cref table.
9350         * cref.cc: Include "symtab.h".
9351         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9352         (Cref_table_compare::operator()): New function.
9353         (Cref_inputs::gather_cref): New function.
9354         (filecol): New static const.
9355         (Cref_inputs::print_cref): New function.
9356         (Cref::print_cref): New function.
9357         * cref.h: Include <cstdio>.
9358         (class Cref): Update declarations.
9359         * mapfile.h (Mapfile::file): New function.
9360         * object.h (class Object): Define Symbols.  Declare virtual
9361         do_get_global_symbols.
9362         (Object::get_global_symbols): New function.
9363         * object.cc (Input_objects::add_object): Pass object to cref_ if
9364         --cref.
9365         (Input_objects::archive_start): Likewise.
9366         (Input_objects::archive_stop): Likewise.
9367         (Input_objects::print_cref): New function.
9368         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9369         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9370         --cref.
9371         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9372         function.
9373         * plugin.h (class Sized_pluginobj): Update declarations.
9374
9375 2010-01-05  Ian Lance Taylor  <iant@google.com>
9376
9377         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9378         to is_default_version.  Rename insdef to insdefault.
9379         (Symbol_table::add_from_relobj): Rename def to is_default_version
9380         and local to is_forced_local.
9381         (Symbol_table::add_from_pluginobj): Likewise.
9382         (Symbol_table::add_from_dynobj): Likewise.
9383         (Symbol_table::define_special_symbol): Rename insdef to
9384         insdefault.
9385
9386 2010-01-04  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10980
9389         * options.h (class General_options): Add
9390         --allow-multiple-definition and -z muldefs.
9391         * resolve.cc (Symbol_table::should_override): Don't warn about a
9392         multiple symbol definition if --allow-multiple-definition or -z
9393         muldefs.
9394
9395         PR 10980
9396         * options.h (class General_options): Add --add-needed and
9397         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9398         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9399         error if --copy-dt-needed-entries aka --add-needed is used and
9400         would cause a change in behaviour.
9401
9402         PR 10980
9403         * options.h (class General_options): Add -G as a short version of
9404         --shared.  Add no-op options -assert, -g, and -i.
9405
9406 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9407
9408         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9409         check for .text or .gnu.linkonce.t sections.
9410         * icf.cc (Icf::find_identical_sections): Ditto.
9411         Change the detection for mangled function name within the section
9412         name.
9413         * icf.h (is_section_foldable_candidate): New function.
9414
9415 2009-12-30  Ian Lance Taylor  <iant@google.com>
9416
9417         PR 10980
9418         * options.h (class General_options): Permit two dashes with
9419         --retain-symbols-file.
9420
9421 2009-12-30  Ian Lance Taylor  <iant@google.com>
9422
9423         PR 10979
9424         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9425         don't put the file header and segment headers in the text
9426         segment.
9427
9428         PR 10979
9429         * common.cc (Sort_commons::operator()): Stabilize sort when both
9430         entries are NULL.
9431         (Symbol_table::do_allocate_commons_list): When allocating common
9432         symbols, skip a symbol which is no longer common.
9433         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9434         an object before checking its type.
9435         * testsuite/common_test_2.c: New file.
9436         * testsuite/common_test_3.c: New file.
9437         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9438         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9439         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9440         (common_test_2_pic.o, common_test_2.so): New targets.
9441         (common_test_3_pic.o, common_test_3.so): New targets.
9442         * testsuite/Makefile.in: Rebuild.
9443
9444         PR 10979
9445         * script.cc (read_input_script): If we see a new SECTIONS clause,
9446         and we have added an input section, give an error.
9447         * layout.h (class Layout): Add have_added_input_section function.
9448         Add have_added_input_section_ field.
9449         * layout.cc (Layout::Layout): Initialize
9450         have_added_input_section_.
9451         (Layout::layout): Set have_added_input_section_.
9452         (Layout::layout_eh_frame): Likewise.
9453
9454 2009-12-30  Ian Lance Taylor  <iant@google.com>
9455
9456         PR 10931
9457         * options.h (class General_options): Add --sort-common option.
9458         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9459         * common.cc (Sort_common): Add sort_order parameter to
9460         constructor.  Add sort_order_ field.
9461         (Sort_commons::operator): Check sort_order_.
9462         (Symbol_table::allocate_commons): Determine the sort order.
9463         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9464         Change all callers.
9465         (Symbol_table::do_allocate_commons_list): Likewise.
9466
9467 2009-12-30  Ian Lance Taylor  <iant@google.com>
9468
9469         PR 10916
9470         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9471         symbols from this object, don't change the visibility of an
9472         undefined symbol.
9473         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9474
9475 2009-12-30  Ian Lance Taylor  <iant@google.com>
9476
9477         PR 10861
9478         * script.h (class Version_script_info): Define Language enum.
9479         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9480         new fields globals_, locals_, and is_finalized_.
9481         * script.cc: Various formatting fixes.
9482         (class Parser_closure): Change language_stack_ from a vector of
9483         std::string to one of Version_script_info::Language.  Adjust all
9484         uses accordingly.
9485         (class Lazy_demangler): Remove.
9486         (struct Version_expression): Change language from std::string to
9487         Version_script_info::Language.
9488         (Version_script_info::Version_script_info): New function.
9489         (Version_script_info::~Version_script_info): Don't call clear.
9490         (Version_script_info::finalize): New function.
9491         (Version_script_info::build_lookup_tables): New function.
9492         (Version_script_info::build_expression_list_lookup): New
9493         function.
9494         (Version_script_info::get_symbol_version_helper): Rewrite to use
9495         lookup tables.
9496         (Version_script_info::print_expression_list): Adjust to use
9497         Version_script_info::Language.
9498         (script_push_lex_into_version_mode): Check that the version script
9499         has not been finalized.
9500         (version_script_push_lang): Change language string to
9501         Version_script_info::Language.
9502         * options.cc (Command_line::version_script): New function.
9503         * options.h (class General_options): Add finalize_dynamic_list
9504         function.  Change version_script from declaration to definition.
9505         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9506         * testsuite/version_script.map: Remove duplicate def of foo.
9507         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9508         version_script.map.
9509         * testsuite/Makefile.in: Rebuild.
9510
9511 2009-12-30  Ian Lance Taylor  <iant@google.com>
9512
9513         PR 10843
9514         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9515         if the input symbol index is 0, make the output symbol index 0.
9516
9517 2009-12-30  Ian Lance Taylor  <iant@google.com>
9518
9519         PR 10670
9520         * options.h (class General_options): Add -x/--discard-all.
9521         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9522         --discard-all.  If the local symbol needs a dynamic entry, check
9523         that before handling --discard-locals.
9524
9525 2009-12-30  Ian Lance Taylor  <iant@google.com>
9526
9527         PR 10450
9528         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9529         flags to PF_R.
9530         (Output_segment::add_output_section): Don't change the flags if
9531         the type is PT_TLS.
9532
9533         PR 10450
9534         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9535         GNU hash table if they need a dynamic value.  Otherwise, don't add
9536         them if they are defined in a dynamic object or are forced local.
9537
9538 2009-12-29  Ian Lance Taylor  <iant@google.com>
9539
9540         PR 10450
9541         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9542         .gnu.hash table for a 32-bit target.
9543
9544         PR 10450
9545         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9546         regular and a dynamic object only needs a dynamic symbol table
9547         entry if it is externally visible.
9548
9549         PR 10450
9550         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9551         constructor.  Add global_offset_table_ field.
9552         (Target_i386::got_section): Set global_offset_table_.
9553         (Target_i386::do_finalize_sections): Set global_offset_table_
9554         size.
9555         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9556         in constructor.  Add global_offset_table_ field.
9557         (Target_x86_64::got_section): Set global_offset_table_.
9558         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9559         size.
9560
9561         * layout.cc (Layout::Layout): Initialize increase_relro_.
9562         (Layout::get_output_section): Add is_relro, is_last_relro, and
9563         is_first_non_relro parameters.  Change all callers.
9564         (Layout::choose_output_section): Likewise.
9565         (Layout::add_output_section_data): Likewise.
9566         (Layout::make_output_section): Likewise.
9567         (Layout::set_segment_offsets): Clear increase_relro when using a
9568         linker script.
9569         * layout.h (class Layout): Add increase_relro method.  Add
9570         increase_relro_ field.  Update declarations.
9571         * output.cc (Output_section::Output_section): Initialize
9572         is_last_relro_ and is_first_non_relro_.
9573         (Output_segment::add_output_section): Group relro sections is
9574         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9575         (Output_segment::maximum_alignment): Remove relro handling.
9576         (Output_segment::set_section_addresses): Add increase_relro
9577         parameter.  Change all callers.  Add initial alignment to align
9578         relro sections on separate page.  Remove old relro handling.
9579         (Output_segment::set_section_list_addresses): Remove in_relro
9580         parameter.  Change all callers.
9581         (Output_segment::set_offset): Add increase parameter.  Change all
9582         callers.  Remove old relro handling.
9583         * output.h (class Output_section): Add new methods: is_last_relro,
9584         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9585         Add is_last_relro_ and is_first_non_relro_ fields.
9586         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9587         Create separate .got.plt section.  Call increase_relro.
9588         * x86_64.cc (Target_x86_64::got_section): Likewise.
9589         * testsuite/relro_script_test.t: Add .got.plt.
9590
9591         PR 10450
9592         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9593         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9594         (Layout::finalize): Call set_dynamic_symbol_size.
9595         (Layout::set_dynamic_symbol_size): New function.
9596         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9597         set_dynamic_symbol_size.
9598
9599         PR 10450
9600         * output.h (class Output_section): Add is_entsize_zero_ field.
9601         * output.cc (Output_section::Output_section): Initialize
9602         is_entsize_zero_.
9603         (Output_section::set_entsize): If two different entsizes are
9604         requested, force it to zero.
9605         (Output_section::add_input_section): Set flags for .debug_str
9606         before updating section flags.  Set entsize.
9607         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9608         and SHF_STRING if all input sections have those flags.
9609
9610 2009-12-29   Rafael Espindola  <espindola@google.com>
9611
9612         * main.cc (main): Fix the sys time reporting.
9613         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9614         reporting.
9615
9616 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9617
9618         * options.cc (General_options::parse_version): Allow -v to exit
9619         without an error if there is nothing to link.
9620
9621 2009-12-29  Ian Lance Taylor  <iant@google.com>
9622
9623         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9624         using a version of gcc before 4.1.
9625         * configure: Rebuild.
9626
9627 2009-12-28  Chris Demetriou  <cgd@google.com>
9628
9629         * attributes.cc (Output_attributes_section_data::do_write): Use
9630         std::vector::front rather than std::vector::data.
9631
9632 2009-12-28  Ian Lance Taylor  <iant@google.com>
9633
9634         * symtab.h (class Symbol_table): Add enum Defined.
9635         * resolve.cc (Symbol_table::should_override): Add defined
9636         parameter.  Change all callers.  Test whether object is NULL
9637         before calling a method on it.
9638         (Symbol_table::report_resolve_problem): Add defined parameter.
9639         Change all callers.
9640         (Symbol_table::should_override_with_special): Likewise.
9641         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9642         parameter.  Change all callers.
9643         (Symbol_table::do_define_in_output_data): Likewise.
9644         (Symbol_table::define_in_output_segment): Likewise.
9645         (Symbol_table::do_define_in_output_segment): Likewise.
9646         (Symbol_table::define_as_constant): Likewise.
9647         (Symbol_table::do_define_as_constant): Likewise.
9648         * script.h (class Symbol_assignment): Add is_defsym parameter to
9649         constructor; change all callers.
9650         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9651         parameter.  Change all callers.  Add is_defsym_ field.
9652         (class Parser_closure): Add parsing_defsym parameter to
9653         constructor; change all callers.  Add parsing_defsym accessor
9654         function.  Add parsing_defsym_ field.
9655
9656 2009-12-28  Ian Lance Taylor  <iant@google.com>
9657
9658         * gold.cc (queue_middle_tasks): Fix formatting.
9659         * object.cc (Relobj::is_section_name_included): Likewise.
9660
9661 2009-12-23  Ian Lance Taylor  <iant@google.com>
9662
9663         * i386.cc (Target_i386::do_calls_non_split): Recognize
9664         -fsplit-stack prologue for a function with a static chain.
9665         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9666         -fsplit-stack prologue when using %r11.
9667
9668 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9669
9670         * options.cc (General_options::parse_version): Make -v continue and do
9671         the link like GNU ld does.
9672
9673 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9674
9675         * Makefile.am (CCFILES): Add timer.cc.
9676         (HFILES): Add timer.h.
9677         * configure.ac: Check for sysconf and times.
9678         * main.cc: include timer.h.
9679         (main): Use Timer instead of get_run_time.
9680         * timer.cc: New.
9681         * timer.h: New.
9682         * workqueue.cc: include timer.h.
9683         (Workqueue::find_and_run_task):
9684         Report user, sys and wall time.
9685         * Makefile.in: Regenerate.
9686         * config.in: Regenerate.
9687         * configure: Regenerate.
9688
9689 2009-12-16  Doug Kwan  <dougkwan@google.com>
9690
9691         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9692         sections.
9693         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9694         relaxed input sections.
9695         * output.cc (Output_section::find_relaxed_input_section): Change
9696         return type to Output_relaxed_input_section pointer.  Adjust code
9697         for new type of relaxed_input_section_map_.
9698         * output.h (Output_section::find_relaxed_input_section): Change
9699         return type to Output_relaxed_input_section pointer.
9700         (Output_section::Output_relaxed_input_section_by_input_section_map):
9701         New type.
9702         (Output_section::relaxed_input_section_map_): Change type to
9703         Output_section::Output_relaxed_input_section_by_input_section_map.
9704         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9705         input section.
9706
9707 2009-12-15  Ian Lance Taylor  <iant@google.com>
9708
9709         * layout.cc (Layout::create_shstrtab): Only write out after input
9710         sections if we are compressing debug sections.
9711
9712 2009-12-15  Ian Lance Taylor  <iant@google.com>
9713
9714         * archive.cc (Archive::add_symbols): Only look up a symbol without
9715         a version if there is, in fact, a version.
9716
9717 2009-12-14  Ian Lance Taylor  <iant@google.com>
9718
9719         Revert -Wshadow changes, all changes from:
9720         2009-12-11  Doug Kwan  <dougkwan@google.com>
9721         2009-12-11  Nick Clifton  <nickc@redhat.com>
9722         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9723
9724 2009-12-11  Doug Kwan  <dougkwan@google.com>
9725
9726         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9727         due to -Wshadow.
9728         * attributes.cc (Object_attribute::size): Ditto.
9729         (Attributes_section_data::size): Ditto.
9730         (Attributes_section_data::Attributes_section_data): Ditto.
9731         (Output_attributes_section_data::do_write): Ditto.
9732         * attributes.h (Object_attribute::set_type): Ditto.
9733         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9734
9735 2009-12-11  Nick Clifton  <nickc@redhat.com>
9736
9737         * archive.cc: Fix shadowed variable warnings.
9738         * arm.cc: Likewise.
9739         * compressed_output.cc: Likewise.
9740         * compressed_output.h: Likewise.
9741         * configure: Likewise.
9742         * dwarf_reader.cc: Likewise.
9743         * dynobj.cc: Likewise.
9744         * dynobj.h: Likewise.
9745         * ehframe.cc: Likewise.
9746         * ehframe.h: Likewise.
9747         * errors.cc: Likewise.
9748         * expression.cc: Likewise.
9749         * fileread.cc: Likewise.
9750         * fileread.h: Likewise.
9751         * freebsd.h: Likewise.
9752         * i386.cc: Likewise.
9753         * icf.cc: Likewise.
9754         * incremental.h: Likewise.
9755         * layout.cc: Likewise.
9756         * layout.h: Likewise.
9757         * mapfile.cc: Likewise.
9758         * merge.cc: Likewise.
9759         * merge.h: Likewise.
9760         * object.cc: Likewise.
9761         * object.h: Likewise.
9762         * options.h: Likewise.
9763         * output.cc: Likewise.
9764         * output.h: Likewise.
9765         * parameters.cc: Likewise.
9766         * plugin.cc: Likewise.
9767         * powerpc.cc: Likewise.
9768         * reduced_debug_output.cc: Likewise.
9769         * reduced_debug_output.h: Likewise.
9770         * reloc.cc: Likewise.
9771         * reloc.h: Likewise.
9772         * resolve.cc: Likewise.
9773         * script-sections.cc: Likewise.
9774         * script.cc: Likewise.
9775         * script.h: Likewise.
9776         * sparc.cc: Likewise.
9777         * symtab.cc: Likewise.
9778         * symtab.h: Likewise.
9779         * target-select.cc: Likewise.
9780         * target-select.h: Likewise.
9781         * token.h: Likewise.
9782         * workqueue.cc: Likewise.
9783         * workqueue.h: Likewise.
9784         * x86_64.cc: Likewise.
9785
9786 2009-12-10  Doug Kwan  <dougkwan@google.com>
9787
9788         * arm.cc (attributes.h): New include.
9789         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9790         (Arm_relobj::~Arm_relobj): Delete object pointed by
9791         attributes_section_data_.
9792         (Arm_relobj::attributes_section_data): New method definition.
9793         (Arm_relobj::attributes_section_data_): New data member declaration.
9794         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9795         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9796         attributes_section_data_.
9797         (Arm_dynobj::attributes_section_data): New method definition.
9798         (Arm_dynobj::attributes_section_data_): New data member declaration.
9799         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9800         initialization value of may_use_blx_ to false.
9801         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9802         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9803         object attributes to compute results instead of hard-coding.
9804         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9805         Target_arm::get_secondary_compatible_arch,
9806         Target_arm::set_secondary_compatible_arch
9807         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9808         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9809         New method declarations.
9810         (Target_arm::get_aeabi_object_attribute): New method definition.
9811         (Target_arm::attributes_section_data_): New data member declaration.
9812         (read_arm_attributes_section): New template definition.
9813         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9814         (Arm_dynobj::do_read_symbols): Ditto.
9815         (Target_arm::do_finalize_sections): Merge attributes sections from
9816         input.  Check for BLX use after attributes section merging.
9817         Fix __exidx_start and __exidx_end visibility.  Create an
9818         .ARM.attributes section if necessary.
9819         (Target_arm::get_secondary_compatible_arch,
9820         Target_arm::set_secondary_compatible_arch,
9821         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9822         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9823         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9824         New method definitions.
9825
9826 2009-12-09  Ian Lance Taylor  <iant@google.com>
9827
9828         * plugin.cc (Plugin::load): Don't cast from void* to a function
9829         pointer.
9830
9831 2009-12-09  Ian Lance Taylor  <iant@google.com>
9832
9833         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9834         information fields.
9835
9836 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9837
9838         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9839         Replace two_file_shared_1.so with two_file_shared_2.so.
9840         * testsuite/Makefile.in: Regenerated.
9841
9842 2009-12-08  Doug Kwan  <dougkwan@google.com>
9843
9844         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9845         (HFILES): Add attributes.h and int_encoding.h.
9846         * Makefile.in: Regenerate.
9847         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9848         function definitions to int_encoding.cc
9849         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9850         prototypes to int_encoding.h
9851         * reduced_debug_output.cc (int_encoding.h): New include.
9852         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9853         function definitions to int_encoding.cc
9854         (insert_into_vector, read_from_pointer): Move template definitions to
9855         int_encoding.h
9856         * attributes.cc: New file.
9857         * attributes.h: New file.
9858         * int_encoding.cc: New file.
9859         * int_encoding.h: New file.
9860
9861 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9862
9863         PR gold/11055
9864         * incremental-dump.cc (dump_incremental_inputs): New.
9865         (main): Use dump_incremental_inputs.
9866
9867 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9868
9869         PR gold/10893
9870         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9871         checking elfcpp::STT_FUNC.
9872         (Target_i386::Relocate::relocate): Likewise.
9873         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9874
9875         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9876         symbols from shared libraries into normal FUNC symbols.
9877
9878         * symtab.h (Symbol): Add is_func and use it.
9879
9880 2009-12-05  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (Target_arm::arm_info): Initialize new fields
9883         attributes_section and attributes_vendor.
9884         * i386.cc (Target_i386::i386_info): Same.
9885         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9886         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9887         fields attributes_section and attributes_vendor.
9888         * sparc.cc (Target_sparc::sparc_info): Same.
9889         * target.h (Target::attributes_section, Target::attributes_vendor,
9890         Target::is_attributes_section, Target::attribute_arg_type,
9891         Target::attributes_order): New method definitions.
9892         (Target::Target_info::attributes_section,
9893         Target::Target_info::attributes_vendor): New fields.
9894         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9895         virtual method definitions.
9896         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9897         attributes_section and attributes_vendor.
9898         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9899
9900 2009-12-05  Doug Kwan  <dougkwan@google.com>
9901
9902         * arm.cc: Update comments about interworking and stub generation.
9903         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9904         considered as non-PIC.
9905         (Arm_relocate_functions::base_abs): Fix formatting.
9906         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9907         of function to use GOT entry address instead of offset.
9908         (Target_arm::Scan::global): Issue an error if a symbol would need a
9909         PLT does not get one because it is untyped.  Remove code to create
9910         dynamic symbols for relative branches.
9911         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9912         takes unsigned integer instead of boolean.
9913
9914 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9915
9916         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9917         (two_file_test_LDADD): Likewise.
9918         (common_test_1_LDADD): Likewise.
9919         (exception_test_LDADD) Likewise.
9920         (weak_test_LDADD): Likewise.
9921         (many_sections_test_LDADD): Likewise.
9922         (initpri1_LDADD): Likewise.
9923         (script_test_1_LDADD): Likewise.
9924         (script_test_2_LDADD): Likewise.
9925         (justsyms_LDADD): Likewise.
9926         (binary_test_LDADD): Likewise.
9927         (large_LDADD): Likewise.
9928         * testsuite/Makefile.in: Regenerated.
9929
9930 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9931
9932         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9933         (Symbol_table::override_with_special): Likewise.
9934         (Symbol_table::add_from_object): Likewise.
9935
9936 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9937
9938         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9939         Don't set the data_offset twice.
9940
9941 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9942
9943         * testsuite/Makefile.in: Regenerate.
9944
9945 2009-12-03  Doug Kwan  <dougkwan@google.com>
9946
9947         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9948         (Target_arm::do_finalize_sections): Add parameter for symbol table
9949         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9950         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9951         parameter for symbol table pointer.
9952         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9953         an additional parameter for a pointer to symbol table.
9954         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9955         parameter for a symbol table pointer.
9956         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9957         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9958         Ditto.
9959         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9960         parameter for a symbol table pointer.
9961
9962 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9963
9964         * incremental.cc (Incremental_inputs_header)
9965         (Incremental_inputs_header_write, Incremental_inputs_entry)
9966         (Incremental_inputs_entry_write): Move ...
9967         * incremental.h (Incremental_inputs_header)
9968         (Incremental_inputs_header_write, Incremental_inputs_entry)
9969         (Incremental_inputs_entry_write): here.
9970
9971 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9972
9973         * incremental.cc (make_sized_incremental_binary): Set the target.
9974         Error if it is incompatible.
9975         * output.h (Output_file): Add filename method.
9976
9977 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9978
9979         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9980         from the get_* methods.
9981
9982 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9983
9984         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9985         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9986         Write 0 for the data_offset of scripts.
9987
9988 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9989
9990         * testsuite/Makefile.am: Add the incremental_test.sh test.
9991         * testsuite/incremental_test.sh: New.
9992         * testsuite/incremental_test_1.c: New.
9993         * testsuite/incremental_test_2.c: New.
9994
9995 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9996
9997         * incremental-dump.cc (main): Fix typos.
9998
9999 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10000
10001         PR gold/11025
10002         * incremental-dump.cc (main): Use llu to print 64 bit values.
10003
10004 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10005             H.J. Lu  <hongjiu.lu@intel.com>
10006
10007         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10008         $(LIBDL).
10009         (incremental_dump_LDADD): Likewise.
10010         * Makefile.in: Regenerated.
10011
10012 2009-11-25  Doug Kwan  <dougkwan@google.com>
10013
10014         Revert:
10015
10016         2009-11-25  Doug Kwan  <dougkwan@google.com>
10017
10018                 * arm.cc (Target_arm::Target_arm): Move method definition
10019                 outside of class definition.  Add code to handle
10020                 --target1-rel, --target1-abs and --target2= options.
10021                 (Target_arm::get_reloc_reloc_type): Change method to be
10022                 non-static and const.
10023                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10024                 New data member declaration.
10025                 (Target_arm::Scan::local, Target_arm::Scan::global,
10026                 Target_arm::Relocate::relocate,
10027                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10028                 Adjust call to Target_arm::get_real_reloc_type.
10029                 (Target_arm::get_real_reloc_type): Use command line options
10030                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10031                 * options.h (--target1-rel, --target1-abs, --target2): New
10032                 ARM-only options.
10033
10034 2009-11-25  Doug Kwan  <dougkwan@google.com>
10035
10036         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10037         class definition.  Add code to handle --target1-rel, --target1-abs
10038         and --target2= options.
10039         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10040         and const.
10041         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10042         member declaration.
10043         (Target_arm::Scan::local, Target_arm::Scan::global,
10044         Target_arm::Relocate::relocate,
10045         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10046         call to Target_arm::get_real_reloc_type.
10047         (Target_arm::get_real_reloc_type): Use command line options to
10048         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10049         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10050         options.
10051
10052 2009-11-25  Doug Kwan  <dougkwan@google.com>
10053
10054         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10055         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10056         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10057         formatting.
10058         (Arm_relocate_functions::thm_call): Replace body with a call to
10059         Arm_relocate_functions::thumb_branch_common.
10060         (Arm_relocate_functions::thm_jump24,
10061         Arm_relocate_functions::thm_xpc22): New method definitions.
10062         (Arm_relocate_functions::thumb_branch_common): New method definition.
10063         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10064         operator.
10065         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10066         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10067
10068 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10069
10070         * Makefile.am: Build incremental-dump
10071         * Makefile.in: Regenerate.
10072         * incremental-dump.cc: New.
10073         * incremental.cc (Incremental_inputs_header_data,
10074         Incremental_inputs_entry_data): Move to incremental.h
10075         * incremental.h: (Incremental_inputs_header_data,
10076         Incremental_inputs_entry_data): Move from incremental.cc
10077
10078 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10079
10080         * incremental.cc (Incremental_inputs_header,
10081         Incremental_inputs_header_write, Incremental_inputs_entry,
10082         Incremental_inputs_entry_write): Add a typedef with the data type.
10083
10084 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10085
10086         * incremental.cc (Incremental_inputs_header,
10087         Incremental_inputs_header_write, Incremental_inputs_entry,
10088         Incremental_inputs_entry_write): Update comment about which
10089         type has the filed descriptions.
10090
10091 2009-11-15  Doug Kwan  <dougkwan@google.com>
10092
10093         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10094         (Arm_relocate_functions::arm_branch_common): Change method defintion
10095         in class definition to a method declaration and update list of formal
10096         parameters.
10097         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10098         Arm_relocation_functions::jump24): Adjust call to
10099         Arm_relocate_functions::arm_branch_common.  Update list of formal
10100         parameters.
10101         (Arm_relocate_functions::xpc25): New method definition.
10102         (Arm_relocate_functions::arm_branch_common): Move method defintion
10103         out from class definition.  Use stubs for mode-switching and extending
10104         branch ranges.
10105         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10106         specially.  Change code to enable use of stubs in ARM branches.
10107
10108 2009-11-10  Doug Kwan  <dougkwan@google.com>
10109
10110         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10111         in method declaration.
10112         (Target_arm::relocate_stub): New method declaration.
10113         (Target_arm::default_target): Change to return a pointer instead of
10114         a const reference.
10115         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10116         Target_arm::default_target.
10117         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10118         method definition.
10119         (Target_arm::relocate_section): Adjust view.
10120         (Target_arm::relocate_stub): New method definition.
10121
10122 2009-11-10  Doug Kwan  <dougkwan@google.com>
10123
10124         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10125         a format warning.
10126         * incremental.cc (open_incremental_binary): Initialized local
10127         variables to avoid warnings.
10128         * object.cc (make_elf_object): Ditto.
10129         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10130         a format warning.
10131
10132 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10133
10134         PR gold/10930
10135         * testsuite/plugin_test.c: Include "config.h".
10136
10137 2009-11-09  Doug Kwan  <dougkwan@google.com>
10138
10139         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10140         (arm_symbol_value): Remove.
10141         (Arm_relocate_functions::arm_branch_common,
10142         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10143         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10144         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10145         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10146         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10147         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10148         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10149         Arm_relocate_functions::thm_mobw_abs_nc,
10150         Arm_relocate_functions::thm_mov_abs,
10151         Arm_relocate_functions::movw_prel_nc,
10152         Arm_relocate_functions::thm_movt_abs,
10153         Arm_relocate_functions::movt_prel,
10154         Arm_relocate_functions::thm_movw_prel_nc,
10155         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10156         (Target_arm::Relocate::relocate): Only decompose address into two
10157         parts if relocation type uses the thumb-bit and pass the actual
10158         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10159         calls to methods in Arm_relocate_functions for this change.
10160
10161 2009-11-08  Ian Lance Taylor  <iant@google.com>
10162
10163         PR 10925
10164         * reloc.cc: Instantiate
10165         Sized_relobj::initialize_input_to_output_maps and
10166         Sized_relobj:free_input_to_output_maps.
10167
10168 2009-11-06  Ian Lance Taylor  <iant@google.com>
10169
10170         PR 10876
10171         * defstd.cc (in_segment): Set only_if_ref true for "end".
10172
10173 2009-11-06  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc (class Reloc_stub): Correct a comment.
10176         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10177         (Target_arm::scan_section_for_stubs): New method declaration.
10178         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10179         Change methods from private to protected.
10180         (Target_arm::do_may_relax): New method definition.
10181         (Target_arm::do_relax, Target_arm::group_sections,
10182         Target_arm::scan_reloc_for_stub,
10183         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10184         (Target_arm::arm_input_section_map_): New data member declaration.
10185         (Target_arm::scan_reloc_for_stub,
10186         Target_arm::scan_reloc_section_for_stubs,
10187         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10188         Target_arm::do_relax): New method definitions.
10189
10190 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10191
10192         * configure.ac: Check for (struct stat)::st_mtim
10193         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10194         * config.in: Regenerate.
10195         * configure: Regenerate.
10196
10197 2009-11-05  Ian Lance Taylor  <iant@google.com>
10198
10199         PR 10910
10200         * output.cc (Output_segment::add_output_section): Add missing
10201         return statement.
10202
10203 2009-11-04  Ian Lance Taylor  <iant@google.com>
10204
10205         PR 10880
10206         * object.h (class Object): Add is_needed and set_is_needed
10207         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10208         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10209         defined in a dynamic object and referenced by a regular object,
10210         set is_needed for the dynamic object.
10211         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10212         if the file is marked with as_needed and it is not needed.
10213
10214 2009-11-04  Ian Lance Taylor  <iant@google.com>
10215
10216         PR 10887
10217         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10218         tags if data is discarded by linker script.
10219         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10220         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10221         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10222         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10223
10224 2009-11-04  Ian Lance Taylor  <iant@google.com>
10225
10226         * layout.cc (Layout::get_output_section): Add is_interp and
10227         is_dynamic_linker_section parameters.  Change all callers.
10228         (Layout::choose_output_section): Likewise.
10229         (Layout::make_output_section): Likewise.
10230         (Layout::add_output_section_data): Add is_dynamic_linker_section
10231         parameter.  Change all callers.
10232         * layout.h (class Layout): Update declarations.
10233         * output.h (class Output_section): Add is_interp, set_is_interp,
10234         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10235         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10236         generate_code_fills_at_write_ to a bitfield.
10237         * output.cc (Output_section::Output_sections): Initialize new
10238         fields.
10239         (Output_segment::add_output_section): Add do_sort parameter.
10240         Change all callers.
10241
10242 2009-11-03  Ian Lance Taylor  <iant@google.com>
10243
10244         PR 10860
10245         * options.h (class General_options): Add --warn-common.
10246         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10247         merging two common symbols.
10248         (Symbol_table::should_override): Handle --warn-common when merging
10249         a common symbol with a defined symbol.  Use report_resolve_problem
10250         for multiple definitions.
10251         (Symbol_table::report_resolve_problem): New function.
10252         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10253
10254 2009-11-03  Doug Kwan  <dougkwan@google.com>
10255
10256         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10257         stub_factory_.
10258         (Target_arm::stub_factory): New method definition.
10259         (Target_arm::new_arm_input_section,
10260         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10261         Target_arm::reloc_uses_thumb_bit): New method declarations.
10262         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10263         New type definitions.
10264         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10265         member declarations.
10266         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10267         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10268         New method definitions.
10269
10270 2009-11-03  Ian Lance Taylor  <iant@google.com>
10271
10272         * options.h (class General_options): Add --warn_constructors.
10273
10274 2009-11-03  Ian Lance Taylor  <iant@google.com>
10275
10276         PR 10893
10277         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10278         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10279
10280 2009-11-03  Ian Lance Taylor  <iant@google.com>
10281
10282         PR 10895
10283         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10284         --msgid-bugs-address.
10285         (install-pdf): New target.
10286         (install-data_yes): Look up one directory to find mkinstalldirs.
10287
10288 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10289
10290         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10291         tree.
10292
10293 2009-10-30  Doug Kwan  <dougkwan@google.com>
10294
10295         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10296
10297 2009-10-30  Doug Kwan  <dougkwan@google.com>
10298
10299         * arm.cc (Stub_addend_reader): New struct template definition
10300         and partial specializations.
10301         (Stub_addend_reader::operator()): New method definition for a
10302         partially specialized template.
10303
10304 2009-10-30  Doug Kwan  <dougkwan@google.com>
10305
10306         * arm.cc (Arm_relobj::processor_specific_flags): New method
10307         definition.
10308         (Arm_relobj::do_read_symbols): New method declaration.
10309         (Arm_relobj::processor_specific_flags_): New data member declaration.
10310         (Arm_dynobj): New class definition.
10311         (Target_arm::do_finalize_sections): Add input_objects parameter.
10312         (Target_arm::do_adjust_elf_header): New method declaration.
10313         (Target_arm::are_eabi_versions_compatible,
10314         (Target_arm::merge_processor_specific_flags): New method declaration.
10315         (Target_arm::do_make_elf_object): New overloaded method definitions
10316         and declaration.
10317         (Arm_relobj::do_read_symbols): New method definition.
10318         (Arm_dynobj::do_read_symbols): Ditto.
10319         (Target_arm::do_finalize_sections): Add input_objects parameters.
10320         Merge processor-specific flags from all input objects.
10321         (Target_arm::are_eabi_versions_compatible,
10322         Target_arm::merge_processor_specific_flags,
10323         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10324         New method definitions.
10325         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10326         Input_objects pointer type parameter.
10327         * layout.cc (Layout::finalize): Pass input objects to target's.
10328         finalize_sections function.
10329         * output.cc (Output_file_header::do_sized_write): Set ELF file
10330         header's processor-specific flags.
10331         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10332         Input_objects pointer type parameter.
10333         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10334         * target.h (Input_objects): New forward class declaration.
10335         (Target::processor_specific_flags,
10336         Target::are_processor_specific_flags_sect): New method definitions.
10337         (Target::finalize_sections): Add input_objects parameter.
10338         (Target::Target): Initialize processor_specific_flags_ and
10339         are_processor_specific_flags_set_.
10340         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10341         parameter.
10342         (Target::set_processor_specific_flags): New method definition.
10343         (Target::processor_specific_flags_,
10344         Target::are_processor_specific_flags_set_): New data member
10345         declarations.
10346         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10347         Input_objects pointer type parameter.
10348
10349 2009-10-30  Doug Kwan  <dougkwan@google.com>
10350
10351         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10352
10353 2009-10-28  Ian Lance Taylor  <iant@google.com>
10354
10355         * object.h (class Relobj): Drop options parameter from
10356         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10357         do_scan_relocs, do_relocate.  Change all callers.
10358         (class Sized_relobj): Drop options parameters from
10359         do_gc_process_relocs, do_scan_relocs, do_relocate,
10360         do_relocate_sections, relocate_sections, emit_relocs_scan,
10361         emit_relocs_scan_reltype.  Change all callers.
10362         (struct Relocate_info): Remove options field and all references to
10363         it.
10364         * reloc.h (class Read_relocs): Remove options constructor
10365         parameter and options_ field.  Change all callers.
10366         (class Gc_process_relocs, class Scan_relocs): Likewise.
10367         (class Relocate_task): Likewise.
10368         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10369         all callers.
10370         (scan_relocatable_relocs): Likewise.
10371         * target.h (class Sized_target): Remove options parameter from
10372         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10373         all callers.
10374         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10375         callers.
10376         * arm.cc: Update functions to remove options parameters.
10377         * i386.cc: Likewise.
10378         * powerpc.cc: Likewise.
10379         * sparc.cc: Likewise.
10380         * x86_64.cc: Likewise.
10381         * testsuite/testfile.cc: Likewise.
10382
10383 2009-10-28  Doug Kwan  <dougkwan@google.com>
10384
10385         * arm.cc (Arm_relobj): New class definition.
10386         (Arm_relobj::scan_sections_for_stubs,
10387         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10388         New method definitions.
10389
10390 2009-10-28  Cary Coutant  <ccoutant@google.com>
10391
10392         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10393         (Plugin::cleanup_done_): New member.
10394         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10395         (Plugin_manager::cleanup_done_): Remove.
10396         (Plugin_manager::add_input_file): Edit error message.
10397         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10398         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10399
10400 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10401
10402         * fileread.cc: (File_read::View::~View): Use the new
10403         data_ownership_ filed.
10404         (File_read::~File_read): Dispose the new whole_file_view_.
10405         (File_read::open): Mmap the whole file if needed.
10406         (File_read::open): Use whole_file_view_ instead of contents_.
10407         (File_read::find_view): Use whole_file_view_ if applicable.
10408         (File_read::do_read): Use whole_file_view_ instead of contents_.
10409         (File_read::make_view): Use whole_file_view_ instead of contents_,
10410         update File_read::View::View call.
10411         (File_read::find_or_make_view): Update File_read::View::View
10412         call.
10413         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10414         remove contents_
10415         (File_read::View::Data_ownership): New enum.
10416         (File_read::View::View): Replace bool mapped_ with Data_ownership
10417         argument.
10418         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10419         (File_read::View::data_ownership_): New field.
10420         (File_read::contents_): Remove (replaced by whole_file_view_).
10421         (File_read::whole_file_view_): New field.
10422         * options.h (class General_options): Add --keep-files-mapped.
10423
10424 2009-10-27  Cary Coutant  <ccoutant@google.com>
10425
10426         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10427         * testsuite/Makefile.am (plugin_test_5): New test case.
10428         * testsuite/Makefile.in: Regenerate.
10429
10430 2009-10-25  Doug Kwan  <dougkwan@google.com>
10431
10432         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10433         from private to protected to allow access by child class.
10434         (Sized_relobj::do_relocate_sections): New method declaration.
10435         (Sized_relobj::relocate_sections): Virtualize.
10436         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10437         Sized_relobj::relocate_sections.  Instantiate template explicitly
10438         for different target sizes and endianity.
10439
10440 2009-10-24  Doug Kwan  <dougkwan@google.com>
10441
10442         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10443         (Arm_input_section::as_arm_input_section): New method.
10444         (Arm_output_section): New class definition.
10445         (Arm_output_section::create_stub_group,
10446         Arm_output_section::group_sections): New method definitions.
10447
10448 2009-10-22  Doug Kwan  <dougkwan@google.com>
10449
10450         * arm.cc (Arm_input_section): New class definition.
10451         (Arm_input_section::init, Arm_input_section:do_write,
10452         Arm_input_section::set_final_data_size,
10453         Arm_input_section::do_reset_address_and_file_offset): New method
10454         definitions.
10455
10456 2009-10-21  Doug Kwan  <dougkwan@google.com>
10457
10458         * arm.cc (Stub_table, Arm_input_section): New forward class
10459         declarations.
10460         (Stub_table): New class defintion.
10461         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10462         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10463         New method definition.
10464
10465 2009-10-21  Doug Kwan  <dougkwan@google.com>
10466
10467         * arm.cc: Update copyright comments.
10468         (Target_arm): New forward class template declaration.
10469         (Arm_address): New type.
10470         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10471         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10472         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10473         constants.
10474         (Insn_template): Same.
10475         (DEF_STUBS): New macro.
10476         (Stub_type): New enum type.
10477         (Stub_template): New class definition.
10478         (Stub): Same.
10479         (Reloc_stub): Same.
10480         (Stub_factory): Same.
10481         (Target_arm::Target_arm): Initialize may_use_blx_ and
10482         should_force_pic_veneer_.
10483         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10484         Target_arm::should_force_pic_veneer,
10485         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10486         Target_arm::using_thumb_only, Target_arm:;default_target): New
10487         method defintions.
10488         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10489         New data member declarations.
10490         (Insn_template::size, Insn_template::alignment): New method defintions.
10491         (Stub_template::Stub_template): New method definition.
10492         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10493         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10494         (Stub_factory::Stub_factory): New method definition.
10495         * gold.h (string_hash): New template.
10496         * output.h (Input_section_specifier::hash_value): Use
10497         gold::string_hash.
10498         (Input_section_specifier::string_hash): Remove.
10499         * stringpool.cc (Stringpool_template::string_hash): Use
10500         gold::string_hash.
10501
10502 2009-10-20  Doug Kwan  <dougkwan@google.com>
10503
10504         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10505         symbols of relaxed input sections.
10506         * output.h (Output_section::find_relaxed_input_section): Make
10507         method public.
10508
10509 2009-10-16  Doug Kwan  <dougkwan@google.com>
10510
10511         * dynobj.cc (Versions::Versions): Initialize version_script_.
10512         Only insert base version symbol definition for a shared object
10513         if version script defines any version versions.
10514         (Versions::define_base_version): New method definition.
10515         (Versions::add_def): Check that base version is not needed.
10516         (Versions::add_need): Define base version lazily.
10517         * dynobj.h (Versions::define_base_version): New method declaration.
10518         (Versions::needs_base_version_): New data member declaration.
10519         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10520         (check_DATA): Add no_version_test.stdout.
10521         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10522         New make rules.
10523         * testsuite/Makefile.in: Regenerate.
10524         * testsuite/no_version_test.c: New file.
10525         * testsuite/no_version_test.sh: Ditto.
10526
10527 2009-10-16  Doug Kwan  <dougkwan@google.com>
10528
10529         * expression.cc (class Segment_start_expression): New class definition.
10530         (Segment_start_expression::value): New method definition.
10531         (script_exp_function_segment_start): Return a new
10532         Segment_start_expression.
10533         * gold/script-c.h (script_saw_segment_start_expression): New function
10534         prototype.
10535         * script-sections.cc (Script_sections::Script_sections): Initialize
10536         SAW_SEGMENT_START_EXPRESSION_ to false.
10537         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10538         and -Tbbs options to specify section addresses if given in
10539         command line and no SEGMENT_START expression is seen in a script.
10540         * script-sections.h (Script_sections::saw_segment_start_expression,
10541         Script_sections::set_saw_segment_start_expression): New method
10542         definition.
10543         (Script_sections::saw_segment_start_expression_): New data member
10544         declaration.
10545         * script.cc (script_saw_segment_start_expression): New function.
10546         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10547         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10548         script_test_7.sh and script_test_8.sh.
10549         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10550         script_test_8.stdout.
10551         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10552         (script_test_6, script_test_6.stdout, script_test_7,
10553         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10554         * Makefile.in: Regenerate.
10555         * testsuite/script_test_6.sh: New file.
10556         * testsuite/script_test_6.t: Same.
10557         * testsuite/script_test_7.sh: Same.
10558         * testsuite/script_test_7.t: Same.
10559         * testsuite/script_test_8.sh: Same.
10560
10561 2009-10-16  Doug Kwan  <dougkwan@google.com>
10562
10563         * output.cc (Output_segment::set_section_list_address): Cast
10564         expressions to unsigned long long type to avoid format warnings.
10565
10566 2009-10-15  Ian Lance Taylor  <iant@google.com>
10567
10568         * script.cc (Script_options::add_symbol_assignment): Always add a
10569         dot assignment to script_sections_.
10570         * script-sections.cc (Script_sections::add_dot_assignment):
10571         Initialize if necessary.
10572
10573         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10574         program headers with no load segment if there is a linker script.
10575
10576         * layout.cc (Layout::set_segment_offsets): Align the file offset
10577         to the segment aligment for -N or -n with no load segment.
10578         * output.cc (Output_segment::add_output_section): Don't crash if
10579         the first section is a TLS section.
10580         (Output_segment::set_section_list_addresses): Print an error
10581         message if the address moves backward in a linker script.
10582         * script-sections.cc
10583         (Output_section_element_input::set_section_addresses): Don't
10584         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10585         (Orphan_output_section::set_section_addresses): Likewise.
10586
10587 2009-10-15  Doug Kwan  <dougkwan@google.com>
10588
10589         * layout.cc (Layout::finish_dynamic_section): Generate tags
10590         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10591         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10592         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10593
10594 2009-10-14  Ian Lance Taylor  <iant@google.com>
10595
10596         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10597         fields.
10598         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10599         data_shdr fields of relinfo.
10600         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10601         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10602         R_386_TLS_LDO_32, adjust based on section flags.
10603         (Target_i386::Relocate::fix_up_ldo): Remove.
10604
10605 2009-10-13  Ian Lance Taylor  <iant@google.com>
10606
10607         Add support for -pie.
10608         * options.h (class General_options): Add -pie and
10609         --pic-executable.
10610         (General_options::output_is_position_independent): Test -pie.
10611         (General_options::output_is_executable): Return true if not shared
10612         and not relocatable.
10613         (General_options::output_is_pie): Remove.
10614         * options.cc (General_options::finalize): Reject incompatible uses
10615         of -pie.
10616         * gold.cc (queue_middle_tasks): A -pie link is not static.
10617         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10618         * symtab.cc (Symbol::final_value_is_known): Return false if
10619         output_is_position_independent.
10620         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10621         output_is_position_independent.
10622         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10623         output_is_position_independent.
10624         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10625         output_is_position_independent.
10626         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10627         two_file_pie_test.
10628         (basic_pie_test.o, basic_pie_test): New targets.
10629         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10630         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10631         (two_file_pie_test): New target.
10632         * testsuite/Makefile.in: Rebuild.
10633         * README: Remove note saying that -pie is not supported.
10634
10635 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10636
10637         * options.h (class General_options): Add -init and -fini.
10638         * layout.cc (Layout::finish_dynamic_section): Emit
10639         given init and fini functions.
10640
10641 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10642
10643         * gc.h (gc_process_relocs): Check if icf is enabled using new
10644         function.
10645         * gold.cc (queue_initial_tasks): Likewise.
10646         (queue_middle_tasks): Likewise.
10647         * object.cc (do_layout): Likewise.
10648         * symtab.cc (is_section_folded): Likewise.
10649         * main.cc (main): Likewise.
10650         * reloc.cc (Read_relocs::run): Likewise.
10651         (Sized_relobj::do_scan_relocs): Likewise.
10652         * icf.cc (is_function_ctor_or_dtor): New function.
10653         (Icf::find_identical_sections): Check if function is ctor or dtor when
10654         safe icf is chosen.
10655         * options.h (General_options::icf): Change option to be an enum.
10656         (Icf_status): New enum.
10657         (icf_enabled): New method.
10658         (icf_safe_folding): New method.
10659         (set_icf_status): New method.
10660         (icf_status_): New variable.
10661         * (options.cc) (General_options::finalize): Set icf_status_.
10662         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10663         icf_test and icf_keep_unique_test to use the --icf enum flag.
10664         * testsuite/icf_safe_test.sh: New file.
10665         * testsuite/icf_safe_test.cc: New file.
10666
10667 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10668
10669         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10670         includes to gc.h and icf.h.
10671         * arm.cc: Include gc.h.
10672         * gold.cc: Likewise.
10673         * i386.cc: Likewise.
10674         * powerpc.cc: Likewise.
10675         * sparc.cc: Likewise.
10676         * x86_64.cc: Likewise.
10677         * gc.h: Include icf.h.
10678
10679 2009-10-11  Ian Lance Taylor  <iant@google.com>
10680
10681         * plugin.cc: Include "gold.h" before other header files.
10682
10683 2009-10-10  Chris Demetriou  <cgd@google.com>
10684
10685         * options.h (Input_file_argument::Input_file_type): New enum.
10686         (Input_file_argument::is_lib_): Replace with...
10687         (Input_file_argument::type_): New member.
10688         (Input_file_argument::Input_file_argument): Take Input_file_type
10689         'type' rather than boolean 'is_lib' as second argument.
10690         (Input_file_argument::is_lib): Use type_.
10691         (Input_file_argument::is_searched_file): New function.
10692         (Input_file_argument::may_need_search): Handle is_searched_file.
10693         * options.cc (General_options::parse_library): Support -l:filename.
10694         (General_options::parse_just_symbols): Update for Input_file_argument
10695         changes.
10696         (Command_line::process): Likewise.
10697         * archive.cc (Archive::get_file_and_offset): Likewise.
10698         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10699         * script.cc (read_script_file, script_add_file): Likewise.
10700         * fileread.cc (Input_file::Input_file): Likewise.
10701         (Input_file::will_search_for): Handle is_searched_file.
10702         (Input_file::open): Likewise.
10703         * readsyms.cc (Read_symbols::get_name): Likewise.
10704         * testsuite/Makefile.am (searched_file_test): New test.
10705         * testsuite/Makefile.in: Regenerate.
10706         * testsuite/searched_file_test.cc: New file.
10707         * testsuite/searched_file_test_lib.cc: New file.
10708
10709 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10710             Ian Lance Taylor  <iant@google.com>
10711
10712         * descriptor.cc: Include <cstdio> and "binary-io.h".
10713         (Descriptors::open): Open the files in binary mode always.
10714         * script.cc (Lex::get_token): Treat \r as whitespace.
10715
10716 2009-10-09  Ian Lance Taylor  <iant@google.com>
10717
10718         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10719
10720 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10721             Ian Lance Taylor  <iant@google.com>
10722
10723         * configure.ac: Check for readv function also.
10724         * fileread.cc (readv): Define if not HAVE_READV.
10725         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10726         does not exist.
10727         * config.in: Regenerate.
10728         * configure: Regenerate.
10729
10730 2009-10-09  Doug Kwan  <dougkwan@google.com>
10731
10732         * layout.cc (Layout::make_output_section): Call target hook to make
10733         ordinary output section.
10734         (Layout::finalize): Adjust parameter list of call the
10735         Target::may_relax().
10736         * layout.h (class Layout::section_list): New method.
10737         * merge.h (Output_merge_base::entsize): Change visibility to public.
10738         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10739         New methods.
10740         (Output_merge_string::do_is_string): New method.
10741         * object.cc (Sized_relobj::do_setup): renamed from
10742         Sized_relobj::set_up.
10743         * object.h (Sized_relobj::adjust_shndx,
10744         Sized_relobj::initializ_input_to_output_maps,
10745         Sized_relobj::free_input_to_output_maps): Change visibilities to
10746         protected.
10747         (Sized_relobj::setup): Virtualize.
10748         (Sized_relobj::do_setup): New method declaration.
10749         (Sized_relobj::invalidate_section_offset,
10750         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10751         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10752         * options.cc (parse_int): New function.
10753         * options.h (parse_int): New declaration.
10754         (DEFINE_int): New macro.
10755         (stub_group_size): New option.
10756         * output.cc (Output_section::Output_section): Initialize memebers
10757         merge_section_map_, merge_section_by_properties_map_,
10758         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10759         (Output_section::add_input_section): Handled deferred code-fill
10760         generation and remove an old comment.
10761         (Output_section::add_relaxed_input_section): New method definition.
10762         (Output_section::add_merge_input_section): Use merge section by
10763         properties map to speed to search.  Update merge section maps
10764         as appropriate.
10765         (Output_section::build_relaxation_map): New method definition.
10766         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10767         Same.
10768         (Output_section::relax_input_section): Renamed to
10769         Output_section::convert_input_sections_to_relaxed_sections and change
10770         interface to take a vector of pointers to relaxed sections.
10771         (Output_section::find_merge_section,
10772         Output_section::find_relaxed_input_section): New method definitions.
10773         (Output_section::is_input_address_mapped,
10774         Output_section::output_offset, Output_section::output_address):
10775         Use output section data maps to speed up searching.
10776         (Output_section::find_starting_output_address): Add comments.
10777         (Output_section::do_write,
10778         Output_section::write_to_postprocessing_buffer): Do code-fill
10779         generation as appropriate.
10780         (Output_section::get_input_sections): Invalidate relaxed input section
10781         map.
10782         (Output_section::restore_states): Adjust type of checkpoint .
10783         Invalidate relaxed input section map.
10784         * output.h (Output_merge_base): New class declaration.
10785         (Input_section_specifier): New class defintion.
10786         (class Output_relaxed_input_section) Change base class to
10787         Output_section_data_build.
10788         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10789         base class initializer.
10790         (Output_section::add_relaxed_input_section): New method declaration.
10791         (Output_section::Input_section): Change visibility to protected.
10792         (Output_section::Input_section::relobj,
10793         Output_section::Input_section::shndx): Handle relaxed input sections.
10794         Output_section::input_sections) Change visibility to protected.  Also
10795         define overload to return a non-const pointer.
10796         (Output_section::Merge_section_properties): New class defintion.
10797         (Output_section::Merge_section_by_properties_map,
10798         Output_section::Output_section_data_by_input_section_map,
10799         Output_section::Relaxation_map): New types.
10800         (Output_section::relax_input_section): Rename method to
10801         Output_section::convert_input_sections_to_relaxed_sections and change
10802         interface to take a vector of relaxed section pointers.
10803         (Output_section::find_merge_section,
10804         Output_section::find_relaxed_input_section,
10805         Output_section::build_relaxation_map,
10806         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10807         New method declarations.
10808         (Output_section::merge_section_map_
10809         Output_section::merge_section_by_properties_map_,
10810         Output_section::relaxed_input_section_map_,
10811         Output_section::is_relaxed_input_section_map_valid_,
10812         Output_section::generate_code_fills_at_write_): New data members.
10813         * script-sections.cc
10814         (Output_section_element_input::set_section_addresses): Call
10815         current_data_size and addralign methods of relaxed input sections.
10816         (Orphan_output_section::set_section_addresses): Call current_data_size
10817         and addralign methods of relaxed input sections.
10818         * symtab.cc (Symbol_table::compute_final_value): Extract template
10819         from the body of Symbol_table::sized_finalize_symbol.
10820         (Symbol_table::sized_finalized_symbol): Call
10821         Symbol_table::compute_final_value.
10822         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10823         (Symbol_table::compute_final_value): New templated method declaration.
10824         * target.cc (Target::do_make_output_section): New method defintion.
10825         * target.h (Target::make_output_section): New method declaration.
10826         (Target::relax): Add more parameters for input objects, symbol table
10827         and layout.  Adjust call to do_relax.
10828         (Target::do_make_output_section): New method declaration.
10829         (Target::do_relax): Add parameters for input objects, symbol table
10830         and layout.
10831
10832 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10833
10834         * pread.c: Include stdio.h.
10835
10836 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10837
10838         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10839         defined.
10840
10841 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10842
10843         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10844         Change read_shndx type to unsigned int.
10845         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10846         int.
10847         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10848         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10849         Change read_shndx type to unsigned int.
10850         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10851         int.
10852         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10853         * layout.cc (Layout::create_symtab_sections): Cast the result of
10854         local_symcount * symsize to off_t in the gold_assert.
10855
10856 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10857
10858         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10859         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10860         R_ARM_BASE_ABS.
10861         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10862         (Arm_relocate_functions::thm_abs5): New function.
10863         (Arm_relocate_functions::abs12): New function.
10864         (Arm_relocate_functions::abs16): New function.
10865         (Arm_relocate_functions::base_abs): New function.
10866         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10867         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10868         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10869         R_ARM_BASE_ABS.
10870         (Scan::global): Likewise.
10871         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10872         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10873         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10874         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10875         R_ARM_BASE_ABS.
10876
10877 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10878
10879         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10880         (Arm_relocate_functions::movt_prel): New function.
10881         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10882         (Arm_relocate_functions::thm_movt_prel): New function.
10883         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10884         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10885         (Scan::global, Relocate::relocate): Likewise.
10886         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10887
10888 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10889
10890         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10891         Incremental_checker.
10892         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10893         unsigned int.
10894         (class Incremental_inputs_header): New class.
10895         (Incremental_inputs_header_writer): Edit comment.
10896         (Incremental_inputs_entry): New class.
10897         (Incremental_inputs_entry_writer): Edit comment.
10898         (Sized_incremental_binary::do_find_incremental_inputs_section):
10899         Add *strtab_shndx parameter, fill it.
10900         (Sized_incremental_binary::do_check_inputs): New method.
10901         (Incremental_checker::can_incrementally_link_output_file): Use
10902         Sized_incremental_binary::check_inputs.
10903         (Incremental_inputs::report_command_line): Save command line in
10904         command_line_.
10905         * incremental.h:
10906         (Incremental_binary::find_incremental_inputs_section): New
10907         method.
10908         (Incremental_binary::do_find_incremental_inputs_section): Add
10909         strtab_shndx parameter.
10910         (Incremental_binary::do_check_inputs): New pure virtual method.
10911         (Sized_incremental_binary::do_check_inputs): Declare.
10912         (Incremental_checker::Incremental_checker): Add incremental_inputs
10913         parameter, use it to initialize incremental_inputs_.
10914         (Incremental_checker::incremental_inputs_): New field.
10915         (Incremental_checker::command_line): New method.
10916         (Incremental_checker::inputs): New method.
10917         (Incremental_checker::command_line_): New field.
10918
10919 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10920
10921         * incremental.cc: Include <cstdarg> and "target-select.h".
10922         (vexplain_no_incremental): New function.
10923         (explain_no_incremental): New function.
10924         (Incremental_binary::error): New method.
10925         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10926         method.
10927         (make_sized_incremental_binary): New function.
10928         (open_incremental_binary): New function.
10929         (can_incrementally_link_file): Add checks if output is ELF and has
10930         inputs section.
10931         * incremental.h: Include "elfcpp_file.h" and "output.h".
10932         (Incremental_binary): New class.
10933         (Sized_incremental_binary): New class.
10934         (open_incremental_binary): Declare.
10935         * object.cc (is_elf_object): Use
10936         elfcpp::Elf_recognizer::is_elf_file.
10937         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10938         * output.h (Output_file::filesize): New method.
10939
10940 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10941
10942         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10943         New function.
10944         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10945         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10946         function.
10947         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10948         function.
10949         (Arm_relocate_functions::movw_abs_nc): New function.
10950         (Arm_relocate_functions::movt_abs): New function.
10951         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10952         (Arm_relocate_functions::thm_movt_abs): New function.
10953         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10954         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10955         (Scan::global): Likewise.
10956         (Relocate::relocate): Likewise.
10957         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10958
10959 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10960
10961         * arm.cc (Arm_relocate_functions::got_prel) New function.
10962         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10963         (Relocate::relocate): Likewise.
10964         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10965
10966 2009-10-06  Ian Lance Taylor  <iant@google.com>
10967
10968         * options.h (class General_options): Define
10969         split_stack_adjust_size parameter.
10970         * object.h (class Object): Add uses_split_stack_ and
10971         has_no_split_stack_ fields.  Add uses_split_stack and
10972         has_no_split_stack accessor functions.  Declare
10973         handle_split_stack_section.
10974         (class Reloc_symbol_changes): Define.
10975         (class Sized_relobj): Define Function_offsets.  Declare
10976         split_stack_adjust, split_stack_adjust_reltype, and
10977         find_functions.
10978         * object.cc (Object::handle_split_stack_section): New function.
10979         (Sized_relobj::do_layout): Call handle_split_stack_section.
10980         * dynobj.cc (Sized_dynobj::do_layout): Call
10981         handle_split_stack_section.
10982         * reloc.cc (Sized_relobj::relocate_sections): Call
10983         split_stack_adjust for executable sections in split_stack
10984         objects.  Pass reloc_map to relocate_section.
10985         (Sized_relobj::split_stack_adjust): New function.
10986         (Sized_relobj::split_stack_adjust_reltype): New function.
10987         (Sized_relobj::find_functions): New function.
10988         * target-reloc.h: Include "object.h".
10989         (relocate_section): Add reloc_symbol_changes parameter.  Change
10990         all callers.
10991         * target.h (class Target): Add calls_non_split method.  Declare
10992         do_calls_non_split virtual method.  Declare match_view and
10993         set_view_to_nop.
10994         * target.cc: Include "elfcpp.h".
10995         (Target::do_calls_non_split): New function.
10996         (Target::match_view): New function.
10997         (Target::set_view_to_nop): New function.
10998         * gold.cc (queue_middle_tasks): Give an error if mixing
10999         split-stack and non-split-stack objects with -r.
11000         * i386.cc (Target_i386::relocate_section): Add
11001         reloc_symbol_changes parameter.
11002         (Target_i386::do_calls_non_split): New function.
11003         * x86_64.cc (Target_x86_64::relocate_section): Add
11004         reloc_symbol_changes parameter.
11005         (Target_x86_64::do_calls_non_split): New function.
11006         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11007         parameter.
11008         * powerpc.cc (Target_powerpc::relocate_section): Add
11009         reloc_symbol_changes parameter.
11010         * sparc.cc (Target_sparc::relocate_section): Add
11011         reloc_symbol_changes parameter.
11012         * configure.ac: Call AM_CONDITIONAL for the default target.
11013         * configure: Rebuild.
11014         * testsuite/Makefile.am (TEST_AS): New variable.
11015         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11016         (check_DATA): Add split_i386 and split_x86_64 files.
11017         (SPLIT_DEFSYMS): Define.
11018         (split_i386_[1234n].o): New targets.
11019         (split_i386_[124]): New targets.
11020         (split_i386_[1234r].stdout): New targets.
11021         (split_x86_64_[1234n].o): New targets.
11022         (split_x86_64_[124]): New targets.
11023         (split_x86_64_[1234r].stdout): New targets.
11024         (MOSTLYCLEANFILES): Add new executables.
11025         * testsuite/split_i386.sh: New file.
11026         * testsuite/split_x86_64.sh: New file.
11027         * testsuite/split_i386_1.s: New file.
11028         * testsuite/split_i386_2.s: New file.
11029         * testsuite/split_i386_3.s: New file.
11030         * testsuite/split_i386_4.s: New file.
11031         * testsuite/split_i386_n.s: New file.
11032         * testsuite/split_x86_64_1.s: New file.
11033         * testsuite/split_x86_64_2.s: New file.
11034         * testsuite/split_x86_64_3.s: New file.
11035         * testsuite/split_x86_64_4.s: New file.
11036         * testsuite/split_x86_64_n.s: New file.
11037         * testsuite/testfile.cc (Target_test): Update relocation_section
11038         function.
11039         * testsuite/Makefile.in: Rebuild.
11040
11041 2009-10-06  Ian Lance Taylor  <iant@google.com>
11042
11043         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11044         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11045         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11046         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11047         the address on ldo_addrs_.
11048         (Target_i386::Relocate::fix_up_ldo): New function.
11049
11050 2009-10-06   Rafael Espindola  <espindola@google.com>
11051
11052         * plugin.cc (add_input_library): New.
11053         (Plugin::load): Add add_input_library to tv.
11054         (Plugin_manager::add_input_file): Add the is_lib argument.
11055         (add_input_file): Update call to Plugin_manager::add_input_file.
11056         (add_input_library): New.
11057         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11058
11059 2009-09-30  Doug Kwan  <dougkwan@google.com>
11060
11061         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11062         symbol and call Symbol::may_need_copy_reloc to determine if
11063         a copy reloc is needed.
11064         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11065         nocopyreloc is given in command line.
11066         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11067         given in command line.
11068         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11069         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11070         of the removed Target_i386::may_need_copy_reloc.
11071         * options.h (copyreloc): New option with default value false.
11072         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11073         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11074         instead of the removed Target_powerpc::may_need_copy_reloc.
11075         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11076         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11077         instead of the removed Target_sparc::may_need_copy_reloc.
11078         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11079         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11080         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11081         instead of the removed Target_x86_64::may_need_copy_reloc.
11082
11083 2009-09-30  Ian Lance Taylor  <iant@google.com>
11084
11085         * object.h (class Object): Remove target_ field, and target,
11086         sized_target, and set_target methods.
11087         (Object::sized_target): Remove.
11088         (class Sized_relobj): Update declarations.  Remove sized_target.
11089         * object.cc (Sized_relobj::setup): Remove target parameter.
11090         Change all callers.
11091         (Input_objects::add_object): Don't do anything with the target.
11092         (make_elf_sized_object): Add punconfigured parameter.  Change all
11093         callers.  Set or test parameter target.
11094         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11095         Change all callers.
11096         * parameters.cc (Parameters::set_target): Change parameter type to
11097         be non-const.
11098         (Parameters::default_target): Remove.
11099         (set_parameters_target): Change parameter type to be non-const.
11100         (parameters_force_valid_target): New function.
11101         (parameters_clear_target): New function.
11102         * parameters.h (class Parameters): Update declarations.  Remove
11103         default_target method.  Add sized_target and clear_target
11104         methods.  Change target_ to be non-const.
11105         (set_parameters_target): Update declaration.
11106         (parameters_force_valid_target): Declare.
11107         (parameters_clear_target): Declare.
11108         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11109         as NULL if we aren't searching.
11110         (Add_symbols::run): Don't check for compatible target.
11111         * fileread.cc (Input_file::open_binary): Call
11112         parameters_force_valid_target.
11113         * gold.cc (queue_middle_tasks): Likewise.
11114         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11115         set_target on object.
11116         * dynobj.h (class Sized_dynobj): Update declarations.
11117         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11118         make_elf_object returns NULL.
11119         (Archive::include_member): Don't check whether object target is
11120         compatible.
11121         * output.cc (Output_section::add_input_section): Get target from
11122         parameters.
11123         (Output_section::relax_input_section): Likewise.
11124         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11125         parameters.
11126         (Sized_relobj::do_scan_relocs): Likewise.
11127         (Sized_relobj::relocate_sections): Likewise.
11128         * resolve.cc (Symbol_table::resolve): Likewise.
11129         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11130         parameter.  Change all callers.
11131         (Symbol_table::add_from_object): Get target from parameters.
11132         (Symbol_table::add_from_relobj): Don't check object target.
11133         (Symbol_table::add_from_dynobj): Likewise.
11134         (Symbol_table::define_special_symbol): Get target from
11135         parameters.
11136         * symtab.h (class Symbol_table): Update declaration.
11137         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11138         parameter.  Change all callers.  Clear parameter target.
11139         (Binary_test): Test target here.
11140         * testsuite/object_unittest.cc (gold_testsuite): Remove
11141         target_test_pointer parameter.  Change all callers.
11142         (Object_test): Test target here.
11143
11144 2009-09-26  Ian Lance Taylor  <iant@google.com>
11145
11146         * testsuite/initpri1.c: Don't try to use constructor priorities if
11147         compiling with gcc before 4.3.
11148
11149 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11150
11151         * testsuite/retain_symbols_file_test.sh (check_present): Change
11152         output file name to retain_symbols_file_test.stdout.
11153         (check_absent): Likewise.
11154
11155 2009-09-18  Craig Silverstein  <csilvers@google.com>
11156
11157         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11158         * options.cc: Include <cerrno> and <fstream>.
11159         (General_options::finalize): Parse -retain-symbols-file tag.
11160         * options.h: New flag.
11161         (General_options): New method should_retain_symbol, new
11162         variable symbols_to_retain.
11163         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11164         should_retain_symbol map.
11165         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11166         * testsuite/Makefile.in: Regenerate.
11167         * testsuite/retain_symbols_file_test.sh: New file.
11168
11169 2009-09-18  Nick Clifton  <nickc@redhat.com>
11170
11171         * po/es.po: Updated Spanish translation.
11172
11173 2009-09-17  Doug Kwan  <dougkwan@google.com>
11174
11175         * debug.h (DEBUG_RELAXATION): New constant.
11176         (DEBUG_ALL): Add DEBUG_RELAXATION.
11177         (debug_string_to_enum): Add relaxation debug option.
11178         * layout.cc
11179         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11180         Layout::Relaxation_debug_check::read_sections,
11181         Layout::Relaxation_debug_check::read_sections): New method definitions.
11182         (Layout::Layout): Initialize data members
11183         record_output_section_data_from_scrips_,
11184         script_output_section_data_list_ and relaxation_debug_check_.
11185         (Layout::save_segments, Layout::restore_segments,
11186         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11187         Layout::relaxation_loop_body): New method definitions.
11188         (Layout::finalize): Support relaxation.  Move section layout code to
11189         Layout::relaxation_loop_body.
11190         (Layout::set_asection_address_from_script): Move code for orphan
11191         section placement out.
11192         (Layout::place_orphan_sections_in_script): New method definition.
11193         * layout.h (Output_segment_headers, Output_file_header):
11194         New forward class declarations.
11195         (Layout::~Layout): Define.
11196         (Layout::new_output_section_data_from_script): New method definition.
11197         (Layout::place_orphan_sections_in_script): New method declaration.
11198         (Layout::Segment_states): New type declaration.
11199         (Layout::save_segments, Layout::restore_segments,
11200         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11201         Layout::relaxation_loop_body): New method declarations.
11202         (Layout::Output_section_data_list): New type declaration.
11203         (Layout::Relaxation_debug_check): New class definition.
11204         (Layout::record_output_section_data_from_script_,
11205         Layout::script_output_section_data_list_, Layout::segment_states_,
11206         Layout::relaxation_debug_check_): New data members.
11207         * output.cc: (Output_section_headers::do_size): New method definition.
11208         (Output_section_headers::Output_section_headers): Move size
11209         computation to Output_section_headers::do_size.
11210         (Output_segment_headers::do_size): New method definition.
11211         (Output_file_header::Output_file_header): Move size computation to
11212         Output_file_header::do_size and call it.
11213         (Output_file_header::do_size): New method definition.
11214         (Output_data_group::Output_data_group): Adjust call to
11215         Output_section_data.
11216         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11217         (Output_symtab_xindex::do_write): Add array bound check.
11218         (Output_section::Input_section::print_to_mapfile): Handle
11219         RELAXED_INPUT_SECTION_CODE.
11220         (Output_section::Output_section): Initialize data member checkpoint_.
11221         (Output_section::~Output_section): Delete checkpoint object pointed
11222         by checkpoint_.
11223         (Output_section::add_input_section): Always add an Input_section if
11224         relaxing.
11225         (Output_section::add_merge_input_section): Add assert.
11226         (Output_section::relax_input_section): New method definition.
11227         (Output_section::set_final_data_size): Set load address to zero for
11228         an unallocated section.
11229         (Output_section::do_address_and_file_offset_have_reset_values):
11230         New method definition.
11231         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11232         Handle relaxed input section.
11233         (Output_section::sort_attached_input_sections): Checkpoint input
11234         section list lazily.
11235         (Output_section::get_input_sections): Change type of input_sections to
11236         list of Simple_input_section pointers.  Checkpoint input section list
11237         lazily.  Also handle relaxed input sections.
11238         (Output_section::add_input_section_for_script): Take a reference to
11239         a Simple_input_section object instead of Relobj pointer and section
11240         index as parameter.  Handle relaxed input sections.
11241         (Output_section::save_states, Output_section::restore_states): New
11242         method definitions.
11243         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11244         (Output_data::is_data_size_fixed): New method definition.
11245         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11246         if it is fixed.
11247         (Output_data::address_and_file_offset_have_reset_values): New method
11248         definition.
11249         (Output_data::do_address_and_file_offset_have_reset_values): New method
11250         definition.
11251         (Output_data::set_data_size): Check that data size is not fixed.
11252         (Output_data::fix_data_size): New method definition.
11253         (Output_data::is_data_size_fixed_): New data member.
11254         (Output_section_headers::set_final_data_size): New method definition.
11255         (Output_section_headers::do_size): New method declaration.
11256         (Output_segment_headers::set_final_data_size): New method definition.
11257         (Output_segment_headers::do_size): New method declaration.
11258         (Output_file_header::set_final_data_size)::New method definition.
11259         (Output_file_header::do_size)::New method declaration.
11260         (Output_section_data::Output_section_data): Add new parameter
11261         is_data_size_fixed and use it to fix data size.
11262         (Output_data_const::Output_data_const): Adjust call to base class
11263         constructor and fix data size.
11264         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11265         base class constructor and fix data size.
11266         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11267         base class constructor and fix data size.
11268         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11269         class constructor and fix data size.
11270         (Output_data_group::set_final_data_size): New method definition.
11271         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11272         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11273         class constructor and fix data size.
11274         (Output_relaxed_input_section): New class definition.
11275         (Output_section::Simple_input_section): New class definition.
11276         (Output_section::get_input_sections): Adjust parameter list.
11277         (Output_section::add_input_section_for_script): Same.
11278         (Output_section::save_states, Output_section::restore_states,
11279         Output_section::do_address_and_file_offset_have_reset_values,
11280         (Output_section::Input_section::Input_section): Handle
11281         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11282         Output_relaxed_input_section.
11283         (Output_section::Input_section::is_input_section,
11284         Output_section::Input_section::set_output_section): Handle relaxed
11285         input section.
11286         (Output_section::Input_section::is_relaxed_input_section,
11287         Output_section::Input_section::output_section_data,
11288         Output_section::Input_section::relaxed_input_section): New method
11289         definitions.
11290         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11291         value.
11292         (Output_section::Input_section::u1_): Update comments.
11293         (Output_section::Input_section::u2_): Add new union member poris.
11294         (Output_section::Checkpoint_output_section): New classs definition.
11295         (Output_section::relax_input_section): New method declaration.
11296         (Output_section::checkpoint_): New data member.
11297         (Output_segment): Update comments.
11298         (Output_segment::Output_segment): Un-privatize copy constructor.
11299         (Output_segment::operator=): Un-privatize.
11300         * script-sections.cc (Output_section_element::Input_section_list):
11301         Change element type to Output_section::Simple_input_section.
11302         (Output_section_element_dot_assignment::set_section_addresses):
11303         Register output section data for relaxation clean up.
11304         (Output_data_exression::Output_data_expression): Adjust call to base
11305         constructor to fix data size.
11306         (Output_section_element_data::set_section_addresses): Register
11307         Output_data_expression object for relaxation clean up.
11308         (struct Input_section_info): Replace Relobj pointer and section index
11309         pair with Output_section::Simple_input_section and Convert struct to a
11310         class.
11311         (Input_section_sorter::operator()): Adjust access to
11312         Input_section_info data member to use accessors.
11313         (Output_section_element_input::set_section_addresses): Use layout
11314         parameter.  Adjust code to use Output_section::Simple_input_section
11315         and Input_secction_info classes.  Register filler for relaxation
11316         clean up.
11317         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11318         and section index pair with Output_section::Simple_input_section
11319         class.  Adjust code accordingly.
11320         (Phdrs_element::release_segment): New method definition.
11321         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11322         segment list.
11323         (Script_sections::release_segments): New method definition.
11324         * gold/script-sections.h (Script_sections::release_segments): New
11325         method declaration.
11326         * gold/target.h (Target::may_relax, Target::relax,
11327         Target::do_may_relax, Target::do_relax): New method definitions.
11328
11329 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11330
11331         * arm.cc (has_signed_unsigned_overflow): New function.
11332         (Arm_relocate_functions::abs8): New function.
11333         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11334         (Target_arm::Scan::global): Likewise.
11335         (Target_arm::relocate::relocate): Likewise.
11336         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11337         Likewise.
11338
11339 2009-09-16  Cary Coutant  <ccoutant@google.com>
11340
11341         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11342         * testsuite/Makefile.in: Regenerate.
11343
11344 2009-09-11  Nick Clifton  <nickc@redhat.com>
11345
11346         * po/gold.pot: Updated by the Translation project.
11347
11348 2009-09-08  Cary Coutant  <ccoutant@google.com>
11349
11350         * output.cc (Output_file::open): Add execute permission to empty file.
11351         * testsuite/Makefile.am (permission_test): New test.
11352         * testsuite/Makefile.in: Regenerate.
11353
11354 2009-09-02  Ian Lance Taylor  <iant@google.com>
11355
11356         * output.cc (Output_file::resize): Call map_no_anonymous rather
11357         than map.
11358
11359 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11360
11361         * gold.cc: Include "incremental.h".
11362         (queue_initial_tasks): Call Incremental_checker methods.
11363         * incremental.cc: Include "output.h".
11364         (Incremental_checker::can_incrementally_link_output_file): New
11365         method.
11366         * incremental.h (Incremental_checker): New class.
11367
11368         * output.cc (Output_file::open_for_modification): New method.
11369         (Output_file::map_anonymous): Changed return type to bool.  Record
11370         map in base_ field.
11371         (Output_file::map_no_anonymous): New method, broken out of map.
11372         (Output_file::map): Use map_no_anonymous and map_anonymous.
11373         * output.h (class Output_file): Update declarations.
11374
11375 2009-08-24  Cary Coutant  <ccoutant@google.com>
11376
11377         * options.h (Command_line::Pre_options): New class.
11378         (Command_line::pre_options): New member.
11379         * options.cc (gold::options::ready_to_register): New variable.
11380         (One_option::register_option): Do nothing if not registering options.
11381         Assert if same short option registered twice.
11382         (General_options::General_options): Turn off option registration when
11383         done constructing.
11384         (Command_line::Pre_options::Pre_options): New constructor.
11385
11386 2009-08-24  Cary Coutant  <ccoutant@google.com>
11387
11388         * options.h (General_options::no_keep_memory): Remove incorrect
11389         short option.
11390
11391 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11392
11393         * Makefile.am (am__skiplex, am__skipyacc): New.
11394         * Makefile.in: Regenerate.
11395
11396 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11397
11398         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11399         (INCLUDES): ... this.
11400         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11401         (AM_CPPFLAGS): Renamed from ...
11402         (INCLUDE): ... this.
11403         * Makefile.in, testsuite/Makefile.in: Regenerate.
11404
11405         * Makefile.in: Regenerate.
11406         * aclocal.m4: Likewise.
11407         * config.in: Likewise.
11408         * configure: Likewise.
11409         * testsuite/Makefile.in: Likewise.
11410
11411         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11412         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11413         * Makefile.in: Regenerate.
11414         * testsuite/Makefile.in: Regenerate.
11415
11416 2009-08-19  Cary Coutant  <ccoutant@google.com>
11417
11418         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11419         symbols in shared libraries overridden by hidden or internal symbols
11420         in the main program.
11421
11422 2009-08-19  Chris Demetriou  <cgd@google.com>
11423
11424         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11425         checking source file names in error messages.
11426
11427 2009-08-18  Doug Kwan  <dougkwan@google.com>
11428
11429         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11430         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11431         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11432         an elfcpp::Ehdr as parameter.
11433         * object.cc (Object::set_target): Remove the version that looks up
11434         a target and sets it.
11435         (Sized_relobj::setup): Take a Target object instead of
11436         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11437         (make_elf_sized_object): Find target and ask target to
11438         make an ELF object.
11439         * object.h: (Object::set_target): Remove the version that looks up
11440         a target and sets it.
11441         (Sized_relobj::setup): Take a Target object instead of
11442         an elfcpp:Ehdr as parameter.
11443         * target.cc: Include dynobj.h.
11444         (Target::do_make_elf_object_implementation): New.
11445         (Target::do_make_elf_object): New.
11446         * target.h (Target::make_elf_object): New template declaration.
11447         (Target::do_make_elf_object): New method declarations.
11448         (Target::do_make_elf_object_implementation): New template declaration.
11449
11450 2009-08-14  Ian Lance Taylor  <iant@google.com>
11451
11452         * gold.h (FUNCTION_NAME): Define.
11453         (gold_unreachable): Use FUNCTION_NAME.
11454
11455 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11456
11457         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11458         symbol in the --keep-unique list is not found.
11459
11460 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11461
11462         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11463         been maked as --keep-unique.
11464         (Icf::unfold_section): New function.
11465         * icf.h (Icf::unfold_section): New function.
11466         * options.h (General_options::keep_unique): New option.
11467         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11468         * testsuite/Makefile.in: Regenerate.
11469         * testsuite/icf_keep_unique_test.sh: New file.
11470         * testsuite/icf_keep_unique_test.cc: New file.
11471
11472 2009-08-12  Cary Coutant  <ccoutant@google.com>
11473
11474         PR 10471
11475         * resolve.cc (Symbol_table::resolve): Check for references from
11476         dynamic objects to hidden and internal symbols.
11477         * testsuite/Makefile.am (hidden_test.sh): New test.
11478         * testsuite/Makefile.in: Regenerate.
11479         * testsuite/hidden_test.sh: New script.
11480         * testsuite/hidden_test_1.c: New test source.
11481         * testsuite/hidden_test_main.c: New test source.
11482
11483 2009-08-11  Doug Kwan  <dougkwan@google.com>
11484
11485         * arm.cc: Update comments.
11486         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11487         segment to locate the .ARM.exidx section if present.
11488
11489 2009-08-09  Doug Kwan  <dougkwan@google.com>
11490
11491         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11492         patch.
11493
11494 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11495         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11496         compiler warnings.
11497
11498 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11499
11500         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11501         valid tls_segment only for non-debug-section relocations.
11502         * testsuite/Makefile.am: Add gc_tls_test.
11503         * testsuite/Makefile.in: Regenerate.
11504         * testsuite/gc_tls_test.cc: New file.
11505         * testsuite/gc_tls_test.sh: New file.
11506
11507 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11508
11509         * icf.cc: New file.
11510         * icf.h: New file.
11511         * Makefile.am (CCFILES): Add icf.cc.
11512         (HFILES): Add icf.h
11513         * Makefile.in: Regenerate.
11514         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11515         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11516         section, symbol and addend information for the relocs.
11517         * gold.cc (queue_middle_tasks): Call identical code folding.
11518         * gold.h: Add defines for multimap.
11519         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11520         to the call of finalize_local_symbols.
11521         * main.cc (main): Create object of class Icf.
11522         * object.cc (Sized_relobj::do_layout): Allow this function to be
11523         called twice during icf.
11524         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11525         to sections marked as identical by icf.
11526         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11527         when available.
11528         (Sized_relobj::do_section_entsize): New function.
11529         * object.h (Object::section_entsize): New function.
11530         (Object::do_section_entsize): New pure virtual function.
11531         (Relobj::finalize_local_symbols): Add new parameter.
11532         (Relobj::do_section_entsize): New function.
11533         * options.h (General_options::icf): New option.
11534         (General_options::icf_iterations): New option.
11535         (General_options::print_icf_sections): New option.
11536         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11537         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11538         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11539         icf.
11540         * symtab.cc (Symbol_table::is_section_folded): New function.
11541         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11542         to sections marked as identical by icf.
11543         * symtab.h (Symbol_table::set_icf): New function.
11544         (Symbol_table::icf): New function.
11545         (Symbol_table::is_section_folded): New function.
11546         (Symbol_table::icf_): New data member.
11547         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11548         * testsuite/Makefile.am: Add commands to build icf_test.
11549         * testsuite/Makefile.in: Regenerate.
11550         * testsuite/icf_test.sh: New file.
11551         * testsuite/icf_test.cc: New file.
11552
11553 2009-07-24  Chris Demetriou  <cgd@google.com>
11554
11555         * layout.cc (is_compressible_debug_section): Fix incorrect
11556         comment about compressed section names.
11557
11558 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11559
11560         PR 10419
11561         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11562
11563 2009-07-16  Ian Lance Taylor  <iant@google.com>
11564
11565         PR 10400
11566         * layout.h: #include <map>.
11567         (class Kept_section): Change from struct to class.  Add accessors
11568         and setters.  Add section size to Comdat_group mapping.  Change
11569         Comdat_group to std::map.  Add is_comdat_ field.  Add
11570         linkonce_size field in union.
11571         (class Layout): Update declaration of find_or_add_kept_section.
11572         Don't declare find_kept_object.
11573         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11574         parameter.  Add object, shndx, is_comdat, and is_group_name
11575         parameters.  Change all callers.  Adjust for new Kept_section.
11576         (Layout::find_kept_object): Remove.
11577         * object.cc (Sized_relobj::include_section_group): Update use of
11578         Kept_section.  Rename secnum to shndx.  Only record
11579         Kept_comdat_section if sections are the same size.
11580         (Sized_relobj::include_linkonce_section): Update use of
11581         Kept_section.  Only record Kept_comdat_section if sections are the
11582         same size.  Set size of linkonce section.
11583         (Sized_relobj::map_to_kept_section): Update call to
11584         get_kept_comdat_section.
11585         * object.h (class Sized_relobj): Rename fields in
11586         Kept_comdat_section to drop trailing underscores; change object
11587         field to Relobj*.  Change Kept_comdat_section_table to store
11588         struct rather than pointer.
11589         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11590         Add kept_object and kept_shndx parameters.  Change all callers.
11591         (Sized_relobj::get_kept_comdat_section): Change return type to
11592         bool.  Add kept_object and kept_shndx parameters.  Change all
11593         callers.
11594         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11595         Layout::find_or_add_kept_section.
11596
11597 2009-07-09  Ian Lance Taylor  <iant@google.com>
11598
11599         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11600         Reserve space in the hash table.
11601
11602 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11603
11604         * fileread.cc (File_read::get_mtime): New method.
11605         * fileread.h (Timespec): New structure.
11606         (File_read::get_mtime): New method.
11607         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11608         Renamed from timestamp_nsec.
11609         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11610         Elf_Xword.
11611         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11612         timestamp_nsec.
11613         (Incremental_inputs::report_archive): Save mtime; style fix.
11614         (Incremental_inputs::report_obejct): Save mtime; style fix.
11615         (Incremental_inputs::report_script): Save mtime; style fix.
11616         (Incremental_inputs::finalize_inputs): Style fix.
11617         (Incremental_inputs::finalize): Style fix.
11618         (Incremental_inputs::create_input_section_data): Store inputs
11619         mtime.
11620         * incremental.h (Incremental_inputs::report_script): Add mtime
11621         argument.
11622         (Incremental_inputs::Input_info::Input_info): Intialize only one
11623         union member.
11624         (Incremental_inputs::Input_info::archive): Move to nameless
11625         union.
11626         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11627         (Incremental_inputs::Input_info::script): Move to nameless union.
11628         (Incremental_inputs::mtime): New field.
11629         * script.cc (read_input_script): Pass file mtime to
11630         Incremental_input.
11631         * script.h (Script_info::inputs): Style fix.
11632
11633 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11634
11635         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11636         instead of 32.
11637
11638 2009-06-24  Ian Lance Taylor  <iant@google.com>
11639
11640         PR 10156
11641         * layout.cc (Layout::choose_output_section): If we find an
11642         existing section, update the flags.
11643         (Layout::create_notes): New function, broken out of
11644         Layout::finalize.
11645         (Layout::finalize): Don't create note sections.
11646         (Layout::create_note): Don't crash if linker script discards
11647         section.
11648         (Layout::create_gold_note): Likewise.
11649         (Layout::create_build_id): Likewise.  Don't set
11650         after_input_sections on the section.
11651         (Layout::create_executable_stack_info): Remove target parameter.
11652         Change caller.
11653         * layout.h (class Layout): Declare create_notes.  Update
11654         declaration of create_executable_stack_info.
11655         * gold.cc (queue_middle_tasks): Call create_notes.
11656         * output.cc (Output_section::update_flags_for_input_section): Move
11657         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11658         invalid.
11659         * output.h (Output_data::mark_address_invalid): New function.
11660         (class Output_section): Only declare, not define,
11661         update_flags_for_input_section.  Remove set_flags.
11662
11663 2009-06-24  Ian Lance Taylor  <iant@google.com>
11664
11665         * script-sections.cc (Output_section_definition::
11666         set_section_addresses): Rename shadowing local load_address to
11667         laddr.
11668
11669 2009-06-24  Ian Lance Taylor  <iant@google.com>
11670
11671         PR 10244
11672         * reloc.cc (relocate_sections): Skip empty relocation sections.
11673
11674 2009-06-23  Ian Lance Taylor  <iant@google.com>
11675
11676         PR 10156
11677         * layout.cc (Layout::create_note): Use choose_output_section
11678         rather than make_output_section.
11679
11680 2009-06-23  Ian Lance Taylor  <iant@google.com>
11681
11682         PR 10237
11683         * options.cc (General_options::parse_V): Set printed_version_.
11684         (General_options::General_options): Initialize printed_version_.
11685         * options.h (class General_options): Add printed_version_ field.
11686         * gold.cc (queue_initial_tasks): If there are no input files,
11687         don't give a fatal error if we printed the version information.
11688         (queue_middle_tasks): If using -r with a shared object, give a
11689         fatal error rather than an ordinary error.
11690
11691 2009-06-23  Ian Lance Taylor  <iant@google.com>
11692
11693         PR 10219
11694         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11695         (Layout::make_output_section): Set have_stabstr_section_ if we see
11696         a .stab*str section.
11697         (Layout::finalize): Call link_stabs_sections.
11698         (Layout::link_stabs_sections): New file.
11699         * layout.h (class Layout): Add have_stabstr_section_ field.
11700         Declare link_stabs_sections.
11701
11702 2009-06-23  Doug Kwan  <dougkwan@google.com>
11703
11704         * Makefile.am (libgold_a_LIBADD): New.
11705         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11706         * Makefile.in: Regenerate.
11707         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11708         * configure: Regenerate.
11709         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11710         * fileread.cc: Include sys/state.h
11711         * gold.h: Declare memmem and strndup if found missing.
11712         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11713
11714 2009-06-23  Ian Lance Taylor  <iant@google.com>
11715
11716         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11717         * configure: Rebuild.
11718
11719 2009-06-23  Ian Lance Taylor  <iant@google.com>
11720
11721         PR 10147
11722         * object.cc (Object::section_contents): Don't try to get a view if
11723         the section has length zero.
11724         (Object::handle_gnu_warning_section): If the section is empty, use
11725         the name of the section as the warning.
11726
11727 2009-06-23  Ian Lance Taylor  <iant@google.com>
11728
11729         PR 10133
11730         * stringpool.h (class Stringpool_template): Add optimize_ field.
11731         (Stringpool_template::set_optimize): New function.
11732         * stringpool.cc (Stringpool_template::Stringpool_template):
11733         Initialize optimize_ field.
11734         (Stringpool_template::set_string_offsets): Test local optimize
11735         fild rather than parameter.
11736         * layout.cc (Layout::Layout): Call set_optimize on the section
11737         name stringpool.
11738
11739 2009-06-22  Ian Lance Taylor  <iant@google.com>
11740
11741         PR 10030
11742         * yyscript.y: Parse TARGET.
11743         * script.cc (script_set_target): New function.
11744         * script-c.h (script_set_target): Declare.
11745         * options.cc (General_options::string_to_object_format): Rename
11746         from string_to_object_format in anonymous namespace.  Change
11747         callers.
11748         * options.h (class General_options): Declare
11749         string_to_object_format.
11750
11751 2009-06-22  Ian Lance Taylor  <iant@google.com>
11752
11753         * script-sections.cc (Script_sections::create_segments): Don't put
11754         program headers in a PT_LOAD segment if -n or -N.
11755
11756 2009-06-22  Ian Lance Taylor  <iant@google.com>
11757
11758         PR 10141
11759         * options.h (class General_options): Add -z lazy and -z now.  Sort
11760         -z options into alphabetical order.
11761         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11762
11763 2009-06-21  Ian Lance Taylor  <iant@google.com>
11764
11765         * layout.cc (Layout::make_output_section): Call
11766         Target::new_output_section.
11767         (Layout::attach_allocated_section_to_segment): Put large section
11768         sections in a separate load segment with the large segment flag
11769         set.
11770         (Layout::segment_precedes): Sort large data segments after other
11771         load segments.
11772         (align_file_offset): New static function.
11773         (Layout::set_segment_offsets): Use align_file_offset.
11774         * output.h (class Output_section): Add is_small_section_ and
11775         is_large_section_ fields.
11776         (Output_section::is_small_section): New function.
11777         (Output_section::set_is_small_section):  New function.
11778         (Output_section::is_large_section): New function.
11779         (Output_section::set_is_large_section): New function.
11780         (Output_section::is_large_data_section): New function.
11781         (class Output_segment): Add is_large_data_segment_ field.
11782         (Output_segment::is_large_data_segment): New function.
11783         (Output_segment::set_is_large_data_segment): New function.
11784         * output.cc (Output_section::Output_section): Initialize new
11785         fields.
11786         (Output_segment::Output_segment): Likewise.
11787         (Output_segment::add_output_section): Add assertion that large
11788         data sections always go in large data segments.  Force small data
11789         sections to the end of the list of data sections.  Force small BSS
11790         sections to the start of the list of BSS sections.  For large BSS
11791         sections to the end of the list of BSS sections.
11792         * symtab.h (class Symbol): Declare is_common_shndx.
11793         (Symbol::is_defined): Check Symbol::is_common_shndx.
11794         (Symbol::is_common): Likewise.
11795         (class Symbol_table): Define enum Commons_section_type.  Update
11796         declarations.  Add small_commons_ and large_commons_ fields.
11797         * symtab.cc (Symbol::is_common_shndx): New function.
11798         (Symbol_table::Symbol_table): Initialize new fields.
11799         (Symbol_table::add_from_object): Put small and large common
11800         symbols in the right list.
11801         (Symbol_table::sized_finalized_symbol): Check
11802         Symbol::is_common_shndx.
11803         (Symbol_table::sized_write_globals): Likewise.
11804         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11805         common symbol lists.  Don't call do_allocate_commons_list if the
11806         list is empty.
11807         (Symbol_table::do_allocate_commons_list): Remove is_tls
11808         parameter.  Add comons_section_type parameter.  Change all
11809         callers.  Handle small and large common symbols.
11810         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11811         Symbol::is_common_shndx.
11812         * resolve.cc (symbol_to_bits): Likewise.
11813         * target.h (Target::small_common_shndx): New function.
11814         (Target::small_common_section_flags): New function.
11815         (Target::large_common_shndx): New function.
11816         (Target::large_common_section_flags): New function.
11817         (Target::new_output_section): New function.
11818         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11819         small_common_section_flags, and large_common_section_flags
11820         fields.
11821         (Target::do_new_output_section): New virtual function.
11822         * arm.cc (Target_arm::arm_info): Initialize new fields.
11823         * i386.cc (Target_i386::i386_info): Likewise.
11824         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11825         Likewise.
11826         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11827         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11828         (Target_x86_64::do_new_output_section): New function.
11829         * configure.ac: Define conditional MCMODEL_MEDIUM.
11830         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11831         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11832         (large_LDFLAGS): Define.
11833         * testsuite/large.c: New file.
11834         * testsuite/testfile.cc (Target_test::test_target_info):
11835         Initialize new fields.
11836         * configure, testsuite/Makefile.in: Rebuild.
11837
11838 2009-06-05  Doug Kwan  <dougkwan@google.com>
11839
11840         * Makefile.am (CCFILES): Add target.cc.
11841         * Makefile.in: Regenerate.
11842         * i386.cc (class Target_i386): Define new virtual method to
11843         override do_is_local_label_name in parent.
11844         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11845         local symbols if --discard-locals or -X is given.
11846         * options.h (class General_options): Declare new options
11847         '--discard-locals' and '-X' for discarding locals.
11848         * target.h (class Target): Define new methods is_local_label_name.
11849         Declare new virtual method do_is_local_label_name.
11850         * target.cc: New file.
11851         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11852         (check_SCRIPTS): Add discard_locals_test.sh.
11853         (check_DATA): Add discard_local_tests.syms.
11854         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11855         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11856         * testsuite/Makefile.in: Regenerate.
11857         * testsuite/discard_locals_test.c: New file.
11858         * testsuite/discard_locals_test.sh: Same.
11859
11860 2009-06-05  Doug Kwan  <dougkwan@google.com>
11861
11862         * object.cc (Sized_relobj::Sized_relobj): Initialize
11863         discarded_eh_frame_shndx_ to -1U.
11864         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11865         section.
11866         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11867         a discarded .eh_frame section.
11868         (Sized_relobj::do_finalize_local_symbols): Ditto.
11869         * object.h (class Sized_relobj): Declare new member
11870         discarded_eh_frame_shndx_.
11871         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11872         (local_labels_test.o, local_labels_test): New rules.
11873         * testsuite/Makefile.in: Regenerate.
11874
11875 2009-06-04  Doug Kwan  <dougkwan@google.com>
11876
11877         * layout.cc (Layout::section_name_mapping): Add mapping for
11878         special ARM sections.
11879
11880 2009-06-03  Doug Kwan  <dougkwan@google.com>
11881
11882         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11883         (utils::has_overflow): Same.
11884
11885 2009-06-03  Ian Lance Taylor  <iant@google.com>
11886
11887         * layout.cc (Layout::section_name_mapping): New array, replacing
11888         Layout::linkonce_mapping.
11889         (Layout::section_name_mapping_count): New variable, replacing
11890         Layout::linkonce_mapping_count.
11891         (Layout::linkonce_output_name): Remove.
11892         (Layout::output_section_name): Rewrite.
11893         * layout.h (class Layout): Rename Linkonce_mapping to
11894         Section_name_mapping, linkonce_mapping to section_name_mapping,
11895         linkonce_mapping_count to section_name_mapping_count.  Don't
11896         declare linkonce_output_name.
11897
11898 2009-06-03  Doug Kwan  <dougkwan@google.com>
11899
11900         * gold/arm.cc (namespace utils): New.
11901         (Target_arm::reloc_is_non_pic): Define new method.
11902         (class Arm_relocate_functions): New.
11903         (Target_arm::Relocate::relocate): Handle relocation types used by
11904         Android.
11905
11906 2009-06-03  Ian Lance Taylor  <iant@google.com>
11907
11908         * arm.cc (Target_arm::scan::global): Use || instead of |.
11909
11910 2009-06-02  Doug Kwan  <dougkwan@google.com>
11911
11912         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11913         issued_non_pic_error_.
11914         (class Target_arm::Scan): Declare new method check_non_pic.
11915         Define new method symbol_needs_plt_entry.
11916         Declare new data member issued_non_pic_error_.
11917         (class Target_arm::Relocate): Declare new method
11918         should_apply_static_reloc.
11919         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11920         (Target_arm::Scan::check_non_pic): Define new method.
11921         (Target_arm::Scan::local): Handle a small subset of reloc types used
11922         by Android.
11923         (Target_arm::Scan::local): Same.
11924         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11925
11926 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11927
11928         * incremental.cc (Incremental_inputs::report_command_line): Filter
11929         out --incremental-* options.
11930
11931 2009-05-29  Doug Kwan  <dougkwan@google.com>
11932
11933         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11934         template class.
11935         (class Target_arm): Update comment.
11936         (Target_arm::Target_arm): Initialize new data members GOT_,
11937         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11938         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11939         and Target_arm::rel_dyn_section.
11940         Declare new_enum Target_arm::Got_type.
11941         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11942         and DYNBSS_.
11943         Update commments for member do_dynsym_value.
11944         (Target_arm::got_size, Target_arm::plt_section,
11945         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11946         new methods inside class defintion.
11947         (Target_arm::got_section): Define new method.
11948         (Target_arm::rel_dyn_section): Same.
11949         (Output_data_plt_arm): New template class.
11950         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11951         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11952         (Output_data_plt_arm::add_entry): Same.
11953         (Output_data_plt_arm::first_plt_entry): Define new
11954         static data member for PLT instruction template.
11955         (Output_data_plt_arm::plt_entry): Same.
11956         (Output_data_plt_arm::do_write): Define new method.
11957         (Target_arm::make_plt_entry): Same.
11958         (Target_arm::do_finalize_sections): Same.
11959         (Target_arm::do_dynsym_value): Same.
11960
11961 2009-05-28  Doug Kwan  <dougkwan@google.com>
11962
11963         * Makefile.am (TARGETSOURCES): Add arm.cc.
11964         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11965         * Makefile.in: Regenerate.
11966         * arm.cc: New file.
11967         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11968
11969 2009-05-26  Doug Kwan  <dougkwan@google.com>
11970
11971         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11972         (General_options::check_excluded_libs): Strip off directories in
11973         archive name before matching like GNU ld does.
11974         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11975         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11976         (exclude_libs_test_LDFLAGS): Add linker option
11977         -Wl,--exclude-libs,libexclude_libs_test_3
11978         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11979         an explicit archive without using -l.
11980         (alt/libexclude_libs_test_3.a): New make rule.
11981         * testsuite/Makefile.in: Regenerate.
11982         * testsuite/exclude_libs_test.c : Declare lib3_default().
11983         (main): Call it.
11984         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11985         * exclude_libs_test_3.c: New file.
11986
11987 2009-05-26  Nick Clifton  <nickc@redhat.com>
11988
11989         * po/id.po: New Indonesian translation.
11990         * po/gold.pot: Updated template file.
11991
11992 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11993
11994         * testsuite/Makefile.am: Add -ffunction-sections to compile
11995         gc_comdat_test files.  Add -Wl,--gc-sections to build
11996         gc_comdat_test.
11997         * testsuite/Makefile.in: Regenerate.
11998         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11999
12000 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12001
12002         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12003         kept comdat section was garbage collected.
12004         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12005         * testsuite/Makefile.in: Regenerate.
12006         * testsuite/gc_comdat_test.sh: New file.
12007         * testsuite/gc_comdat_test_1.cc: New file.
12008         * testsuite/gc_comdat_test_2.cc: New file.
12009
12010 2009-05-19  Doug Kwan  <dougkwan@google.com>
12011
12012         * archive.cc (Archive::Archive): Move constructor from archive.h
12013         to here.  Initialize no_export_.
12014         (Archive::get_elf_object_for_member): Set no_export flag of object.
12015         * archive.h (Archive::Archive): Move constructor body to
12016         archive.cc.
12017         (Archive::no_export): New method.
12018         (Archive::no_export_): New field.
12019         * object.h (Object::Object): Initialize no_export_ to false.
12020         (Object::no_export, Object::set_no_export): New methods.
12021         (Object::no_export_): New field.
12022         * options.cc (General_options::parse_exclude_libs): New method.
12023         (General_options::check_excluded_libs) Same.
12024         * options.h (exclude_libs): New option.
12025         (General_options::check_excluded_libs): New method declaration.
12026         (General_options::excluded_libs_): New field.
12027         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12028         default or protected visibility if an object has no-export flag set.
12029         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12030         (check_SCRIPTS): Add exclude_libs_test.sh.
12031         (check_DATA): Add exclude_libs_test.syms.
12032         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12033         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12034         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12035         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12036         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12037         libexclude_libs_test_2.a): New rules.
12038         * testsuite/Makefile.in: Regenerate.
12039         * testsuite/exclude_libs_test.c: New file.
12040         * testsuite/exclude_libs_test.sh: Ditto.
12041         * testsuite/exclude_libs_test_1.c: Ditto.
12042         * testsuite/exclude_libs_test_2.c: Ditto.
12043
12044 2009-05-15  Ian Lance Taylor  <iant@google.com>
12045
12046         * configure.ac: Check for declarations for cases where libiberty.h
12047         checks HAVE_DECL_xxx.
12048         * configure, config.in: Rebuild.
12049
12050 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12051
12052         * gold.h (Incremental_argument_list): Remove (invalid) forward
12053         declaration.
12054         * incremental.cc (Incremental_inputs::report_achive): New method.
12055         (Incremental_inputs::report_object): New method.
12056         (Incremental_inputs::report_script): New method.
12057         (Incremental_inputs::finalize_inputs): New method.
12058         (Incremental_inputs::finalize): Call finalize_inputs().
12059         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12060         Create inputs entries.
12061         * incremental.h (Incremental_input_type): New enum.
12062         (Incremental_inputs::Incremental_input): Initialize new fields.
12063         (Incremental_inputs::report_inputs): New method.
12064         (Incremental_inputs::report_achive): New method.
12065         (Incremental_inputs::report_object): New method.
12066         (Incremental_inputs::report_script): New method.
12067         (Incremental_inputs::finalize_inputs): New method.
12068         (Incremental_inputs::Input_info): New struct.
12069         (Incremental_inputs::Input_info_map): New typedef.
12070         (Incremental_inputs::lock_): New field.
12071         (Incremental_inputs::Inputs_): New field.
12072         (Incremental_inputs::Inputs_map): New field.
12073         * main.cc (main): Call Incremental_input::report_inputs.
12074         * options.h (Input_argument_list): Typedef moved from
12075         Input_arguments.
12076         (Input_file_group::Files): Remove, use ::Input_argument_list.
12077         (Input_file_group::Input_argument_list): Remove, use
12078         ::Input_argument_list.
12079         * plugin.cc (Plugin_manager::add_input_file): Add error in
12080         incremental build.
12081         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12082         functions.
12083         * script.cc (read_input_script): Call
12084         Incremental_input::report_script.
12085         * script.h (Script_info): New class.
12086
12087 2009-04-27  Ian Lance Taylor  <iant@google.com>
12088
12089         * x86_64.cc (do_adjust_output_section): Set entsize to
12090         plt_entry_size.
12091
12092 2009-04-23  Elliott Hughes  <enh@google.com>
12093
12094         * output.cc (Output_file::close): After short writes, continue
12095         writing from the correct offset in the buffer being written.
12096
12097 2009-04-23  Chris Demetriou  <cgd@google.com>
12098
12099         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12100         * configure: Regenerate.
12101         * config.in: Regenerate.
12102         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12103         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12104
12105 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12106
12107         * incremental.cc (Incremental_inputs_header_data): Renamed from
12108         Incremental_input_header_data.
12109         (Incremental_inputs_header_data::data_size): New field.
12110         (Incremental_inputs_header_data::put_input_file_count): Renamed
12111         from input_file_count.
12112         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12113         from command_line_offset.
12114         (Incremental_inputs_header_data::put_reserved): Renamed from
12115         put_reserved.
12116         (Incremental_inputs_entry_data): Renamed from
12117         Incremental_input_entry_data.
12118         (Incremental_inputs_entry_data::data_size): New field.
12119         (Incremental_inputs::report_command_line): New method.
12120         (Incremental_inputs::finalize): New method.
12121         (Incremental_inputs::create_incremental_inputs_data): New method.
12122         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12123         * incremental.h: New file.
12124         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12125         (Layout::finalize): Create incremental inputs section in
12126         incremental builds.
12127         (Layout::create_incremental_info_sections): New method.
12128         * layout.h (Layout::incremental_inputs): New method.
12129         (Layout::create_incremental_info_sections): New method.
12130         (Layout::incremental_inputs_): New field.
12131         * main.cc (main): Notify Incremental_input of the command line.
12132
12133 2009-04-01  Ian Lance Taylor  <iant@google.com>
12134             Mikolaj Zalewski  <mikolajz@google.com>
12135
12136         * gold.h (reserve_unordered_map): Define, three versions, one for
12137         each version of Unordered_map.
12138         * layout.cc (Layout::Layout): Remove options parameter.  Add
12139         number_of_input_files parameter.  Don't initialize options_.
12140         Initialize number_of_input_files_ and resized_signatures_.  Move
12141         sections_are_attached_.
12142         (Layout::layout_group): Reserve space for group_signatures_.
12143         (Layout::find_or_add_kept_section): Change name parameter to be a
12144         reference.  Resize signatures_ map when it gets large enough.
12145         (Layout::layout_eh_frame): Use parameters->options() instead of
12146         this->options_.
12147         (Layout::make_output_section): Likewise.
12148         (Layout::attach_allocated_section_to_segment): Likewise.
12149         (Layout::finalize, Layout::create_executable_stack): Likewise.
12150         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12151         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12152         * layout.h (class Layout): Update declarations.  Remove options_
12153         field.  Add number_of_input_files_ and resized_signatures_
12154         fields.  Move sections_are_attached_ field.
12155         * main.cc (main): Pass number of input files to Layout
12156         constructor.  Don't pass options.
12157
12158 2009-03-30  Ian Lance Taylor  <iant@google.com>
12159
12160         * ffsll.c (ffsll): Correct implementation.
12161
12162 2009-03-27  Ian Lance Taylor  <iant@google.com>
12163
12164         * ffsll.c: New file.
12165         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12166         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12167         * ftruncate.c (ftruncate): Declare before definition.
12168         * mremap.c (mremap): Likewise.
12169         * pread.c (pread): Likewise.
12170         * configure, Makefile.in, config.in: Rebuild.
12171
12172         * mremap.c: New file.
12173         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12174         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12175         (mremap): Declare if HAVE_MREMAP is not defined.
12176         * configure, Makefile.in, config.in: Rebuild.
12177
12178 2009-03-27  Cary Coutant  <ccoutant@google.com>
12179
12180         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12181         position independent.
12182         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12183         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12184
12185 2009-03-24  Cary Coutant  <ccoutant@google.com>
12186
12187         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12188         an executable.
12189         (needs_dynamic_reloc): Likewise.
12190
12191 2009-03-24  Ian Lance Taylor  <iant@google.com>
12192
12193         * yyscript.y (file_cmd): Recognize EXTERN.
12194         (extern_name_list, extern_name_list_body): New nonterminals.
12195         * script.cc (script_add_extern): Define.
12196         * script-c.h (script_add_extern): Declare.
12197
12198 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12199
12200         * object.cc (is_elf_object): Define.
12201         * object.h (is_elf_object): Declare.
12202         * archive.cc (Archive::get_elf_object_for_member): Call
12203         is_elf_object.
12204         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12205
12206 2009-03-24  Elliott Hughes  <enh@google.com>
12207
12208         * output.cc (Output_file::map_anonymous): Define.
12209         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12210         try an anonymous one.  Report the size if the mmap fails.
12211         * output.h (class Output_file): Declare map_anonymous.
12212
12213 2009-03-24  Ian Lance Taylor  <iant@google.com>
12214
12215         * target-select.cc (instantiate_target): Don't acquire the lock if
12216         the instantiated_target_ field has already been set.
12217
12218 2009-03-23  Ian Lance Taylor  <iant@google.com>
12219
12220         * gold-threads.h (class Initialize_lock): Define.
12221         * gold-threads.cc (class Initialize_lock_once): Define.
12222         (initialize_lock_control): New static variable.
12223         (initialize_lock_pointer): New static variable.
12224         (initialize_lock_once): New static function.
12225         (Initialize_lock::Initialize_lock): Define.
12226         (Initialize_lock::initialize): Define.
12227         * target-select.h: Include "gold-threads.h".
12228         (class Target_selector): Add lock_ and initialize_lock_ fields.
12229         Don't define instantiate_target, just declare it.
12230         * target-select.cc (Target_selector::Target_selector): Initialize
12231         new fields.
12232         (Target_selector::instantiate_target): Define.
12233         * descriptors.h: Include "gold-threads.h".
12234         (class Descriptors): Add initialize_lock_ field.
12235         * descriptors.cc (Descriptors::Descriptors): Initialize new
12236         field.
12237         (Descriptors::open): Use initialize_lock_ field
12238         * errors.h (class Errors): Add initialize_lock_ field.
12239         * errors.cc (Errors::Errors): Initialize new field.
12240         (Errors::initialize_lock): Use initialize_lock_ field.
12241         * powerpc.cc (class Target_selector_powerpc): Remove
12242         instantiated_target_ field.  In do_recognize call
12243         instantiate_target rather than do_instantiate_target.  In
12244         do_instantiate_target just allocate a new target.
12245         * sparc.cc (class Target_selector_sparc): Likewise.
12246
12247         * freebsd.h: New file.
12248         * i386.cc: Include "freebsd.h".
12249         (Target_i386): Derive from Target_freebsd rather than
12250         Sized_target.
12251         (Target_selector_i386): Derive from Target_selector_freebsd rather
12252         than Target_selector.
12253         * x86_64.cc: Include "freebsd.h".
12254         (Target_x86_64): Derive from Target_freebsd rather than
12255         Sized_target.
12256         (Target_selector_x86_64): Derive from Target_selector_freebsd
12257         rather than Target_selector.
12258         * target.h (class Target): Add adjust_elf_header and
12259         do_adjust_elf_header.
12260         * output.cc (Output_file_header:: do_sized_write): Call target
12261         adjust_elf_header routine.
12262         * configure.tgt: Set targ_osabi.
12263         * configure.ac: Define GOLD_DEFAULT_OSABI.
12264         * parameters.cc (Parameters::default_target): Pass
12265         GOLD_DEFAULT_OSABI to select_target.
12266         * target-select.h (class Target_selector): Make instantiate_target
12267         protected rather than private.
12268         * Makefile.am (HFILES): Add freebsd.h.
12269         * configure, Makefile.in, config.in: Rebuild.
12270
12271         * merge.cc (do_add_input_section): Correct pend value.  Change
12272         message about last entry not being null terminated from error to
12273         warning.
12274
12275 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12276
12277         * incremental.cc: New file.
12278         * Makefile.am (CCFILES): Add incremental.cc.
12279         * Makefile.in: Rebuild.
12280
12281 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12282
12283         * layout.cc (Layout::output_section_name): Preserve names
12284         of '.note.' sections.
12285
12286 2009-03-19  Ian Lance Taylor  <iant@google.com>
12287
12288         * descriptors.cc (Descriptors::open): Check that the options are
12289         valid before using them.
12290
12291 2009-03-18  Ian Lance Taylor  <iant@google.com>
12292
12293         * script-sections.h: Include <list>.
12294         (class Script_sections): Change Sections_elements from std::vector
12295         to std::list.  Typedef public Elements_iterator.  Add
12296         orphan_section_placement_, data_segment_align_start_, and
12297         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12298         field.
12299         * script-sections.cc (class Orphan_section_placement): New class.
12300         (class Sections_element): Add virtual functions is_relro and
12301         orphan_section_init.  Remove virtual function place_orphan_here.
12302         (class Output_section_definition): Add is_relro and
12303         orphan_section_init.  Remove place_orphan_here.
12304         (class Orphan_output_section): Likewise.
12305         (Script_sections::Script_sections): Update for field changes.
12306         (Script_sections::data_segment_align): Set saw_data_segment_align_
12307         and data_segment_align_start_, not data_segment_align_index.
12308         (Script_sections::data_segment_relro_end): Check
12309         saw_data_segment_align_.  Use data_segment_align_start_ rather
12310         than data_segment_align_index_.
12311         (Script_sections::place_orphan): Rewrite to use
12312         Orphan_section_placement.
12313
12314 2009-03-17  Ian Lance Taylor  <iant@google.com>
12315
12316         * archive.cc (Archive::add_symbols): Check for a version attached
12317         to the symbol name in the archive map.
12318         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12319         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12320         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12321         (ver_test_11.a): New target.
12322         * testsuite/Makefile.in: Rebuild.
12323
12324         * configure.ac: Check for chsize and posix_fallocate.  Replace
12325         ftruncate.
12326         * ftruncate.c: New file, from gnulib.
12327         * output.cc (posix_fallocate): Define dummy version if not
12328         HAVE_POSIX_FALLOCATE.
12329         (Output_file::map): Call posix_fallocate rather than lseek and
12330         write.
12331         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12332         * configure, Makefile.in, config.in: Rebuild.
12333
12334 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12335
12336         * layout.h (Layout::create_note): Add section_name parameter.
12337         * layout.cc (Layout::create_note): Likewise.
12338         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12339
12340 2009-03-17  Ian Lance Taylor  <iant@google.com>
12341
12342         * descriptors.cc: Include "options.h".
12343         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12344         (Descriptors::open): Always use O_CLOEXEC when opening a new
12345         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12346         then set FD_CLOEXEC.
12347
12348         * sparc.cc (class Target_sparc): Add has_got_section.
12349         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12350         make sure we have a GOT section.
12351
12352         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12353         (Target_sparc::Scan::local): Likewise.
12354         (Target_sparc::Scan::global): Likewise.
12355         (Target_sparc::Relocate::relocate): Likewise.
12356         (Target_sparc::Relocate::relocate_tls): Likewise.
12357
12358         * symtab.cc (Symbol_table::define_default_version): New function,
12359         broken out of add_from_object.
12360         (Symbol_table::add_from_object): Call define_default_version.
12361         (Symbol_table::define_special_symbol): Add resolve_oldsym
12362         parameter.  Change all callers.  If the version for a symbol comes
12363         from a version script, resolve it with the symbol with the same
12364         name with no version.  Also add the symbol without a version if
12365         appropriate.
12366         (do_define_in_output_data): If resolving with oldsym, don't delete
12367         sym.
12368         (do_define_in_output_segment): Likewise.
12369         (do_define_as_constant): Likewise.
12370         * symtab.h (class Symbol_table): Update declarations.
12371
12372 2009-03-13  Ian Lance Taylor  <iant@google.com>
12373
12374         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12375         (Read_symbols::requeue): New function.
12376         (Read_symbols::do_read_symbols): If make_elf_object fails because
12377         the target type is not configured, and the file was searched for,
12378         issue a warning and retry with the next directory.
12379         (Add_symbols::run): If the file has an incompatible format, and
12380         it was searched for, requeue the Read_symbols task.  On error,
12381         release the object.
12382         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12383         dirindex parameter to constructor.  Change all callers.  Declare
12384         incompatible_warning and requeue.
12385         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12386         input_argument_ and input_group_ fields.  Add them to
12387         constructor.  Change all callers.
12388         (class Read_script): Add dirindex_ field.  Add it to constructor.
12389         Change all callers.
12390         * archive.cc (Archive::setup): Remove input_objects parameter.
12391         Change all callers.
12392         (Archive::get_file_and_offset): Likewise.
12393         (Archive::read_all_symbols): Likewise.
12394         (Archive::read_symbols): Likewise.
12395         (Archive::get_elf_object_for_member): Remove input_objects
12396         parameter.  Add punconfigured parameter.  Change all callers.
12397         (Archive::add_symbols): Change return type to bool.  Check return
12398         value of include_member.
12399         (Archive::include_all_members): Likewise.
12400         (Archive::include_member): Change return type to bool.  Return
12401         false if first included object has incompatible target.  Set
12402         included_member_ field.
12403         (Add_archive_symbols::run): If add_symbols returns false, requeue
12404         Read_symbols task.
12405         * archive.h (class Archive): Add included_member_ field.
12406         Initialize it in constructor.  Add input_file and searched_for
12407         methods.  Update declarations.
12408         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12409         input_argument_ fields.  Add them to constructor.  Change all
12410         callers.
12411         * script.cc: Include "target-select.h".
12412         (class Parser_closure): Add skip_on_incompatible_target_ and
12413         found_incompatible_target_ fields.  Add
12414         skip_on_incompatible_target parameter to constructor.  Change all
12415         callers.  Add methods skip_on_incompatible_target,
12416         clear_skip_on_incompatible_target, found_incompatible_target, and
12417         set_found_incompatible_target.
12418         (read_input_script): Add dirindex parameter.  Change all callers.
12419         If parser finds an incompatible target, requeue Read_symbols
12420         task.
12421         (script_set_symbol): Clear skip_on_incompatible_target in
12422         closure.
12423         (script_add_assertion, script_parse_option): Likewise.
12424         (script_start_sections, script_add_phdr): Likewise.
12425         (script_check_output_format): New function.
12426         * script.h (read_input_script): Update declaration.
12427         * script-c.h (script_check_output_format): Declare.
12428         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12429         (ignore_cmd): Remove OUTPUT_FORMAT.
12430         * fileread.cc (Input_file::Input_file): Add explicit this.
12431         (Input_file::will_search_for): New function.
12432         (Input_file::open): Add pindex parameter.  Change all callers.
12433         * fileread.h (class Input_file): Add input_file_argument method.
12434         Declare will_search_for.  Update declarations.
12435         * object.cc (make_elf_object): Add punconfigured parameter.
12436         Change all callers.
12437         * object.h (class Object): Make input_file public.  Add
12438         searched_for method.
12439         (make_elf_object): Update declaration.
12440         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12441         restart search.
12442         * dirsearch.h (class Dirsearch): Update declaration.
12443         * options.h (class General_options): Add --warn-search-mismatch.
12444         * parameters.cc (Parameters::is_compatible_target): New function.
12445         * parameters.h (class Parameters): Declare is_compatible_target.
12446         * workqueue.cc (Workqueue::add_blocker): New function.
12447         * workqueue.h (class Workqueue): Declare add_blocker.
12448
12449         * fileread.cc (Input_file::open): Remove options parameter.
12450         Change all callers.
12451         (Input_file::open_binary): Likewise.
12452         * script.cc (read_input_script): Likewise.
12453         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12454         options parameter from constructor.  Change all callers.
12455         (class Read_script): Likewise.
12456         * fileread.h (class Input_file): Update declarations.
12457         * script.h (read_input_script): Update declaration.
12458
12459 2009-03-10  Nick Clifton  <nickc@redhat.com>
12460
12461         * po/es.po: New Spanish translation.
12462
12463 2009-03-06  Cary Coutant  <ccoutant@google.com>
12464
12465         * options.cc (parse_short_option): Keep dash_z from registering itself.
12466
12467 2009-03-03  Ian Lance Taylor  <iant@google.com>
12468
12469         PR 9918
12470         * target-reloc.h (relocate_section): Pass output_section to
12471         relocate.
12472         * i386.cc (Target_i386::should_apply_static_reloc): Add
12473         output_section parameter.  Change all callers.
12474         (Target_i386::Relocate::relocate): Add output_section parameter.
12475         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12476         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12477         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12478         * testsuite/two_file_shared.sh: New script.
12479         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12480         (check_DATA): Add two_file_shared.dbg.
12481         (two_file_shared.dbg): New target.
12482         * testsuite/Makefile.in: Rebuild.
12483
12484 2009-03-01  Ian Lance Taylor  <iant@google.com>
12485
12486         * configure.ac: Check for byteswap.h.
12487         * configure: Rebuild.
12488         * config.in: Rebuild.
12489
12490 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12491
12492         * layout.cc (Layout::find_or_add_kept_section): New function.
12493         (Layout::add_comdat): Removed.
12494         * layout.h (struct Kept_section): Move out of class Layout.
12495         Remove trailing underscores from field names.  Add group_sections
12496         field.  Rename group_ field to is_group.  Change all uses.
12497         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12498         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12499         comdat_groups_ field.
12500         (Sized_relobj::include_section_group): Use
12501         find_or_add_kept_section and Kept_section::group_sections.
12502         (Sized_relobj::include_linkonce_section): Likewise.
12503         * object.cc (class Sized_relobj): Don't define Comdat_group or
12504         Comdat_group_table.  Remove find_comdat_group and
12505         add_comdat_group.  Remove comdat_groups_ field.
12506         * plugin.cc (include_comdat_group): Use
12507         Layout::find_or_add_kept_section.
12508
12509 2009-02-28  Ian Lance Taylor  <iant@google.com>
12510
12511         * README: --gc-sections and map files are now supported.  Document
12512         some build requirements.
12513
12514         PR 6992
12515         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12516         relocatable link set the value of the section symbol to zero.
12517         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12518         relocatable link don't include the section address in the local
12519         symbol value.
12520
12521 2009-02-27  Ian Lance Taylor  <iant@google.com>
12522
12523         PR 6811
12524         * options.h (class Search_directory): Add is_system_directory.
12525         (class General_options): Declare is_in_system_directory.
12526         * options.cc (get_relative_sysroot): Make static.
12527         (get_default_sysroot): Make static.
12528         (General_optoins::is_in_system_directory): New function.
12529         * fileread.cc (Input_file::is_in_system_directory): New function.
12530         * fileread.h (class Input_file): Declare is_in_system_directory.
12531         * object.h (class Object): Add is_in_system_directory.
12532         (class Input_objects): Remove system_library_directory_ field.
12533         * object.cc (Input_objects::add_object): Don't set
12534         system_library_directory_.
12535         (input_objects::found_in_system_library_directory): Remove.
12536         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12537         parameter.  Change all callers.
12538         (Symbol_table::sized_write_globals): Likewise.
12539         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12540         Call Object::is_in_system_directory.
12541         * symtab.h (class Symbol_table): Update declarations.
12542
12543         PR 5990
12544         * descriptors.h (Open_descriptor): Add is_on_stack field.
12545         * descriptors.cc (Descriptors::open): If the descriptor is on the
12546         top of the stack, remove it.  Initialize is_on_stack field.
12547         (Descriptors::release): Only add pod to stack if it is not on the
12548         stack already.
12549         (Descriptors::close_some_descriptor): Clear stack_next and
12550         is_on_stack fields.
12551
12552         PR 7091
12553         * output.cc (Output_section::find_starting_output_address): Rename
12554         from starting_output_address; add PADDR parameter; change return
12555         type.
12556         * output.h (class Output_section): Declare
12557         find_starting_output_address instead of starting_output_address.
12558         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12559         section symbol for which we can't find a merge section.
12560
12561         PR 9836
12562         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12563         hidden or internal, force the symbol to be local.
12564         * resolve.cc (Symbol::override_visibility): Define.
12565         (Symbol::override_base): Use override_visibility.
12566         (Symbol_table::resolve): Likewise.
12567         (Symbol::override_base_with_special): Likewise.
12568         (Symbol_table::override_with_special): If the visibility is hidden
12569         or internal, force the symbol to be local.
12570         * symtab.h (class Symbol): Add set_visibility and
12571         override_visibility.
12572         * testsuite/ver_test_1.sh: New file.
12573         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12574         (check_DATA): Add ver_test_1.syms.
12575         (ver_test_1.syms): New target.
12576         * testsuite/Makefile.in: Rebuild.
12577
12578 2009-02-25  Cary Coutant  <ccoutant@google.com>
12579
12580         * layout.cc (Layout::choose_output_section): Don't rename sections
12581         when using a linker script that has a SECTIONS clause.
12582         * Makefile.in: Regenerate.
12583
12584         * testsuite/Makefile.am (script_test_5.sh): New test case.
12585         * testsuite/Makefile.in: Regenerate.
12586         * testsuite/script_test_5.cc: New file.
12587         * testsuite/script_test_5.sh: New file.
12588         * testsuite/script_test_5.t: New file.
12589
12590 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12591
12592         * archive.cc (Archive::include_member): Update calls to add_symbols.
12593         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12594         the Layout argument.
12595         * dynobj.h (do_add_symbols): Add the Layout argument.
12596         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12597         Layout argument.
12598         * object.h (Object::add_symbols): Add the Layout argument.
12599         (Object::do_add_symbols): Add the Layout argument.
12600         (Sized_relobj::do_add_symbols): Add the Layout argument.
12601         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12602         Unify the two versions.
12603         (Add_plugin_symbols): Remove.
12604         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12605         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12606         (Add_plugin_symbols): Remove.
12607         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12608         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12609         (Add_symbols::run): Make it work with Pulginobj.
12610
12611 2009-02-06  Ian Lance Taylor  <iant@google.com>
12612
12613         * object.cc (Sized_relobj::do_layout): Make info message start
12614         with lower case letter.
12615
12616 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12617
12618         * binary.cc: Fix file comment.
12619
12620         * options.h (enum Incremental_disposition): Define.
12621         (class General_options): Add new options: --incremental,
12622         --incremental_changed, --incremental_unchanged,
12623         --incremental_unknown.  Add incremental_disposition_ and
12624         implicit_incremental_ fields.
12625         (General_options::incremental_disposition): New function.
12626         (class Position_dependent_options): Add incremental_disposition
12627         option.
12628         (Position_dependent_options::copy_from_options): Set incremental
12629         dispositions.
12630         * options.cc (General_options::parse_incremental_changed): New
12631         function.
12632         (General_options::parse_incremental_unchanged): New function.
12633         (General_options::parse_incremental_unknown): New function.
12634         (General_options::General_options): Initialize new fields
12635         incremental_disposition_ and implicit_incremental_.
12636         (General_options::finalize): Check for uasge of --incremental-*
12637         without --incremental.
12638
12639 2009-02-06  Chris Demetriou  <cgd@google.com>
12640
12641         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12642         pointer and to report location as the file name associated with
12643         the symbol.
12644         (gold_undefined_symbol_at_location): New function to replace the
12645         old gold_undefined_symbol functionality.
12646         * target-reloc.h (relocate_section): Update to use
12647         gold_undefined_symbol_at_location.
12648         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12649         Call gold_undefined_symbol function rather than gold_error.
12650         * errors.h (Errors::undefined_symbol): Take location as a
12651         string, rather than calculating it from a relocation.
12652         * errors.cc (Errors::fatal): Print "fatal error:" before the
12653         formatted message.
12654         (Errors::error, Errors::error_at_location): Print "error: "
12655         before the formatted message.
12656         (Errors::undefined_symbol): Take location as a string, rather
12657         than calculating it from a relocation.
12658         (gold_undefined_symbol_at_location): New function akin to
12659         old gold_undefined_symbol, calculates location from relocation.
12660         (gold_undefined_symbol): Change to take only a Symbol pointer
12661         and to report location as the file name associated with the symbol.
12662         * testsuite/debug_msg.sh: Update for changed error messages.
12663         * testsuite/undef_symbol.sh: Likewise.
12664
12665 2009-02-04  Duncan Sands  <baldrick@free.fr>
12666
12667         PR 9812
12668         * reduced_debug_output.h
12669         (Output_reduced_debug_abbrev_section::failed): Use format for
12670         gold_warning.
12671         (Output_reduced_debug_info_section::faild): Likewise.
12672
12673 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12674
12675         * script.cc (Lazy_demangler): New class.
12676         (Version_script_info::get_symbol_version_helper): Demangle a
12677         symbol only once.
12678
12679 2009-01-29  Cary Coutant  <ccoutant@google.com>
12680
12681         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12682         to __tls_get_addr.
12683         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12684
12685 2009-01-28  Ian Lance Taylor  <iant@google.com>
12686
12687         * version.cc (version_string): Bump to 1.9.
12688
12689         * gold.h: Include <cstring> and <stdint.h>.
12690         * version.cc: Include <cstdio>.
12691         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12692         warning.
12693         * reduced_debug_output.cc (insert_into_vector): Rename from
12694         Insert_into_vector; change all callers.  Use Swap_unaligned to
12695         avoid aliasing issue; remove union since it is unnecessary.
12696
12697 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12698
12699         * Makefile.am (CCFILES): Add gc.cc.
12700         (HFILES): Add gc.h.
12701         * Makefile.in: Regenerate.
12702         * gold.cc (Gc_runner): New class.
12703         (queue_initial_tasks): Call garbage collection related tasks
12704         when corresponding options are invoked.
12705         (queue_middle_gc_tasks): New function.
12706         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12707         processed early before laying out sections during garbage collection.
12708         * gold.h (queue_middle_gc_tasks): New function.
12709         (is_prefix_of): Move from "layout.cc".
12710         * i386.cc (Target_i386::gc_process_relocs): New function.
12711         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12712         * main.cc (main): Create object of class "Garbage_collection".
12713         * object.cc (Relobj::copy_symbols_data): New function.
12714         (Relobj::is_section_name_included): New function.
12715         (Sized_relobj::do_layout): Allow this function to be called twice
12716         during garbage collection and defer layout of section during the
12717         first call.
12718         * object.h (Relobj::get_symbols_data): New function.
12719         (Relobj::is_section_name_included): New function.
12720         (Relobj::copy_symbols_data): New function.
12721         (Relobj::set_symbols_data): New function.
12722         (Relobj::get_relocs_data): New function.
12723         (Relobj::set_relocs_data): New function.
12724         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12725         (Relobj::gc_process_relocs): New function.
12726         (Relobj::do_gc_process_relocs): New pure virtual function.
12727         (Relobj::sd_): New data member.
12728         (Sized_relobj::is_output_section_offset_invalid): New function.
12729         (Sized_relobj::do_gc_process_relocs): New function.
12730         * options.h (General_options::gc_sections): Modify to not be a no-op.
12731         (General_options::print_gc_sections): New option.
12732         * plugin.cc (Plugin_finish::run): Remove function call to
12733         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12734         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12735         * reloc.cc (Read_relocs::run): Add task to process relocs and
12736         determine unreferenced sections when doing garbage collection.
12737         (Gc_process_relocs): New class.
12738         (Sized_relobj::do_gc_process_relocs): New function.
12739         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12740         sections that are garbage collected.
12741         * reloc.h (Gc_process_relocs): New class.
12742         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12743         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12744         symbols whose corresponding sections are garbage collected.
12745         (Symbol_table::Symbol_table): Add new parameter for the garbage
12746         collection object.
12747         (Symbol_table::gc_mark_undef_symbols): New function.
12748         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12749         (Symbol_table::gc_mark_dyn_syms): New function.
12750         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12751         as garbage.
12752         (Symbol_table::add_from_object): Likewise.
12753         (Symbol_table::add_from_relobj): When building shared objects, do not
12754         treat externally visible symbols as garbage.
12755         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12756         table information for static and relocatable links.
12757         * symtab.h (Symbol_table::set_gc): New function.
12758         (Symbol_table::gc): New function.
12759         (Symbol_table::gc_mark_undef_symbols): New function.
12760         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12761         (Symbol_table::gc_mark_dyn_syms): New function.
12762         (Symbol_table::gc_): New data member.
12763         * target.h (Sized_target::gc_process_relocs): New pure virtual
12764         function.
12765         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12766         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12767
12768 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12769
12770         * options.h (General_options::gc_sections): Define as a no-op for now.
12771         (General_options::no_keep_memory): Ditto.
12772         (General_options::Bshareable): Define.
12773         * options.cc (General_options::finalize): Honor -Bshareable.
12774
12775 2009-01-20  Andreas Schwab  <schwab@suse.de>
12776
12777         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12778         read the value in the contents, since we don't use it.  Use the
12779         template endianness when writing.
12780         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12781
12782 2009-01-19  Andreas Schwab  <schwab@suse.de>
12783
12784         * configure.tgt (powerpc64-*): Fix targ_obj.
12785
12786 2009-01-15  Ian Lance Taylor  <iant@google.com>
12787
12788         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12789         local symbols when stripping all symbols.
12790
12791 2009-01-14  Cary Coutant  <ccoutant@google.com>
12792
12793         * output.cc (Output_reloc): Add explicit instantiations.
12794
12795 2009-01-14  Cary Coutant  <ccoutant@google.com>
12796
12797         * archive.cc (Archive::get_elf_object_for_member): Remove call
12798         to File_read::claim_for_plugin.
12799         * descriptors.cc (Descriptors::open): Remove reference to
12800         is_claimed.
12801         (Descriptors::claim_for_plugin): Remove.
12802         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12803         (Descriptors::is_claimed): Remove.
12804         (claim_descriptor_for_plugin): Remove.
12805         * fileread.cc (File_read::claim_for_plugin): Remove.
12806         * fileread.h (File_read::claim_for_plugin): Remove.
12807         (File_read::descriptor): Reopen descriptor if necessary.
12808         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12809         (Plugin_manager::all_symbols_read): Add task parameter. Change
12810         all callers.
12811         (Plugin_manager::get_input_file): New function.
12812         (Plugin_manager::release_input_file): New function.
12813         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12814         corresponding data member.
12815         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12816         and pass to base constructor. Change all callers.
12817         (get_input_file, release_input_file): New functions.
12818         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12819         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12820         (Plugin_manager::all_symbols_read): Add task parameter.
12821         (Plugin_manager::get_input_file): New function.
12822         (Plugin_manager::release_input_file): New function.
12823         (Plugin_manager::task_): New data member.
12824         (Pluginobj::Pluginobj): Add filesize parameter.
12825         (Pluginobj::filename): New function.
12826         (Pluginobj::descriptor): New function.
12827         (Pluginobj::filesize): New function.
12828         (Pluginobj::filesize_): New data member.
12829         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12830         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12831         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12832
12833         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12834         with archive libraries.
12835         * testsuite/Makefile.in: Regenerate.
12836         * testsuite/plugin_test.c (struct sym_info): New type.
12837         (get_input_file, release_input_file): New static variables.
12838         (onload): Capture new transfer vector entries.
12839         (claim_file_hook): Stop reading at end of file according to filesize.
12840         Factor out parsing of readelf output into separate function.
12841         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12842         APIs and get the source file name from the symbol table.  Convert
12843         source file name to corresponding object file name.  Print info
12844         message when adding new input files.
12845         (parse_readelf_line): New function.
12846         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12847         * testsuite/plugin_test_2.sh: Likewise.
12848         * testsuite/plugin_test_3.sh: Likewise.
12849         * testsuite/plugin_test_4.sh: New test case.
12850
12851 2009-01-07  Ian Lance Taylor  <iant@google.com>
12852
12853         * version.cc (version_string): Bump to 1.8.
12854
12855 2008-12-23  Cary Coutant  <ccoutant@google.com>
12856
12857         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12858         * plugin.cc (Plugin_manager::finish): Rename as
12859         layout_deferred_objects.  Move cleanup to separate function.
12860         (Plugin_manager::cleanup): New function.
12861         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12862         separately.
12863         * plugin.h (Plugin_manager::finish): Rename as
12864         layout_deferred_objects.
12865         (Plugin_manager::cleanup): New function.
12866         (Plugin_manager::cleanup_done): New field.
12867
12868 2008-12-23  Cary Coutant  <ccoutant@google.com>
12869
12870         * plugin.cc (is_visible_from_outside): New function.
12871         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12872         so we don't return "IR only" status for exported symbols or -r links.
12873
12874         * testsuite/Makefile.am (plugin_test_3): New test case.
12875         * testsuite/Makefile.in: Regenerate.
12876         * testsuite/plugin_test_3.sh: New file.
12877
12878 2008-12-22  Cary Coutant  <ccoutant@google.com>
12879
12880         * object.cc (Sized_relobj::layout_section): New function.
12881         (Sized_relobj::do_layout): Defer layout of input sections until after
12882         plugin has provided replacement files.
12883         (Sized_relobj::do_layout_deferred_sections): New function.
12884         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12885         (Relobj::layout_deferred_sections): New function.
12886         (Relobj::do_layout_deferred_sections): New function.
12887         (Sized_relobj::do_layout_deferred_sections): New function.
12888         (Sized_relobj::layout_section): New function.
12889         (Sized_relobj::Deferred_layout): New structure.
12890         (Sized_relobj::deferred_layout_): New field.
12891         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12892         Change all callers.  Layout deferred sections.
12893         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12894         references.
12895         (Plugin_hook::run): Move code from do_plugin_hook inline.
12896         (Plugin_hook::do_plugin_hook): Remove.
12897         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12898         (Plugin_manager::finish): Renamed, was cleanup.
12899         (Plugin_manager::should_defer_layout): New function.
12900         (Plugin_manager::add_deferred_layout_object): New function.
12901         (Plugin_manager::Deferred_layout_list): New type.
12902         (Plugin_manager::deferred_layout_objects_): New field.
12903         (Plugin_hook::do_plugin_hook): Remove.
12904
12905 2008-12-17  Ian Lance Taylor  <iant@google.com>
12906
12907         * options.h (class General_options): Add --no case for
12908         --export-dynamic.
12909
12910 2008-12-16  Cary Coutant  <ccoutant@google.com>
12911
12912         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12913         vector.
12914         (Plugin_manager::claim_file): Create plugin object even if
12915         plugin did not call the add_symbols callback.
12916         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12917         asking for more symbols than were added.
12918         * testsuite/Makefile.am (plugin_test_1): Add test case with
12919         no global symbols.
12920         (empty.syms): New target.
12921         * testsuite/Makefile.in: Regenerate.
12922         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12923         message. Don't call add_symbols if no globals.
12924         (all_symbols_read_hook): Don't provide replacement for empty
12925         claimed file.
12926
12927 2008-12-12  Ian Lance Taylor  <iant@google.com>
12928
12929         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12930         r_type == 0 for a local symbol with r_sym == 0.
12931         (scan_relocatable_relocs): Pass r_sym to
12932         local_non_section_strategy.
12933         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12934         r_sym parameter.
12935
12936         * configure.ac: Update test for TLS descriptors: they are
12937         supported as of glibc 2.9.
12938         * configure: Rebuild.
12939
12940 2008-12-11  Ian Lance Taylor  <iant@google.com>
12941
12942         PR 7091
12943         * target-reloc.h (Default_scan_relocatable_relocs): For each
12944         function, map r_type == 0 to RELOC_DISCARD.
12945
12946 2008-12-10  Cary Coutant  <ccoutant@google.com>
12947
12948         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12949         object to override a kept COMDAT group from a plugin object.
12950
12951 2008-12-09  Ian Lance Taylor  <iant@google.com>
12952
12953         PR 7088
12954         * yyscript.y (file_cmd): Handle INPUT.
12955
12956         * testsuite/initpri1.c: Change all declarations to be full
12957         prototypes by adding void, to avoid compiler warnings.
12958
12959 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12960
12961         * options.cc (General_options::parse_plugin_opt): New.
12962         (General_options::add_plugin): The argument now is just the filename.
12963         (General_options::add_plugin_option): New.
12964         * options.h (plugin_opt): New.
12965         (add_plugin): Change argument name.
12966         (add_plugin_option): New.
12967         * plugin.cc (Plugin::load): Don't parse the plugin option.
12968         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12969         (Plugin::add_option): New.
12970         (Plugin::args_): Change type.
12971         (Plugin::filename_): New.
12972         (Plugin_manager::add_plugin_option): New.
12973         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12974         * testsuite/Makefile.in: Regenerate.
12975
12976 2008-12-05  Cary Coutant  <ccoutant@google.com>
12977
12978         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12979         Handle --strip-lto-sections option.
12980         * options.h (strip_lto_sections): New option.
12981
12982 2008-12-01  Cary Coutant  <ccoutant@google.com>
12983
12984         * plugin.cc (ld_plugin_message): Change format parameter to const.
12985         Fix mismatch between new[] and delete.
12986
12987 2008-11-14  Cary Coutant  <ccoutant@google.com>
12988
12989         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12990         instead of -1U.
12991
12992 2008-11-05  Craig Silverstein  <csilvers@google.com>
12993
12994         * options.cc (General_options::parse_dynamic_list): New function.
12995         * options.h (General_options): New flags dynamic_list,
12996         dynamic_list_data, dynamic_list_cpp_new, and
12997         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12998         (General_options::in_dynamic_list): New function.
12999         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13000         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13001         (Lex::can_continue_name): Likewise.
13002         (yylex): Likewise.
13003         (read_script_file): New parameter script_options.
13004         (read_dynamic_list): New function.
13005         (Script_options::define_dynamic_list): New function.
13006         (dynamic_list_keyword_parsecodes): New variable.
13007         (dynamic_list_keywords): New variable.
13008         * script.h (Script_options::define_dynamic_list): New function
13009         prototype.
13010         (read_dynamic_list): New function prototype.
13011         * symtab.cc (strprefix): New macro.
13012         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13013         dynamic_list_data, dynamic_list_cpp_new, and
13014         dynamic_list_cpp_typeinfo.
13015         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13016         (dynamic_list_expr): New rule.
13017         (dynamic_list_nodes): Likewise.
13018         (dynamic_list_node): Likewise.
13019         * testsuite/Makefile.am (dynamic_list): New test.
13020         * testsuite/Makefile.in: Regenerated.
13021         * testsuite/dynamic_list.t: New file.
13022         * testsuite/dynamic_list.sh: New file.
13023
13024 2008-11-05  Craig Silverstein  <csilvers@google.com>
13025
13026         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13027         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13028         (t11_last): Likewise.
13029         * testsuite/ver_test_6.c (main): Likewise.
13030
13031 2008-10-07  Cary Coutant  <ccoutant@google.com>
13032
13033         * options.c (General_options::finalize): Add check for -static and
13034         -shared.
13035         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13036         is not empty.
13037
13038 2008-10-02  Cary Coutant  <ccoutant@google.com>
13039
13040         * plugin.cc (make_sized_plugin_object): Fix conditional
13041         compilation to work when not all targets are enabled.
13042
13043 2008-09-29  Cary Coutant  <ccoutant@google.com>
13044
13045         * archive.cc (Archive::get_file_and_offset): Use filename instead
13046         of name to get library path.
13047         (Archive::include_member): Unlock external member of a thin archive.
13048
13049         * testsuite/Makefile.am (TEST_AR): New variable.
13050         (thin_archive_test_1): New test.
13051         (thin_archive_test_2): New test.
13052         * testsuite/Makefile.in: Regenerate.
13053         * testsuite/thin_archive_main.cc: New file.
13054         * testsuite/thin_archive_test_1.cc: New file.
13055         * testsuite/thin_archive_test_2.cc: New file.
13056         * testsuite/thin_archive_test_3.cc: New file.
13057         * testsuite/thin_archive_test_4.cc: New file.
13058
13059 2008-09-29  Cary Coutant  <ccoutant@google.com>
13060
13061         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13062         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13063         instead of -1U.
13064         (Sized_relobj::do_finalize_local_symbols): Likewise.
13065         (Sized_relobj::map_to_kept_section): Likewise.
13066         * object.h (Sized_relobj::invalid_address): New constant.
13067         (Sized_relobj::do_output_section_offset): Check for invalid_address
13068         and return -1ULL.
13069         * output.cc (Output_reloc::local_section_offset): Use constant
13070         invalid_address instead of -1U.
13071         (Output_reloc::get_address): Likewise.
13072         (Output_section::output_address): Change -1U to -1ULL.
13073         * output.h (Output_reloc::invalid_address): New constant.
13074         * reloc.cc (Sized_relobj::write_sections): Use constant
13075         invalid_address instead of -1U.
13076         (Sized_relobj::relocate_sections): Likewise.
13077         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13078         values for merge sections.
13079         * target-reloc.h (relocate_for_relocatable): Use constant
13080         invalid_address instead of -1U.
13081
13082 2008-09-19  Cary Coutant  <ccoutant@google.com>
13083
13084         Add plugin functionality for link-time optimization (LTO).
13085         * configure.ac (plugins): Add --enable-plugins option.
13086         * configure: Regenerate.
13087         * config.in: Regenerate.
13088         * Makefile.am (LIBDL): New variable.
13089         (CCFILES): Add plugin.cc.
13090         (HFILES): Add plugin.h.
13091         (ldadd_var): Add LIBDL.
13092         * Makefile.in: Regenerate.
13093
13094         * archive.cc: Include "plugin.h".
13095         (Archive::setup): Don't preread archive symbols when using a plugin.
13096         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13097         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13098         files.
13099         (Archive::include_member): Add symbols from plugin objects.
13100         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13101         * descriptors.cc (Descriptors::open): Check for file descriptors
13102         abandoned by plugins.
13103         (Descriptors::claim_for_plugin): New function.
13104         * descriptors.h (Descriptors::claim_for_plugin): New function.
13105         (Open_descriptor::is_claimed): New field.
13106         (claim_descriptor_for_plugin): New function.
13107         * fileread.cc (File_read::claim_for_plugin): New function.
13108         * fileread.h (File_read::claim_for_plugin): New function.
13109         (File_read::descriptor): New function.
13110         * gold.cc: Include "plugin.h".
13111         (queue_initial_tasks): Add task to call plugin hooks for generating
13112         new object files.
13113         * main.cc: Include "plugin.h".
13114         (main): Load plugin libraries.
13115         * object.h (Pluginobj): Declare.
13116         (Object::pluginobj): New function.
13117         (Object::do_pluginobj): New function.
13118         (Object::set_target): New function.
13119         * options.cc: Include "plugin.h".
13120         (General_options::parse_plugin): New function.
13121         (General_options::General_options): Initialize plugins_ field.
13122         (General_options::add_plugin): New function.
13123         * options.h (Plugin_manager): Declare.
13124         (General_options): Add --plugin option.
13125         (General_options::has_plugins): New function.
13126         (General_options::plugins): New function.
13127         (General_options::add_plugin): New function.
13128         (General_options::plugins_): New field.
13129         * plugin.cc: New file.
13130         * plugin.h: New file.
13131         * readsyms.cc: Include "plugin.h".
13132         (Read_symbols::do_read_symbols): Check for archive before checking
13133         for ELF file.  Call plugin hooks to claim files.
13134         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13135         from a real object file; force override when processing replacement
13136         files.
13137         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13138         (Symbol::init_base_object): Likewise.
13139         (Symbol::init_base_output_data): Likewise.
13140         (Symbol::init_base_output_segment): Likewise.
13141         (Symbol::init_base_constant): Likewise.
13142         (Symbol::init_base_undefined): Likewise.
13143         (Symbol::output_section): Assert that object is not a plugin.
13144         (Symbol_table::add_from_pluginobj): New function.
13145         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13146         undefined.
13147         (Symbol_table::sized_write_globals): Likewise.
13148         (Symbol_table::add_from_pluginobj): Instantiate template.
13149         * symtab.h (Sized_pluginobj): Declare.
13150         (Symbol::in_real_elf): New function.
13151         (Symbol::set_in_real_elf): New function.
13152         (Symbol::in_real_elf_): New field.
13153         (Symbol_table::add_from_pluginobj): New function.
13154
13155         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13156         (LIBDL): New variable.
13157         (LDADD): Add LIBDL.
13158         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13159         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13160         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13161         (MOSTLYCLEANFILES): Likewise.
13162         * testsuite/Makefile.in: Regenerate.
13163         * testsuite/plugin_test.c: New file.
13164         * testsuite/plugin_test_1.sh: New file.
13165         * testsuite/plugin_test_2.sh: New file.
13166
13167 2008-09-16  Ian Lance Taylor  <iant@google.com>
13168
13169         * target-reloc.h (relocate_section): Check whether a symbol is
13170         defined by the ABI before reporting an undefined symbol error.
13171         * target.h (Target::is_defined_by_abi): Make parameter const.
13172         (Target::do_is_defined_by_abi): Likewise.
13173         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13174         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13175         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13176         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13177         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13178         * testsuite/Makefile.in: Rebuild.
13179
13180         * fileread.cc (make_view): Add casts to avoid warning.
13181
13182 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13183
13184         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13185         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13186
13187 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13188
13189         * options.h (General_options::output_is_executable): New.
13190         (General_options::output_is_pie): New.
13191         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13192         for shared libraries.
13193         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13194
13195 2008-09-11  Chris Demetriou  <cgd@google.com>
13196
13197         * options.h (origin): New -z option.
13198         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13199         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13200         in DT_FLAGS_1.
13201
13202 2008-09-05  Cary Coutant  <ccoutant@google.com>
13203
13204         * fileread.cc (File_read::make_view): Add check for attempt to map
13205         beyond end of file.
13206
13207 2008-09-05  Cary Coutant  <ccoutant@google.com>
13208
13209         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13210         explicit instantiations.
13211
13212 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13213
13214         PR gold/6858
13215         * options.cc (General_options::finalize): Allow undefined symbols
13216         in shlibs if linking -shared.
13217
13218         PR gold/6859
13219         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13220         symbols as not needing a dynsym entry.
13221
13222 2008-08-20  Craig Silverstein  <csilvers@google.com>
13223
13224         * fileread.cc (File_read::open): Do not lock the file unless it
13225         was successfully opened.
13226
13227 2008-08-14  Cary Coutant  <ccoutant@google.com>
13228
13229         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13230         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13231         * testsuite/tls_test.cc (struct int128): 128-bit struct
13232         for testing TLS relocs with non-zero addend.
13233         (v12): New TLS variable.
13234         (t12): New test.
13235         (t_last): Add check for v12.
13236         * testsuite/tls_test.h (t12): New function.
13237         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13238
13239 2008-08-13  Ian Lance Taylor  <iant@google.com>
13240
13241         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13242         set tls_segment_ or relro_segment_.
13243         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13244         when appropriate.
13245         * output.h (Output_section::clear_is_relro): New function.
13246         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13247         sections specially even when output_data_ is empty.
13248         (Output_segment::maximum_alignment): When first section is relro,
13249         only force alignment for PT_LOAD segments.
13250         * script.cc (script_data_segment_align): New function.
13251         (script_data_segment_relro_end): New function.
13252         * script-c.h (script_data_segment_align): Declare.
13253         (script_data_segment_relro_end): Declare.
13254         * script-sections.h (class Script_sections): Declare
13255         data_segment_align and data_segment_relro_end.  Add fields
13256         segment_align_index_ and saw_relro_end_.
13257         * script-sections.cc (class Sections_element): Add set_is_relro
13258         virtual function.  Add new bool* parameter to place_orphan_here.
13259         Add get_output_section virtual function.
13260         (class Output_section_definition): Add set_is_relro.  Add new
13261         bool* parameter to place_orphan_here.  Add get_output_section.
13262         Add is_relro_ field.
13263         (Output_section_definition::Output_section_definition): Initialize
13264         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13265         and is_relro_ fields.
13266         (Output_section_definition::place_orphan_here): Add is_relro
13267         parameter.
13268         (Output_section_definition::set_section_addresses): Set relro for
13269         output section.
13270         (Output_section_definition::alternate_constraint): Likewise.
13271         (class Orphan_output_section): Add new bool* parameter to
13272         place_orphan_here.  Add get_output_section.
13273         (Orphan_output_section::place_orphan_here): Add is_relro
13274         parameter.
13275         (Script_sections::Script_sections): Initialize
13276         data_segment_align_index_ and saw_relro_end_.
13277         (Script_sections::data_segment_align): New function.
13278         (Script_sections::data_segment_relro_end): New function.
13279         (Script_sections::place_orphan): Set or clear is_relro.
13280         (Script_sections::set_section_addresses): Force alignment of first
13281         TLS section.
13282         * yyscript.y (exp): Call script_data_segment_align and
13283         script_data_segment_relro_end.
13284         * testsuite/relro_script_test.t: New file.
13285         * testsuite/relro_test.cc (using_script): Declare.
13286         (t1, t2): Test using_script.
13287         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13288         (relro_script_test_SOURCES): Define.
13289         (relro_script_test_DEPENDENCIES): Define.
13290         (relro_script_test_LDFLAGS): Define.
13291         (relro_script_test_LDADD): Define.
13292         (relro_script_test.so): New target.
13293         * testsuite/Makefile.in: Rebuild.
13294
13295 2008-08-06  Cary Coutant <ccoutant@google.com>
13296
13297         * archive.cc (Archive::total_archives, Archive::total_members)
13298         (Archive::total_members_loaded): New variables.
13299         (Archive::setup): Add parameter.  Add option to preread
13300         archive symbols.
13301         (Archive::read_armap): Add counter.
13302         (Archive::get_file_and_offset): New function.
13303         (Archive::get_elf_object_for_member): New function.
13304         (Archive::read_all_symbols): New function.
13305         (Archive::read_symbols): New function.
13306         (Archive::add_symbols): Add counters.
13307         (Archive::include_all_members): Use armap to find members if it's
13308         already built.
13309         (Archive::include_member): Skip reading symbols if already read.
13310         Factored code into Archive::get_file_and_offset and
13311         Archive::get_elf_object_for_member.  Changed call to
13312         Mapfile::report_include_archive_member.
13313         (Archive::print_stats): New function.
13314         * archive.h: Declare Object and Read_symbols_data classes.
13315         (Archive::Archive): Add initializers for new members.
13316         (Archive::setup): Add parameter.
13317         (Archive::print_stats): New function.
13318         (Archive::total_archives, Archive::total_members)
13319         (Archive::total_members_loaded): New variables.
13320         (Archive::get_file_and_offset): New function.
13321         (Archive::get_elf_object_for_member): New function.
13322         (Archive::read_all_symbols): New function.
13323         (Archive::read_symbols): New function.
13324         (Archive::Archive_member): New class.
13325         (Archive::members_): New member.
13326         (Archive::num_members_): New member.
13327         * main.cc: Include archive.h.
13328         (main): Call Archive::print_stats.
13329         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13330         archive parameter; member_name is now the fully-decorated name.
13331         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13332         * options.h: (General_options): Add --preread-archive-symbols option.
13333         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13334         Archive::setup.
13335
13336 2008-08-04  Ian Lance Taylor  <iant@google.com>
13337
13338         * symtab.h (Symbol::use_plt_offset): New function.
13339         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13340         * powerpc.cc (Relocate::relocate): Likewise.
13341         * sparc.cc (Relocate::relocate): Likewise.
13342         * x86_64.cc (Relocate::relocate): Likewise.
13343         * testsuite/weak_plt.sh: New test.
13344         * testsuite/weak_plt_main.cc: New test.
13345         * testsuite/weak_plt_shared.cc: New test.
13346         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13347         (check_PROGRAMS): Add weak_plt.
13348         (check_DATA): Add weak_plt_shared.so.
13349         (weak_plt_main_pic.o, weak_plt): New targets.
13350         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13351         * testsuite/Makefile.in: Rebuild.
13352
13353         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13354         gcctestdir/ld.
13355         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13356         * testsuite/Makefile.in: Rebuild.
13357
13358 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13359
13360         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13361         * Makefile.in: Regenerate.
13362         * po/POTFILES.in: Regenerate.
13363
13364 2008-07-29  Ian Lance Taylor  <iant@google.com>
13365
13366         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13367         symbols before other symbols.
13368         * testsuite/script_test_2.cc (test_addr): Declare.
13369         (test_addr_alias): Declare.
13370         (main): Check that test_addr and test_addr_alias have the right
13371         values.
13372         * testsuite/script_test_2.t: Define test_addr_alias and
13373         test_addr.
13374
13375 2008-07-24  Ian Lance Taylor  <iant@google.com>
13376
13377         PR 5990
13378         * descriptors.cc: New file.
13379         * descriptors.h: New file.
13380         * gold-threads.h (class Hold_optional_lock): New class.
13381         * fileread.cc: Include "descriptors.h".
13382         (File_read::~File_read): Release descriptor rather than closing
13383         it.
13384         (File_read::open) [file]: Call open_descriptor rather than open.
13385         Set is_descriptor_opened_.
13386         (File_read::open) [memory]: Assert that descriptor is not open.
13387         (File_read::reopen_descriptor): New function.
13388         (File_read::release): Release descriptor.
13389         (File_read::do_read): Make non-const.  Reopen descriptor.
13390         (File_read::read): Make non-const.
13391         (File_read::make_view): Reopen descriptor.
13392         (File_read::do_readv): Likewise.
13393         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13394         Update declarations.
13395         * layout.cc: Include "descriptors.h".
13396         (Layout::create_build_id): Use open_descriptor rather than open.
13397         * output.cc: Include "descriptors.h".
13398         (Output_file::open): Use open_descriptor rather than open.
13399         * archive.cc (Archive::const_iterator): Change Archive to be
13400         non-const.
13401         (Archive::begin, Archive::end): Make non-const.
13402         (Archive::count_members): Likewise.
13403         * archive.h (class Archive): Update declarations.
13404         * object.h (Object::read): Make non-const.
13405         * Makefile.am (CCFILES): Add descriptors.cc.
13406         (HFILES): Add descriptors.h.
13407         * Makefile.in: Rebuild.
13408
13409         PR 6716
13410         * gold.h: Always include <clocale>.  Add Solaris workarounds
13411         following code in binutils/sysdep.h.
13412
13413         PR 6048
13414         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13415         this->eh_frame_hdr_ is NULL before using it.
13416
13417         * dynobj.cc (Versions::Versions): Update comment.
13418
13419         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13420         the base version name.
13421
13422         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13423         array size plus one.
13424         (Stringpool_template::set_string_offsets): Subtract one from key
13425         before using it as an array index.
13426         (Stringpool_template::get_offset_with_length): Likewise.
13427         (Stringpool_template::write_to_buffer): Likewise.
13428         * stringpool.h (Stringpool_template::get_offset_from_key):
13429         Likewise.
13430
13431 2008-07-23  Ian Lance Taylor  <iant@google.com>
13432
13433         PR 6658
13434         * object.h (Merged_symbol_value::value): Do our best to handle a
13435         negative addend.
13436
13437         PR 6647
13438         * script.cc (Version_script_info::get_versions): Don't add empty
13439         version tag to return value.
13440         (Version_script_info::get_symbol_version_helper): Change return
13441         type to bool.  Add pversion parameter.  Change all callers.
13442         (script_register_vers_node): Don't require a non-NULL tag.
13443         * script.h (class Version_script_info): Update declarations.
13444         (Version_script_info::get_symbol_version): Change return type to
13445         bool.  Add version parameter.  Change all callers.
13446         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13447         handling.  Handle an empty version from a version script.
13448         (Symbol_table::define_special_symbol): Likewise.
13449         * testsuite/ver_test_10.script: New file.
13450         * testsuite/ver_test_10.sh: New file.
13451         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13452         (check_DATA): Add ver_test_10.syms.
13453         (ver_test_10.syms, ver_test_10.so): New target.
13454         * testsuite/Makefile.in: Rebuild.
13455
13456 2008-07-23  Simon Baldwin  <simonb@google.com>
13457
13458         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13459         to zero for undefined symbols from dynamic libraries.
13460
13461 2008-07-23  Ian Lance Taylor  <iant@google.com>
13462
13463         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13464         Change all callers.
13465         * symtab.h (class Symbol_table): Update declaration.
13466         * testsuite/ver_test_9.cc: New file.
13467         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13468         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13469         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13470         (ver_test_9.so, ver_test_9.o): New targets.
13471         * testsuite/Makefile.in: Rebuild.
13472
13473 2008-07-22  Ian Lance Taylor  <iant@google.com>
13474
13475         * options.h (class General_options): Define --check-sections.
13476         * layout.cc (Layout::set_segment_offsets): Handle
13477         --check-sections.
13478
13479         * options.h (class General_options): Define -n/--nmagic and
13480         -N/--omagic.
13481         * options.cc (General_options::finalize): For -n/--nmagic or
13482         -N/--omagic, set -static.
13483         * layout.cc (Layout::attach_allocated_section_to_segment): If
13484         -N/--omagic, don't put read-only and read-write sections in
13485         different segments.
13486         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13487         finding a read-only segment.
13488         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13489         don't set the minimum segment alignment to the common page size,
13490         and don't set the file offset to the address modulo the page size.
13491         * script-sections.cc (Script_sections::create_segments): If
13492         -n/--omagic, don't put read-only and read-write sections in
13493         different segments.
13494
13495         * cref.cc: New file.
13496         * cref.h: New file.
13497         * options.h (class General_options): Add --print-symbol-counts.
13498         * main.cc (main): Issue defined symbol report if requested.
13499         * archive.cc (Archive::interpret_header): Make into a const member
13500         function.
13501         (Archive::add_symbols): Call Input_objects::archive_start and
13502         archive_stop.
13503         (Archive::const_iterator): Define new class.
13504         (Archive::begin, Archive::end): New functions.
13505         (Archive::include_all_members): Rewrite to use iterator.
13506         (Archive::count_members): New function.
13507         * archive.h (class Archive): Update declarations.
13508         (Archive::filename): New function.
13509         * object.cc: Include "cref.h".
13510         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13511         (Sized_relobj::do_get_global_symbol_counts): New function.
13512         (Input_objects::add_object): Add object to cross-referencer.
13513         (Input_objects::archive_start): New function.
13514         (Input_objects::archive_stop): New function.
13515         (Input_objects::print_symbol_counts): New function.
13516         * object.h: Declare Cref and Archive.
13517         (Object::get_global_symbol_counts): New function.
13518         (Object::do_get_global_symbol_counts): New pure virtual function.
13519         (class Sized_relobj): Add defined_count_ field.  Update
13520         declarations.
13521         (class Input_objects): Add cref_ field.  Update constructor.
13522         Update declarations.
13523         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13524         defined_count_.
13525         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13526         symbol counts.
13527         (Sized_dynobj::do_get_global_symbol_counts): New function.
13528         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13529         defined_count_.  Update declarations.  Define Symbols typedef.
13530         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13531         parameter.  Change all callers.
13532         (Symbol_table::add_from_dynobj): Add sympointers and defined
13533         parameters.  Change all callers.
13534         * symtab.h (class Symbol_table): Update declarations.
13535         * Makefile.am (CCFILES): Add cref.cc.
13536         (HFILES): Add cref.h.
13537         * Makefile.in: Rebuild.
13538
13539 2008-07-22  Simon Baldwin  <simonb@google.com>
13540
13541         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13542         to zero when writing undefined symbols.
13543
13544 2008-07-22  Ian Lance Taylor  <iant@google.com>
13545
13546         * output.cc (Output_section::add_input_section): Don't try to
13547         merge empty merge sections.
13548
13549 2008-07-21  Craig Silverstein  <csilvers@google.com>
13550
13551         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13552         Include symbol version in error message.
13553
13554 2008-07-20  Chris Demetriou  <cgd@google.com>
13555
13556         * configure.ac (gold_cv_c_random_seed): New configured variable.
13557         (RANDOM_SEED_CFLAGS): New substituted variable.
13558         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13559         * configure: Rebuild.
13560         * Makefile.in: Likewise.
13561         * testsuite/Makefile.in: Likewise.
13562
13563 2008-07-18  Ian Lance Taylor  <iant@google.com>
13564
13565         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13566         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13567         * testsuite/ver_test_main.cc (main): Call t4.
13568         (t4, t4_2a): Define.
13569         * testsuite/ver_test_2.cc (t4_2): Define.
13570         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13571         * testsuite/ver_test_4.cc (t4_2a): Define.
13572         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13573         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13574
13575 2008-07-17  Ian Lance Taylor  <iant@google.com>
13576
13577         * dynobj.cc (Versions::add_def): If we give an error about a
13578         missing version, go ahead and create the version anyhow.
13579
13580 2008-07-10  Ian Lance Taylor  <iant@google.com>
13581
13582         Handle output sections with more than 0x7fffffff bytes.
13583         * object.h (class Relobj): Change map_to_output_ to
13584         output_sections_, and just keep a section pointer.  Change all
13585         uses.  Move comdat group support to Sized_relobj.
13586         (Relobj::is_section_specially_mapped): Remove.
13587         (Relobj::output_section): Remove poff parameter.  Change all
13588         callers.
13589         (Relobj::output_section_offset): New function.
13590         (Relobj::set_section_offset): Rewrite.
13591         (Relobj::map_to_output): Remove.
13592         (Relobj::output_sections): New function.
13593         (Relobj::do_output_section_offset): New pure virtual function.
13594         (Relobj::do_set_section_offset): Likewise.
13595         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13596         group support from Relobj.  Update declarations.
13597         (Sized_relobj::get_output_section_offset): New function.
13598         (Sized_relobj::do_output_section_offset): New function.
13599         (Sized_relobj::do_set_section_offset): New function.
13600         * object.cc (Relobj::output_section_address): Remove.
13601         (Sized_relobj::Sized_relobj): Initialize new fields.
13602         (Sized_relobj::include_section_group): Cast find_kept_object to
13603         Sized_relobj.
13604         (Sized_relobj::include_linkonce_section): Likewise.
13605         (Sized_relobj::do_layout): Use separate arrays for output section
13606         and output offset.
13607         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13608         output_sections.
13609         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13610         output_sections and section_offsets.
13611         (Sized_relobj::write_local_symbols): Likewise.
13612         (map_to_kept_section): Compute output address directly.
13613         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13614         output_sections and section_offsets.
13615         (Sized_relobj::write_sections): Likewise.
13616         (Sized_relobj::relocate_sections): Likewise.
13617         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13618         * output.h (class Output_reloc): Update declarations.  Change
13619         u2_.relobj to Sized_relobj*.
13620         (class Output_data_reloc): Change add functions to use
13621         Sized_relobj*.
13622         * output.cc (Output_reloc::Output_reloc): Change relobj to
13623         Sized_relobj*.
13624         (Output_reloc::local_section_offset): Change return type to
13625         Elf_Addr.  Use get_output_section_offset.
13626         (Output_reloc::get_address): Likewise.
13627         (Output_section::is_input_address_mapped): Don't call
13628         is_section_specially_mapped.
13629         (Output_section::output_offset): Likewise.
13630         (Output_section::output_address): Likewise.
13631         (Output_section::starting_output_address): Likewise.
13632         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13633         parameter to Sized_relobj*.
13634         (Copy_relocs::need_copy_reloc): Likewise.
13635         (Copy_relocs::save): Likewise.
13636         * copy-relocs.h (class Copy_relocs): Update declarations.
13637         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13638         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13639         * target-reloc.h (relocate_for_relocatable): Change
13640         offset_in_output_section type to Elf_Addr.  Change code that uses
13641         it as well.
13642         * layout.cc (Layout::layout): Always set *off.
13643         * mapfile.cc (Mapfile::print_input_section): Use
13644         output_section_offset.
13645         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13646         Sized_relobj*.
13647         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13648         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13649         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13650
13651 2008-07-03  Ian Lance Taylor  <iant@google.com>
13652
13653         * layout.cc (Layout::include_section): Do not discard unrecognized
13654         SHT_STRTAB sections.
13655
13656 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13657
13658         * script.cc (Lex::can_continue_name): Make '?' allowable in
13659         version-script names.
13660         * testsuite/version_script.map: Change glob pattern to use '?'
13661
13662 2008-06-30  Manish Singh  <yosh@gimp.org>
13663
13664         PR 6585
13665         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13666         Correct typo.
13667
13668 2008-06-30  Ian Lance Taylor  <iant@google.com>
13669
13670         PR 6660
13671         PR 6682
13672         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13673         versions]: Don't try to read the value in the contents, since we
13674         don't use it.  Use the template endianness when writing.
13675
13676 2008-06-25  Cary Coutant  <ccoutant@google.com>
13677
13678         * fileread.cc (File_read::make_view): Assert on zero-length view.
13679         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13680         symbol table when there are no symbols to read.
13681
13682 2008-06-23  Craig Silverstein  <csilvers@google.com>
13683
13684         * version.cc (version_string): Bump to 1.7
13685
13686 2008-06-18  Craig Silverstein  <csilvers@google.com>
13687
13688         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13689         constant 0xFFFF to type Valtype.
13690         (Powerpc_relocate_functions::rel16_ha): Likewise.
13691
13692 2008-06-17  Ian Lance Taylor  <iant@google.com>
13693
13694         * output.h (Output_section::Input_section): Initialize p2align_ to
13695         zero for Output_section_data constructors.
13696         (Output_section::Input_section::addralign): If not an input
13697         section, return the alignment of the Output_section_data.
13698         * testsuite/copy_test.cc: New file.
13699         * testsuite/copy_test_1.cc: New file.
13700         * testsuite/copy_test_2.cc: New file.
13701         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13702         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13703         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13704         (copy_test_1_pic.o, copy_test_1.so): New targets.
13705         (copy_test_2_pic.o, copy_test_2.so): New targets.
13706         * testsuite/Makefile.in: Rebuild.
13707
13708         * script-sections.cc (Script_sections::place_orphan): Initialize
13709         local variable exact.
13710
13711 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13712
13713         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13714
13715 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13716             David S. Miller  <davem@davemloft.net>
13717
13718         * powerpc.cc: New file.
13719         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13720         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13721         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13722         * Makefile.in: Rebuild.
13723
13724 2008-06-09  Ian Lance Taylor  <iant@google.com>
13725
13726         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13727         <exception>.
13728         (throwing, orig_terminate): New static variables.
13729         (terminate_handler): New static function.
13730         (t2): Set terminate handler.
13731
13732 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13733
13734         PR 6584
13735         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13736         alignment.
13737
13738 2008-05-30  Cary Coutant  <ccoutant@google.com>
13739
13740         * archive.cc (Archive::include_all_members) Correct to step
13741         over symbol table and extended name table in thin archives.
13742
13743 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13744
13745         PR 6407
13746         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13747         calculation.
13748
13749 2008-05-28  Caleb Howe  <cshowe@google.com>
13750
13751         * reduced_debug_output.cc: New file.
13752         * reduced_debug_output.h: New file.
13753         * options.h (class General_options): Add --strip-debug-non-line.
13754         * options.cc (General_options::finalize): Add strip_debug_non_line
13755         to the strip heirarchy.
13756         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13757         fields.
13758         * layout.cc: Include "reduced_debug_output.h".
13759         (Layout::Layout): Initialize new fields.
13760         (line_only_debug_sections): New static array.
13761         (is_lines_only_debug_sections): New static inline function.
13762         (Layout::include_section): Handle --strip-debug-non-line.
13763         (Layout::make_output_section): If --strip-debug-non-line, build
13764         new output sections for .debug_abbrev and .debug_info.
13765         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13766         gold.  Warn about possible overflow.
13767         (read_signed_LEB_128): Likewise.
13768         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13769         (read_signed_LEB_128): Declare.
13770         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13771         (HFILES): Add reduced_debug_output.h.
13772         * Makefile.in: Rebuild.
13773
13774 2008-05-21  Ian Lance Taylor  <iant@google.com>
13775
13776         * mapfile.cc: New file.
13777         * mapfile.h: New file.
13778         * options.h (class General_options): Add -M/--print-map and -Map.
13779         * options.cc (General_options::finalize): Make -M equivalent to
13780         -Map -.
13781         * main.cc: Include <cstdio> and "mapfile.h".
13782         (main): Open mapfile if requested.
13783         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13784         constructor.  Change caller.
13785         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13786         (queue_middle_tasks): Likewise.
13787         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13788         declarations.
13789         * archive.cc: Include "mapfile.h".
13790         (Archive::add_symbols): Add mapfile parameter.  Change all
13791         callers.  Pass mapfile, symbol, and reason to include_member.
13792         (Archive::include_all_members): Add mapfile parameter.  Change all
13793         callers.
13794         (Archive::include_member): Add mapfile, sym, and why parameters.
13795         Change all callers.  Report inclusion to map file.
13796         * archive.h: Include "fileread.h".
13797         (class Archive): Update declarations.
13798         (Archive::file): New const method.
13799         (class Add_archive_symbols): Add mapfile_ field.  Update
13800         constructor.  Change all callers.
13801         * readsyms.h (class Read_symbols): Likewise.
13802         (class Finish_group): Likewise.
13803         (class Read_script): Likewise.
13804         * common.cc: Include "mapfile.h".
13805         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13806         all callers.
13807         (Symbol_table::do_allocate_commons): Likewise.
13808         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13809         symbol allocation to mapfile.
13810         * common.h (class Allocate_commons_task): Add mapfile_ field.
13811         Update constructor.  Change all callers.
13812         * symtab.h (class Symbol_table): Update declarations.
13813         * layout.cc: Include "mapfile.h".
13814         (Layout_task_runner::run): Print information to mapfile.
13815         (Layout::create_gold_note): Change Output_data_fixed_space to
13816         Output_data_zero_fill.
13817         (Layout::create_build_id): Likewise.
13818         (Layout::print_to_mapfile): New function.
13819         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13820         constructor.  Change caller.
13821         (class Layout): Declare print_to_mapfile.
13822         * output.cc (Output_section::Input_section::print_to_mapfile): New
13823         function.
13824         (Output_section::add_input_section): If producing a map, always
13825         add to input_sections_ list.
13826         (Output_section::do_print_to_mapfile): New function.
13827         (Output_segment::print_sections_to_mapfile): New function.
13828         (Output_segment::print_section_list_to_mapfile): New function.
13829         * output.h: Include "mapfile.h".
13830         (Output_data::print_to_mapfile): New function.
13831         (Output_data::do_print_to_mapfile): New virtual function.
13832         (Output_segment_headers::do_print_to_mapfile): New function.
13833         (Output_file_header::do_print_to_mapfile): New function.
13834         (Output_data_const::do_print_to_mapfile): New function.
13835         (class Output_data_const_buffer): Add map_name_ field.  Update
13836         constructor.  Change all callers.  Add do_print_to_mapfile
13837         function.
13838         (class Output_data_fixed_space): Likewise.
13839         (class Output_data_space): Likewise.
13840         (class Output_data_zero_fill): New class.
13841         (Output_data_strtab::do_print_to_mapfile): New function.
13842         (Output_data_reloc_base::do_print_to_mapfile): New function.
13843         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13844         (Output_data_group::do_print_to_mapfile): New function.
13845         (Output_data_got::do_print_to_mapfile): New function.
13846         (Output_data_dynamic::do_print_to_mapfile): New function.
13847         (Output_symtab_xindex::do_print_to_mapfile): New function.
13848         (class Output_section): Declare do_print_to_mapflie.  Declare
13849         print_to_mapfile in Input_section.
13850         (class Output_segment): Declare new functions.
13851         * object.h (Sized_relobj::symbol_count): New function.
13852         * script-sections.cc
13853         (Output_section_element_dot_assignment::set_section_addresses):
13854         Change Output_data_fixed_space to Output_data_zero_fill.
13855         (Output_data_expression::do_print_to_mapfile): New function.
13856         * script.cc (read_input_script): Add mapfile parameter.  Change
13857         all callers.
13858         * script.h (read_input_script): Update declaration.
13859         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13860         (Eh_frame::do_print_to_mapfile): New function.
13861         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13862         (Output_merge_string::do_print_to_mapfile): New function.
13863         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13864         function.
13865         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13866         function.
13867         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13868         function.
13869         * Makefile.am (CCFILES): Add mapfile.cc.
13870         (HFILES): Add mapfile.h.
13871         * Makefile.in: Rebuild.
13872
13873 2008-05-19  Ian Lance Taylor  <iant@google.com>
13874
13875         * options.h (class General_options): Add -z relro.
13876         * layout.cc (Layout::Layout): Initialize relro_segment_.
13877         (Layout::add_output_section_data): Return the output section.
13878         (Layout::make_output_section): Rcognize relro sections and mark
13879         them appropriately.
13880         (Layout::attach_allocated_section_to_segment): Put relro sections
13881         in a PT_GNU_RELRO segment.
13882         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13883         section as relro.
13884         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13885         PT_TLS segments.
13886         (Layout::linkonce_mapping): Map d.rel.ro.local to
13887         .data.rel.ro.local.
13888         (Layout::output_section_name): Us .data.rel.ro.local for any
13889         section which begins with that.
13890         * layout.h (class Layout): Update add_output_section_data
13891         declaration.  Add relro_segment_ field.
13892         * output.cc (Output_section::Output_section): Initialize is_relro_
13893         and is_relro_local_ fields.
13894         (Output_segment::add_output_section): Group relro sections.
13895         (Output_segment::is_first_section_relro): New function.
13896         (Output_segment::maximum_alignment): If there is a relro section,
13897         align the segment to the common page size.
13898         (Output_segment::set_section_addresses): Track whether we are
13899         looking at relro sections.  If the last section is a relro
13900         section, align to the common page size.
13901         (Output_segment::set_section_list_addresses): Add in_relro
13902         parameter.  Change all callers.  Align to the page size when
13903         moving from relro to non-relro section.
13904         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13905         segment.
13906         * output.h (class Output_section): Add is_relro_ and
13907         is_relro_local_ fields.
13908         (Output_section::is_relro): New function.
13909         (Output_section::set_is_relro): New function.
13910         (Output_section::is_relro_local): New function.
13911         (Output_section::set_is_relro_local): New function.
13912         (class Output_segment): Update declarations.
13913         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13914         * sparc.cc (Target_sparc::got_section): Likewise.
13915         * x86_64.cc (Target_x86_64::got_section): Likewise.
13916         * testsuite/relro_test_main.cc: New file.
13917         * testsuite/relro_test.cc: New file.
13918         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13919         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13920         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13921         (relro_test.so, relro_test_pic.o): New targets.
13922         * testsuite/Makefile.in: Rebuild.
13923
13924 2008-05-16  Ian Lance Taylor  <iant@google.com>
13925
13926         * output.cc (Output_segment::add_output_section): Remove front
13927         parameter.
13928         * output.h (class Output_segment): Remove
13929         add_initial_output_section and overloaded add_output_section.
13930         Update declaration of remaining add_output_section.
13931         * layout.cc (Layout::create_interp): Call add_output_section
13932         rather than add_initial_output_section.
13933         (Layout::finish_dynamic_section): Likewise.
13934
13935         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13936         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13937         know the dynamic type.
13938         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13939         field.  Initialize it in constructor.
13940         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13941         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13942         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13943         reloc.
13944
13945         * output.cc (Output_reloc::get_address): Change return type to
13946         Elf_Addr.
13947         * output.h (class Output_reloc): Update get_address declaration.
13948         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13949         for section addresses.
13950
13951 2008-05-09  Ian Lance Taylor  <iant@google.com>
13952
13953         PR 6493
13954         * gold.cc (gold_nomem): Use return value of write.
13955
13956 2008-05-08  Ian Lance Taylor  <iant@google.com>
13957
13958         * symtab.c (Symbol::init_base_output_data): Add version
13959         parameter.  Change all callers.
13960         (Symbol::init_base_output_segment): Likewise.
13961         (Symbol::init_base_constant): Likewise.
13962         (Symbol::init_base_undefined): Likewise.
13963         (Sized_symbol::init_output_data): Likewise.
13964         (Sized_symbol::init_output_segment): Likewise.
13965         (Sized_symbol::init_constant): Likewise.
13966         (Sized_symbol::init_undefined): Likewise.
13967         (Symbol_table::do_define_in_output_data): If the new symbol has a
13968         version, mark it as the default.
13969         (Symbol_table::do_define_in_output_segment): Likewise.
13970         (Symbol_table::do_define_as_constant): Likewise.
13971         * symtab.h (class Symbol): Update declarations.
13972         (class Sized_symbol): Likewise.
13973         * resolve.cc (Symbol::override_version): New function.
13974         (Symbol::override_base): Call override_version.
13975         (Symbol::override_base_with_special): Likewise.
13976         * testsuite/ver_script_8.script: New file.
13977         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13978         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13979         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13980         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13981
13982 2008-05-06  Ian Lance Taylor  <iant@google.com>
13983
13984         PR 6049
13985         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13986         functions.
13987         (class General_options): Remove existing --undefined, and add
13988         --no-undefined instead.  Add new --undefined as synonym for -u.
13989         * archive.cc (Archive::add_symbols): Check whether symbol was
13990         named with -u.
13991         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13992         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13993         all uses.  Add IS_UNDEFINED.  Update declarations to split
13994         different versions of init_base.  Declare init_base_undefined.
13995         (Symbol::is_defined): Handle IS_UNDEFINED.
13996         (Symbol::is_undefined): Likewise.
13997         (Symbol::is_weak_undefined): Call is_undefined.
13998         (Symbol::is_absolute): Handle IS_CONSTANT.
13999         (class Sized_symbol): Update declarations to split different
14000         versions of init.  Declare init_undefined.
14001         (class Symbol_table): Declare new functions.
14002         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14003         Change all callers.
14004         (Symbol::init_base_output_data): Likewise.
14005         (Symbol::init_base_output_segment): Likewise.
14006         (Symbol::init_base_constant): Likewise.
14007         (Symbol::init_base_undefined): New function.
14008         (Sized_symbol::init_object): Rename from init.  Change all
14009         callers.
14010         (Sized_symbol::init_output_data): Likewise.
14011         (Sized_symbol::init_output_segment): Likewise.
14012         (Sized_symbol::init_constant): Likewise.
14013         (Sized_symbol::init_undefined): New function.
14014         (Symbol_table::add_undefined_symbols_from_command_line): New
14015         function.
14016         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14017         function.
14018         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14019         (Symbol::output_section): Likewise.
14020         (Symbol::set_output_section): Likewise.
14021         (Symbol_table::sized_finalize_symbol): Likewise.
14022         (Symbol_table::sized_write_globals): Likewise.
14023         * resolve.cc (Symbol_table::should_override): Likewise.
14024         (Symbol::override_base_with_special): Likewise.
14025
14026         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14027         symbol, change it to have default visibility.
14028         * testsuite/protected_1.cc: New file.
14029         * testsuite/protected_2.cc: New file.
14030         * testsuite/protected_3.cc: New file.
14031         * testsuite/protected_main_1.cc: New file.
14032         * testsuite/protected_main_2.cc: New file.
14033         * testsuite/protected_main_3.cc: New file.
14034         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14035         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14036         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14037         (protected_1.so): New target.
14038         (protected_1_pic.o, protected_2_pic.o): New targets.
14039         (protected_3_pic.o): New target.
14040         (check_PROGRAMS): Add protected_2.
14041         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14042         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14043         * testsuite/Makefile.in: Rebuild.
14044
14045         * options.h (DEFINE_var): Add set_user_set_##varname__.
14046         (DEFINE_bool_alias): New macro.
14047         (class General_options): Define -Bstatic using DEFINE_bool_alias
14048         rather than DEFINE_special.  Add --undefined as an alias for -z
14049         defs.
14050         * options.cc (General_options::parse_Bstatic): Remove.
14051
14052         * options.h (class General_options): Add --fatal-warnings.
14053         * main.cc (main): Implement --fatal-warnings.
14054         * errors.h (Errors::warning_count): New function.
14055
14056         * options.h (class General_options): Add -Bsymbolic-functions.
14057         * symtab.h (Symbol::is_preemptible): Check for
14058         -Bsymbolic-functions.
14059
14060 2008-05-05  Ian Lance Taylor  <iant@google.com>
14061
14062         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14063         as noVARNAME rather than no-VARNAME.
14064         (class General_options): Add option -z combreloc.
14065         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14066         get_address.
14067         (Output_reloc::sort_before) [SHT_REL]: New function.
14068         (Output_reloc::sort_before) [SHT_RELA]: New function.
14069         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14070         Sort_relocs_comparison.
14071         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14072         parameter.  Change all callers.
14073         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14074         sort_relocs parameter.  Change all callers.
14075         * output.cc (Output_reloc::get_address): New function, broken out
14076         of write_rel.
14077         (Output_reloc::write_rel): Call it.
14078         (Output_reloc::compare): New function.
14079         (Output_data_reloc_base::do_write): Optionally sort relocs.
14080
14081         * configure.ac: If targ_extra_obj is set, link it in.
14082         * configure.tgt: Initialize all variables.
14083         (x86_64*): Set targ_extra_obj and targ_extra_size.
14084         * configure: Rebuild.
14085
14086         * object.cc (Sized_relobj::include_section_group): Adjust section
14087         indexes read from group data.  Build vector to pass to
14088         layout_group.
14089         * layout.cc (Layout::layout_group): Add flags and shndxes
14090         parameters.  Remove contents parameter.  Change caller.  Update
14091         explicit instantiations.
14092         * layout.h (class Layout): Update layout_group declaration.
14093         * output.cc (Output_data_group::Output_data_group): Add flags and
14094         input_shndxes parameters.  Remove contents parameter.  Change
14095         caller.
14096         (Output_data_group::do_write): Change input_sections_ to
14097         input_shndxes_.
14098         * output.h (class Output_data_group): Update constructor
14099         declaration.  Rename input_sections_ to input_shndxes_.
14100         * testsuite/many_sections_test.cc: Add template.
14101
14102 2008-04-30  Cary Coutant  <ccoutant@google.com>
14103
14104         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14105
14106         * layout.cc (Layout::include_section): Refactored check for debug
14107         info section.
14108         (Layout::add_comdat): Add new parameters.  Change type
14109         of signature parameter.  Add object and shndx to signatures table.
14110         (Layout::find_kept_object): New function.
14111         * layout.h: Include <cstring>.
14112         (Layout::is_debug_info_section): New function.
14113         (Layout::add_comdat): Add new parameters.
14114         (Layout::find_kept_object): New function.
14115         (Layout::Kept_section): New struct.
14116         (Layout::Signatures): Change type of map range.
14117         * object.cc (Relobj::output_section_address): New function.
14118         (Sized_relobj::include_section_group): Add new parameters.  Change
14119         calls to Layout::add_comdat.  Change to build table of kept comdat
14120         groups and table mapping discarded sections to kept sections.
14121         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14122         (Sized_relobj::do_layout): Change calls to include_section_group and
14123         include_linkonce_section.
14124         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14125         value to zero when section is discarded.
14126         (Sized_relobj::map_to_kept_section): New function.
14127         * object.h (Relobj::output_section_address): New function.
14128         (Relobj::Comdat_group): New type.
14129         (Relobj::find_comdat_group): New function.
14130         (Relobj::Comdat_group_table): New type.
14131         (Relobj::Kept_comdat_section): New type.
14132         (Relobj::Kept_comdat_section_table): New type.
14133         (Relobj::add_comdat_group): New function.
14134         (Relobj::set_kept_comdat_section): New function.
14135         (Relobj::get_kept_comdat_section): New function.
14136         (Relobj::comdat_groups_): New field.
14137         (Relobj::kept_comdat_sections_): New field.
14138         (Symbol_value::input_value): Update comment.
14139         (Sized_relobj::map_to_kept_section) New function.
14140         (Sized_relobj::include_linkonce_section): Add new parameter.
14141         * target-reloc.h (Comdat_behavior): New type.
14142         (get_comdat_behavior): New function.
14143         (relocate_section): Add code to map a discarded section to the
14144         corresponding kept section when applying a relocation.
14145
14146 2008-04-30  Craig Silverstein  <csilvers@google.com>
14147
14148         * dwarf_reader.cc (next_generation_count): New static var.
14149         (Addr2line_cache_entry): New struct.
14150         (addr2line_cache): New static var.
14151         (Dwarf_line_info::one_addr2line): Added caching.
14152         (Dwarf_line_info::clear_addr2line_cache): New function.
14153         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14154         cache-size parameter.
14155         (Dwarf_line_info::one_addr2line_cache): New function.
14156         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14157         new cache-size argument to one_addr2line(), and clear cache.
14158
14159 2008-04-28  Cary Coutant  <ccoutant@google.com>
14160
14161         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14162         R_386_PC8 relocations.
14163
14164 2008-04-23  Ian Lance Taylor  <iant@google.com>
14165
14166         * object.cc (Sized_relobj::include_section_group): Check for
14167         invalid section group.
14168
14169         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14170         header size.
14171
14172         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14173         than read for file header.
14174         * archive.cc (Archive::include_member): Likewise.
14175
14176 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14177
14178         * aclocal.m4: Regenerate.
14179         * configure: Regenerate.
14180
14181 2008-04-19  Ian Lance Taylor  <iant@google.com>
14182
14183         * version.cc (version_string): Bump to 1.6.
14184
14185         * testsuite/Makefile.am (many_sections_r_test): New target.
14186         (many_sections_r_test_SOURCES): Remove.
14187         (many_sections_r_test_DEPENDENCIES): Remove.
14188         (many_sections_r_test_LDFLAGS): Remove.
14189         (many_sections_r_test_LDADD): Remove.
14190
14191         * object.cc (Sized_relobj::do_add_symbols): Always pass
14192         local_symbol_count_ to add_from_relobj.
14193
14194         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14195         every thousand variables.
14196         * testsuite/Makefile.in: Rebuild.
14197
14198         * object.cc (Xindex::initialize_symtab_xindex): New function.
14199         (Xindex::read_symtab_xindex): New function.
14200         (Xindex::sym_xindex_to_shndx): New function.
14201         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14202         available.
14203         (Sized_relobj::do_initialize_xindex): New function.
14204         (Sized_relobj::do_read_symbols): Adjust section links.
14205         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14206         parameter.  Change all callers.
14207         (Sized_relobj::include_section_group): Adjust section links and
14208         symbol section indexes.
14209         (Sized_relobj::do_layout): Adjust section links.
14210         (Sized_relobj::do_count_local_symbols): Adjust section links and
14211         symbol section indexes.
14212         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14213         ordinary and special symbols.
14214         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14215         dynsym_xindex parameters.  Change all callers.  Adjust section
14216         links.  Use SHN_XINDEX when needed.
14217         (Sized_relobj::get_symbol_location_info): Adjust section links.
14218         Don't get fooled by special symbols.
14219         * object.h (class Xindex): Define.
14220         (class Object): Add xindex_ parameter.  Declare virtual functoin
14221         do_initialize_xindex.
14222         (Object::adjust_sym_shndx): New function.
14223         (Object::set_xindex): New protected function.
14224         (class Symbol_value): Add is_ordinary_shndx_ field.
14225         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14226         (Symbol_value::value): Assert ordinary section.
14227         (Symbol_value::initialize_input_to_output_map): Likewise.
14228         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14229         Change all callers.
14230         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14231         all callers.
14232         (class Sized_relobj): Update declarations.
14233         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14234         parameter.  Change all callers.
14235         (Sized_relobj::adjust_shndx): New function.
14236         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14237         field.
14238         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14239         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14240         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14241         (Sized_dynobj::read_dynsym_section): Adjust section links.
14242         (Sized_dynobj::read_dynamic): Likewise.
14243         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14244         section links.
14245         (Sized_dynobj::do_initialize_xindex): New function.
14246         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14247         do_initialize_xindex.
14248         (Sized_dynobj::adjust_shndx): New function.
14249         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14250         dynsym_xindex_ fields.
14251         (Layout::finalize): Add a call to set_section_indexes before
14252         creating the symtab sections.
14253         (Layout::set_section_indexes): Don't do anything if the section
14254         already has a section index.
14255         (Layout::create_symtab_sections): Add shnum parameter.  Change
14256         caller.  Create .symtab_shndx section if needed.
14257         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14258         caller.
14259         (Layout::allocated_output_section_count): New function.
14260         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14261         needed.
14262         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14263         fields.  Update declarations.
14264         (Layout::symtab_xindex): New function.
14265         (Layout::dynsym_xindex): New function.
14266         (class Write_symbols_task): Add layout_ field.
14267         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14268         Change caller.
14269         * output.cc (Output_section_headers::Output_section_headers): Add
14270         shstrtab_section parameter.  Change all callers.
14271         (Output_section_headers::do_sized_write): Store overflow values
14272         for section count and section string table section index in
14273         section header zero.
14274         (Output_file_header::do_sized_write): Check for overflow of
14275         section count and section string table section index.
14276         (Output_symtab_xindex::do_write): New function.
14277         (Output_symtab_xindex::endian_do_write): New function.
14278         * output.h (class Output_section_headers): Add shstrtab_section_.
14279         Update declarations.
14280         (class Output_symtab_xindex): Define.
14281         (Output_section::has_out_shndx): New function.
14282         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14283         field.
14284         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14285         Change all callers.
14286         (Sized_symbol::init): Likewise.
14287         (Symbol::output_section): Check for ordinary symbol.
14288         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14289         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14290         callers.
14291         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14292         Change all callers.  Simplify handling of symbols from sections
14293         not included in the link.
14294         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14295         distinction.
14296         (Weak_alias_sorter::operator()): Assert that symbols are
14297         ordinary.
14298         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14299         distinction.
14300         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14301         parameters.  Change all callers.
14302         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14303         symbol distinction.  Use SHN_XINDEX when needed.
14304         (Symbol_table::write_section_symbol): Add symtab_xindex
14305         parameter.  Change all callers.
14306         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14307         SHN_XINDEX when needed.
14308         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14309         declarations.
14310         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14311         (Symbol::is_defined): Check is_ordinary.
14312         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14313         (Symbol::is_absolute, Symbol::is_common): Likewise.
14314         (class Sized_symbol): Update declarations.
14315         (class Symbol_table): Update declarations.
14316         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14317         parameters.  Change all callers.
14318         (Sized_symbol::override): Likewise.
14319         (Symbol_table::override): Likewise.
14320         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14321         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14322         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14323         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14324         to be in an ordinary section.
14325         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14326         object and is_ordinary parameters.  Change all callers.
14327         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14328         Change all callers.  Don't add undefined or non-ordinary symbols
14329         to reloc_map_.
14330         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14331         Change all callers.
14332         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14333         declarations.
14334         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14335         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14336         (Sized_relobj::relocate_sections): Likewise.
14337         * target-reloc.h (scan_relocs): Adjust section symbol index.
14338         (scan_relocatable_relocs): Likewise.
14339         * i386.cc (Scan::local): Check for ordinary symbols.
14340         * sparc.cc (Scan::local): Likewise.
14341         * x86_64.cc (Scan::local): Likewise.
14342         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14343         to symbol_section_and_value.
14344         * testsuite/many_sections_test.cc: New file.
14345         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14346         (check_PROGRAMS): Add many_sections_test.
14347         (many_sections_test_SOURCES): Define.
14348         (many_sections_test_DEPENDENCIES): Define.
14349         (many_sections_test_LDFLAGS): Define.
14350         (BUILT_SOURCES): Add many_sections_define.h.
14351         (many_sections_define.h): New target.
14352         (BUILT_SOURCES): Add many_sections_check.h.
14353         (many_sections_check.h): New target.
14354         (check_PROGRAMS): Add many_sections_r_test.
14355         (many_sections_r_test_SOURCES): Define.
14356         (many_sections_r_test_DEPENDENCIES): Define.
14357         (many_sections_r_test_LDFLAGS): Define.
14358         (many_sections_r_test_LDADD): Define.
14359         (many_sections_r_test.o): New target.
14360         * testsuite/Makefile.in: Rebuild.
14361
14362 2008-04-17  Cary Coutant  <ccoutant@google.com>
14363
14364         * errors.cc (Errors::info): New function.
14365         (gold_info): New function.
14366         * errors.h (Errors::info): New function.
14367         * gold.h (gold_info): New function.
14368         * object.cc (Input_objects::add_object): Print trace output.
14369         * options.cc (options::parse_set): New function.
14370         (General_options::parse_wrap): Deleted.
14371         (General_options::General_options): Deleted initializer.
14372         * options.h (options::String_set): New typedef.
14373         (options::parse_set): New function.
14374         (DEFINE_set): New macro.
14375         (General_options::wrap): Changed to use DEFINE_set. Changed
14376         callers of any_wrap_symbols and is_wrap_symbol.
14377         (General_options::trace, General_options::trace_symbol):
14378         New options.
14379         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14380         (General_options::wrap_symbols_): Deleted.
14381         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14382
14383 2008-04-17  David S. Miller  <davem@davemloft.net>
14384
14385         * options.cc (General_options::parse_V): New function.
14386         * options.h: Add entries for -V and -Qy.
14387
14388 2008-04-17  Ian Lance Taylor  <iant@google.com>
14389
14390         * common.cc (Symbol_table::allocate_commons): Remove options
14391         parameter.  Change caller.
14392         (Symbol_table::do_allocate_commons): Remove options parameter.
14393         Change caller.  Just call do_allocate_commons_list twice.
14394         (Symbol_table::do_allocate_commons_list): New function, broken out
14395         of do_allocate_commons.
14396         * common.h (class Allocate_commons_task): Remove options_ field.
14397         Update constructor.
14398         * symtab.cc (Symbol_table::Symbol_table): Initialize
14399         tls_commons_.
14400         (Symbol_table::add_from_object): Put TLS common symbols on
14401         tls_commons_ list.
14402         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14403         which are IN_OUTPUT_DATA.
14404         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14405         allocate_commons and do_allocate_commons declarations.  Declare
14406         do_allocate_commons_list.
14407         * gold.cc (queue_middle_tasks): Update creation of
14408         Allocate_commons_task to not pass options.
14409         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14410         (TLS_TEST_C_FLAGS): New variable.
14411         (tls_test_c_pic.o): New target.
14412         (tls_test_shared.so): Link in tls_test_c_pic.o.
14413         (tls_test_c_pic_ie.o): New target.
14414         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14415         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14416         (tls_test_c.o): New target.
14417         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14418         (tls_pic_test_LDADD): Likewise.
14419         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14420         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14421         (tls_test_c_gnu2.o): New target.
14422         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14423         tls_test_c_gnu2.o.
14424         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14425         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14426         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14427         * testsuite/tls_test.cc: Include "config.h".
14428         (t_last): Call t11_last.
14429         * testsuite/tls_test.h (t11, t11_last): Declare.
14430         * testsuite/tls_test_c.c: New file.
14431         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14432         * configure.ac: Check for OpenMP support.
14433         * configure, config.in, Makefile.in: Rebuild.
14434         * testsuite/Makefile.in: Rebuild.
14435
14436 2008-04-16  Cary Coutant  <ccoutant@google.com>
14437
14438         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14439         (Target_i386::tls_base_symbol_defined_): New field.
14440         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14441         (Target_i386::Scan::global): Likewise.
14442         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14443         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14444         (Target_x86_64::tls_base_symbol_defined_): New field.
14445         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14446         (Target_x86_64::Scan::global): Likewise.
14447
14448 2008-04-16  Cary Coutant  <ccoutant@google.com>
14449
14450         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14451         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14452         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14453         building shared libraries.
14454         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14455         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14456         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14457         * testsuite/Makefile.in: Rebuild.
14458         * testsuite/weak_undef.h: New file.
14459         * testsuite/weak_undef_file1.cc: Add extra test cases.
14460         * testsuite/weak_undef_file2.cc: Likewise.
14461         * testsuite/weak_undef_test.cc: Likewise.
14462
14463 2008-04-16  David S. Miller  <davem@davemloft.net>
14464
14465         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14466         Add issued_non_pic_error_ field.  Declare check_non_pic.
14467         (Target_sparc::Scan::check_non_pic): New function.
14468         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14469         (Target_sparc::Scan::global): Likewise.
14470
14471         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14472         * configure: Rebuild.
14473
14474         * options.h (DEFINE_enable): New macro.
14475         (new_dtags): New enable option.
14476         (initfirst, interpose, loadfltr, nodefaultlib,
14477         nodelete, nodlopen, nodump): New -z options.
14478         * layout.cc (Layout:finish_dynamic_section): If new
14479         dtags enabled, emit DT_RUNPATH.  Also, emit a
14480         DT_FLAGS_1 containing any specified -z flags.
14481
14482 2008-04-16  Ian Lance Taylor  <iant@google.com>
14483
14484         * copy-relocs.cc: New file.
14485         * copy-relocs.h: New file.
14486         * reloc.cc: Remove Copy_relocs code.
14487         * reloc.h: Likewise.
14488         * reloc-types.h (struct Reloc_types) [both versions]: Add
14489         get_reloc_addend_noerror.
14490         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14491         variants of add_global which take an addend which must be zero.
14492         * i386.cc: Include "copy-relocs.h".
14493         (class Target_i386): Change type of copy_relocs_ to variable,
14494         update initializer.
14495         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14496         Change all callers.
14497         (Target_i386::do_finalize_sections): Change handling of
14498         copy_relocs_.
14499         * sparc.cc: Include "copy-relocs.h".
14500         (class Target_sparc): Change type of copy_relocs_ to variable,
14501         update initializer.
14502         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14503         Change all callers.
14504         (Target_sparc::do_finalize_sections): Change handling of
14505         copy_relocs_.
14506         * x86_64.cc: Include "copy-relocs.h".
14507         (class Target_x86_64): Change type of copy_relocs_ to variable,
14508         update initializer.
14509         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14510         class.  Change all callers.
14511         (Target_x86_64::do_finalize_sections): Change handling of
14512         copy_relocs_.
14513         * Makefile.am (CCFILES): Add copy-relocs.cc.
14514         (HFILES): Add copy-relocs.h.
14515
14516         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14517
14518         * testsuite/script_test_4.sh: Permit leading zeroes.
14519
14520 2008-04-15  Ian Lance Taylor  <iant@google.com>
14521
14522         * script-sections.cc (Script_sections::create_segments): Use
14523         header_size_adjustment even when there is enough room for the
14524         headers.
14525         * testsuite/script_test_4.sh: New file.
14526         * testsuite/script_test_4.t: New file.
14527         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14528         (check_DATA): Add script_test_4.stdout.
14529         (MOSTLYCLEANFILES): Likewise.
14530         (script_test_4): New target.
14531         (script_test_4.stdout): New target.
14532         * testsuite/Makefile.in: Rebuild.
14533
14534         * sparc.cc: Add definitions for Output_data_plt_sparc class
14535         constants.
14536
14537 2008-04-14  David S. Miller  <davem@davemloft.net>
14538
14539         * sparc.cc: New file.
14540         * Makefile.am (TARGETSOURCES): Add sparc.cc
14541         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14542         * configure.tgt: Document targ_extra_size and
14543         targ_extra_big_endian.  Add entries for sparc-* and
14544         sparc64-*.
14545         * configure.ac: Handle targ_extra_size and
14546         targ_extra_big_endian.
14547         * Makefile.in: Rebuild.
14548         * configure: Likewise.
14549         * po/POTFILES.in: Likewise.
14550         * po/gold.pot: Likewise.
14551
14552 2008-04-14  Ian Lance Taylor  <iant@google.com>
14553
14554         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14555         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14556         in the name/type/flags to section mapping.  Don't call
14557         allocate_output_section.
14558         (Layout::choose_output_section): Change parameter from adjust_name
14559         to is_input_section.  Don't permit input sections after sections
14560         are attached to segments.  Don't call allocate_output_section.
14561         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14562         not write_enable_output_section.
14563         (Layout::make_output_section): Don't push to
14564         unattached_section_list_ nor call attach_to_segment.  Call
14565         attach_section_to_segment if sections are attached.
14566         (Layout::attach_sections_to_segments): New function.
14567         (Layout::attach_section_to_segment): New function.
14568         (Layout::attach_allocated_section_to_segment): Rename from
14569         attach_to_segment.  Remove flags parameter.
14570         (Layout::allocate_output_section): Remove function.
14571         (Layout::write_enable_output_section): Remove function.
14572         * layout.h (class Layout): Update for above changes.  Add new
14573         field sections_are_attached_.
14574         * output.h (Output_section::update_flags_for_input_section): New
14575         function.
14576         * output.cc (Output_section::add_input_section): Call
14577         update_flags_for_input_section.
14578         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14579
14580 2008-04-11  Cary Coutant  <ccoutant@google.com>
14581
14582         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14583         thought unnecessary.
14584         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14585
14586 2008-04-11  Ian Lance Taylor  <iant@google.com>
14587
14588         * output.h (class Output_section_data): Remove inline definition
14589         of set_addralign.
14590         * output.cc (Output_section_data::set_addralign): New function.
14591
14592 2008-04-11  Cary Coutant  <ccoutant@google.com>
14593
14594         Add support for TLS descriptors for i386 and x86_64.
14595         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14596         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14597         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14598         GOT_TYPE_TLS_DESC.
14599         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14600         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14601         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14602         relocations.
14603         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14604         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14605         Fix problem with initial-exec relocations.
14606         (Target_i386::Relocate::relocate_tls): Likewise.
14607         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14608         relaxation.
14609         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14610         support for section-plus-offset dynamic table entries.
14611         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14612         (Output_data_dynamic::Dynamic_entry): Add support for
14613         section-plus-offset dynamic table entries.
14614         (Output_data_dynamic::Classification): Likewise.
14615         (Output_data_dynamic::classification_): Renamed offset_.
14616         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14617         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14618         (Target_x86_64::make_plt_section): New function.
14619         (Target_x86_64::reserve_tlsdesc_entries): New function.
14620         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14621         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14622         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14623         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14624         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14625         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14626         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14627         add extra PLT entry for TLS descriptors.
14628         (Output_data_plt_x86_64::got_): New field.
14629         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14630         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14631         fields.
14632         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14633         descriptors.
14634         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14635         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14636         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14637         R_386_TLS_DESC_CALL relocations.
14638         (Target_x86_64::Scan::global): Likewise.
14639         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14640         for TLS descriptors.
14641         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14642         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14643         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14644         GD-to-IE relaxation.
14645         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14646         and TLS_DESCRIPTORS.
14647         * Makefile.in: Rebuild.
14648         * configure: Rebuild.
14649         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14650         (tls_test_shared2.so): New target.
14651         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14652         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14653         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14654         (tls_shared_gd_to_ie_test_LDADD): New variable.
14655         (tls_shared_gnu2_gd_to_ie_test): New target.
14656         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14657         New targets.
14658         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14659         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14660         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14661         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14662         (tls_shared_gnu2_test): New target.
14663         (tls_test_gnu2_shared.so): New target.
14664         (tls_shared_gnu2_test_SOURCES): New variable.
14665         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14666         (tls_shared_gnu2_test_LDFLAGS): New variable.
14667         (tls_shared_gnu2_test_LDADD): New variable.
14668         * testsuite/Makefile.in: Rebuild.
14669         * testsuite/Makefile.
14670
14671 2008-04-11  Ian Lance Taylor  <iant@google.com>
14672
14673         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14674         justsyms.t.
14675         * testsuite/Makefile.in: Rebuild.
14676
14677         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14678         long.
14679         * testsuite/script_test_2.cc (main): Adjust test.
14680
14681 2008-04-11  David S. Miller  <davem@davemloft.net>
14682             Ian Lance Taylor  <iant@google.com>
14683
14684         * options.h (General_options): Add entries for '-Y' and
14685         '-relax'.
14686         * options.cc (General_options:finalize): If -Y was used, add those
14687         entries to the library path instead of the default "/lib" and
14688         "/usr/lib".
14689
14690 2008-04-11  David S. Miller  <davem@davemloft.net>
14691
14692         * testsuite/justsyms.t: Start at 0x100.
14693         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14694         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14695         long.
14696         * testsuite/script_test_2.cc: Adjust string and section length
14697         checks.
14698
14699 2008-04-09  Ian Lance Taylor  <iant@google.com>
14700
14701         PR gold/5996
14702         * script-sections.cc (Sections_element::allocate_to_segment): Add
14703         orphan parameter.
14704         (Output_section_definition::allocate_to_segment): Likewise.
14705         (Orphan_output_section::allocate_to_segment): Likewise.
14706         (Script_sections::attach_sections_using_phdrs_clause): Don't
14707         propagate non-PT_LOAD segments to orphan sections.
14708         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14709         readelf rather than objdump.
14710         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14711         .interp section and PT_INTERP segment are the same size.
14712         * testsuite/Makefile.in: Rebuild.
14713
14714         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14715         aliases for symbols defined in the same object.
14716         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14717         (weak_alias_test_SOURCES): New variable.
14718         (weak_alias_test_DEPENDENCIES): New variable.
14719         (weak_alias_test_LDFLAGS): New variable.
14720         (weak_alias_test_LDADD): New variable.
14721         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14722         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14723         (weak_alias_test_3.o): New target.
14724         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14725         * testsuite/weak_alias_test_main.cc: New file.
14726         * testsuite/weak_alias_test_1.cc: New file.
14727         * testsuite/weak_alias_test_2.cc: New file.
14728         * testsuite/weak_alias_test_3.cc: New file.
14729
14730 2008-04-08  Ian Lance Taylor  <iant@google.com>
14731
14732         * options.h (class General_options): Add --noinhibit-exec option.
14733         * main.cc (main): Check --noinhibit-exec.
14734
14735         * options.h (class General_options): Define --wrap as a special
14736         option.  Add wrap_symbols_ field.
14737         (General_options::any_wrap_symbols): New function.
14738         (General_options::is_wrap_symbol): New function.
14739         * options.cc (General_options::parse_wrap): New function.
14740         (General_options::General_options): Initialize wrap_symbols_.
14741         * symtab.cc (Symbol_table::wrap_symbol): New function.
14742         (Symbol_table::add_from_object): Handle --wrap.
14743         * symtab.h (class Symbol_table): Declare wrap_symbol.
14744         * target.h (Target::wrap_char): New function.
14745         (Target::Target_info): Add wrap_char field.
14746         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14747         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14748         * testsuite/testfile.cc (Target_test::test_target_info):
14749         Likewise.
14750
14751         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14752         there is one.
14753
14754         * layout.h (class Layout): Add added_eh_frame_data_ field.
14755         * layout.cc (Layout::Layout): Initialize new field.
14756         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14757         output section until we find a section we merged successfully.
14758         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14759         that the size be non-zero.
14760
14761         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14762         qualifier.
14763
14764 2008-04-08  Craig Silverstein  <csilvers@google.com>
14765
14766         * configure.ac: Export new conditional variable HAVE_ZLIB.
14767         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14768         on HAVE_ZLIB.
14769         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14770         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14771
14772 2008-04-07  Ian Lance Taylor  <iant@google.com>
14773
14774         * version.cc (version_string): Set to "1.5".
14775
14776         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14777         Add issued_non_pic_error_ field.  Declare check_non_pic.
14778         (Target_x86_64::Scan::check_non_pic): New function.
14779         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14780         (Target_x86_64::Scan::global): Likewise.
14781
14782         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14783         addend parameter.  Change caller.  Handle merge sections.
14784         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14785         Address to Addend.  Don't add in the result of
14786         local_section_offset, pass down the addend and use the returned
14787         value.
14788         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14789         Update declarations of local_section_offset and symbol_value.
14790         * testsuite/two_file_test_1.cc (t18): New function.
14791         * testsuite/two_file_test_2.cc (f18): New function.
14792         * testsuite/two_file_test_main.cc (main): Call t18.
14793         * testsuite/two_file_test.h (t18, f18): Declare.
14794
14795         * configure.ac: Don't test for objdump, c++filt, or readelf.
14796         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14797         conditionals.
14798         (TEST_READELF): New variable.
14799         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14800         (check_PROGRAMS): Add two_file_strip_test.
14801         (two_file_strip_test): New target.
14802         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14803         (two_file_same_shared_strip_test_SOURCES): New variable.
14804         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14805         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14806         (two_file_same_shared_strip_test_LDADD): New variable.
14807         (two_file_shared_strip.so): New target.
14808         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14809         (ver_test_5.syms, ver_test_7.syms): Likewise.
14810         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14811         (strip_test_3.stdout): Use TEST_OBJDUMP.
14812         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14813
14814 2008-04-04  Cary Coutant  <ccoutant@google.com>
14815
14816         * symtab.h (Symbol::is_weak_undefined): New function.
14817         (Symbol::is_strong_undefined): New function.
14818         (Symbol::is_absolute): New function.
14819         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14820         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14821         absolute symbols.
14822         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14823         (weak_undef_test): New target.
14824         * testsuite/Makefile.in: Rebuild.
14825         * testsuite/weak_undef_file1.cc: New file.
14826         * testsuite/weak_undef_file2.cc: New file.
14827         * testsuite/weak_undef_test.cc: New file.
14828
14829 2008-04-03  Craig Silverstein  <csilvers@google.com>
14830
14831         * compressed_output.h (class Output_compressed_section): Use
14832         unsigned buffer.
14833         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14834         add zlib header.
14835         (zlib_compressed_suffix): Removed.
14836         (Output_compressed_section::set_final_data_size): Use unsigned
14837         buffers.
14838         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14839         Fix linker invocation.
14840         (flagstest_o_specialfile_and_compress_debug_sections):
14841         Likewise.
14842         * testsuite/Makefile.in: Regenerated.
14843
14844 2008-04-02  David S. Miller  <davem@davemloft.net>
14845
14846         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14847         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14848
14849 2008-04-02  Craig Silverstein  <csilvers@google.com>
14850
14851         * TODO: New file.
14852
14853 2008-04-02  Ian Lance Taylor  <iant@google.com>
14854
14855         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14856         parameters.  Update for new key type to views_.  Change all
14857         callers.
14858         (File_read::read): Adjust for byteshift in returned view.
14859         (File_read::add_view): New function, broken out of
14860         find_and_make_view.
14861         (File_read::make_view): New function, broken out of
14862         find_and_make_view.
14863         (File_read::find_or_make_view): Add offset and aligned
14864         parameters.  Rewrite accordingly.  Change all callers.
14865         (File_read::get_view): Add offset and aligned parameters.  Adjust
14866         for byteshift in return value.
14867         (File_read::get_lasting_view): Likewise.
14868         * fileread.h (class File_read): Update declarations.
14869         (class File_read::View): Add byteshift_ field.  Add byteshift to
14870         constructor.  Add byteshift method.
14871         * archive.h (Archive::clear_uncached_views): New function.
14872         (Archive::get_view): Add aligned parameter.  Change all callers.
14873         * object.h (Object::get_view): Add aligned parameter.  Change all
14874         callers.
14875         (Object::get_lasting_view): Likewise.
14876
14877         * fileread.cc (File_read::release): Don't call clear_views if
14878         there are multiple objects.
14879         * fileread.h (File_read::clear_uncached_views): New function.
14880         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14881         on the archive.
14882
14883 2008-03-31  Cary Coutant  <ccoutant@google.com>
14884
14885         Add thin archive support.
14886         * archive.cc (Archive::armagt): New const.
14887         (Archive::setup): Remove task parameter and calls to unlock.
14888         (Archive::unlock_nested_archives): New function.
14889         (Archive::read_header): Add nested_off parameter. Change
14890         all callers.
14891         (Archive::interpret_header): Likewise.
14892         (Archive::include_all_members): Change to handle thin
14893         archives.
14894         (Archive::include_member): Likewise.
14895         * archive.h (Archive::Archive): Add new parameters and
14896         initializers.
14897         (Archive::armagt): New const.
14898         (Archive::setup): Remove task parameter.
14899         (Archive::unlock_nested_archives): New function.
14900         (Archive::read_header): Add nested_off parameter.
14901         (Archive::interpret_header): Likewise.
14902         (Archive::Nested_archive_table): New typedef.
14903         (Archive::is_thin_archive_): New field.
14904         (Archive::nested_archives_): New field.
14905         (Archive::options_): New field.
14906         (Archive::dirpath_): New field.
14907         (Archive::task_): New field.
14908         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14909         for thin archives.  Pass additional parameters to
14910         Archive::Archive.  Unlock the archive file after calling
14911         Archive::setup.
14912
14913 2008-03-29  Ian Lance Taylor  <iant@google.com>
14914
14915         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14916         version symbol to be local.
14917         * testsuite/ver_test_4.sh: New file.
14918         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14919         (check_DATA): Add ver_test_4.syms.
14920         (ver_test_4.syms): New target.
14921         * testsuite/Makefile.in: Rebuild.
14922
14923         * output.cc
14924         (Output_section::Input_section_sort_entry::has_priority): New
14925         function.
14926         (Output_section::Input_section_sort_entry::match_file_name): New
14927         function.
14928         (Output_section::Input_section_sort_entry::match_section_name):
14929         Remove.
14930         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14931         Remove.
14932         (Output_section::Input_section_sort_entry::match_section_file):
14933         Remove.
14934         (Output_section::Input_section_sort_compare::operator()): Rewrite
14935         using new Input_section_sort_entry functions.  Sort crtbegin and
14936         crtend first.  Sort sections with no priority before sections with
14937         a priority.
14938         * testsuite/initpri1.c (d3): Check j != 4.
14939         (cd5): New constructor/destructor function.
14940         (main): Check j != 2.
14941
14942         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14943         new symbol when resolving, don't call set_is_default.
14944         * testsuite/ver_test_7.cc: New file.
14945         * testsuite/ver_test_7.sh: New file.
14946         * testsuite/Makefile.am (ver_test_7.so): New target.
14947         (ver_test_7.o): New target.
14948         (check_SCRIPTS): Add ver_test_7.sh.
14949         (check_DATA): Add ver_test_7.syms.
14950         (ver_test_7.syms): New target.
14951
14952 2008-03-28  Ian Lance Taylor  <iant@google.com>
14953
14954         * layout.cc (Layout::layout): If we see an input section with a
14955         name that needs sorting, set the must_sort flag for the output
14956         section.
14957         (Layout::make_output_section): If the name of the output section
14958         indicates that it might require sorting, set the may_sort flag.
14959         * output.h (Output_section::may_sort_attached_input_sections): New
14960         function.
14961         (Output_section::set_may_sort_attached_input_sections): New
14962         function.
14963         (Output_section::must_sort_attached_input_sections): New
14964         function.
14965         (Output_section::set_must_sort_attached_input_sections): New
14966         function.
14967         (class Output_section): Declare Input_section_sort_entry.  Define
14968         Input_section_sort_compare.  Declare
14969         sort_attached_input_sections.  Add new fields:
14970         may_sort_attached_input_sections_,
14971         must_sort_attached_input_sections_,
14972         attached_input_sections_are_sorted_.
14973         * output.cc (Output_section::Output_section): Initialize new
14974         fields.
14975         (Output_section::add_input_section): Add an entry to
14976         input_sections_ if may_sort or must_sort are true.
14977         (Output_section::set_final_data_size): Call
14978         sort_attached_input_sections if necessary.
14979         (Output_section::Input_section_sort_entry): Define new class.
14980         (Output_section::Input_section_sort_compare::operator()): New
14981         function.
14982         (Output_section::sort_attached_input_sections): New function.
14983         * configure.ac: Check whether the compiler supports constructor
14984         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14985         * testsuite/initpri1.c: New file.
14986         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14987         CONSTRUCTOR_PRIORITY.
14988         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14989         (initpri1_LDFLAGS): New variable.
14990         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14991
14992 2008-03-27  Ian Lance Taylor  <iant@google.com>
14993
14994         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14995         * testsuite/common_test_1.c: New file.
14996         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14997         (common_test_1_SOURCES): New variable.
14998         (common_test_1_DEPENDENCIES): New variable.
14999         (common_test_1_LDFLAGS): New variable.
15000
15001         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15002         and commons_ correctly when NAME/VERSION does not override
15003         NAME/NULL.
15004         * testsuite/ver_test_6.c: New file.
15005         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15006         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15007         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15008
15009 2008-03-26  Ian Lance Taylor  <iant@google.com>
15010
15011         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15012         of an undefined symbol from a version script.
15013         * testsuite/Makefile.am (ver_test_5.so): New target.
15014         (ver_test_5.o): New target.
15015         (check_SCRIPTS): Add ver_test_5.sh.
15016         (check_DATA): Add ver_test_5.syms.
15017         (ver_test_5.syms): New target.
15018         * testsuite/ver_test_5.cc: New file.
15019         * testsuite/ver_test_5.script: New file.
15020         * testsuite/ver_test_5.sh: New file.
15021         * Makefile.in, testsuite/Makefile.in: Rebuild.
15022
15023         PR gold/5986
15024         Fix problems building gold with gcc 4.3.0.
15025         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15026         (gold_error_at_location, gold_warning_at_location): Use it.
15027         * configure.ac: Check whether we can compile and use a template
15028         function with a printf attribute.
15029         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15030         when jumping over bytes.
15031         * object.cc: Instantiate Object::read_section_data.
15032         * debug.h: Include <cstring>
15033         * dwarf_reader.cc: Include <algorithm>
15034         * main.cc: Include <cstring>.
15035         * options.cc: Include <cstring>.
15036         * output.cc: Include <cstring>.
15037         * script.cc: Include <cstring>.
15038         * script.h: Include <string>.
15039         * symtab.cc: Include <cstring> and <algorithm>.
15040         * target-select.cc: Include <cstring>.
15041         * version.cc: Include <string>.
15042         * testsuite/testmain.cc: Include <cstdlib>.
15043         * configure, config.in: Rebuild.
15044
15045 2008-03-25  Ian Lance Taylor  <iant@google.com>
15046
15047         * options.cc: Include "../bfd/bfdver.h".
15048         (options::help): Print bug reporting address.
15049
15050         * version.cc (print_version): Adjust output for current value of
15051         BFD_VERSION_STRING.
15052
15053         * NEWS: New file.
15054
15055         * options.cc (options::help): Print list of supported targets.
15056         * target-select.h: Include <vector>.
15057         (class Target_selector): Make machine_, size_, and is_big_endian_
15058         fields const.  Add bfd_name_ and instantiated_target_ fields.
15059         (Target_selector::Target_selector): Add bfd_name parameter.
15060         (Target_selector::recognize): Make non-virtual, call
15061         do_recognize.
15062         (Target_selector::recognize_by_name): Make non-virtual, call
15063         do_recognize_by_name.
15064         (Target_selector::supported_names): New function.
15065         (Target_selector::bfd_name): New function.
15066         (Target_selector::do_instantiate_target): New pure virtual
15067         function.
15068         (Target_selector::do_recognize): New virtual function.
15069         (Target_selector::do_recognize_by_name): New virtual function.
15070         (Target_selector::instantiate_target): New private function.
15071         (supported_target_names): Declare.
15072         * target-select.cc (Target_selector::Target_selector): Update for
15073         new parameter and fields.
15074         (select_target_by_name): Check that the name matches before
15075         calling recognize_by_name.
15076         (supported_target_names): New function.
15077         * i386.cc (class Target_selector_i386): Update Target_selector
15078         constructor call.  Remove recognize and recognize_by_name.  Add
15079         do_instantiate_target.
15080         * x86_64.cc (class Target_selector_x86_64): Likewise.
15081         * testsuite/testfile.cc (class Target_selector_test): Update for
15082         changes to Target_selector.
15083
15084         * README: Rewrite, with some notes on unsupported features.
15085
15086 2008-03-24  Cary Coutant  <ccoutant@google.com>
15087
15088         * i386.cc (Target_i386::Got_type): New enum declaration.
15089         (Target_i386::Scan::local): Updated callers of Output_data_got
15090         member functions.
15091         (Target_i386::Scan::global): Likewise.
15092         (Target_i386::Relocate::relocate): Likewise.
15093         (Target_i386::Relocate::relocate_tls): Likewise.
15094         * object.h (Got_offset_list): New class.
15095         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15096         (Sized_relobj::local_got_offset): Likewise.
15097         (Sized_relobj::set_local_got_offset): Likewise.
15098         (Sized_relobj::local_has_tls_got_offset): Removed.
15099         (Sized_relobj::local_tls_got_offset): Removed.
15100         (Sized_relobj::set_local_tls_got_offset): Removed.
15101         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15102         * output.cc (Output_data_got::add_global): Added got_type parameter.
15103         (Output_data_got::add_global_with_rel): Likewise.
15104         (Output_data_got::add_global_with_rela): Likewise.
15105         (Output_data_got::add_global_pair_with_rel): New function.
15106         (Output_data_got::add_global_pair_with_rela): New function.
15107         (Output_data_got::add_local): Added got_type parameter.
15108         (Output_data_got::add_local_with_rel): Likewise.
15109         (Output_data_got::add_local_with_rela): Likewise.
15110         (Output_data_got::add_local_pair_with_rel): New function.
15111         (Output_data_got::add_local_pair_with_rela): New function.
15112         (Output_data_got::add_global_tls): Removed.
15113         (Output_data_got::add_global_tls_with_rel): Removed.
15114         (Output_data_got::add_global_tls_with_rela): Removed.
15115         (Output_data_got::add_local_tls): Removed.
15116         (Output_data_got::add_local_tls_with_rel): Removed.
15117         (Output_data_got::add_local_tls_with_rela): Removed.
15118         * output.h (Output_data_got::add_global): Added got_type parameter.
15119         (Output_data_got::add_global_with_rel): Likewise.
15120         (Output_data_got::add_global_with_rela): Likewise.
15121         (Output_data_got::add_global_pair_with_rel): New function.
15122         (Output_data_got::add_global_pair_with_rela): New function.
15123         (Output_data_got::add_local): Added got_type parameter.
15124         (Output_data_got::add_local_with_rel): Likewise.
15125         (Output_data_got::add_local_with_rela): Likewise.
15126         (Output_data_got::add_local_pair_with_rel): New function.
15127         (Output_data_got::add_local_pair_with_rela): New function.
15128         (Output_data_got::add_global_tls): Removed.
15129         (Output_data_got::add_global_tls_with_rel): Removed.
15130         (Output_data_got::add_global_tls_with_rela): Removed.
15131         (Output_data_got::add_local_tls): Removed.
15132         (Output_data_got::add_local_tls_with_rel): Removed.
15133         (Output_data_got::add_local_tls_with_rela): Removed.
15134         * resolve.cc (Symbol::override_base_with_special): Removed
15135         reference to has_got_offset_ field.
15136         * symtab.cc (Symbol::init_fields): Replaced initialization
15137         of got_offset_ with got_offsets_.  Removed initialization
15138         of has_got_offset_
15139         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15140         (Symbol::got_offset): Likewise.
15141         (Symbol::set_got_offset): Likewise.
15142         (Symbol::has_tls_got_offset): Removed.
15143         (Symbol::tls_got_offset): Removed.
15144         (Symbol::set_tls_got_offset): Removed.
15145         (Symbol::got_offset_): Removed.
15146         (Symbol::tls_mod_got_offset_): Removed.
15147         (Symbol::tls_pair_got_offset_): Removed.
15148         (Symbol::got_offsets_): New field.
15149         (Symbol::has_got_offset): Removed.
15150         (Symbol::has_tls_mod_got_offset): Removed.
15151         (Symbol::has_tls_pair_got_offset): Removed.
15152         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15153         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15154         member functions.
15155         (Target_x86_64::Scan::global): Likewise.
15156         (Target_x86_64::Relocate::relocate): Likewise.
15157         (Target_x86_64::Relocate::relocate_tls): Likewise.
15158
15159 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15160
15161         * yyscript.y: Fix spelling error in comment.
15162
15163 2008-03-24  Ian Lance Taylor  <iant@google.com>
15164
15165         * options.h (class General_options): Define build_id option.
15166         * layout.h (class Layout): Declare write_build_id, create_note,
15167         create_build_id.  Add build_id_note_ member.
15168         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15169         "libiberty.h", "md5.h", "sha1.h".
15170         (Layout::Layout): Initialize eh_frame_data_,
15171         eh_frame_hdr_section_, and build_id_note_.
15172         (Layout::finalize): Call create_build_id.
15173         (Layout::create_note): New function, broken out of
15174         Layout::create_gold_note.
15175         (Layout::create_gold_note): Call create_note.
15176         (Layout::create_build_id): New function.
15177         (Layout::write_build_id): New function.
15178         (Close_task_runner::run): Call write_build_id.
15179
15180         * x86_64.cc: Correct license to GPLv3.
15181
15182 2008-03-23  Ian Lance Taylor  <iant@google.com>
15183
15184         * options.cc: Include "demangle.h".
15185         (parse_optional_string): New function.
15186         (parse_long_option): Handle takes_optional_argument.
15187         (parse_short_option): Update dash_z initializer.  Handle
15188         takes_optional_argument.
15189         (General_options::General_options): Initialize do_demangle_.
15190         (General_options::finalize): Set do_demangle_.  Handle demangling
15191         style.
15192         * options.h (parse_optional_string): Declare.
15193         (struct One_option): Add optional_arg field.  Update constructor.
15194         Update call constructor calls.  Add takes_optional_argument
15195         function.
15196         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15197         (DEFINE_optional_string): Define.
15198         (General_options::demangle): Change from DEFINE_bool to
15199         DEFINE_optional_string.
15200         (General_options::no_demangle): New function.
15201         (General_options::do_demangle): New function.
15202         (General_options::set_do_demangle): New function.
15203         (General_options::execstack_status_): Move definition to end of
15204         class definition.
15205         (General_options::static_): Likewise.
15206         (General_options::do_demangle_): New field.
15207         * object.cc (big_endian>::get_symbol_location_info): Call
15208         Options::do_demangle, not Options::demangle.
15209         * symtab.cc (demangle): Likewise.
15210
15211 2008-03-22  Ian Lance Taylor  <iant@google.com>
15212
15213         * gold.h: Include <cstddef> and <sys/types.h>
15214         * options.h: Include <cstring>.
15215
15216 2008-03-21  Ian Lance Taylor  <iant@google.com>
15217
15218         * Added source code to GNU binutils.
15219 \f
15220 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15221
15222 Copying and distribution of this file, with or without modification,
15223 are permitted in any medium without royalty provided the copyright
15224 notice and this notice are preserved.
15225
15226 Local Variables:
15227 mode: change-log
15228 left-margin: 8
15229 fill-column: 74
15230 version-control: never
15231 End: