gold/
[external/binutils.git] / gold / ChangeLog
1 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2
3         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
4         add_got_entry and add_got_entry_pair.
5
6         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
7         (HAVE_PUBNAMES): Likewise.
8         * configure: Regenerate.
9
10         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
11         * testsuite/Makefile.in: Regenerate.
12
13         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
14         Remove const from declaration.
15         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
16         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
17         * output.h (Output_file_header): Remove const from member target_
18         and corresponding constructor argument.
19         * output.cc (Output_file_header::Output_file_header): Update prototype.
20         (Output_file_header::do_sized_write): Use this->target_ in place
21         of parameters()->target().
22
23         * testsuite/undef_symbol.cc (Foo::get_a): New method.
24
25         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
26         * configure: Regenerate.
27         * Makefile.in: Regenerate.
28         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
29         * testsuite/merge_string_literals_2.c: Likewise.
30         * testsuite/Makefile.am
31         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
32         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
33         literal -fmerge-constants.
34         * testsuite/Makefile.in: Regenerate.
35
36         * i386.cc (Target_i386): Remove unused member dynbss_.
37         * arm.cc (Target_arm): Likewise.
38         * powerpc.cc (Target_powerpc): Likewise.
39         * sparc.cc (Target_sparc): Likewise.
40         * tilegx.cc (Target_tilegx): Likewise.
41         * x86_64.cc (Target_x86_64): Likewise.
42         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
43         type_signature_, type_offset_.
44         * plugin.h (Plugin_hook): Remove unused member layout_.
45         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
46         mapfile_.
47         (Read_member): Remove unused members input_objects_, symtab_,
48         mapfile_, layout_.
49         (Check_library): Remove unused member symtab_.
50         * archive.h (Lib_group): Remove unused member lib_.
51         * archive.cc (Lib_group::Lib_group): Update initializer.
52         * incremental.h (Incremental_binary): Remove unused member target_.
53         (Incremental_script_entry): Removed unused member script_.
54         * layout.h (Write_symbols_task): Remove unused member input_objects_.
55         * icf.h (Icf): Remove unused member num_tracked_relocs.
56
57         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
58         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
59         its only use.
60         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
61
62         * archive.h: Use struct rather than class for forward declaration
63         of Read_symbols_data.
64
65 2013-10-07  Cary Coutant  <ccoutant@google.com>
66
67         PR gold/16010
68         * testsuite/Makefile.am (icf_test): Fix dependencies.
69         (icf_safe_test): Likewise.
70         (icf_safe_so_test): Likewise.
71         (large_symbol_alignment): Add empty _LDADD rule.
72         * testsuite/Makefile.in: Regenerate.
73
74 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
75
76         PR gold/15927
77         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
78         relocation for R_X86_64_32 on x32.
79
80 2013-08-27  Roland McGrath  <mcgrathr@google.com>
81
82         * output.cc (Output_segment::set_section_addresses): Take new
83         Target* argument.  If target->isolate_execinstr() and the segment
84         is executable and starts at a target->abi_pagesize() boundary,
85         pad its end out to a target->abi_pagesize() boundary with code fill.
86         * output.h (Output_segment::set_section_addresses): Update decl.
87         * layout.h (Layout::check_output_data_for_reset_values): Take new
88         argument RELAX_OUTPUTS.
89         (Layout): New member relax_output_list_.
90         (Layout::add_relax_output): New method.
91         * layout.cc (Layout::Layout): Update constructor.
92         (Layout::reset_relax_output): New method.
93         (Layout::clean_up_after_relaxation): Call it.
94         (Layout::prepare_for_relaxation): Update caller.
95         (Layout::set_segment_offsets): Update callers of set_section_addresses.
96         Call reset_relax_output before re-processing segments for
97         isolate_execinstr case.
98         (Layout::write_data): Handle relax_output_list_.
99         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
100         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
101
102 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
103
104         PR binutils/15834
105         * object.h: Fix typos.
106
107 2013-08-16  Roland McGrath  <mcgrathr@google.com>
108
109         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
110         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
111
112 2013-08-07  Cary Coutant  <ccoutant@google.com>
113
114         Revert support for v2 DWP files:
115
116         2013-03-01  Cary Coutant  <ccoutant@google.com>
117
118             Add dwp support for v2 DWARF package file format.
119             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
120             tu_length parameter.  Adjust all callers.
121             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
122             * dwp.cc: Include dwarf.h.
123             (Section_bounds): New struct type.
124             (Unit_set): New struct type.
125             (Dwo_file::Dwo_file): Initialize new data member.
126             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
127             Combine and rename to...
128             (Dwo_file::read_unit_index): ...this.
129             (Dwo_file::sized_read_compunit_index)
130             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
131             (Dwo_file::sized_read_unit_index): ...this.
132             (Dwo_file::copy_section): Remove section_name, is_str_offsets
133             parameters; add section_id parameter.
134             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
135             (Dwo_file::add_unit_set): ...this.
136             (Dwo_file::shndx_map_): Remove.
137             (Dwo_file::sect_offsets_): New data member.
138             (Dwp_output_file::Dwp_output_file): Initialize new data members.
139             (Dwp_output_file::add_section): Rename to...
140             (Dwp_output_file::add_contribution): ...this.
141             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
142             (Dwp_output_file::add_tu_set): Likewise.
143             (Dwp_output_file::Contribution): New type.
144             (Dwp_output_file::Section::contributions): New data member.
145             (Dwp_output_file::Cu_or_tu_set): Remove.
146             (Dwp_output_file::Section::Section): New ctor.
147             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
148             (Dwp_output_file::Dwp_index::Section_table): New type.
149             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
150             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
151             parameter.
152             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
153             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
154             (Dwp_output_file::Dwp_index::section_table): New member function.
155             (Dwp_output_file::Dwp_index::section_table_end): New member function.
156             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
157             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
158             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
159             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
160             (Dwp_output_file::Dwp_index::section_table_): New data member.
161             (Dwp_output_file::Dwp_index::section_mask_): New data member.
162             (Dwp_output_file::add_output_section): New member function.
163             (Dwp_output_file::write_new_section): New member function.
164             (Dwp_output_file::write_contributions): New member function.
165             (Dwp_output_file::section_id_map_): New data member.
166             (class Dwo_id_info_reader): Remove.
167             (class Unit_reader): New class.
168             (get_dwarf_section_name): New function.
169             (Dwo_file::read_executable): Adjust initializations of class data.
170             (Dwo_file::read): Add support for v2 package file format.
171             (Dwo_file::read_unit_index): Likewise.
172             (Dwo_file::sized_read_unit_index): Likewise.
173             (Dwo_file::copy_section): Likewise.
174             (Dwo_file::add_unit_set): Likewise.
175             (Dwp_output_file::add_output_section): Likewise.
176             (Dwp_output_file::add_contribution): Likewise.
177             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
178             for empty slot.
179             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
180             file format.
181             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
182             slot.
183             (Dwp_output_file::initialize): Remove unused function.
184             (Dwp_output_file::finalize): Add support for v2 package file format.
185             (Dwp_output_file::write_index): Likewise.
186             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
187             function prototype.
188
189 2013-07-31  Cary Coutant  <ccoutant@google.com>
190
191         * object.cc (Sized_relobj::do_output_section_address): New function.
192         (Sized_relobj): Instantiate explicitly.
193         * object.h (Object::output_section_address): New function.
194         (Object::do_output_section_address): New function.
195         (Sized_relobj::do_output_section_address): New function.
196         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
197
198 2013-07-30  Cary Coutant  <ccoutant@google.com>
199             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
200
201         * parameters.cc (Parameters::entry): Return target-specific entry
202         symbol name.
203         * target.h (Target::entry_symbol_name): New function.
204         (Target_info::entry_symbol_name): New data member.
205
206         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
207         * i386.cc (Target_i386::i386_info): Likewise.
208         (Target_i386_nacl::i386_nacl_info): Likewise.
209         * sparc.cc (Target_sparc::sparc_info): Likewise.
210         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
211         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
212         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
213         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
214
215 2013-07-22  Sterling Augustine  <saugustine@google.com>
216
217         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
218         Convert parameter shndx to local variable. Add parameters symtab
219         and symtab_size.  Scan over section names.  Find relocation
220         section corresponding to current section.  Create and initialize
221         reloc_mapper_ and reloc_type_.
222         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
223         unit_length to off_t.  Initialize member unit_length_.  Fill in field
224         cu_offset_.
225         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
226         Initialize new fields unit_length_ and cu_offset_.
227         (Dwarf_pubnames_table::read_section): Update prototype.
228         (Dwarf_pubnames_table::cu_offset): New member function.
229         (Dwarf_pubnames_table::subsection_size): Likewise.
230         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
231         New fields.
232         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
233         member functions public.
234         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
235         Update comment.  Rework logic.  Move repeated parts to...
236         (Gdb_index_info_reader::read_pubtable): ...here. New function.
237         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
238         pubtypes_table_, and stmt_list_offset.
239         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
240         Gdb_index::find_pubtype_offset,
241         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
242         (Gdb_index::pubnames_read): Update prototype and rework logic.
243         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
244         Forward declare.
245         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
246         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
247         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
248         Gdb_index::map_pubtable_to_dies):
249         Declare functions.
250         (Gdb_index::pubnames_read): Update declaration.
251         (Gdb_index::Pubname_offset_map): New type.
252         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
253         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
254         Gdb_index::stmt_list_offset): Declare.
255         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
256         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
257         Gdb_index::pubtypes_offset_): Remove.
258
259 2013-07-19  Roland McGrath  <mcgrathr@google.com>
260
261         * options.h (General_options): Add -Trodata-segment option.
262         * parameters.cc (Parameters::check_rodata_segment): New function.
263         (Parameters::set_target_once): Call it.
264         * parameters.h (Parameters): Declare it (private member function).
265         * layout.cc (load_seg_unusable_for_headers): New function, broken
266         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
267         then validate rodata segment rather than text segment.
268         (relaxation_loop_body): Call that.
269         (is_text_segment): New function.  Don't admit a non-executable
270         segment if TARGET->isolate_execinstr().
271         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
272
273 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
274
275         PR gold/15070
276         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
277         * nacl.h (Sniff_file::View::View): Request aligned view.
278
279 2013-07-11  Cary Coutant  <ccoutant@google.com>
280
281         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
282         correct BRLT entry size.
283
284 2013-07-03  Alan Modra  <amodra@gmail.com>
285
286         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
287         comment.
288
289 2013-07-01  Cary Coutant  <ccoutant@google.com>
290
291         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
292         reloc_type_.
293         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
294         (Dwarf_ranges_table::lookup_reloc): New function.
295         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
296         reloc_type_.
297         (Dwarf_ranges_table::lookup_reloc): New function.
298         (Dwarf_ranges_table::reloc_type_): New data member.
299
300 2013-06-27  Jing Yu  <jingyu@google.com>
301
302         PR gold/15662
303         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
304         function.
305         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
306         (Target_powerpc::do_relax): Call the above.
307
308 2013-06-27  Cary Coutant  <ccoutant@google.com>
309
310         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
311         on garbage collected .opd section.
312
313 2013-06-27  Alan Modra  <amodra@gmail.com>
314
315         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
316         is non-zero.
317         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
318         (Target_powerpc::do_function_location): Likewise for loc->shndx.
319
320 2013-06-14  Cary Coutant  <ccoutant@google.com>
321
322         * resolve.cc (Symbol::override_base): Don't override st_type
323         from plugin placeholder symbols.
324         (Symbol_table::resolve): Likewise.
325         (Symbol_table::should_override): Don't complain about TLS mismatch
326         if the TO symbol is a plugin placeholder.
327         * testsuite/Makefile.am (plugin_test_tls): New test.
328         * testsuite/Makefile.in: Regenerate.
329         * testsuite/plugin_test_tls.sh: New test script.
330         * testsuite/two_file_test_2_tls.cc: New test source.
331         * testsuite/two_file_test_tls.cc: New test source.
332
333 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
334
335         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
336         the maximum segment alignment is larger than the page size.
337         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
338         correctly aligns the symbols with large alignemnt.
339         * testsuite/Makefile.in: Regenerate.
340         * testsuite/large_symbol_alignment.cc: New file.
341
342 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
343             Sriraman Tallam  <tmsriram@google.com>
344
345         * options.h (sort_section): New option.
346         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
347         Rename from Input_section_sort_section_name_special_ordering_compare.
348         (Input_section_sort_section_name_compare): New struct.
349         * output.cc (Output_section::Input_section_sort_section_name_compare::
350         operator()): New function.
351         (Output_section::sort_attached_input_sections): Use new sort function
352         for .text if --sort-section=name is specified.
353         * layout.cc (Layout::make_output_section):
354         Add sorting by name when --sort-section=name is specified.
355         * testsuite/Makefile.am (text_section_grouping): Test option
356         --sort-section=name.
357         * testsuite/Makefile.in: Regenerate.
358         * testsuite/section_sorting_name.cc: New file.
359         * testsuite/section_sorting_name.sh: New file.
360
361 2013-05-21  Cary Coutant  <ccoutant@google.com>
362
363         * symtab.h (Symbol::is_cxx_vtable): New function.
364         * target-reloc.h (relocate_section): Check for vtable symbol.
365         * testsuite/Makefile.am (missing_key_func.sh): New test case.
366         * testsuite/Makefile.in: Regenerate.
367         * testsuite/missing_key_func.cc: New test source.
368         * testsuite/missing_key_func.sh: New test script.
369
370 2013-05-21  Cary Coutant  <ccoutant@google.com>
371
372         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
373         type of enclosing symbol.
374         (Relocate_info::location): Check symbol type when describing symbol.
375         * object.h (Symbol_location_info): Remove unused line_number;
376         add enclosing_symbol_type.
377         * testsuite/debug_msg.sh: Adjust expected output.
378
379 2013-05-13  Cary Coutant  <ccoutant@google.com>
380
381         * configure.ac: Export DEFAULT_TARGET.
382         * configure: Regenerate.
383         * Makefile.in: Regenerate.
384         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
385         * testsuite/Makefile.in: Regenerate.
386         * testsuite/debug_msg.sh: Delete duplicate tests.
387         Don't check undef_int error message match for powerpc where the
388         source file and line number aren't available.
389
390 2013-05-10  Roland McGrath  <mcgrathr@google.com>
391
392         * options.h (General_options): Add --rosegment-gap option.
393         * options.cc (finalize): --rosegment-gap implies --rosegment.
394         * layout.cc (set_segment_offsets): Let user option override
395         target->rosegment_gap().
396
397 2013-05-10  Roland McGrath  <mcgrathr@google.com>
398
399         * options.h (General_options): Remove leading space from help
400         messages for -nostdlib and --rosegment.
401
402 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
403
404         PR ld/15365
405         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
406
407 2013-05-03  Alan Modra  <amodra@gmail.com>
408
409         * merge.cc (Output_merge_string::do_add_input_section): Correct
410         scan for number of strings.  Rename vars to avoid shadowing.
411         Include missing terminator in input_size_.
412
413 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
414
415         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
416         Restore empty string handling.
417
418 2013-05-01  Cary Coutant  <ccoutant@google.com>
419
420         * stringpool.cc (Stringpool_template::new_key_offset): Fix
421         uninitialized warning.
422
423 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
424
425         * output.cc (Output_section::add_merge_input_section): Allow
426         to merge sections if the alignment is more than character size.
427         * merge.h (Output_merge_string::Output_merge_string): Remove
428         assert.
429         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
430         only not-null strings. Check the alignment of strings.
431         * stringpool.h
432         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
433         alignment as the argument.
434         (Stringpool_template<Stringpool_char>::addralign_): New class member.
435         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
436         Align non-zero length strings according to the addralign_.
437         (Stringpool_template<Stringpool_char>::set_string_offsets):
438         Updating offsets according to the given alignment.
439         * testsuite/Makefile.am (text_section_grouping): Test if string
440         literals are getting merged.
441         * testsuite/Makefile.in: Regenerate.
442         * testsuite/merge_string_literals_1.c: New file.
443         * testsuite/merge_string_literals_2.c: Ditto.
444         * testsuite/merge_string_literals.sh: Ditto.
445
446 2013-04-26  Ian Lance Taylor  <iant@google.com>
447
448         * target-reloc.h (relocate_section): If the reloc offset is out of
449         range, pass VIEW as NULL to relocate.relocate.
450         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
451         * i386.cc (Target_i386::Relocate::relocate): Likewise.
452         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
453         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
454         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
455         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
456
457 2013-04-26  Geoff Pike  <gpike@chromium.org>
458
459         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
460         * layout.cc (Hash_task): New class.
461         (Layout::queue_build_id_tasks): New function.
462         (Layout::write_build_id): Handle single-thread portion of build ID
463         computation.  (In some cases, all of it is single-threaded.)  Replace
464         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
465         functionality in fewer lines of code.
466         * layout.h (Layout::queue_build_id_tasks): New function declaration.
467         * options.h (General_options): make "--build-id" default to tree
468         rather than sha1.  Add two new options related to --build-id=tree:
469         --build-id-chunk-size-for-treehash and
470         --build-id-min-file-size-for-treehash.
471         * Makefile.am: add testing of --build-id=tree and related new options
472         (these tests will be invoked by "make check").
473         * Makefile.in: Regenerate.
474
475 2013-04-25  Alan Modra  <amodra@gmail.com>
476
477         * configure.tgt: Add powerpcle and powerpc64le.
478
479 2013-04-22  Alan Modra  <amodra@gmail.com>
480
481         PR gold/15355
482         * layout.cc (Layout::segment_precedes): Allow more than one
483         segment with the same type and flags.
484
485 2013-04-15  Cary Coutant  <ccoutant@google.com>
486
487         * layout.cc (Layout::set_relocatable_section_offsets): Don't
488         allocate space in file for BSS sections.
489
490 2013-04-15  Cary Coutant  <ccoutant@google.com>
491
492         * script-sections.cc (Orphan_output_section): Reset address
493         to zero after each orphaned section for relocatable links.
494
495 2013-04-15  Cary Coutant  <ccoutant@google.com>
496
497         * symtab.cc (Symbol_table::sized_write_globals): Subtract
498         section starting address for relocatable link.
499         * testsuite/Makefile.am (script_test_11): New test.
500         * testsuite/Makefile.in: Regenerate.
501         * testsuite/script_test_11.c: New source file.
502         * testsuite/script_test_11.t: New linker script.
503
504 2013-04-13  Alan Modra  <amodra@gmail.com>
505
506         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
507         owner when sections are not adjacent and exceed group size.
508         (Target_powerpc::group_sections): Handle corner case.
509         (Target_powerpc::Branch_info::make_stub): Handle case where
510         stub table doesn't exist due to branches in non-exec sections.
511         (Target_powerpc::Relocate::relocate): Likewise.
512
513 2013-04-11  Alan Modra  <amodra@gmail.com>
514
515         PR gold/15354
516         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
517         .branch_lt to match bfd ld.  Adjust comments throughout file.
518
519 2013-04-04  Ian Lance Taylor  <iant@google.com>
520
521         GCC PR c++/56840
522         * object.cc (do_layout_deferred_sections): Handle .eh_frame
523         sections before checking whether they are included in the link.
524
525 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
526
527         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
528         object before calling the plugin claim_file handler.  Pass the elf
529         object of the archive to the plugin. Delete the elf object if the
530         plugin claims the file.
531
532 2013-03-21  Alan Modra  <amodra@gmail.com>
533
534         * layout.cc (Layout::set_segment_offsets): Accept writable .text
535         segment when omagic.
536
537 2013-03-21  Alan Modra  <amodra@gmail.com>
538
539         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
540         comparison warning.
541         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
542         uninitialized" warning.
543
544 2013-03-20  Alan Modra  <amodra@gmail.com>
545
546         * symtab.h (Symbol::clear_version): New function.
547         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
548         is_needed by weak references.  Clear version for symbols defined
549         in as-needed objects that are not needed.
550
551 2013-03-15  Alan Modra  <amodra@gmail.com>
552
553         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
554         static and public.  Add report_err param.  Return false for data refs.
555         (Target_powerpc::rela_dyn_section): New overloaded function.
556         (Target_powerpc::plt_, iplt_): Elucidate.
557         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
558         (Output_data_plt_powerpc::do_write): Don't write .iplt.
559         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
560         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
561         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
562         push_branch and make_plt_entry for ifunc syms when
563         reloc_needs_plt_for_ifunc.
564         (Target_powerpc::Relocate::relocate): Don't use plt entry value
565         for ifunc unless reloc_needs_plt_for_ifunc.
566
567 2013-03-15  Alan Modra  <amodra@gmail.com>
568
569         * gc.h (gc_process_relocs): Don't look through function descriptors.
570         * icf.cc (get_section_contents): Do so here instead.
571
572 2013-03-13  Alan Modra  <amodra@gmail.com>
573
574         * powerpc.cc (is_branch_reloc): Forward declare.
575         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
576         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
577         false for 64-bit, true for 32-bit non-branch relocs.
578         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
579         * testsuite/Makefile.am (icf_test): Use linker map file instead of
580         nm output.
581         (icf_safe_test): Generate linker map file as well as nm output.
582         (icf_safe_so_test): Likewise.
583         * testsuite/Makefile.in: Regenerate.
584         * testsuite/icf_test.sh: Parse linker map file to determine
585         section folding.
586         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
587         * testsuite/icf_safe_so_test.sh: Likewise.
588         (X86_32_or_ARM_specific_safe_fold): Merge into..
589         (arch_specific_safe_fold): ..this.
590         (X86_64_specific_safe_fold): Delete unused function.
591
592 2013-03-12  Alan Modra  <amodra@gmail.com>
593
594         * gc.h (gc_process_relocs): Look through function descriptors
595         to determine shndx, symvalue and addend used by ICF.  Tidy
596         variable duplication.
597
598 2013-03-11  Alan Modra  <amodra@gmail.com>
599
600         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
601         * layout.cc (Layout_task_runner::run): ..to here.
602         * symtab.h (struct Symbol_location): Extract from..
603         (class Symbol_table): ..here.
604         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
605         * target.h (class Target): Add function_location and
606         do_function_location functions.
607         (class Sized_target): Add do_function_location.
608         * object.h (class Sized_relobj_file): Move find_shdr..
609         (class Object): ..to here.
610         * object.cc: Likewise.  Update to suit.  Instantiate.
611         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
612         * powerpc.cc (class Powerpc_dynobj): New.
613         (Target_powerpc::do_function_location): New function.
614         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
615         (Powerpc_dynobj::do_read_symbols): New function.
616         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
617
618 2013-03-08  Ian Lance Taylor  <iant@google.com>
619
620         * options.cc (General_options::string_to_object_format): Accept
621         "default".
622
623 2013-03-08  Alan Modra  <amodra@gmail.com>
624
625         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
626         pointer to Post_fde.
627         (struct Post_fde): Move definition to here..
628         * ehframe.cc (struct Post_fde): ..from here.
629         (Cie::write): Don't alloc Post_fde.
630         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
631
632 2013-03-07  Alan Modra  <amodra@gmail.com>
633
634         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
635         relocation referencing .LC0.
636         * testsuite/discard_locals_test.sh: Remove FIXMEs.
637
638 2013-03-07  Alan Modra  <amodra@gmail.com>
639
640         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
641         always_inline.  Add assembly for powerpc to avoid GOT.
642
643 2013-03-07  Alan Modra  <amodra@gmail.com>
644
645         * testsuite/script_test_10.sh: Don't test .bss section
646         header number.
647
648 2013-03-06  Alan Modra  <amodra@gmail.com>
649
650         * powerpc.cc (class Powerpc_relobj): Move some member functions.
651         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
652         all callers.  Handle folded sections.
653         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
654         to Powerpc_relobj.
655         (Global_symbol_visitor_opd::operator()): Likewise.
656
657 2013-03-04  Alan Modra  <amodra@gmail.com>
658
659         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
660         * testsuite/Makefile.in: Regenerate.
661
662 2013-03-01  Cary Coutant  <ccoutant@google.com>
663
664         Add dwp support for v2 DWARF package file format.
665         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
666         tu_length parameter.  Adjust all callers.
667         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
668         * dwp.cc: Include dwarf.h.
669         (Section_bounds): New struct type.
670         (Unit_set): New struct type.
671         (Dwo_file::Dwo_file): Initialize new data member.
672         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
673         Combine and rename to...
674         (Dwo_file::read_unit_index): ...this.
675         (Dwo_file::sized_read_compunit_index)
676         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
677         (Dwo_file::sized_read_unit_index): ...this.
678         (Dwo_file::copy_section): Remove section_name, is_str_offsets
679         parameters; add section_id parameter.
680         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
681         (Dwo_file::add_unit_set): ...this.
682         (Dwo_file::shndx_map_): Remove.
683         (Dwo_file::sect_offsets_): New data member.
684         (Dwp_output_file::Dwp_output_file): Initialize new data members.
685         (Dwp_output_file::add_section): Rename to...
686         (Dwp_output_file::add_contribution): ...this.
687         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
688         (Dwp_output_file::add_tu_set): Likewise.
689         (Dwp_output_file::Contribution): New type.
690         (Dwp_output_file::Section::contributions): New data member.
691         (Dwp_output_file::Cu_or_tu_set): Remove.
692         (Dwp_output_file::Section::Section): New ctor.
693         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
694         (Dwp_output_file::Dwp_index::Section_table): New type.
695         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
696         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
697         parameter.
698         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
699         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
700         (Dwp_output_file::Dwp_index::section_table): New member function.
701         (Dwp_output_file::Dwp_index::section_table_end): New member function.
702         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
703         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
704         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
705         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
706         (Dwp_output_file::Dwp_index::section_table_): New data member.
707         (Dwp_output_file::Dwp_index::section_mask_): New data member.
708         (Dwp_output_file::add_output_section): New member function.
709         (Dwp_output_file::write_new_section): New member function.
710         (Dwp_output_file::write_contributions): New member function.
711         (Dwp_output_file::section_id_map_): New data member.
712         (class Dwo_id_info_reader): Remove.
713         (class Unit_reader): New class.
714         (get_dwarf_section_name): New function.
715         (Dwo_file::read_executable): Adjust initializations of class data.
716         (Dwo_file::read): Add support for v2 package file format.
717         (Dwo_file::read_unit_index): Likewise.
718         (Dwo_file::sized_read_unit_index): Likewise.
719         (Dwo_file::copy_section): Likewise.
720         (Dwo_file::add_unit_set): Likewise.
721         (Dwp_output_file::add_output_section): Likewise.
722         (Dwp_output_file::add_contribution): Likewise.
723         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
724         for empty slot.
725         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
726         file format.
727         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
728         slot.
729         (Dwp_output_file::initialize): Remove unused function.
730         (Dwp_output_file::finalize): Add support for v2 package file format.
731         (Dwp_output_file::write_index): Likewise.
732         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
733         function prototype.
734
735 2013-03-01  Cary Coutant  <ccoutant@google.com>
736
737         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
738         function into class definition in header file.
739         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
740         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
741         New function.
742         (Dwarf_info_reader::check_buffer): Move here from .cc file.
743
744 2013-02-28  Alan Modra  <amodra@gmail.com>
745
746         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
747         * target.cc (Target::do_plt_fde_location): New function.
748         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
749         accessor function, and constructor param.
750         (struct Post_fde, Post_fdes): Declare.
751         (Cie::write): Add post_fdes param.
752         * ehframe.cc (Fde::write): Use plt_fde_location.
753         (struct Post_fde): Define.
754         (Cie::write): Stash FDEs added post merge mapping.
755         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
756         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
757         (Eh_frame::do_sized_write): Arrange to write post map FDES after
758         other FDEs.
759         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
760         (Target_powerpc::has_glink): New function.
761         (Target_powerpc::do_relax): Add eh_frame info for stubs.
762         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
763         glink_eh_frame_fde_32, default_fde): New data.
764         (Stub_table::eh_frame_added_): New var.
765         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
766         Make const.
767         (Stub_table::add_eh_frame): New function.
768         (Output_data_glink::add_eh_frame): New function.
769         (Target_powerpc::make_glink_section): Call add_eh_frame.
770
771 2013-02-15  Ian Lance Taylor  <iant@google.com>
772
773         * options.h (DEFINE_uint64_alias): Define.
774         (class General_options): Add -Ttext-segment as an alias for
775         -Ttext.
776
777 2013-02-15  Alan Modra  <amodra@gmail.com>
778
779         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
780         (Stub_table::do_write): ..here, two places.
781         (Stub_table::plt_call_size): Use it here too.
782
783 2013-02-11  Ian Lance Taylor  <iant@google.com>
784
785         * descriptors.cc (Descriptors::close_all): New function.
786         * descriptors.h (class Descriptors): Declare close_all.
787         (close_all_descriptors): New inline function.
788         * plugin.cc: Include "descriptors.h".
789         (Plugin_manager::cleanup): Call close_all_descriptors.
790
791 2013-02-06  Alan Modra  <amodra@gmail.com>
792
793         * README: Update coding style link.
794
795 2013-01-28  Cary Coutant  <ccoutant@google.com>
796
797         * dwp.cc (File_list): New typedef.
798         (Dwo_name_info_reader): New class.
799         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
800         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
801         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
802         (Dwo_file::read_executable): New function.
803         (Dwo_file::read): Move common setup code to ...
804         (Dwo_file::make_object): ... here.
805         (dwp_options): Add --exec/-e.
806         (usage): Likewise.
807         (main): Likewise.
808
809 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
810
811         * layout.cc (Layout::layout): Check for option text_reorder.
812         (Layout::make_output_section): Ditto.
813         * options.h (text_reorder): New option.
814         * output.cc (Input_section_sort_compare): Remove special ordering
815         of section names.
816         (Output_section::
817          Input_section_sort_section_name_special_ordering_compare::
818          operator()): New function.
819         (Output_section::sort_attached_input_sections): Use new sort function
820         for .text.
821         * output.h (Input_section_sort_section_name_special_ordering_compare):
822         New struct.
823         * testsuite/Makefile.am (text_section_grouping): Test option
824         --no-text-reorder
825         * testsuite/Makefile.in: Regenerate.
826         * testsuite/text_section_grouping.sh: Check order of functions without
827         default text reordering.
828
829 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
830
831         * options.h (General_options): Change default to true for new_dtags.
832
833 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
834
835         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
836         when enable_new_dtags is false.  Only add DT_RUNPATH when
837         enable_new_dtags is true.
838
839 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
840
841         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
842         used in declaration and definition consistent.
843         (Target_powerpc::symval_for_branch): Ditto.
844
845 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
846
847         * testsuite/plugin_final_layout.cc: Fix comment.
848
849 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
850
851         * layout.cc (Layout::layout): Do not do default sorting for
852         text sections when section ordering is specified.
853         (make_output_section): Ditto.
854         * testsuite/plugin_final_layout.cc: Name the function sections
855         to catch reordering issues.
856
857 2013-01-15  Alan Modra  <amodra@gmail.com>
858
859         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
860         plt-thread-safe.
861
862 2013-01-15  Alan Modra  <amodra@gmail.com>
863
864         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
865         * testsuite/Makefile.in: Regenerate.
866
867 2013-01-14  Alan Modra  <amodra@gmail.com>
868
869         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
870         * testsuite/Makefile.in: Regenerate.
871
872 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
873
874         PR bfd/14430
875         Fix mingw gold build with plugins enabled
876         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
877         * configure.ac: Export DLOPEN_LIBS and add headers check.
878         * plugin.cc: Handle non-dlfcn case.
879         * Makefile.in: Regenerate.
880         * config.in: Regenerate.
881         * configure: Regenerate.
882         * testsuite/Makefile.in: Regenerate.
883
884 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
885
886         * output.h (sort_attached_input_sections): Change to be public.
887         * script-sections.cc
888         (Output_section_definition::set_section_addresses): Sort
889         attached input sections according to section order before linker
890         script assigns section addresses.
891         (Orphan_output_section::set_section_addresses): Sort
892         attached input sections according to section order before linker
893         script assigns section addresses.
894         * Makefile.am (final_layout.sh): Use a simple linker script to
895         check if section ordering still works.
896         * Makefile.in: Regenerate.
897
898 2013-01-09  Ben Cheng  <bccheng@google.com>
899
900         * arm.cc (Target_arm::attributes_accept_div): New function.
901         (Target_arm::attributes_forbid_div): New function.
902         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
903         attribute using the same new functions as what bfd/elf32_arm.c
904         does.
905
906 2013-01-07  Cary Coutant  <ccoutant@google.com>
907
908         PR gold/14993
909         * output.cc (Output_section::add_input_section): For incremental
910         updates, don't track input sections that are allocated from patch
911         space.
912
913 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
914             Ian Lance Taylor  <iant@google.com>
915
916         PR gold/14897
917         * configure.ac (--enable-ld): Removed.
918         (install_as_default): Set to yes only for --enable-gold=default
919         or --disable-ld.
920         * configure: Regenerated.
921
922 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
923
924         * options.h (General_options): Add -fuse-ld= for GCC linker
925         option compatibility.
926
927 2013-01-04  Cary Coutant  <ccoutant@google.com>
928
929         * configure.ac: Fix typo restoring CXXFLAGS.
930         * configure: Regenerate.
931
932 2013-01-04  Cary Coutant  <ccoutant@google.com>
933
934         * testsuite/Makefile.am (CXXLINK_S): New macro.
935         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
936         * testsuite/Makefile.in: Regenerate.
937
938 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
939
940         * version.cc (print_version): Update copyright year to 2013.
941
942 2012-12-20  Ian Lance Taylor  <iant@google.com>
943
944         * layout.cc (Layout::special_ordering_of_input_section): New
945         function.
946         (Layout::layout): If input section requires special ordering, must
947         sort input sections.
948         (Layout::make_output_section): May sort .text input sections.
949         (Layout::is_section_name_prefix_grouped): Remove.
950         * layout.h (class Layout): Declare
951         special_ordering_of_input_section.  Don't declare
952         is_section_name_prefix_grouped.
953         * output.cc (Output_section::add_input_section): Revert last
954         change.
955         (Output_section::Input_section_sort::match_file_name): Don't crash
956         if called on output section data.
957         (Output_section::Input_section_sort_compare): Sort based on
958         special ordering.
959         (Output_section::Input_section_sort_section_order_index_compare):
960         Revert last patch.
961         (Output_section::sort_attached_input_sections): Likewise.
962
963 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
964
965         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
966         * layout.h (Layout::is_section_name_prefix_grouped): New function.
967         * output.cc (Output_section::add_input_section): Check if section
968         name contains special prefix.  Keep input sections to sort such
969         sections.
970         (Output_section::Input_section_sort_section_order_index_compare
971          ::operator()): Group sections according to prefixes.
972         (Output_section::sort_attached_input_sections): Add condition to
973         Input_section_entry constructor call.
974         * testsuite/Makefile.am (text_section_grouping): New test.
975         * testsuite/Makefile.in: Regenerate.
976         * testsuite/text_section_grouping.cc: New file.
977         * testsuite/text_section_grouping.sh: New file.
978
979 2012-12-17  Nick Clifton  <nickc@redhat.com>
980
981         * Makefile.am: Add copyright notice.
982         * NEWS: Likewise.
983         * README: Likewise.
984         * configure.ac: Likewise.
985         * ftruncate.c: Likewise.
986         * Makefile.in: Regenerate.
987
988 2012-12-14  Cary Coutant  <ccoutant@google.com>
989
990         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
991         --no-as-needed flag.
992         (exception_separate_shared_12_test): Likewise.
993         (incremental_copy_test): Likewise.
994         * testsuite/Makefile.in: Regenerate.
995
996 2012-12-14  Cary Coutant  <ccoutant@google.com>
997
998         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
999         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1000
1001 2012-12-12  Alan Modra  <amodra@gmail.com>
1002
1003         * powerpc.cc (class Track_tls): New.
1004         (class Relocate, class Scan): Inherit Track_tls.
1005         (Target_powerpc::Scan::local, global): Track tls optimization
1006         and avoid creating plt entry for __tls_get_addr if all uses
1007         are optimized away.
1008         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1009
1010 2012-12-12  Alan Modra  <amodra@gmail.com>
1011
1012         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1013         Replace no_toc_optimize with toc_optimize.
1014         * output.h (Output_section::input_sections): Provide non-const variant.
1015         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1016         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1017         accessors.
1018         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1019         (class Sort_toc_sections): New.
1020         (Target_powerpc::do_finalize_sections): Sort toc sections.
1021         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1022
1023 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1024
1025         * testsuite/binary_unittest.cc (read_all): New function.
1026         (Sized_binary_test): Use it instead of ::read.
1027         * fileread.cc (do_read): Don't assume pread always reads the whole
1028         amount in a single call.
1029
1030 2012-12-10  Alan Modra  <amodra@gmail.com>
1031
1032         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1033         Set EM_PPC64 or EM_PPC here.
1034         (Target_selector_powerpc::do_recognize): Delete.
1035
1036 2012-12-10  Alan Modra  <amodra@gmail.com>
1037
1038         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1039         stub_table_.
1040         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1041
1042 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1043
1044         * testsuite/binary_unittest.cc (Sized_binary_test):
1045         Use open_descriptor rather than ::open.
1046
1047 2012-12-07  Alan Modra  <amodra@gmail.com>
1048
1049         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1050         typedef and invalid_address constant.
1051         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1052         instantiate constants.
1053
1054 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1055
1056         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1057         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1058         * aclocal.m4: Regenerate.
1059         * configure: Regenerate.
1060         * Makefile.in: Regenerate.
1061         * testsuite/Makefile.in: Regenerate.
1062
1063 2012-12-07  Alan Modra  <amodra@gmail.com>
1064
1065         * options.h (General_options): Add no_toc_optimize.
1066         * powerpc.cc (ok_lo_toc_insn): New function.
1067         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1068
1069 2012-12-06  Alan Modra  <amodra@gmail.com>
1070
1071         * options.h (General_options): Add plt_align, plt_static_chain,
1072         plt_thread_safe.  Update stub_group_size help text.
1073         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1074         for new plt_thread_safe_ var.
1075         (use_plt_offset): Correct comments.
1076         (Target_powerpc::do_relax): Look for thread creation symbols to
1077         determine default plt_thread_safe value.  Clear plt call stubs
1078         as well as branch stubs each iteration.
1079         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1080         insn constants.
1081         (l, hi, ha, write_insn): Move earlier.
1082         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1083         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1084         plt stubs too.
1085         (Stub_table::update_size): Adjust.
1086         (Stub_table::prev_size, set_prev_size): Delete.
1087         (Stub_table::stub_align): Let --plt-align affect result.
1088         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1089         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1090         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1091         (Stub_table::do_write): Support more stub variants.
1092
1093 2012-12-04  Alan Modra  <amodra@gmail.com>
1094
1095         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1096         (Target_powerpc::do_define_standard_symbols): New function.
1097
1098 2012-12-03  Alan Modra  <amodra@gmail.com>
1099
1100         * output.h: Formatting, whitespace.
1101
1102 2012-12-03  Alan Modra  <amodra@gmail.com>
1103
1104         * layout.h (Layout::get_executable_sections): Declare.
1105         * layout.cc (Layout::get_executable_sections): New function.
1106         * arm.cc (Target_arm::group_sections): Use it.
1107         (Arm_output_section::group_sections): Delete now redundant test.
1108         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1109         param to handle relative relocs.
1110         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1111         (Output_data_reloc::add_absolute): Adjust.
1112         (Output_data_reloc::add_relative): New function.
1113         (Output_data::reset_data_size): New function.
1114         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1115         (Output_section::set_addralign): New function.
1116         (Output_section::checkpoint_set_addralign): New function.
1117         (Output_section::clear_section_offsets_need_adjustment): New function.
1118         (Output_section::input_sections): Make public.
1119         * powerpc.cc (class Output_data_brlt_powerpc): New.
1120         (class Stub_table, class Stub_control): New.
1121         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1122         stub_table_, set_stub_table, stub_table): New vectors and accessor
1123         functions.
1124         (Target_powerpc::do_may_relax, do_relax, push_branch,
1125         new_stub_table, stub_tables, brlt_section, group_sections,
1126         add_branch_lookup_table, find_branch_lookup_table,
1127         write_branch_lookup_table, make_brlt_section): New functions.
1128         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1129         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1130         branch_info_): New vars.
1131         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1132         make call stubs here.
1133         (Output_data_glink): Remove all call stub handling from this class.
1134         (Target_powerpc::Scan::local, global): Save interesting branch
1135         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1136         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1137         functions on final link.
1138         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1139         Handle long branch destinations too.
1140         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1141         do_plt_address_for_local): Adjust lookup of plt call stubs.
1142
1143 2012-11-30  Alan Modra  <amodra@gmail.com>
1144
1145         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1146         relocs against protected symbols when building 32-bit shared libs.
1147
1148 2012-11-30  Alan Modra  <amodra@gmail.com>
1149
1150         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1151         param.  Call got_section() to make .got.  Update all callers
1152         and their callers and so on.
1153
1154 2012-11-30  Alan Modra  <amodra@gmail.com>
1155
1156         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1157         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1158         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1159         value if it already exists.
1160
1161 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1162
1163         PR gold/14858
1164         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1165
1166 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1167
1168         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1169         than bfc instruction for data sandboxing.
1170
1171 2012-11-08  Alan Modra  <amodra@gmail.com>
1172
1173         * po/POTFILES.in: Regenerate.
1174
1175 2012-11-05  Alan Modra  <amodra@gmail.com>
1176
1177         * configure.ac: Apply 2012-09-10 change to config.in here.
1178         * configure: Regenerate.
1179
1180 2012-11-05  Alan Modra  <amodra@gmail.com>
1181
1182         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1183         (struct Opd_ent): Use "Address" rather than "Offset".
1184         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1185         (Target_powerpc::got_section): Make public.
1186         (Target_powerpc::scan_relocs): Move code setting symbols..
1187         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1188         Create _SDA_BASE_ only when referenced.
1189
1190 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1191
1192         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1193         from last change.
1194
1195 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1196
1197         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1198         for offset_in_output_section parameter.
1199         (Sized_target::relocate_special_relocatable): Likewise.
1200         * arm.cc (Target_arm::relocate_relocs): Likewise.
1201         (Target_arm::relocate_special_relocatable): Likewise.
1202         * i386.cc (Target_i386::relocate_relocs): Likewise.
1203         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1204         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1205         * target-reloc.h (relocate_relocs): Likewise.
1206         * testsuite/testfile.cc (Target_test): Likewise.
1207         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1208         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1209
1210         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1211         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1212
1213         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1214         parameter, which is unused in the [!F_SETFD] case.
1215
1216         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1217         SYMNDX to off_t before comparing it to this->data_size().
1218         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1219         * incremental.cc (Output_section_incremental_inputs::do_write):
1220         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1221
1222         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1223
1224 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1225
1226         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1227         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1228         in EABI_VER5.
1229
1230 2012-10-29  Cary Coutant  <ccoutant@google.com>
1231
1232         * dwp.cc (usage): Add file and exit status parameters;
1233         add --help and --version options.
1234         (print_version): New function.
1235         (main): Add --help and --version options.
1236
1237 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1238
1239         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1240         final_layout_sequence.txt.
1241         * testsuite/Makefile.in: Regenerated.
1242
1243 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1244
1245         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1246         COMPILE generated by automake.
1247         (LINK1): Likewise.
1248         (CXXCOMPILE1): Likewise.
1249         (CXXLINK1): Likewise.
1250         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1251         (LINK): Likewise.
1252         (CXXCOMPILE): Likewise.
1253         (CXXLINK): Likewise.
1254         * testsuite/Makefile.in: Regenerated.
1255
1256 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1257
1258         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1259         on bad fwrite return.
1260
1261 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1262
1263         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1264         on val.
1265
1266 2012-10-23  Cary Coutant  <ccoutant@google.com>
1267
1268         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1269         * testsuite/Makefile.in: Regenerate.
1270         * testsuite/dwp_test.h: New source file.
1271         * testsuite/dwp_test_1.cc: New source file.
1272         * testsuite/dwp_test_1.s: New source file.
1273         * testsuite/dwp_test_1.sh: New source file.
1274         * testsuite/dwp_test_1b.cc: New source file.
1275         * testsuite/dwp_test_1b.s: New source file.
1276         * testsuite/dwp_test_2.cc: New source file.
1277         * testsuite/dwp_test_2.s: New source file.
1278         * testsuite/dwp_test_2.sh: New source file.
1279         * testsuite/dwp_test_main.cc: New source file.
1280         * testsuite/dwp_test_main.s: New source file.
1281
1282 2012-10-23  Cary Coutant  <ccoutant@google.com>
1283
1284         * dwp.h: New header file.
1285         * dwp.cc: New source file.
1286         * gold.h: Move shared declarations to system.h.
1287         * system.h: New header file.
1288         * Makefile.am: Add dwp.
1289         * Makefile.in: Regenerate.
1290
1291 2012-10-23  Cary Coutant  <ccoutant@google.com>
1292
1293         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1294         Dwarf_info_reader::read_from_pointer.
1295         (Dwarf_pubnames_table::read_header): Likewise.
1296         (Dwarf_pubnames_table::next_name): Likewise.
1297         (Dwarf_die::read_attributes): Likewise.
1298         (Dwarf_die::skip_attributes): Likewise.
1299         (Dwarf_info_reader::read_from_pointer): New function template.
1300         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1301         (Dwarf_pubnames_table): Likewise.
1302         (Dwarf_info_reader::read_from_pointer): New function template.
1303         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1304         Dwarf_pubnames_table ctor.
1305
1306 2012-10-23  Cary Coutant  <ccoutant@google.com>
1307
1308         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1309         abbrev_shndx.
1310         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1311         abbrev_shndx_.
1312         (Dwarf_info_reader::set_abbrev_shndx): New method.
1313         (Dwarf_info_reader::abbrev_shndx_): New data member.
1314
1315 2012-10-23  Cary Coutant  <ccoutant@google.com>
1316
1317         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1318         from object, not parameters.
1319         (Dwarf_info_reader::parse): Likewise.
1320         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1321         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1322         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1323         methods.
1324
1325 2012-10-23  Cary Coutant  <ccoutant@google.com>
1326
1327         * fileread.cc (Input_file::Input_file): New constructor.
1328         * fileread.h (class Input_file): Add new constructor.
1329
1330 2012-10-18  Alan Modra  <amodra@gmail.com>
1331
1332         PR gold/14727
1333         * object.cc (Relobj::is_section_name_included): Also match
1334         .sdata personality section.
1335
1336 2012-10-18  Alan Modra  <amodra@gmail.com>
1337
1338         * target-reloc.h (class Default_comdat_behavior): New, package up..
1339         (get_comdat_behaviour): ..this.
1340         (relocate_section): Add Relocate_comdat_behavior template arg,
1341         adjust code to suit.
1342         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1343         (Target_arm::scan_reloc_section): Likewise.
1344         * i386.cc (Target_i386::relocate_section): Likewise.
1345         * sparc.cc (Target_sparc::relocate_section): Likewise.
1346         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1347         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1348         * powerpc.cc (class Relocate_comdat_behavior): New.
1349         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1350         gold::relocate_section with new template arg.
1351
1352 2012-10-18  Alan Modra  <amodra@gmail.com>
1353
1354         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1355         dynamic relocs for GOT_TPREL got entries, without symbol if
1356         resolving locally.
1357         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1358         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1359         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1360
1361 2012-10-17  Alan Modra  <amodra@gmail.com>
1362
1363         PR gold/14726
1364         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1365
1366 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1367
1368         * layout.cc (Layout::include_section): Keep sections marked
1369         SHF_EXCLUDE when doing relocatable links.
1370
1371 2012-10-16  Alan Modra  <amodra@gmail.com>
1372
1373         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1374         (Target_powerpc::do_finalize_sections): Call it.
1375         (Output_data_save_res): New class and supporting functions.
1376         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1377         normal symbols defined in object files.
1378
1379 2012-10-12  Alan Modra  <amodra@gmail.com>
1380
1381         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1382         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1383         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1384         section if scan_opd_relocs not yet called.
1385         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1386
1387 2012-10-12  Alan Modra  <amodra@gmail.com>
1388
1389         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1390         add_local_ifunc_entry): Revert last change.
1391         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1392
1393 2012-10-05  Alan Modra  <amodra@gmail.com>
1394
1395         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1396         do_plt_address_for_global): New functions.
1397         (Output_data_got_powerpc::do_write): Don't segfault when linking
1398         statically.
1399         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1400         add_local_ifunc_entry): Return true on adding entry..
1401         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1402         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1403         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1404         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1405         set up symbols here.
1406         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1407         syms here.  Do so even when no .iplt.  Don't segfault when linking
1408         statically.
1409         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1410         new variants without reloc param.
1411         (Glink_sym_ent::Glink_sym_ent): Likewise.
1412         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1413         reloc when refs will resolve to plt call stub.
1414         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1415         R_PPC_PLTREL24 to resolve locally.
1416         (Target_powerpc::Scan::global): Correct ifunc handling.
1417         (Target_powerpc::Relocate::relocate): Correct local sym glink
1418         lookup.  Don't destroy "value" when we have a plt call stub,
1419         and when checking plt call validity.
1420         (Target_powerpc::do_dynsym_value): Simplify.
1421
1422 2012-10-05  Alan Modra  <amodra@gmail.com>
1423
1424         * i386.cc (Output_data_plt_i386::address_for_global,
1425         address_for_local): Add plt offset to returned value.  Adjust uses.
1426         * sparc.cc (Output_data_plt_sparc::address_for_global,
1427         address_for_local): Likewise.
1428         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1429         address_for_local): Likewise.
1430         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1431         address_for_local): Likewise.
1432         * target.h (Target::plt_address_for_global, plt_address_for_local):
1433         Update comment.
1434         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1435         (Output_data_got::Got_entry::write): Nor here.
1436         * output.h: Comment fix.
1437
1438 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1439
1440         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1441         global_offset_table_ value for larget got.
1442         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1443
1444 2012-09-29  Alan Modra  <amodra@gmail.com>
1445
1446         * powerpc.cc (Target_powerpc::iplt_): New output section.
1447         (Target_powerpc::iplt_section, make_iplt_section,
1448         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1449         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1450         Target_powerpc::plt_entry_count): Count iplt entries too.
1451         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1452         reloc section in constructor.  New params.
1453         (Target_powerpc::make_plt_section): Create reloc section here instead.
1454         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1455         functions.
1456         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1457         (Output_data_glink::add_entry, find_entry): New functions to
1458         deal with local syms.
1459         (Glink_sym_ent): Add support for local syms.
1460         (Output_data_glink::do_write): Handle ifunc plt entries.
1461         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1462         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1463         (Target_powerpc::Relocate::relocate): Likewise.
1464         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1465
1466 2012-09-25  Alan Modra  <amodra@gmail.com>
1467
1468         * object.h (Sized_relobj_file::adjust_local_symbol,
1469         do_adjust_local_symbol): New functions.
1470         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1471         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1472         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1473         and irregular opd entry spacing.
1474         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1475         (Global_symbol_visitor_opd): New functor.
1476         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1477         on deleted opd entries.
1478
1479 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1480
1481         * tilegx.cc: New file.
1482         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1483         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1484         * configure.tgt: Add entries for tilegx*.
1485         * configure.ac: Likewise.
1486         * Makefile.in: Rebuild.
1487         * configure: Likewise.
1488         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1489         tilegx.
1490
1491 2012-09-13  Alan Modra  <amodra@gmail.com>
1492
1493         * target-reloc.h (scan_relocs): Call scan.local for relocs
1494         against symbols in discarded sections.  Pass is_discarded
1495         param.
1496         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1497         Add is_discarded param.
1498         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1499         is_discarded to flag opd entry as discarded.  Don't emit dyn
1500         relocs on such entries.
1501         (Target_powerpc::Scan::global): Similarly detect and handle
1502         such opd entries.
1503         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1504         opd_ent_.  Update all uses.
1505         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1506         (Target_powerpc::relocate_section): Zero out discarded opd
1507         entry relocs.
1508
1509 2012-09-12  Ian Lance Taylor  <iant@google.com>
1510
1511         PR gold/14570
1512         * output.cc: Rename Output_data_got template parameter from size
1513         to got_size for all functions.  Compile all variants of
1514         Output_data_got.
1515         (Output_data_got::Got_entry::write): Correct use of size for
1516         symbol value.  Use local_is_tls rather than casting to
1517         Sized_relobj_file.
1518         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1519         (class Sized_relobj_file): Add do_local_is_tls.
1520         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1521
1522 2012-09-11  Alan Modra  <amodra@gmail.com>
1523
1524         PR gold/14566
1525         * layout.cc (Layout::set_segment_offsets): When using
1526         common-page-size alignment, ensure we are on a new max-page-size
1527         page.
1528         * output.cc (Output_segment::set_section_addresses): Use
1529         abi_pagesize, not common_pagesize for relro boundary.
1530         (Output_segment::set_offset): Likewise.
1531
1532 2012-09-11  Alan Modra  <amodra@gmail.com>
1533
1534         * output.h (Output_data_got::add_global_tls, add_local_tls,
1535         add_local_tls_pair): New functions.
1536         (Output_data_got::add_local_pair_with_rel): Remove second
1537         reloc param.  Expand comment.
1538         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1539         use_plt_or_tls_offset_, similarly for constructor param.
1540         (Output_data_got::Got_entry::write): Add got_index param.
1541         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1542         add_local_tls_pair): New functions.
1543         (Output_data_got::Got_entry::write): Handle tls symbols
1544         with use_plt_or_tls_offset_ set specially.
1545         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1546         (Output_data_got::do_write): Replace iterator with index, pass
1547         index to entry write function.
1548         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1549         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1550         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1551         call.
1552         * i386.cc (Target_i386::Scan::local): Likewise.
1553         * sparc.cc (Target_sparc::Scan::local): Likewise.
1554         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1555         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1556         do_tls_offset_for_global): New functions.
1557         (Target_powerpc::Scan::local): Correct TLS relocations and got
1558         entry values.
1559         (Target_powerpc::Scan::global): Don't emit unnecessary
1560         dynamic relocations on TLS GOT entries.
1561
1562 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1563
1564         * config.in: Disable sanity check for kfreebsd.
1565
1566 2012-09-10  Sterling Augustine  <saugustine@google.com>
1567
1568         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1569         (Gdb_index::pubtypes_read): New parameter.
1570         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1571         to calls.
1572         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1573         pubtypes_object_.
1574
1575 2012-09-09  Alan Modra  <amodra@gmail.com>
1576
1577         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1578         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1579         * gc.h (gc_process_relocs): Call target gc_add_reference.
1580         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1581         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1582         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1583         unnecessary cast.
1584         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1585         to cater for when we don't need code offset.  Update use.
1586         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1587         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1588         set_opd_valid): New functions.
1589         (Target_powerpc::do_gc_add_reference): New function.
1590         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1591         stashed refs.
1592         (Target_powerpc::do_gc_mark_symbol): New function.
1593
1594 2012-09-06  Cary Coutant  <ccoutant@google.com>
1595
1596         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1597         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1598         (Dwarf_die::skip_attributes): Likewise.
1599         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1600         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1601         (main): Call it.
1602         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1603
1604 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1605
1606         * testsuite/script_test_3.t: Add .got.plt output section
1607         statement.
1608         * testsuite/script_test_4.t: Likewise.
1609
1610 2012-09-05  Alan Modra  <amodra@gmail.com>
1611
1612         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1613         update all uses and lose "enum" when using type.
1614
1615 2012-09-05  Alan Modra  <amodra@gmail.com>
1616
1617         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1618         * configure: Regenerate.
1619         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1620         (plugin_final_layout.stdout): Likewise.
1621         (memory_test): Set page sizes to 0x1000.
1622         * testsuite/Makefile.in: Regenerate.
1623         * testsuite/discard_locals_test.sh: Add FIXME comment.
1624         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1625         * testsuite/pr14265.t: Add .got output section statement.
1626         * testsuite/script_test_2.t: Likewise.
1627         * testsuite/script_test_3.t: Likewise.
1628         * testsuite/script_test_4.t: Likewise.
1629         * testsuite/script_test_5.t: Likewise.
1630         * testsuite/script_test_6.t: Likewise.
1631         * testsuite/script_test_7.t: Likewise.
1632         * testsuite/script_test_9.t: Likewise.
1633
1634 2012-09-05  Alan Modra  <amodra@gmail.com>
1635
1636         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1637         (Powerpc_relocate_functions::Status): New typedef.
1638         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1639         (Target_powerpc::Scan::local): Handle REL64.
1640         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1641         for REL32 and REL64.
1642         (Target_powerpc::symval_for_branch): New function, extracted from..
1643         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1644         checks.  Report overflow errors.
1645
1646 2012-09-05  Alan Modra  <amodra@gmail.com>
1647
1648         * object.h (Sized_relobj_file::emit_relocs): Delete.
1649         (Sized_relobj_file::emit_relocs_reltype): Delete.
1650         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1651         relocate_relocs for --emit-relocs.
1652         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1653         * output.h: Update comment.
1654         (Output_segment::first_section): New function.
1655         (Output_segment::first_section_load_address): Use first_section.
1656         * output.cc (Output_segment::first_section): New function extracted..
1657         (Output_segment::first_section_load_address): ..from here.  Delete.
1658         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1659         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1660         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1661         adjust call to target.h function.
1662         * i386.cc (Target_i386): Likewise.
1663         * sparc.cc (Target_sparc): Likewise.
1664         * x86_64.cc (Target_x86_64): Likewise.
1665         * powerpc.cc (Target_powerpc): Likewise.
1666         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1667         first tls section has section symbol for optimised local dynamic
1668         output relocs.
1669         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1670         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1671         optimised tls code.
1672         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1673         Rename to relocate_relocs.  Update error message.
1674
1675 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1676
1677         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1678         --just-symbols.
1679
1680 2012-08-31  Alan Modra  <amodra@gmail.com>
1681
1682         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1683         (Powerpc_relobj::toc_base_offset): New stub function.
1684         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1685         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1686         (Target_powerpc::Relocate::enum skip_tls): New.
1687         (Target_powerpc::call_tls_get_addr_): New var.
1688         (Target_powerpc::is_branch_reloc): Move to file scope.
1689         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1690         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1691         New functions.
1692         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1693         (powerpc_info): Correct common_pagesize for ppc64.
1694         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1695         (Powerpc_relocate_functions): Add overflow check enums and functions.
1696         Add non-shift version of rela, rela_ua.  Delete all rel public
1697         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1698         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1699         addr16_ha3, addr14 functions.
1700         (Output_data_got_powerpc::add_constant_pair): New function.
1701         (Output_data_got_powerpc::got_base_offset): Likewise.
1702         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1703         (instruction constants): Sort, add some more.
1704         (Output_data_glink::do_write): Add and use Address typedef.  Use
1705         object->toc_base_offset() stub for 64-bit.
1706         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1707         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1708         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1709         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1710         Always treat .opd relocs as against locally defined symbol.
1711         Correct condition for RELATIVE relocs.
1712         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1713         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1714         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1715         calculations.  Handle TLS relocs, and more.  Add overflow
1716         checking and adjust for Powerpc_relocate_functions changes.
1717         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1718         Reinstate --emit-relocs code with FIXME.
1719
1720 2012-08-30  Alan Modra  <amodra@gmail.com>
1721
1722         * layout.cc (Layout::set_segment_offsets): Set p_align to
1723         abi_pagesize, not common_pagesize.
1724         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1725         to determine whether file header can go in segment.
1726
1727 2012-08-30  Alan Modra  <amodra@gmail.com>
1728
1729         * output.h (Output_reloc::Output_reloc <output section>): Add
1730         is_relative param.  Adjust calls.
1731         (Output_reloc::add_output_section_relative): New functions.
1732         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1733         is_relative.
1734         (Output_reloc::symbol_value): Handle SECTION_CODE.
1735
1736 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1737
1738         * gold.cc (queue_middle_tasks): Call layout again when unique
1739         segments for sections is desired.
1740         * layout.cc (Layout::Layout): Initialize new members.
1741         (Layout::get_output_section_flags): New function.
1742         (Layout::choose_output_section): Call get_output_section_flags.
1743         (Layout::layout): Make output section for mapping to a unique segment.
1744         (Layout::insert_section_segment_map): New function.
1745         (Layout::attach_allocated_section_to_segment): Make unique segment for
1746         output sections marked so.
1747         (Layout::segment_precedes): Check for unique segments when sorting.
1748         * layout.h (Layout::Unique_segment_info): New struct.
1749         (Layout::Section_segment_map): New typedef.
1750         (Layout::insert_section_segment_map): New function.
1751         (Layout::get_output_section_flags): New function.
1752         (Layout::is_unique_segment_for_sections_specified): New function.
1753         (Layout::set_unique_segment_for_sections_specified): New function.
1754         (Layout::unique_segment_for_sections_specified_): New member.
1755         (Layout::section_segment_map_): New member.
1756         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1757         Rename is_gc_pass_one to is_pass_one.
1758         Rename is_gc_pass_two to is_pass_two.
1759         Rename is_gc_or_icf to is_two_pass.
1760         Check for which pass based on whether symbols data is present.
1761         Make it two pass when unique segments for sections is desired.
1762         * output.cc (Output_section::Output_section): Initialize new
1763         members.
1764         * output.h (Output_section::is_unique_segment): New function.
1765         (Output_section::set_is_unique_segment): New function.
1766         (Output_section::is_unique_segment_): New member.
1767         (Output_section::extra_segment_flags): New function.
1768         (Output_section::set_extra_segment_flags): New function.
1769         (Output_section::extra_segment_flags_): New member.
1770         (Output_section::segment_alignment): New function.
1771         (Output_section::set_segment_alignment): New function.
1772         (Output_section::segment_alignment_): New member.
1773         (Output_segment::Output_segment): Initialize is_unique_segment_.
1774         (Output_segment::is_unique_segment): New function.
1775         (Output_segment::set_is_unique_segment): New function.
1776         (Output_segment::is_unique_segment_): New member.
1777         * plugin.cc (allow_unique_segment_for_sections): New function.
1778         (unique_segment_for_sections): New function.
1779         (Plugin::load): Add new functions to transfer vector.
1780         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1781         * Makefile.in: Regenerate.
1782         * testsuite/plugin_final_layout.sh: Check if unique segment
1783         functionality works.
1784         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1785         are available.
1786         (allow_unique_segment_for_sections): New global.
1787         (unique_segment_for_sections): New global.
1788         (claim_file_hook): Call allow_unique_segment_for_sections.
1789         (all_symbols_read_hook): Call unique_segment_for_sections.
1790
1791 2012-08-22  Cary Coutant  <ccoutant@google.com>
1792
1793         * layout.cc (Layout::include_section): Don't assert on GROUP
1794         sections with --emit-relocs.
1795
1796 2012-08-21  Cary Coutant  <ccoutant@google.com>
1797
1798         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1799         if --export-dynamic-symbol names an undef symbol.
1800
1801 2012-08-18  Alan Modra  <amodra@gmail.com>
1802
1803         * powerpc.cc: Formatting and white space.
1804         (Powerpc_relobj): Rename got2_section_ to special_.
1805         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1806         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1807         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1808         (Target_powerpc): Add Address typedef and invalid_address.  Use
1809         throughout.
1810         (Target_powerpc::is_branch_reloc): New function.
1811         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1812         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1813         for dst_mask, value and addend.
1814         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1815         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1816         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1817         uint16_t for 24-bit offset.  Use get_output_section_offset and
1818         check return.
1819         (Target_powerpc::Scan::local): Handle more relocs.
1820         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1821         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1822         Plug in toc restoring insn after plt calls.  Translate branches
1823         to function descriptor symbols to corresponding entry point.
1824         (Target_powerpc::relocate_for_relocatable): Check return from
1825         get_output_section_offset.
1826         * symtab.h: Comment typo.
1827
1828 2012-08-14  Ian Lance Taylor  <iant@google.com>
1829
1830         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1831         unsupported_relocal_local to call unsupported_reloc_global.
1832
1833 2012-08-14  Nick Clifton  <nickc@redhat.com>
1834
1835         PR ld/14265
1836         * script-sections.cc (Sections_element::output_section_name): Add
1837         keep return parameter.
1838         (Output_section_element::match_name): Add keep return parameter.
1839         Return the value of the keep_ member.
1840         * script-sections.h (class Output_section): Update
1841         output_section_name prototype.
1842         * layout.cc (Layout::keep_input_section): New public member
1843         function.
1844         (Layout::choose_output_section): Pass keep parameter to
1845         output_section_name.
1846         * layout.h (class Layout): Add keep_input_section.
1847         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1848         sections.
1849         * testsuite/Makefile.am: Add a test.
1850         * testsuite/Makefile.in: Regenerate.
1851         * testsuite/pr14265.c: Source file for the test.
1852         * testsuite/pr14265.t: Linker script for the test.
1853         * testsuite/pr14265.sh: Shell script for the test.
1854
1855 2012-08-14  Alan Modra  <amodra@gmail.com>
1856
1857         * target.h (Target::output_section_name): New function.
1858         (Target::do_output_section_name): New function.
1859         * layout.cc (Layout::choose_output_section): Call the above.
1860         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1861
1862 2012-08-14  Alan Modra  <amodra@gmail.com>
1863
1864         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1865         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1866         for replace_constant call.
1867         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1868         (Output_data_glink::do_print_to_mapfile): New function.
1869         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1870         (Target_powerpc::Relocate::relocate): Likewise.
1871
1872 2012-08-14  Alan Modra  <amodra@gmail.com>
1873
1874         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1875         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1876         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1877         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1878         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1879         here.
1880         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1881         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1882         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1883         here.
1884         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1885         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1886
1887 2012-08-12  Alan Modra  <amodra@gmail.com>
1888
1889         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1890         (glink insn constants): Use uint32_t.
1891         (Output_data_glink::add_entry): Use insert, not [] operator.
1892
1893 2012-08-11  Alan Modra  <amodra@gmail.com>
1894
1895         * object.h (Sized_relobj_file::find_shdr): New function.
1896         (Sized_relobj_file::find_special_sections): New function.
1897         * object.cc (Sized_relobj_file::find_shdr): New function.
1898         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1899         (Sized_relobj_file::find_special_sections): New function, split out..
1900         (Sized_relobj_file::do_read_symbols): ..from here.
1901         * output.h (Output_data_got::replace_constant): New function.
1902         (Output_data_got::num_entries): New function.
1903         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1904         (Output_data_got::got_offset): Protected rather than private.
1905         (Output_data_got::replace_got_entry): New function.
1906         * output.cc (Output_data_got::replace_got_entry): New function.
1907         * powerpc.cc (class Powerpc_relobj): New.
1908         (class Powerpc_relocate_functions): Delete all psymval variants or
1909         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1910         Implement _ha functions using corresponding _hi function.
1911         (Powerpc_relobj::find_special_sections): New function.
1912         (Target_powerpc::do_make_elf_object): New function.
1913         (class Output_data_got_powerpc): New.
1914         (class Output_data_glink): New.
1915         (class Powerpc_scan_relocatable_reloc): New.
1916         Many more changes througout file.
1917
1918 2012-08-09  Nick Clifton  <nickc@redhat.com>
1919
1920         * po/vi.po: Updated Vietnamese translation.
1921
1922 2012-08-07  Ian Lance Taylor  <iant@google.com>
1923
1924         * layout.cc (Layout::add_target_dynamic_tags): If
1925         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1926         plt_rel.
1927
1928 2012-07-30  Nick Clifton  <nickc@redhat.com>
1929
1930         * po/gold.pot: Updated template.
1931         * po/es.po: Updated Spanish translation.
1932
1933 2012-07-18  Cary Coutant  <ccoutant@google.com>
1934
1935         PR gold/14344
1936         * configure.ac: Add check for -gpubnames support.
1937         * configure: Regenerate.
1938         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1939         support; force -gno-pubnames.
1940         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1941         support.
1942         (gdb_index_test_4): New test.
1943         * testsuite/Makefile.in: Regenerate.
1944         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1945         * testsuite/gdb_index_test_2.sh: Likewise.
1946         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1947         * testsuite/gdb_index_test_4.sh: New script.
1948         * testsuite/gdb_index_test_comm.sh: New script with common code;
1949         don't look for space after colon.
1950
1951 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1952
1953         * gold.cc (queue_middle_tasks): Update function order only after
1954         deferred objects due to plugins are processed.
1955
1956 2012-07-11  Ian Lance Taylor  <iant@google.com>
1957
1958         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1959         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1960         (Target_arm::scan_reloc_for_stub): Likewise.
1961         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1962         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1963         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1964         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1965         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1966
1967 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1968             Ian Lance Taylor  <iant@google.com>
1969
1970         PR gold/14309
1971         * configure.ac: Test whether std::tr1::hash<off_t> works.
1972         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1973         needed.
1974         * output.h (class Output_fill): Add virtual destructor.
1975         * configure, config.in: Rebuild.
1976
1977 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1978
1979         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1980
1981 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1982
1983         * plugin.cc (Plugin::load): Handle position independent executables.
1984
1985 2012-06-06  Cary Coutant  <ccoutant@google.com>
1986
1987         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1988         add .debug_macro.
1989         (lines_only_debug_sections): Likewise.
1990         (gdb_fast_lookup_sections): New static array.
1991         (is_gdb_debug_section): Rename formal parameter.
1992         (is_lines_only_debug_section): Likewise.
1993         (is_gdb_fast_lookup_section): New function.
1994         (Layout::include_section): Check for ".zdebug_" prefix; pass
1995         section name suffix to is_gdb_debug_section, et al.; check for
1996         fast-lookup sections when building .gdb_index.
1997         * options.h (--strip-debug-gdb): Update GDB version number.
1998
1999 2012-06-06  Cary Coutant  <ccoutant@google.com>
2000
2001         * configure.ac: Add check for fallocate.
2002         * configure: Regenerate.
2003         * config.in: Regenerate.
2004
2005         * options.h (class General_options): Add --mmap-output-file and
2006         --posix-fallocate options.
2007         * output.cc: (posix_fallocate): Remove; replace with...
2008         (gold_fallocate): New function.
2009         (Output_file::map_no_anonymous): Call gold_fallocate.
2010         (Output_file::map): Check --mmap-output-file option.
2011
2012 2012-06-05  Jing Yu  <jingyu@google.com>
2013
2014         * gold.h (textdomain): Add do {} to empty while(0).
2015         (bindtextdomain): Likewise.
2016
2017 2012-06-04  Cary Coutant  <ccoutant@google.com>
2018
2019         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2020         has_dynsym_index.
2021
2022 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2023
2024         * symtab.cc (Symbol_table::define_special_symbol):
2025         Initialize *poldsym to prevent uninitialized variable errors.
2026
2027 2012-05-23  Cary Coutant  <ccoutant@google.com>
2028
2029         * layout.cc (Layout::section_name_mapping): Add rules to handle
2030         exact match on .data.rel.ro.local or .data.rel.ro.
2031         (Layout::output_section_name): Check for exact matches.
2032
2033 2012-05-23  Cary Coutant  <ccoutant@google.com>
2034
2035         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2036         more carefully.
2037
2038 2012-05-22  Cary Coutant  <ccoutant@google.com>
2039
2040         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2041         object before exporting symbol.
2042
2043 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2044
2045         * testsuite/tls_test.cc: Include "config.h" first.
2046         * testsuite/tls_test_c.c: Likewise.
2047
2048 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2049             Nick Clifton  <nickc@redhat.com>
2050
2051         PR 14072
2052         * configure.in: Add check that sysdep.h has been included before
2053         any system header files.
2054         * configure: Regenerate.
2055         * config.in: Regenerate.
2056
2057 2012-05-14  Cary Coutant  <ccoutant@google.com>
2058
2059         * layout.cc (Layout::make_output_section): Mark .tdata section
2060         as RELRO.
2061         * testsuite/relro_test.cc: Add a TLS variable.
2062
2063 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2064
2065         PR gold/14091
2066         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2067         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2068         R_X86_64_64.
2069
2070 2012-05-08  Cary Coutant  <ccoutant@google.com>
2071
2072         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2073         (lines_only_debug_sections): Likewise.
2074
2075 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2076
2077         * nacl.cc: New file.
2078         * nacl.h: New file.
2079         * Makefile.am (CCFILES, HFILES): Add them.
2080         * Makefile.in: Regenerate.
2081         * i386.cc (Output_data_plt_i386_nacl): New class.
2082         (Output_data_plt_i386_nacl_exec): New class.
2083         (Output_data_plt_i386_nacl_dyn): New class.
2084         (Target_i386_nacl): New class.
2085         (Target_selector_i386_nacl): New class.
2086         (target_selector_i386): Use it instead of Target_selector_i386.
2087         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2088         (Target_x86_64_nacl): New class.
2089         (Target_selector_x86_64_nacl): New class.
2090         (target_selector_x86_64, target_selector_x32): Use it instead of
2091         Target_selector_x86_64.
2092         * arm.cc (Output_data_plt_arm_nacl): New class.
2093         (Target_arm_nacl): New class.
2094         (Target_selector_arm_nacl): New class.
2095         (target_selector_arm, target_selector_armbe): Use it instead of
2096         Target_selector_arm.
2097
2098         * target-select.cc (select_target): Take new Input_file* and off_t
2099         arguments, pass them on to recognize method of selector.
2100         * object.cc (make_elf_sized_object): Update caller.
2101         * parameters.cc (parameters_force_valid_target): Likewise.
2102         * incremental.cc (make_sized_incremental_binary): Likewise.
2103         * target-select.h: Update decl.
2104         (Target_selector::recognize): Take new Input_file* argument,
2105         pass it on to do_recognize.
2106         (Target_selector::do_recognize): Take new Input_file* argument.
2107         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2108         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2109         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2110         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2111
2112         * target.h (Target::Target_info): New members isolate_execinstr
2113         and rosegment_gap.
2114         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2115         * arm.cc (Target_arm::arm_info): Update initializer.
2116         * i386.cc (Target_i386::i386_info): Likewise.
2117         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2118         * sparc.cc (Target_sparc::sparc_info): Likewise.
2119         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2120         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2121         * layout.cc (Layout::attach_allocated_section_to_segment):
2122         Take new const Target* argument.  If target->isolate_execinstr(), act
2123         like --rosegment.
2124         (Layout::find_first_load_seg): Take new const Target* argument;
2125         if target->isolate_execinstr(), reject PF_X segments.
2126         (Layout::relaxation_loop_body): Update caller.
2127         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2128         reset file offset to zero when we hit LOAD_SEG, and then do a second
2129         loop over the segments before LOAD_SEG to reassign offsets after
2130         addresses have been determined.  Handle target->rosegment_gap().
2131         (Layout::attach_section_to_segment): Take new const Target* argument;
2132         pass it to attach_allocated_section_to_segment.
2133         (Layout::make_output_section): Update caller.
2134         (Layout::attach_sections_to_segments): Take new const Target* argument;
2135         pass it to attach_section_to_segment.
2136         * gold.cc (queue_middle_tasks): Update caller.
2137         * layout.h (Layout): Update method decls with new arguments.
2138
2139         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2140         Target_info pointer to use.
2141         (Target_arm::do_make_data_plt): New virtual method.
2142         (Target_arm::make_data_plt): New method that calls it.
2143         (Target_arm::make_plt_entry): Use it.
2144         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2145         for the section alignment.
2146         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2147         method.
2148         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2149         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2150         method.
2151         (Output_data_plt_arm::get_plt_entry_size): Call it.
2152         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2153         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2154         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2155         method.
2156         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2157         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2158         method instead of sizeof(plt_entry).
2159         (Output_data_plt_arm::add_entry): Likewise.
2160         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2161         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2162         than static method.
2163         (Target_arm::plt_entry_size): Likewise.
2164         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2165         Move to ...
2166         (Output_data_plt_arm_standard): ... here, new class.
2167         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2168         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2169         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2170
2171         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2172         Take additional argument for the PLT entry size.
2173         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2174         Use get_plt_entry_size method rather than plt_entry_size variable.
2175         (Output_data_plt_x86_64::reserve_slot): Likewise.
2176         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2177         (Output_data_plt_x86_64::add_entry): Likewise.
2178         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2179         (Output_data_plt_x86_64::address_for_global): Likewise.
2180         (Output_data_plt_x86_64::address_for_local): Likewise.
2181         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2182         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2183         Make method non-static.
2184         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2185         method.
2186         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2187         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2188         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2189         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2190         virtual method.
2191         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2192         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2193         virtual method.
2194         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2195         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2196         virtual method.
2197         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2198         (Output_data_plt_x86_64::plt_entry_size)
2199         (Output_data_plt_x86_64::first_plt_entry)
2200         (Output_data_plt_x86_64::plt_entry)
2201         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2202         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2203         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2204         (Output_data_plt_x86_64_standard): ... here, new class.
2205         (Target_x86_64::Target_x86_64): Take optional argument for the
2206         Target_info pointer to use.
2207         (Target_x86_64::do_make_data_plt): New virtual method.
2208         (Target_x86_64::make_data_plt): New method to call it.
2209         (Target_x86_64::init_got_plt_for_update): Use that.
2210         Call this->plt_->add_eh_frame method here.
2211         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2212         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2213         rather than static method.
2214         (Target_x86_64::plt_entry_size): Likewise.
2215         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2216         rather than plt_entry_size variable.  Move guts of PLT filling to...
2217         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2218         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2219         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2220
2221         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2222         additional argument for the section alignment.
2223         Don't do add_eh_frame_for_plt here.
2224         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2225         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2226         variable.
2227         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2228         method.
2229         (Output_data_plt_i386::get_plt_entry_size): Call it.
2230         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2231         (Output_data_plt_i386::add_eh_frame): New method to call it.
2232         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2233         method.
2234         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2235         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2236         method.
2237         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2238         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2239         method instead of plt_entry_size.
2240         (Output_data_plt_i386::plt_entry_size)
2241         (Output_data_plt_i386::plt_eh_frame_fde_size)
2242         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2243         (Output_data_plt_i386_standard): ... here, new class.
2244         (Output_data_plt_i386_exec): New class.
2245         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2246         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2247         (Output_data_plt_i386::exec_plt_entry): Move to ...
2248         (Output_data_plt_i386_exec::plt_entry): ... here.
2249         (Output_data_plt_i386_dyn): New class.
2250         (Output_data_plt_i386::first_plt_entry): Move to ...
2251         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2252         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2253         (Output_data_plt_i386_dyn::plt_entry): ... here.
2254         (Target_i386::Target_i386): Take optional argument for the Target_info
2255         pointer to use.
2256         (Target_i386::do_make_data_plt): New virtual method.
2257         (Target_i386::make_data_plt): New method to call it.
2258         (Target_i386::make_plt_section): Use that.
2259         Call this->plt_->add_eh_frame method here.
2260         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2261         rather than plt_entry_size variable.
2262         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2263         (Output_data_plt_i386::address_for_local): Likewise.
2264         (Output_data_plt_i386::do_write): Likewise.
2265         Move guts of PLT filling to...
2266         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2267         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2268         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2269         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2270
2271 2012-05-01  Cary Coutant  <ccoutant@google.com>
2272
2273         * dwarf_reader.cc (Dwarf_die::read_attributes)
2274         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2275         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2276         * reduced_debug_output.cc
2277         (Output_reduced_debug_info_section::get_die_end): Remove
2278         DW_FORM_GNU_ref_index.  Add default case.
2279
2280 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2281
2282         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2283         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2284         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2285         DW_AT_high_pc as offset from DW_AT_low_pc.
2286
2287         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2288         * testsuite/Makefile.in: Regenerate.
2289         * testsuite/gdb_index_test_3.c: New test source file.
2290         * testsuite/gdb_index_test_3.sh: New test source file.
2291
2292 2012-04-25  Ian Lance Taylor  <iant@google.com>
2293
2294         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2295         pointer.
2296         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2297         as a class, not a struct.
2298         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2299         (Target_arm::apply_cortex_a8_workaround): Likewise.
2300         * gc.h: Declare Reloc_types as a struct, not a class.
2301         * object.h: Declare Symbols_data as a struct.
2302         * reloc.h: Declare Read_relocs_data as a struct.
2303         * target.h: Declare Relocate_info as a struct.
2304
2305 2012-04-24  David S. Miller  <davem@davemloft.net>
2306
2307         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2308         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2309         and R_SPARC_WPLT30.
2310
2311 2012-04-24  Cary Coutant  <ccoutant@google.com>
2312
2313         * incremental-dump.cc (find_input_containing_global): Replace
2314         magic number with symbolic constant.
2315         (dump_incremental_inputs): Update version number.
2316         * incremental.cc (Output_section_incremental_inputs): Update version
2317         number; import symbolic constants from Incremental_inputs_reader.
2318         (Incremental_inputs::create_data_sections): Align relocations
2319         section correctly for 64-bit targets.
2320         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2321         constants; add padding.
2322         (Output_section_incremental_inputs::write_header): Add assert for
2323         header_size.
2324         (Output_section_incremental_inputs::write_input_files): Add assert
2325         for input_entry_size.
2326         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2327         add assert for object_info_size, input_section_entry_size,
2328         global_sym_entry_size.
2329         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2330         for data structure sizes; use them.
2331         (Incremental_input_entry_reader): Import symbolic constants from
2332         Incremental_inputs_reader; use them.
2333
2334 2012-04-23  David S. Miller  <davem@davemloft.net>
2335
2336         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2337         and elf_flags_set_.
2338         (Target_sparc::Target_sparc): Initialize new fields.
2339         (Target_sparc::do_make_elf_object): New function.
2340         (Target_sparc::do_adjust_elf_header): New function.
2341
2342 2012-04-23  Cary Coutant  <ccoutant@google.com>
2343
2344         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2345         CU range table of gdb index.
2346
2347 2012-04-20  David S. Miller  <davem@davemloft.net>
2348
2349         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2350         instead of false.
2351
2352 2012-04-16  David S. Miller  <davem@davemloft.net>
2353
2354         * sparc.cc (Target_sparc::got_address): New function.
2355         (Sparc_relocate_functions::gdop_hix22): New function.
2356         (Sparc_relocate_functions::gdop_lox10): New function.
2357         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2358         relocs.
2359         (Target_sparc::Scan::local): Likewise if the global symbol is not
2360         preemptible and is not IFUNC.
2361         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2362         transformations for local and non-preemptible non-IFUNC global
2363         symbols.
2364
2365         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2366         writing out 64-bit part of ranges.
2367
2368         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2369         -fpic and -fpie respectively.
2370         * Makefile.in: Regenerate.
2371
2372         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2373         (Target_sparc::Target_sparc): Initialize new field.
2374         (Target_sparc::do_plt_section_for_global): New function.
2375         (Target_sparc::do_plt_section_for_local): New function.
2376         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2377         (Target_sparc::make_plt_section): New function, broken out of
2378         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2379         (Target_sparc::make_plt_entry): Call make_plt_section.
2380         (Target_sparc::make_local_ifunc_plt_entry): New function.
2381         (Target_sparc::rela_ifunc_section): New function.
2382         (Target_sparc::plt_section): Remove const.
2383         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2384         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2385         and ifunc_count_ fields.
2386         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2387         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2388         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2389         (Output_data_plt_sparc::rela_ifunc): New function.
2390         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2391         (Output_data_plt_sparc::has_ifunc_section): New function.
2392         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2393         (Output_data_plt_sparc::address_for_global): New function.
2394         (Output_data_plt_sparc::address_for_local): New function.
2395         (Output_data_plt_sparc::plt_index_to_offset): New function.
2396         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2397         and entry_count.
2398         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2399         entry_count.
2400         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2401         R_SPARC_JMP_IREL to switch.
2402         (Target_sparc::Scan::check_non_pic): Likewise.
2403         (Target_sparc::Scan::local): Handle IFUNC symbols.
2404         (Target_sparc::Scan::local): Likewise.
2405         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2406         and plt_address_for_local.
2407         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2408         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2409
2410         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2411         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2412         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2413         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2414         global relocs too.
2415         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2416         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2417         calls.
2418         * sparc.cc (Target_sparc::Scan::global): Likewise.
2419         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2420
2421 2012-04-16  Cary Coutant  <ccoutant@google.com>
2422
2423         * archive.cc (Library_base::should_include_member): Check for
2424         --export-dynamic-symbol.
2425         * options.h (class General_options): Add --export-dynamic-symbol.
2426         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2427         --export-dynamic-symbol.
2428         (Symbol_table::gc_mark_undef_symbols): Likewise.
2429         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2430
2431 2012-04-12  David S. Miller  <davem@davemloft.net>
2432
2433         * sparc.cc (Reloc::wdisp10): New relocation method.
2434         (Reloc::h34): Likewise.
2435         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2436         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2437         R_SPARC_WDISP10.
2438         (Target_sparc::Scan::local): Likewise.
2439         (Target_sparc::Scan::global): Likewise.
2440         (Target_sparc::Relocate::relocate): Likewise.
2441
2442 2012-04-09  Cary Coutant  <ccoutant@google.com>
2443
2444         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2445         low_pc == 0.
2446
2447 2012-04-06  Ian Lance Taylor  <iant@google.com>
2448
2449         * timer.cc: #include <unistd.h>.
2450
2451 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2452
2453         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2454         * config.in: Regenerate.
2455         * configure: Regenerate.
2456
2457 2012-04-05  Nick Clifton  <nickc@redhat.com>
2458
2459         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2460         (AM_LC_MESSAGES): Add.
2461         * aclocal.m4: Regenerate.
2462         * config.in: Regenerate.
2463         * configure: Regenerate.
2464
2465 2012-03-21  Cary Coutant  <ccoutant@google.com>
2466
2467         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2468         * Makefile.in: Regenerate.
2469         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2470         (Sized_elf_reloc_mapper::symbol_section): New function.
2471         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2472         (make_elf_reloc_mapper): New function.
2473         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2474         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2475         (Dwarf_abbrev_table::do_get_abbrev): New function.
2476         (Dwarf_ranges_table::read_ranges_table): New function.
2477         (Dwarf_ranges_table::read_range_list): New function.
2478         (Dwarf_pubnames_table::read_section): New function.
2479         (Dwarf_pubnames_table::read_header): New function.
2480         (Dwarf_pubnames_table::next_name): New function.
2481         (Dwarf_die::Dwarf_die): New function.
2482         (Dwarf_die::read_attributes): New function.
2483         (Dwarf_die::skip_attributes): New function.
2484         (Dwarf_die::set_name): New function.
2485         (Dwarf_die::set_linkage_name): New function.
2486         (Dwarf_die::attribute): New function.
2487         (Dwarf_die::string_attribute): New function.
2488         (Dwarf_die::int_attribute): New function.
2489         (Dwarf_die::uint_attribute): New function.
2490         (Dwarf_die::ref_attribute): New function.
2491         (Dwarf_die::child_offset): New function.
2492         (Dwarf_die::sibling_offset): New function.
2493         (Dwarf_info_reader::check_buffer): New function.
2494         (Dwarf_info_reader::parse): New function.
2495         (Dwarf_info_reader::do_parse): New function.
2496         (Dwarf_info_reader::do_read_string_table): New function.
2497         (Dwarf_info_reader::lookup_reloc): New function.
2498         (Dwarf_info_reader::get_string): New function.
2499         (Dwarf_info_reader::visit_compilation_unit): New function.
2500         (Dwarf_info_reader::visit_type_unit): New function.
2501         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2502         Sized_elf_reloc_mapper.
2503         (Sized_dwarf_line_info::symbol_section): Remove function.
2504         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2505         (Sized_dwarf_line_info::read_line_mappings): Remove object
2506         parameter, adjust callers.
2507         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2508         * dwarf_reader.h: Include <sys/types.h>.
2509         (class Track_relocs): Remove forward declaration.
2510         (class Elf_reloc_mapper): New class.
2511         (class Sized_elf_reloc_mapper): New class.
2512         (class Dwarf_abbrev_table): New class.
2513         (class Dwarf_range_list): New class.
2514         (class Dwarf_ranges_table): New class.
2515         (class Dwarf_pubnames_table): New class.
2516         (class Dwarf_die): New class.
2517         (class Dwarf_info_reader): New class.
2518         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2519         (Sized_dwarf_line_info::symbol_section): Remove member function.
2520         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2521         base class.
2522         * gdb-index.cc: New source file.
2523         * gdb-index.h: New source file.
2524         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2525         and .debug_types sections, call Layout::add_to_gdb_index.
2526         (Sized_relobj_incr::do_section_name): Implement.
2527         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2528         return type; Implement.
2529         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2530         return type.
2531         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2532         parameter list and return type.
2533         (Sized_incr_dynobj::do_section_contents): Likewise.
2534         * layout.cc: Include gdb-index.h.
2535         (Layout::Layout): Initialize gdb_index_data_.
2536         (Layout::init_fixed_output_section): Check for .gdb_index section.
2537         (Layout::add_to_gdb_index): New function. Instantiate.
2538         * layout.h: Add forward declaration for class Gdb_index.
2539         (Layout::add_to_gdb_index): New member function.
2540         (Layout::gdb_index_data_): New data member.
2541         * main.cc: Include gdb-index.h.
2542         (main): Print statistics for gdb index.
2543         * object.cc (Object::section_contents): Move code into
2544         do_section_contents.
2545         (need_decompressed_section): Check for sections needed when building
2546         gdb index.
2547         (build_compressed_section_map): Likewise.
2548         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2549         gdb index.
2550         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2551         sections; call Layout::add_to_gdb_index.
2552         (Sized_relobj_file::do_decompressed_section_contents): Call
2553         do_section_contents directly.
2554         * object.h (Object::do_section_contents): Adjust parameter list and
2555         return type.
2556         (Object::do_decompressed_section_contents): Call do_section_contents
2557         directly.
2558         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2559         return type.
2560         * options.h (class General_options): Add --gdb-index option.
2561         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2562         list and return type.
2563         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2564         * reloc.h (Track_relocs::checkpoint): New function.
2565         (Track_relocs::reset): New function.
2566
2567         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2568         New test cases.
2569         * testsuite/Makefile.in: Regenerate.
2570         * testsuite/gdb_index_test.cc: New test source file.
2571         * testsuite/gdb_index_test_1.sh: New test source file.
2572         * testsuite/gdb_index_test_2.sh: New test source file.
2573
2574 2012-03-19  Doug Kwan  <dougkwan@google.com>
2575
2576         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2577         (Target_arm::do_finalize_sections): Remove code which defines
2578         __exidx_start and __exidx_end.  Make symbol table parameter
2579         anonymous as it is not used.
2580         * gold.cc (queue_middle_tasks): Call target hook to define any
2581         target-specific symbols.
2582         * target.h (Target::define_standard_symbols): New method.
2583         (Target::do_define_standard_symbols): Same.
2584         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2585         * testsuite/Makefile.in: Regenerate.
2586         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2587         and __exidx_end.
2588         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2589         relocations are generated for __exidx_start and __exidx_end.
2590
2591 2012-03-16  Doug Kwan  <dougkwan@google.com>
2592
2593         * testsuite/Makefile.am: Disable test initpri3b.
2594         * testsuite/Makefile.in: Regenerate.
2595
2596 2012-03-15  Doug Kwan  <dougkwan@google.com>
2597
2598         * arm.cc (Target_arm::got_section): Make .got section read-only
2599         if -z now is given.
2600
2601 2012-03-15  Ian Lance Taylor  <iant@google.com>
2602
2603         PR gold/13850
2604         * layout.cc (Layout::make_output_section): Correctly mark
2605         SHT_INIT_ARRAY, et. al., as relro.
2606
2607 2012-03-14  Doug Kwan  <dougkwan@google.com>
2608
2609         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2610         dynamic relocations for protected symbols in shared objects.
2611
2612 2012-03-13  Ian Lance Taylor  <iant@google.com>
2613
2614         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2615         keep the larger alignment.
2616
2617 2012-03-12  Cary Coutant  <ccoutant@google.com>
2618
2619         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2620         handling of DW_LNE_define_file.
2621
2622 2012-03-12  Cary Coutant  <ccoutant@google.com>
2623
2624         * reduced_debug_output.cc
2625         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2626         codes to switch.
2627
2628 2012-02-29  Cary Coutant  <ccoutant@google.com>
2629
2630         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2631
2632 2012-02-29  Cary Coutant  <ccoutant@google.com>
2633
2634         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2635         Call Object::decompressed_section_contents.
2636         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2637         New dtor.
2638         (Sized_dwarf_line_info::buffer_start_): New data member.
2639         * merge.cc (Output_merge_data::do_add_input_section): Call
2640         Object::decompressed_section_contents.
2641         (Output_merge_string::do_add_input_section): Likewise.
2642         * object.cc (need_decompressed_section): New function.
2643         (build_compressed_section_map): Decompress sections needed later.
2644         (Sized_relobj_file::do_decompressed_section_contents): New function.
2645         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2646         * object.h (Object::decompressed_section_contents): New function.
2647         (Object::discard_decompressed_sections): New function.
2648         (Object::do_decompressed_section_contents): New function.
2649         (Object::do_discard_decompressed_sections): New function.
2650         (Compressed_section_info): New type.
2651         (Compressed_section_map): Include decompressed section contents.
2652         (Sized_relobj_file::do_decompressed_section_contents): New function.
2653         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2654
2655 2012-02-16  Cary Coutant  <ccoutant@google.com>
2656
2657         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2658         * testsuite/Makefile.in: Regenerate.
2659
2660 2012-02-14  Cary Coutant  <ccoutant@google.com>
2661
2662         * options.cc (General_options::finalize): Disallow -pie and -static.
2663
2664 2012-02-03  Doug Kwan  <dougkwan@google.com>
2665
2666         * arm.cc (Arm_relocate_functions::abs8,
2667         Arm_relocate_functions::abs16): Use
2668         Bits::has_signed_unsigned_overflow32.
2669         (Arm_relocate_functions::thm_abs8): Correct range of
2670         overflow check.
2671         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2672         in assertions.
2673
2674 2012-02-02  Doug Kwan  <dougkwan@google.com>
2675
2676         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2677         position independent outputs, not just shared objects.
2678
2679 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2680
2681         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2682         * configure: Regenerated.
2683
2684 2012-01-27  Ian Lance Taylor  <iant@google.com>
2685
2686         * reloc.h (Bits): New class with static functions, copied from
2687         namespace utils in arm.cc.
2688         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2689         instead.
2690
2691 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2692
2693         * incremental.cc (write_info_blocks): Correct relocation offset.
2694
2695 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2696
2697         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2698         (Relocate::tls_gd_to_le): Likewise.
2699
2700 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2701
2702         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2703
2704 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2705
2706         * configure.ac: Check if -mcmodel=medium works.
2707         * configure: Regenerated.
2708
2709 2012-01-24  Cary Coutant  <ccoutant@google.com>
2710
2711         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2712         definition and ...
2713         (read_unsigned_LEB_128_x): ... this new function.
2714         (read_signed_LEB_128): Replaced with inline definition and ...
2715         (read_signed_LEB_128_x): ... this new function.
2716         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2717         (read_unsigned_LEB_128): Add inline definition.
2718         (read_signed_LEB_128_x): New function.
2719         (read_signed_LEB_128): Add inline definition.
2720         * testsuite/Makefile.am (leb128_unittest): New unit test.
2721         * testsuite/Makefile.in: Regenerate.
2722         * testsuite/leb128_unittest.cc: New unit test.
2723
2724 2012-01-23  Ian Lance Taylor  <iant@google.com>
2725
2726         PR gold/13617
2727         * i386.cc (Target_i386::do_code_fill): When using a jmp
2728         instruction, pad with nop instructions.
2729         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2730
2731 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2732
2733         * x86_64.cc (gc_process_relocs): Add typename on types used in
2734         template.
2735         (scan_relocs): Likewise.
2736         (relocate_section): Likewise.
2737         (apply_relocation): Likewise.
2738
2739 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2740
2741         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2742         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2743         under x32.
2744
2745 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2746
2747         * x86_64.cc: Initial support for x32.
2748
2749 2012-01-03  Cary Coutant  <ccoutant@google.com>
2750
2751         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2752         Use abstract base class for GOT.
2753         * gold/output.h (class Output_data_got_base): New abstract base class.
2754         (class Output_data_got): Derive from new base class, adjust ctors.
2755         (Output_data_got::reserve_slot): Make virtual; rename to
2756         do_reserve_slot; Adjust callers.
2757         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2758         pointer to abstract base class.
2759         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2760
2761 2011-12-18  Ian Lance Taylor  <iant@google.com>
2762
2763         * object.h (Relobj::local_symbol_value): New function.
2764         (Relobj::local_plt_offset): New function.
2765         (Relobj::local_has_got_offset): New function.
2766         (Relobj::local_got_offset): New function.
2767         (Relobj::set_local_got_offset): New function.
2768         (Relobj::do_local_symbol_value): New pure virtual function.
2769         (Relobj::do_local_plt_offset): Likewise.
2770         (Relobj::do_local_has_got_offset): Likewise.
2771         (Relobj::do_local_got_offset): Likewise.
2772         (Relobj::do_set_local_got_offset): Likewise.
2773         (Sized_relobj::do_local_has_got_offset): Rename from
2774         local_has_got_offset.
2775         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2776         (Sized_relobj::do_set_local_got_offset): Rename from
2777         set_local_got_offset.
2778         (Sized_relobj_file::do_local_plt_offset): Rename from
2779         local_plt_offset.
2780         (Sized_relobj_file::do_local_symbol_value): New function.
2781         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2782         local_plt_offset.
2783         * output.cc (Output_data_got::Got_entry::write): Change object to
2784         Relobj.  Use local_symbol_value.
2785         (Output_data_got::add_global_with_rel): Change rel_dyn to
2786         Output_data_reloc_generic*.  Use add_global_generic.
2787         (Output_data_got::add_global_with_rela): Remove.  Change all
2788         callers to use add_global_with_rel.
2789         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2790         Output_data_reloc_generic*.  Use add_global_generic.
2791         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2792         callers to use add_global_pair_with_rel.
2793         (Output_data_got::add_local): Change object to Relobj*.
2794         (Output_data_got::add_local_plt): Likewise.
2795         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2796         change rel_dyn to Output_data_reloc_generic*.  Use
2797         add_local_generic.
2798         (Output_data_got::add_local_with_rela): Remove.  Change all
2799         callers to use all_local_with_rel.
2800         (Output_data_got::add_local_pair_with_rel): Change object to
2801         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2802         add_output_section_generic.
2803         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2804         callers to use add_local_pair_with_rel.
2805         (Output_data_got::reserve_local): Change object to Relobj*.
2806         * output.h: (class Output_data_reloc_generic): Add pure virtual
2807         declarations for add_global_generic, add_local_generic,
2808         add_output_section_generic.
2809         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2810         functions for Output_data_reloc_generic.  Update declarations for
2811         changes listed in output.cc.
2812         (class Output_data_got): Change template parameter to got_size.
2813         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2814         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2815         function.
2816         (Sized_relobj_incr::do_local_plt_offset): New function.
2817         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2818         add_global_generic.
2819
2820 2011-12-17  Cary Coutant  <ccoutant@google.com>
2821
2822         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2823         * resolve.cc (Symbol_table::resolve): Likewise.
2824         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2825         arrays.
2826         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2827
2828 2011-12-16  Ian Lance Taylor  <iant@google.com>
2829
2830         * output.h (Output_data_reloc_generic::add): Only call
2831         add_dynamic_reloc if this is a dynamic reloc section.
2832
2833 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2834
2835         PR gold/13505
2836         * target-reloc.h (apply_relocation): Replace <64, false> with
2837         <size, big_endian>.
2838
2839 2011-11-25  Nick Clifton  <nickc@redhat.com>
2840
2841         * po/it.po: New Italian translation.
2842
2843 2011-11-17  Sterling Augustine  <saugustine@google.com>
2844
2845         * script.cc (script_include_directive): Implement.
2846         (read_script_file): New local variables name and search_path. Update
2847         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2848         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2849         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2850
2851 2011-11-11  Sterling Augustine  <saugustine@google.com>
2852
2853         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2854         (file_or_sections_cmd): Likewise.
2855
2856 2011-11-11  Doug Kwan  <dougkwan@google.com>
2857
2858         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2859         if --just-symbols is given.
2860
2861 2011-11-10  Doug Kwan  <dougkwan@google.com>
2862
2863         PR gold/13362
2864         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2865         when processing data relocs.
2866         * reloc.h (Relocate_functions::rel_unaligned): New method.
2867         (Relocate_functions::pcrel_unaligned): Ditto.
2868         (Relocate_functions::rel32_unaligned): Ditto.
2869         (Relocate_functions::pcrel32_unaligned): Ditto.
2870
2871 2011-11-09  Doug Kwan  <dougkwan@google.com>
2872
2873         PR gold/13362
2874         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2875         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2876         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2877         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2878         (Relocate_functions::rel_unaligned): New.
2879         (Relocate_functions::rel32_unaligned): New.
2880         * target-reloc.h (relocate_for_relocatable): Add code to handle
2881         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2882         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2883         arm_unaligned_reloc_r): New targets.
2884         * testsuite/Makefile.in: Regenerate.
2885         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2886         linking.
2887
2888 2011-11-02  Ian Lance Taylor  <iant@google.com>
2889
2890         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2891         NATIVE_LINKER.
2892         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2893         * options.cc (General_options::finalize): Use library search path
2894         from configure script if specified.  If not native and no sysroot,
2895         only search TOOLLIBDIR.
2896         * options.h (Search_directory::Search_directory): Change name to
2897         const std::string&.
2898         (General_options::add_to_library_path_with_sysroot): Change arg to
2899         const std::string&.
2900         * configure, Makefile.in, config.in: Rebuild.
2901
2902 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2903
2904         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2905         we are working around the ARM1176 Erratum.
2906         * options.h (General_options::fix_arm1176): Add option.
2907         * testsuite/Makefile.am: Add testcases, and keep current ones
2908         working.
2909         * testsuite/Makefile.in: Regenerate.
2910         * testsuite/arm_fix_1176.s: New file.
2911         * testsuite/arm_fix_1176.sh: Likewise.
2912
2913 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2914
2915         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2916         may_use_blx_.
2917         (Target_arm::may_use_blx): Remove method.
2918         (Target_arm::set_may_use_blx): Likewise.
2919         (Target_arm::may_use_v4t_interworking): New method.
2920         (Target_arm::may_use_v5t_interworking): Likewise.
2921         (Target_arm::may_use_blx_): Remove member variable.
2922         (Arm_relocate_functions::arm_branch_common): Check for v5T
2923         interworking.
2924         (Arm_relocate_functions::thumb_branch_common): Likewise.
2925         (Reloc_stub::stub_type_for_reloc): Likewise.
2926         (Target_arm::do_finalize_sections): Correct interworking checks.
2927         * testsuite/Makefile.am: Add new tests.
2928         * testsuite/Makefile.in: Regenerate.
2929         * testsuite/arm_farcall_arm_arm.s: New test.
2930         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2931         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2932         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2933         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2934         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2935         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2936         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2937
2938 2011-10-31  Cary Coutant  <ccoutant@google.com>
2939
2940         PR gold/13023
2941         * expression.cc (Expression::eval_with_dot): Add
2942         is_section_dot_assignment parameter.
2943         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2944         absolute and assigning to dot within a section.
2945         * script-sections.cc
2946         (Output_section_element_assignment::set_section_addresses): Pass
2947         dot_section to set_if_absolute.
2948         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2949         as is_section_dot_assignment flag to eval_with_dot.
2950         (Output_section_element_dot_assignment::set_section_addresses):
2951         Likewise.
2952         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2953         parameter.  Also set value if relative to dot_section; set the
2954         symbol's output_section.
2955         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2956         parameter.  Adjust all callers.
2957         (Expression::eval_maybe_dot): Likewise.
2958         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2959         Adjust all callers.
2960         * testsuite/script_test_2.t: Test assignment of an absolute value
2961         to dot within an output section element.
2962
2963 2011-10-31  Cary Coutant  <ccoutant@google.com>
2964
2965         * options.h (class General_options): Add --[no-]gnu-unique options.
2966         * symtab.cc (Symbol_table::sized_write_globals): Convert
2967         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2968
2969 2011-10-31  Cary Coutant  <ccoutant@google.com>
2970
2971         PR gold/13359
2972         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2973         unnecessary assertion.
2974         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2975
2976 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2977
2978         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2979         gc_mark_symbol.
2980         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2981         gc_mark_symbol.
2982         Change to just keep the section associated with symbol.
2983         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2984         they are externally visible and --export-dynamic is turned on.
2985         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2986
2987 2011-10-19  Ian Lance Taylor  <iant@google.com>
2988
2989         PR gold/13163
2990         * script-sections.cc
2991         (Output_section_element_dot_assignment::needs_output_section): New
2992         function.
2993
2994 2011-10-19  Ian Lance Taylor  <iant@google.com>
2995
2996         PR gold/13204
2997         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2998         --section-start option was seen.
2999         * options.h (General_options::any_section_start): New function.
3000
3001 2011-10-18  David S. Miller  <davem@davemloft.net>
3002
3003         PR binutils/13301
3004         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3005         member to track relocation locations that have moved during TLS
3006         reloc optimizations.
3007         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3008         (Target_sparc::Relocate::relocate): Adjust view down by 4
3009         bytes if it matches reloc_adjust_addr_.
3010         (Target_sparc::Relocate::relocate_tls): Always move the
3011         __tls_get_addr call delay slot instruction forward 4 bytes when
3012         performing relaxation.
3013
3014 2011-10-18  Cary Coutant  <ccoutant@google.com>
3015
3016         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3017         (Output_file::map_no_anonymous): Check for non-zero
3018         return code from posix_fallocate.
3019
3020 2011-10-17  Cary Coutant  <ccoutant@google.com>
3021
3022         PR gold/13245
3023         * plugin.cc (is_visible_from_outside): Check for symbols
3024         referenced from dynamic objects.
3025         * resolve.cc (Symbol_table::resolve): Don't count references
3026         from dynamic objects as references from real ELF files.
3027         * testsuite/plugin_test_2.sh: Adjust expected result.
3028
3029 2011-10-17  Cary Coutant  <ccoutant@google.com>
3030
3031         * gold.cc: Include timer.h.
3032         (queue_middle_tasks): Stamp time.
3033         (queue_final_tasks): Likewise.
3034         * main.cc (main): Store timer in parameters.  Print timers
3035         for each pass.
3036         * parameters.cc (Parameters::Parameters): Initialize timer_.
3037         (Parameters::set_timer): New function.
3038         (set_parameters_timer): New function.
3039         * parameters.h (Parameters::set_timer): New function.
3040         (Parameters::timer): New function.
3041         (Parameters::timer_): New data member.
3042         (set_parameters_timer): New function.
3043         * timer.cc (Timer::stamp): New function.
3044         (Timer::get_pass_time): New function.
3045         * timer.h (Timer::stamp): New function.
3046         (Timer::get_pass_time): New function.
3047         (Timer::pass_times_): New data member.
3048
3049 2011-10-17  Cary Coutant  <ccoutant@google.com>
3050
3051         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3052         task for members of lib groups.
3053
3054 2011-10-17  Cary Coutant  <ccoutant@google.com>
3055
3056         PR gold/13288
3057         * fileread.cc (File_read::find_view): Add assert.
3058         (File_read::make_view): Move bounds check (replace with assert)...
3059         (File_read::find_or_make_view): ... to here.
3060
3061 2011-10-12  Cary Coutant  <ccoutant@google.com>
3062
3063         * output.cc (Output_file::open_base_file): Handle case where
3064         ::read returns less than requested size.
3065
3066 2011-10-10  Cary Coutant  <ccoutant@google.com>
3067
3068         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3069         Initialize defined_count_.
3070         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3071         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3072         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3073         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3074         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3075         * incremental.h (Sized_relobj_incr::defined_count_): New data
3076         member.
3077         (Sized_incr_dynobj::defined_count_): New data member.
3078         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3079         Return zeroes instead of internal error.
3080
3081 2011-10-10  Cary Coutant  <ccoutant@google.com>
3082
3083         PR gold/13249
3084         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3085         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3086         * output.h (class Output_reloc): Add use_plt_offset flag.
3087         (Output_reloc::type_): Adjust size of bit field.
3088         (Output_reloc::use_plt_offset_): New bit field.
3089         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3090         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3091         flag.  Adjust all callers.
3092         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3093         creating RELATIVE relocations.
3094
3095 2011-10-10  Nick Clifton  <nickc@redhat.com>
3096
3097         * po/es.po: Updated Spanish translation.
3098         * po/fi.po: Updated Finnish translation.
3099
3100 2011-10-03   Diego Novillo  <dnovillo@google.com>
3101
3102         * options.cc (parse_uint): Fix dereference of RETVAL.
3103
3104 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3105
3106         * layout.h (section_order_map_): New member.
3107         (get_section_order_map): New member function.
3108         * output.cc (Output_section::add_input_section): Check for patterns
3109         only when --section-ordering-file is specified.
3110         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3111         output_sections have been formed.
3112         * layout.cc (Layout_Layout): Initialize section_order_map_.
3113         * plugin.cc (update_section_order): Store order in order_map. Do not
3114         update the order.
3115         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3116         * testsuite/Makefile.in: Regenerate.
3117         * testsuite/plugin_section_order.c: New file.
3118         * testsuite/plugin_final_layout.cc: New file.
3119         * testsuite/plugin_final_layout.sh: New file.
3120
3121 2011-09-29  Cary Coutant  <ccoutant@google.com>
3122
3123         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3124         Check for NULL.
3125         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3126         symbols during incremental update.
3127         (Symbol_table::add_from_dynobj): Likewise.
3128
3129 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3130             Ian Lance Taylor  <iant@google.com>
3131
3132         * symtab.cc (Symbol_table::define_special_symbol): Always
3133         canonicalize version string.
3134
3135 2011-09-26  Cary Coutant  <ccoutant@google.com>
3136
3137         * gold.cc (queue_initial_tasks): Move option checks ...
3138         * options.cc (General_options::finalize): ... to here. Disable
3139         some options; make others fatal.
3140
3141 2011-09-26  Cary Coutant  <ccoutant@google.com>
3142
3143         gcc PR lto/47247
3144         * plugin.cc (get_symbols_v2): New function.
3145         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3146         (is_referenced_from_outside): New function.
3147         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3148         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3149         (get_symbols): Pass version parameter.
3150         (get_symbols_v2): New function.
3151         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3152         parameter.
3153         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3154         (onload): Add LDPT_GET_SYMBOLS_V2.
3155         (all_symbols_read_hook): Use get_symbols_v2; check for
3156         LDPR_PREVAILING_DEF_IRONLY_EXP.
3157         * testsuite/plugin_test_3.sh: Update expected results.
3158
3159 2011-09-23  Simon Baldwin  <simonb@google.com>
3160
3161         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3162         configuration options.
3163         * configure: Regenerate.
3164         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3165         * Makefile.in: Regenerate.
3166         * testsuite/Makefile.in: Regenerate.
3167
3168 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3169
3170         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3171
3172 2011-09-19  Cary Coutant  <ccoutant@google.com>
3173
3174         * incremental.cc (can_incremental_update): Fix typo in comment.
3175         * incremental.h (can_incremental_update): Likewise.
3176
3177 2011-09-18  Cary Coutant  <ccoutant@google.com>
3178
3179         * incremental.cc (can_incremental_update): New function.
3180         * incremental.h (can_incremental_update): New function.
3181         * layout.cc (Layout::init_fixed_output_section): Call it.
3182         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3183         * object.cc (Sized_relobj_file::do_layout): Call
3184         can_incremental_update.
3185
3186 2011-09-13  Cary Coutant  <ccoutant@google.com>
3187
3188         * configure.ac: Check for glibc support for gnu_indirect_function
3189         support with static linking, setting automake conditional
3190         IFUNC_STATIC.
3191         * Makefile.in: Regenerate.
3192         * configure: Regenerate.
3193
3194         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3195         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3196         for IFUNC_STATIC.
3197         * testsuite/Makefile.in: Regenerate.
3198
3199 2011-09-13  Cary Coutant  <ccoutant@google.com>
3200
3201         * incremental.cc (Sized_relobj_incr::do_layout): Call
3202         report_comdat_group for kept comdat sections.
3203         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3204         * testsuite/Makefile.in: Regenerate.
3205         * testsuite/incr_comdat_test_1.cc: New source file.
3206         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3207         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3208         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3209
3210 2011-09-13  Ian Lance Taylor  <iant@google.com>
3211
3212         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3213         variable external_symbols_offset.
3214
3215 2011-09-12  Ian Lance Taylor  <iant@google.com>
3216
3217         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3218         triggered if object has no symbols.
3219
3220 2011-09-09  David S. Miller  <davem@davemloft.net>
3221
3222         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3223         (Output_fill_debug_line::do_write): Likewise.
3224
3225 2011-08-29  Cary Coutant  <ccoutant@google.com>
3226
3227         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3228         casts to match formatting specs.
3229         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3230
3231 2011-08-26  Cary Coutant  <ccoutant@google.com>
3232
3233         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3234         remaining hole size when allocating.
3235         (Layout::make_output_section): Set fill methods for debug sections.
3236         * layout.h (Free_list::Free_list_node): Move from private to
3237         public.
3238         (Free_list::set_min_hole_size): New function.
3239         (Free_list::begin, Free_list::end): New functions.
3240         (Free_list::min_hole_): New data member.
3241         * output.cc: Include dwarf.h.
3242         (Output_fill_debug_info::do_minimum_hole_size): New function.
3243         (Output_fill_debug_info::do_write): New function.
3244         (Output_fill_debug_line::do_minimum_hole_size): New function.
3245         (Output_fill_debug_line::do_write): New function.
3246         (Output_section::Output_section): Initialize new data member.
3247         (Output_section::set_final_data_size): Ensure patch space is larger
3248         than minimum hole size.
3249         (Output_section::do_write): Fill holes in debug sections.
3250         * output.h (Output_fill): New class.
3251         (Output_fill_debug_info): New class.
3252         (Output_fill_debug_line): New class.
3253         (Output_section::set_free_space_fill): New function.
3254         (Output_section::free_space_fill_): New data member.
3255         * testsuite/Makefile.am (incremental_test_3): Add
3256         --incremental-patch option.
3257         (incremental_test_4): Likewise.
3258         (incremental_test_5): Likewise.
3259         (incremental_test_6): Likewise.
3260         (incremental_copy_test): Likewise.
3261         (incremental_common_test_1): Likewise.
3262         * testsuite/Makefile.in: Regenerate.
3263
3264 2011-08-26  Nick Clifton  <nickc@redhat.com>
3265
3266         * po/es.po: Updated Spanish translation.
3267
3268 2011-08-01  Cary Coutant  <ccoutant@google.com>
3269
3270         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3271         * gold/testsuite/Makefile.in: Regenerate.
3272         * gold/testsuite/justsyms_exec.c: New source file.
3273         * gold/testsuite/justsyms_lib.c: New source file.
3274
3275 2011-08-01  Cary Coutant  <ccoutant@google.com>
3276
3277         * layout.cc (Layout::set_segment_offsets): Don't realign text
3278         segment if -Ttext was specified.
3279         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3280         file type.
3281         * object.h (Sized_relobj_file::e_type): New function.
3282         (Sized_relobj_file::e_type_): New data member.
3283         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3284         base address for ET_EXEC files.
3285         * target.cc (Target::do_make_elf_object_implementation): Allow
3286         ET_EXEC files with --just-symbols option.
3287
3288 2011-07-28  Cary Coutant  <ccoutant@google.com>
3289
3290         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3291         Add thread_number parameter.
3292         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3293         * workqueue-threads.cc
3294         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3295         current thread if its thread number is greater than desired thread
3296         count.
3297         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3298         Add thread_number parameter.
3299         (Workqueue::should_cancel_thread): Likewise.
3300         (Workqueue::find_runnable_or_wait): Pass thread_number to
3301         should_cancel_thread.
3302         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3303         parameter.
3304
3305 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3306
3307         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3308         only after checking if it cannot be forced local.
3309         * symtab.h (is_externally_visible): Check if the symbol is not forced
3310         local.
3311
3312 2011-07-15  Ian Lance Taylor  <iant@google.com>
3313
3314         * options.h (class General_options): Add --print-output-format.
3315         Move -EL next to -EB, for  better --help output.
3316         * target-select.cc: Include <cstdio>, "options.h", and
3317         "parameters.h".
3318         (Target_selector::do_target_bfd_name): New function.
3319         (print_output_format): New function.
3320         * target-select.h (class Target_selector): Update declarations.
3321         (Target_selector::target_bfd_name): New function.
3322         (print_output_format): Declare.
3323         * main.cc: Include "target-select.h".
3324         (main): Handle --print-output-format.
3325         * gold.cc: Include "target-select.h".
3326         (queue_initial_tasks): Handle --print-output-format when there are
3327         no input files.
3328         * parameters.cc (parameters_force_valid_target): Give a better
3329         error message if -EB/-EL does not match target.
3330         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3331         function.
3332
3333 2011-07-15  Ian Lance Taylor  <iant@google.com>
3334
3335         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3336         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3337         (Output_data_plt_i386::do_write): Write address of .dynamic
3338         section to first entry in .got.plt section.
3339         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3340         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3341         Initialize layout_.
3342         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3343         section to first entry in .got.plt section.
3344         * layout.h (Layout::dynamic_section): New function.
3345
3346 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3347
3348         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3349         to claim_file call.
3350         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3351         input_section_position_, and input_section_glob_.
3352         (read_layout_from_file): Call function section_ordering_specified.
3353         * layout.h (is_section_ordering_specified): New function.
3354         (section_ordering_specified): New function.
3355         (section_ordering_specified_): New boolean member.
3356         * main.cc(main): Call load_plugins after layout object is defined.
3357         * output.cc (Output_section::add_input_section): Use
3358         function section_ordering_specified to check if section ordering is
3359         needed.
3360         * output.cc (Output_section::add_relaxed_input_section): Use
3361         function section_ordering_specified to check if section ordering is
3362         needed.
3363         (Output_section::update_section_layout): New function.
3364         (Output_section::sort_attached_input_sections): Check if input section
3365         must be reordered.
3366         * output.h (Output_section::update_section_layout): New function.
3367         * plugin.cc (get_section_count): New function.
3368         (get_section_type): New function.
3369         (get_section_name): New function.
3370         (get_section_contents): New function.
3371         (update_section_order): New function.
3372         (allow_section_ordering): New function.
3373         (Plugin::load): Add the new interfaces to the transfer vector.
3374         (Plugin_manager::load_plugins): New parameter.
3375         (Plugin_manager::all_symbols_read): New parameter.
3376         (Plugin_manager::claim_file): New parameter. Save the elf object for
3377         unclaimed objects.
3378         (Plugin_manager::get_elf_object): New function.
3379         (Plugin_manager::get_view): Change to directly use the bool to check
3380         if get_view is called from claim_file_hook.
3381         * plugin.h (input_objects): New function
3382         (Plugin__manager::load_plugins): New parameter.
3383         (Plugin_manager::claim_file): New parameter.
3384         (Plugin_manager::get_elf_object): New function.
3385         (Plugin_manager::in_claim_file_handler): New function.
3386         (Plugin_manager::in_claim_file_handler_): New member.
3387         (layout): New function.
3388         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3389         handler with an extra parameter. Make the elf object before calling
3390         claim_file handler.
3391         * testsuite/plugin_test.c (get_section_count): New function pointer.
3392         (get_section_type): New function pointer.
3393         (get_section_name): New function pointer.
3394         (get_section_contents): New function pointer.
3395         (update_section_order): New function pointer.
3396         (allow_section_ordering): New function pointer.
3397         (onload): Check if the new interfaces exist.
3398
3399 2011-07-13  Ian Lance Taylor  <iant@google.com>
3400
3401         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3402         relro section.
3403         * x86_64.cc (Target_x86_64::got_section): Likewise.
3404         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3405         (relro_now_test_SOURCES): New variable.
3406         (relro_now_test_DEPENDENCIES): New variable.
3407         (relro_now_test_LDFLAGS): New variable.
3408         (relro_now_test_LDADD): New variable.
3409         (relro_now_test.so): New target.
3410         * testsuite/Makefile.in: Rebuild.
3411
3412 2011-07-12  Ian Lance Taylor  <iant@google.com>
3413
3414         PR gold/12980
3415         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3416         GLOB_DAT relocation rather than a RELATIVE relocation for a
3417         protected symbol when creating a shared library.
3418         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3419         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3420         * testsuite/protected_main_1.cc (main): Test that protected
3421         function has same address.
3422
3423 2011-07-11  Ian Lance Taylor  <iant@google.com>
3424
3425         PR gold/12979
3426         * options.h (class General_options): Add -Bgroup.
3427         * options.cc (General_options::finalize): If -Bgroup is set,
3428         default to --unresolved-symbols=report-all.
3429         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3430         * target-reloc.h (issue_undefined_symbol_error): Handle
3431         --unresolved-symbols=report-all.
3432
3433 2011-07-08  Ian Lance Taylor  <iant@google.com>
3434
3435         PR gold/11985
3436         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3437         if linker script discards key sections.
3438         (Layout::create_dynamic_symtab): Likewise.
3439         (Layout::assign_local_dynsym_offsets): Likewise.
3440         (Layout::sized_create_version_sections): Likewise.
3441         (Layout::create_interp): Likewise.
3442         (Layout::finish_dynamic_section): Likewise.
3443         (Layout::set_dynamic_symbol_size): Likewise.
3444
3445 2011-07-08  Ian Lance Taylor  <iant@google.com>
3446
3447         PR gold/12386
3448         * options.h (class General_options): Add --unresolved-symbols.
3449         * target-reloc.h (issue_undefined_symbol_error): Check
3450         --unresolved-symbols.  Add comments.
3451
3452 2011-07-08  Ian Lance Taylor  <iant@google.com>
3453
3454         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3455         expression more complex.
3456
3457 2011-07-08  Ian Lance Taylor  <iant@google.com>
3458
3459         PR gold/11317
3460         * target-reloc.h (issue_undefined_symbol_error): New inline
3461         function, broken out of relocate_section.
3462         (relocate_section): Call issue_undefined_symbol_error.
3463         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3464         there is no TLS segment if we are about to issue an undefined
3465         symbol error.
3466         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3467
3468 2011-07-08  Ian Lance Taylor  <iant@google.com>
3469
3470         PR gold/12279
3471         * resolve.cc (Symbol_table::should_override): Add fromtype
3472         parameter.  Change all callers.  Give error when linking together
3473         TLS and non-TLS symbol.
3474         (Symbol_table::should_override_with_special): Add fromtype
3475         parameter.  Change all callers.
3476         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3477         there is no TLS segment if we have reported some errors.
3478         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3479
3480 2011-07-08  Ian Lance Taylor  <iant@google.com>
3481
3482         PR gold/12372
3483         * target.h (Target::plt_address_for_global): New function.
3484         (Target::plt_address_for_local): New function.
3485         (Target::plt_section_for_global): Remove.
3486         (Target::plt_section_for_local): Remove.
3487         (Target::do_plt_address_for_global): New virtual function.
3488         (Target::do_plt_address_for_local): New virtual function.
3489         (Target::do_plt_section_for_global): Remove.
3490         (Target::do_plt_section_for_local): Remove.
3491         (Target::register_global_plt_entry): Add Symbol_table and Layout
3492         parameters.
3493         * output.cc (Output_data_got::Got_entry::write): Use
3494         plt_address_for_global and plt_address_for_local.
3495         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3496         address of output section.
3497         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3498         got_irelative_, and irelative_count_ fields.  Update
3499         declarations.
3500         (Output_data_plt_i386::has_irelative_section): New function.
3501         (Output_data_plt_i386::entry_count): Add irelative_count_.
3502         (Output_data_plt_i386::set_final_data_size): Likewise.
3503         (class Target_i386): Add got_irelative_ and rel_irelative_
3504         fields.  Update declarations.
3505         (Target_i386::Target_i386): Initialize new fields.
3506         (Target_i386::do_plt_address_for_global): New function replacing
3507         do_plt_section_for_global.
3508         (Target_i386::do_plt_address_for_local): New function replacing
3509         do_plt_section_for_local.
3510         (Target_i386::got_section): Create got_irelative_.
3511         (Target_i386::rel_irelative_section): New function.
3512         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3513         fields.  Don't define __rel_iplt_{start,end}.
3514         (Output_data_plt_i386::add_entry): Add symtab and layout
3515         parameters.  Change all callers.  Use different PLT and GOT for
3516         IFUNC symbols.
3517         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3518         layout parameters.  Change all callers.  Use different PLT and
3519         GOT.
3520         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3521         (Output_data_plt_i386::rel_irelative): New function.
3522         (Output_data_plt_i386::address_for_global): New function.
3523         (Output_data_plt_i386::address_for_local): New function.
3524         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3525         IRELATIVE GOT when changing IFUNC GOT entries.
3526         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3527         reloc.
3528         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3529         if we didn't create an IRELATIVE GOT.
3530         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3531         plt_address_for_local.
3532         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3533         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3534         got_irelative_, and irelative_count_ fields.  Update
3535         declarations.
3536         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3537         Initialize new fields.  Remove symtab parameter.  Change all
3538         callers.
3539         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3540         irelative_count_.
3541         (Output_data_plt_x86_64::has_irelative_section): New function.
3542         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3543         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3544         fields.  Update declarations.
3545         (Target_x86_64::Target_x86_64): Initialize new fields.
3546         (Target_x86_64::do_plt_address_for_global): New function replacing
3547         do_plt_section_for_global.
3548         (Target_x86_64::do_plt_address_for_local): New function replacing
3549         do_plt_section_for_local.
3550         (Target_x86_64::got_section): Create got_irelative_.
3551         (Target_x86_64::rela_irelative_section): New function.
3552         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3553         all callers.  Don't create __rel_iplt_{start,end}.
3554         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3555         parameters.  Change all callers.  Use different PLT and GOT for
3556         IFUNC symbols.
3557         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3558         layout parameters.  Change all callers.  Use different PLT and
3559         GOT.
3560         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3561         parameters.  Change all callers.  Use different PLT and GOT for
3562         IFUNC symbols.
3563         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3564         (Output_data_plt_x86_64::rela_irelative): New function.
3565         (Output_data_plt_x86_64::address_for_global): New function.
3566         (Output_data_plt_x86_64::address_for_local): New function.
3567         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3568         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3569         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3570         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3571         parameters.
3572         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3573         reloc.
3574         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3575         symbols if we didn't create an IRELATIVE GOT.
3576         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3577         plt_address_for_local.
3578         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3579         * testsuite/ifuncvar1.c: New test file.
3580         * testsuite/ifuncvar2.c: New test file.
3581         * testsuite/ifuncvar3.c: New test file.
3582         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3583         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3584         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3585         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3586         * testsuite/Makefile.in: Rebuild.
3587
3588 2011-07-07  Cary Coutant  <ccoutant@google.com>
3589
3590         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3591         (two_file_test_1_ndebug.o): Likewise.
3592         (two_file_test_1b_ndebug.o): Likewise.
3593         (two_file_test_2_ndebug.o): Likewise.
3594         (two_file_test_main_ndebug.o): Likewise.
3595         (incremental_test_2): Link with no-debug versions.
3596
3597 2011-07-06  Cary Coutant  <ccoutant@google.com>
3598
3599         * gold/incremental.cc
3600         (Output_section_incremental_inputs::write_info_blocks): Check for
3601         hidden and internal symbols.
3602
3603 2011-07-06  Cary Coutant  <ccoutant@google.com>
3604
3605         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3606         Check disposition for startup file.
3607         (Incremental_inputs::report_command_line): Ignore
3608         --incremental-startup-unchanged option.
3609         * options.cc (General_options::parse_incremental_startup_unchanged):
3610         New function.
3611         (General_options::General_options): Initialize new data member.
3612         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3613         (General_options): Add --incremental-startup-unchanged option.
3614         (General_options::incremental_startup_disposition): New function.
3615         (General_options::incremental_startup_disposition_): New data member.
3616
3617 2011-07-06  Cary Coutant  <ccoutant@google.com>
3618
3619         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3620         input file index to Script_info ctor.
3621         (Sized_incremental_binary::do_file_has_changed): Find the
3622         command-line argument for files named in scripts.
3623         * incremental.h (Script_info::Script_info): New ctor
3624         with input file index.
3625         (Script_info::input_file_index): New function.
3626         (Script_info::input_file_index_): New data member.
3627         (Incremental_binary::get_library): Add const.
3628         (Incremental_binary::get_script_info): Add const.
3629         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3630         * testsuite/Makefile.am (incremental_test_5): New test case.
3631         (incremental_test_6): New test case.
3632         * testsuite/Makefile.in: Regenerate.
3633
3634 2011-07-06  Cary Coutant  <ccoutant@google.com>
3635
3636         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3637         debug output when command lines differ.
3638
3639 2011-07-06  Cary Coutant  <ccoutant@google.com>
3640
3641         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3642         --incremental-patch option.
3643         * layout.cc (Free_list::allocate): Extend allocation beyond original
3644         end if enabled.
3645         (Layout::make_output_section): Mark sections that should get
3646         patch space.
3647         * options.cc (parse_percent): New function.
3648         * options.h (parse_percent): New function.
3649         (DEFINE_percent): New macro.
3650         (General_options): Add --incremental-patch option.
3651         * output.cc (Output_section::Output_section): Initialize new data
3652         members.
3653         (Output_section::add_input_section): Print section name when out
3654         of patch space.
3655         (Output_section::add_output_section_data): Likewise.
3656         (Output_section::set_final_data_size): Add patch space when
3657         doing --incremental-full.
3658         (Output_section::do_reset_address_and_file_offset): Remove patch
3659         space.
3660         (Output_segment::set_section_list_addresses): Print debug output
3661         only if --incremental-update.
3662         * output.h (Output_section::set_is_patch_space_allowed): New function.
3663         (Output_section::is_patch_space_allowed_): New data member.
3664         (Output_section::patch_space_): New data member.
3665         * parameters.cc (Parameters::incremental_full): New function.
3666         * parameters.h (Parameters::incremental_full): New function
3667         * testsuite/Makefile.am (incremental_test_2): Add test for
3668         --incremental-patch option.
3669         * testsuite/Makefile.in: Regenerate.
3670         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3671         (t18): Remove function body.
3672
3673 2011-07-05  Doug Kwan  <dougkwan@google.com>
3674
3675         PR gold/12771
3676         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3677         Arm_Address type for relocation result.
3678         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3679         overflow check.
3680         (Arm_relocate_functions::abs32): Use unaligned access.
3681         (Arm_relocate_functions::rel32): Ditto.
3682         (Arm_relocate_functions::prel31): Ditto.
3683         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3684         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3685         static data relocations.
3686         * testsuite/Makefile.in: Regnerate.
3687         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3688
3689 2011-07-05  Ian Lance Taylor  <iant@google.com>
3690
3691         PR gold/12392
3692         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3693         symbols if necessary.
3694         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3695
3696 2011-07-05  Ian Lance Taylor  <iant@google.com>
3697
3698         PR gold/12952
3699         * resolve.cc (Symbol::override_base_with_special): Simply override
3700         version with special symbol version, ignoring previous version.
3701
3702 2011-07-05  Ian Lance Taylor  <iant@google.com>
3703
3704         * object.cc (Sized_relobj_file::include_section_group): Add
3705         information to comment about signature location.
3706
3707 2011-07-02  Ian Lance Taylor  <iant@google.com>
3708
3709         PR gold/12957
3710         * options.h (class General_options): Add -f and -F.
3711         * options.cc (General_options::finalize): Fatal error if -f/-F
3712         are used without -shared.
3713         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3714
3715 2011-07-02  Ian Lance Taylor  <iant@google.com>
3716
3717         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3718
3719 2011-07-01  Ian Lance Taylor  <iant@google.com>
3720
3721         PR gold/12525
3722         PR gold/12952
3723         * resolve.cc (Symbol::override_base_with_special): Don't override
3724         the version if the overriding symbol has a different name.
3725         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3726         all callers.  If we give an error about an undefined version,
3727         define the base version if necessary.
3728         * dynobj.h (class Versions): Update declaration.
3729         * testsuite/weak_alias_test_5.cc: New file.
3730         * testsuite/weak_alias_test.script: New file.
3731         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3732         and versioned_alias have the right value, and call t2.
3733         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3734         weak_alias_test_5.so.
3735         (weak_alias_test_LDADD): Likewise.
3736         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3737         * testsuite/Makefile.in: Rebuild.
3738
3739 2011-07-01  Ian Lance Taylor  <iant@google.com>
3740
3741         PR gold/12525
3742         * options.h (class General_options): Support -z notext.
3743         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3744         -Wl,-z,notext.
3745         (two_file_shared_nonpic.so): Likewise.
3746         (two_file_shared_mixed.so): Likewise.
3747         (two_file_shared_mixed_1.so): Likewise.
3748         (weak_undef_lib_nonpic.so): Likewise.
3749         (alt/weak_undef_lib_nonpic.so): Likewise.
3750         (tls_test_shared_nonpic.so): Likewise.
3751         * testsuite/Makefile.in: Rebuild.
3752
3753 2011-07-01  Ian Lance Taylor  <iant@google.com>
3754
3755         PR gold/12525
3756         * configure.ac: Test whether static linking works, setting
3757         the automake conditional HAVE_STATIC.
3758         * testsuite/Makefile.am: Disable tests using -static if
3759         HAVE_STATIC is not true.
3760         * configure, testsuite/Makefile.in: Rebuild.
3761
3762 2011-07-01  Ian Lance Taylor  <iant@google.com>
3763
3764         PR gold/12525
3765         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3766         Assert if we see DW_EH_PE_indirect.
3767         * target.h (Target::ehframe_datarel_base): New function.
3768         (Target::do_ehframe_datarel_base): New target function.
3769         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3770         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3771         function.
3772
3773 2011-07-01  Ian Lance Taylor  <iant@google.com>
3774
3775         PR gold/12571
3776         * options.h (class General_options): Add
3777         --ld-generated-unwind-info.
3778         * ehframe.cc (Fde::write): Add address parameter.  Change all
3779         callers.  If associated with PLT, fill in address and size.
3780         (Cie::set_output_offset): Only add merge mapping if there is an
3781         object.
3782         (Cie::write): Add address parameter.  Change all callers.
3783         (Eh_frame::add_ehframe_for_plt): New function.
3784         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3785         input_offset_ fields into union u_, with new plt field.
3786         (Fde::Fde): Adjust for new union field.
3787         (Fde::Fde) [Output_data version]: New constructor.
3788         (Fde::add_mapping): Only add merge mapping if there is an object.
3789         (class Cie): Update declarations.
3790         (class Eh_frame): Declare add_ehframe_for_plt.
3791         * layout.cc (Layout::layout_eh_frame): Break out code into
3792         make_eh_frame_section, and call it.
3793         (Layout::make_eh_frame_section): New function.
3794         (Layout::add_eh_frame_for_plt): New function.
3795         * layout.h (class Layout): Update declarations.
3796         * merge.cc (Merge_map::add_mapping): Add assertion.
3797         * i386.cc: Include "dwarf.h".
3798         (class Output_data_plt_i386): Make first_plt_entry,
3799         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3800         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3801         and plt_eh_frame_fde.
3802         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3803         boundary.  Call add_eh_frame_for_plt if appropriate.
3804         * x86_64.cc: Include "dwarf.h".
3805         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3806         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3807         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3808         and plt_eh_frame_fde.
3809         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3810         appropriate.
3811
3812 2011-06-29  Ian Lance Taylor  <iant@google.com>
3813
3814         PR gold/12629
3815         * object.cc (Sized_relobj_file::layout_section): Change shdr
3816         parameter to be const.
3817         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3818         out of do_layout.
3819         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3820         appropriate.  Call layout_eh_frame_section.
3821         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3822         sections.
3823         * object.h (class Sized_relobj_file): Update declarations.
3824
3825 2011-06-29  Ian Lance Taylor  <iant@google.com>
3826
3827         PR gold/12652
3828         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3829         modifier.
3830         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3831
3832 2011-06-29  Ian Lance Taylor  <iant@google.com>
3833
3834         PR gold/12675
3835         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3836         SHT_X86_64_UNWIND.
3837         * layout.cc (Layout::layout_eh_frame): Likewise.
3838
3839 2011-06-29  Ian Lance Taylor  <iant@google.com>
3840
3841         PR gold/12695
3842         * layout.cc (Layout::symtab_section_shndx): New function.
3843         * layout.h (class Layout): Declare symtab_section_shndx.
3844         * output.cc (Output_section::write_header): Call it.
3845
3846 2011-06-29  Ian Lance Taylor  <iant@google.com>
3847
3848         PR gold/12818
3849         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3850         symbols which are not used in a relocation.
3851
3852 2011-06-28  Ian Lance Taylor  <iant@google.com>
3853
3854         PR gold/12898
3855         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3856         script create indistinguishable segments.
3857         (Layout::set_segment_offsets): Use stable_sort when sorting
3858         segments.  Pass this to Compare_segments constructor.
3859         * layout.h (class Layout): Make segment_precedes non-static.
3860         (class Compare_segments): Change from struct to class.  Add
3861         layout_ field.  Add constructor.
3862         * script-sections.cc
3863         (Script_sections::attach_sections_using_phdrs_clause): Rename
3864         local orphan to is_orphan.  Don't report failure to put empty
3865         section in segment.  On attachment failure, report name of
3866         section, and attach to first PT_LOAD segment.
3867
3868 2011-06-28  Ian Lance Taylor  <iant@google.com>
3869
3870         PR gold/12934
3871         * target-select.cc (Target_selector::Target_selector): Add
3872         emulation parameter.  Change all callers.
3873         (select_target_by_bfd_name): Rename from select_target_by_name.
3874         Change all callers.
3875         (select_target_by_emulation): New function.
3876         (supported_emulation_names): New function.
3877         * target-select.h (class Target_selector): Add emulation_ field.
3878         Update declarations.
3879         (Target_selector::recognize_by_bfd_name): Rename from
3880         recognize_by_name.  Change all callers.
3881         (Target_selector::supported_bfd_names): Rename from
3882         supported_names.  Change all callers.
3883         (Target_selector::recognize_by_emulation): New function.
3884         (Target_selector::supported_emulations): New function.
3885         (Target_selector::emulation): New function.
3886         (Target_selector::do_recognize_by_bfd_name): Rename from
3887         do_recognize_by_name.  Change all callers.
3888         (Target_selector::do_supported_bfd_names): Rename from
3889         do_supported_names.  Change all callers.
3890         (Target_selector::do_recognize_by_emulation): New function.
3891         (Target_selector::do_supported_emulations): New function.
3892         (select_target_by_bfd_name): Change name in declaration.
3893         (select_target_by_emulation): Declare.
3894         (supported_emulation_names): Declare.
3895         * parameters.cc (parameters_force_valid_target): Try to find
3896         target based on emulation from -m option.
3897         * options.h (class General_options): Change doc string for -m.
3898         * options.cc (help): Print emulations.
3899         (General_options::parse_V): Likewise.
3900         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3901         Add emulation parameter.  Change all callers.
3902
3903 2011-06-28  Ian Lance Taylor  <iant@google.com>
3904
3905         * target.h (class Target): Add osabi_ field.
3906         (Target::osabi): New function.
3907         (Target::set_osabi): New function.
3908         (Target::Target): Initialize osabi_.
3909         (Target::do_adjust_elf_header): Make pure virtual.
3910         (Sized_target::do_adjust_elf_header): Declare.
3911         * target.cc (Sized_target::do_adjust_elf_header): New function.
3912         (class Sized_target): Instantiate all versions.
3913         * freebsd.h (class Target_freebsd): Remove.
3914         (Target_selector_freebsd::do_recognize): Call set_osabi on
3915         Target.
3916         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3917         (Target_selector_freebsd::set_osabi): Remove.
3918         * i386.cc (class Target_i386): Inherit from Sized_target rather
3919         than Target_freebsd.
3920         * x86_64.cc (class Target_x86_64): Likewise.
3921
3922 2011-06-28  Ian Lance Taylor  <iant@google.com>
3923
3924         * target.h (Target::can_check_for_function_pointers): Rewrite.
3925         Make non-virtual.
3926         (Target::can_icf_inline_merge_sections): Likewise.
3927         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3928         (Target::Target_info): Add can_icf_inline_merge_sections field.
3929         (Target::do_can_check_for_function_pointers): New virtual
3930         function.
3931         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3932         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3933         from can_check_for_function_pointers, move in file.
3934         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3935         section_may_have_icf_unsafe_poineters, move in file.
3936         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3937         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3938         Rename from can_check_for_function_pointers, move in file.
3939         (Target_i386::can_icf_inline_merge_sections): Remove.
3940         (Target_i386::i386_info): Initialize
3941         can_icf_inline_merge_sections.
3942         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3943         Initialize can_icf_inline_merge_sections.
3944         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3945         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3946         Rename from can_check_for_function_pointers, move in file.
3947         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3948         (Target_x86_64::x86_64_info): Initialize
3949         can_icf_inline_merge_sections.
3950         * testsuite/testfile.cc (Target_test::test_target_info):
3951         Likewise.
3952         * icf.cc (get_section_contents): Correct formatting.
3953
3954 2011-06-27  Ian Lance Taylor  <iant@google.com>
3955
3956         * symtab.cc (Symbol::versioned_name): New function.
3957         (Symbol_table::add_to_final_symtab): Use versioned_name when
3958         appropriate.
3959         (Symbol_table::sized_write_symbol): Likewise.
3960         * symtab.h (class Symbol): Declare versioned_name.
3961         * stringpool.h (class Stringpool_template): Add variant of add
3962         which takes a std::basic_string.
3963         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3964         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3965         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3966         (ver_test_12.o): New target.
3967         * testsuite/Makefile.in: Rebuild.
3968
3969 2011-06-27  Doug Kwan  <dougkwan@google.com>
3970
3971         * arm.cc (Arm_relocate_functions::thm_jump8,
3972         Arm_relocate_functions::thm_jump11): Use a wider signed
3973         type to compute offset.
3974         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3975         arm_thm_jump8.
3976         * testsuite/Makefile.in: Regenerate.
3977         * testsuite/arm_branch_in_range.sh: Check test results of
3978         arm_thm_jump11 and arm_thm_jump8.
3979         * testsuite/arm_thm_jump11.s: New test source file.
3980         * testsuite/arm_thm_jump11.t: New linker script.
3981         * testsuite/arm_thm_jump8.s: New test source file.
3982         * testsuite/arm_thm_jump8.t: New linker script.
3983
3984 2011-06-24  Ian Lance Taylor  <iant@google.com>
3985
3986         * layout.cc: Include "object.h".
3987         (ctors_sections_in_init_array): New static variable.
3988         (Layout::is_ctors_in_init_array): New function.
3989         (Layout::layout): Add entry to ctors_sections_in_init_array if
3990         appropriate.
3991         * layout.h (class Layout): Declare is_ctors_in_init_array.
3992         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3993         is_ctors_reverse_view is set.
3994         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3995         all callers.  Set is_ctors_reverse_view field of View_size.
3996         (Sized_relobj_file::reverse_words): New function.
3997         * object.h (Sized_relobj_file::View_size): Add
3998         is_ctors_reverse_view field.
3999         (class Sized_relobj_file): Update declarations.
4000         * testsuite/initpri3.c: New test.
4001         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4002         initpri3b.
4003         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4004         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4005         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4006         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4007         * testsuite/Makefile.in: Rebuild.
4008
4009 2011-06-24  Cary Coutant  <ccoutant@google.com>
4010
4011         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4012         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4013         (debug_msg_cdebug.err): New targets.
4014         * testsuite/Makefile.in: Regenerate.
4015         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4016         Fix checks for link with shared library.
4017
4018 2011-06-24  Doug Kwan  <dougkwan@google.com>
4019
4020         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4021         skip empty text sections.
4022         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4023
4024 2011-06-22  Ian Lance Taylor  <iant@google.com>
4025
4026         PR gold/12910
4027         * options.h (class General_options): Add --ctors-in-init-array.
4028         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4029         friends as SHT_PROGBITS for merging sections.
4030         (Layout::layout): Remove special handling of .init_array and
4031         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4032         and .dtors if ctors_in_init_array.
4033         (Layout::make_output_section): Force correct section types for
4034         .init_array and friends.  Don't sort if doing relocatable link,
4035         Don't sort .ctors and .dtors if ctors_in_init_array.
4036         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4037         (Layout::output_section_name): Add relobj parameter.  Change all
4038         callers.  Handle .ctors. and .dtors. in code rather than table.
4039         Handle .ctors and .dtors if ctors_in_init_array.
4040         (Layout::match_file_name): New function, moved from output.cc.
4041         * layout.h (class Layout): Update declarations.
4042         * output.cc: Include "layout.h".
4043         (Input_section_sort_entry::get_priority): New function.
4044         (Input_section_sort_entry::match_file_name): Just call
4045         Layout::match_file_name.
4046         (Output_section::Input_section_sort_init_fini_compare::operator()):
4047         Handle .ctors and .dtors.  Sort by explicit priority rather than
4048         by name.
4049         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4050         * testsuite/initpri2.c: New test.
4051         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4052         (check_PROGRAMS): Add initpri2.
4053         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4054         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4055         * configure, testsuite/Makefile.in: Rebuild.
4056
4057 2011-06-19  Ian Lance Taylor  <iant@google.com>
4058
4059         PR gold/12880
4060         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4061         .interp section to a PT_INTERP segment even if we have seen a
4062         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4063         clause in a linker script.
4064         (Layout::finalize): Don't create a .interp section if we've
4065         already create a PT_INTERP segment.
4066         (Layout::create_interp): Always call choose_output_section (revert
4067         patch of 2011-06-17).  Don't create PT_INTERP segment.
4068         * script-sections.cc
4069         (Script_sections::create_note_and_tls_segments): Add a .interp
4070         section to a PT_INTERP segment even if we have seen a
4071         --dynamic-linker option.
4072
4073 2011-06-18  Ian Lance Taylor  <iant@google.com>
4074
4075         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4076         merely because a non-PT_LOAD segment has a dynamic reloc.
4077
4078 2011-06-18  Ian Lance Taylor  <iant@google.com>
4079
4080         * layout.cc (Layout::finish_dynamic_section): Don't create
4081         DT_FLAGS entry if not needed.
4082
4083 2011-06-18  Ian Lance Taylor  <iant@google.com>
4084
4085         PR gold/12745
4086         * layout.cc (Layout::layout_eh_frame): Correct handling of
4087         writable .eh_frame section.
4088
4089 2011-06-17  Ian Lance Taylor  <iant@google.com>
4090
4091         PR gold/12893
4092         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4093         symbol is redefined with the exact same object and value.
4094
4095 2011-06-17  Ian Lance Taylor  <iant@google.com>
4096
4097         PR gold/12880
4098         * layout.h (class Layout): Add interp_segment_ field.
4099         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4100         (Layout::attach_allocated_section_to_segment): If making shared
4101         library, put .interp section in PT_INTERP segment.
4102         (Layout::finalize): Also call create_interp if -dynamic-linker
4103         option was used.
4104         (Layout::create_interp): Assert that there is no PT_INTERP
4105         segment.  If not using a SECTIONS clause, use make_output_section.
4106         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4107         * script-sections.cc
4108         (Script_sections::create_note_and_tls_segments): If making shared
4109         library, put .interp section in PT_INTERP segment.
4110
4111 2011-06-17  Ian Lance Taylor  <iant@google.com>
4112
4113         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4114         when making a shared library.
4115
4116 2011-06-17  Ian Lance Taylor  <iant@google.com>
4117
4118         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4119         parameter.  Change all callers.  Don't issue warning about PC32
4120         against locally defined symbol.
4121
4122 2011-06-16  Ian Lance Taylor  <iant@google.com>
4123
4124         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4125         occurs in same object.
4126
4127 2011-06-14  Alan Modra  <amodra@gmail.com>
4128
4129         * po/POTFILES.in: Regenerate.
4130
4131 2011-06-09  Ian Lance Taylor  <iant@google.com>
4132
4133         * script-sections.cc
4134         (Orphan_output_section::set_section_addresses): For a relocatable
4135         link set address to 0.
4136
4137 2011-06-09  Cary Coutant  <ccoutant@google.com>
4138
4139         PR gold/12804
4140         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4141         used with --compress-debug-sections.
4142         * gold/object.cc (Sized_relobj_file::do_layout): Report
4143         uncompressed size of compressed input sections.
4144
4145 2011-06-08  Cary Coutant  <ccoutant@google.com>
4146
4147         PR gold/12804
4148         * testsuite/two_file_test_2_v1.cc: Change initialization of
4149         v2 to keep it in .data.
4150
4151 2011-06-07  Cary Coutant  <ccoutant@google.com>
4152
4153         * common.cc (Symbol_table::do_allocate_commons_list): Call
4154         gold_fallback.
4155         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4156         (Errors::fallback): New function.
4157         (gold_fallback): New function.
4158         * errors.h (Errors::fallback): New function.
4159         * gold.cc (gold_exit): Change status parameter to enum; adjust
4160         all callers.
4161         (queue_initial_tasks): Call gold_fallback.
4162         * gold.h: Include cstdlib.
4163         (Exit_status): New enum type.
4164         (gold_exit): Change status parameter to enum.
4165         (gold_fallback): New function.
4166         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4167         (Layout::create_symtab_sections): Likewise.
4168         (Layout::create_shdrs): Likewise.
4169         * main.cc (main): Adjust call to gold_exit.
4170         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4171         (Output_data_got::add_got_entry_pair): Likewise.
4172         (Output_section::add_input_section): Likewise.
4173         (Output_section::add_output_section_data): Likewise.
4174         (Output_segment::set_section_list_addresses): Likewise.
4175         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4176
4177 2011-06-07  Cary Coutant  <ccoutant@google.com>
4178
4179         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4180         for incremental links.
4181         * output.cc (Output_segment::set_section_list_addresses): Remove
4182         FIXME and test for TLS or BSS.
4183
4184 2011-06-07  Cary Coutant  <ccoutant@google.com>
4185
4186         * testsuite/Makefile.am: Add incremental_copy_test,
4187         incremental_common_test_1.
4188         * testsuite/Makefile.in: Regenerate.
4189         * testsuite/common_test_1_v1.c: New source file.
4190         * testsuite/common_test_1_v2.c: New source file.
4191         * testsuite/copy_test_v1.cc: New source file.
4192
4193 2011-06-07  Cary Coutant  <ccoutant@google.com>
4194
4195         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4196         update, allocate common from bss section's free list.
4197         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4198         linker-defined symbols.
4199         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4200         Skip GOT and PLT entries that are no longer referenced.
4201         (Output_section_incremental_inputs::write_info_blocks): Mark
4202         linker-defined symbols.
4203         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4204         * output.cc (Output_section::allocate): New function.
4205         * output.h (Output_section::allocate): New function.
4206         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4207         linker-defined symbols.
4208         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4209         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4210         (Symbol::init_base_output_data): Likewise.
4211         (Symbol::init_base_output_segment): Likewise.
4212         (Symbol::init_base_constant): Likewise.
4213         (Sized_symbol::init_output_data): Likewise.
4214         (Sized_symbol::init_output_segment): Likewise.
4215         (Sized_symbol::init_constant): Likewise.
4216         (Symbol_table::do_define_in_output_data): Likewise.
4217         (Symbol_table::do_define_in_output_segment): Likewise.
4218         (Symbol_table::do_define_as_constant): Likewise.
4219         * symtab.h (Symbol::is_predefined): New function.
4220         (Symbol::init_base_output_data): Add is_predefined parameter.
4221         (Symbol::init_base_output_segment): Likewise.
4222         (Symbol::init_base_constant): Likewise.
4223         (Symbol::is_predefined_): New data member.
4224         (Sized_symbol::init_output_data): Add is_predefined parameter.
4225         (Sized_symbol::init_output_segment): Likewise.
4226         (Sized_symbol::init_constant): Likewise.
4227         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4228
4229 2011-06-07  Cary Coutant  <ccoutant@google.com>
4230
4231         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4232         instead of emit_copy_reloc.
4233         (Copy_relocs::emit_copy_reloc): Refactor.
4234         (Copy_relocs::make_copy_reloc): New function.
4235         (Copy_relocs::add_copy_reloc): Remove.
4236         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4237         section.
4238         (Copy_relocs::make_copy_reloc): New function.
4239         (Copy_relocs::add_copy_reloc): Remove.
4240         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4241         unchanged input files.
4242         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4243         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4244         Reserve BSS space for COPY relocations.
4245         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4246         (Output_section_incremental_inputs::write_info_blocks): Record
4247         whether a symbol is copied from a shared object.
4248         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4249         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4250         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4251         (Incremental_input_entry_reader::get_output_symbol_index): Add
4252         is_copy parameter.
4253         (Incremental_binary::emit_copy_relocs): New function.
4254         (Incremental_binary::do_emit_copy_relocs): New function.
4255         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4256         new data member.
4257         (Sized_incremental_binary::add_copy_reloc): New function.
4258         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4259         (Sized_incremental_binary::Copy_reloc): New struct.
4260         (Sized_incremental_binary::Copy_relocs): New typedef.
4261         (Sized_incremental_binary::copy_relocs_): New data member.
4262         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4263         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4264         * target.h (Sized_target::emit_copy_reloc): New function.
4265         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4266
4267 2011-06-02  Cary Coutant  <ccoutant@google.com>
4268
4269         PR gold/12163
4270         * gold/archive.cc (Archive::Archive): Initialize new data member.
4271         (Archive::include_all_members): Return if archive has already been
4272         included.
4273         * gold/archive.h (Archive::include_all_members_): New data member.
4274
4275 2011-06-02  Nick Clifton  <nickc@redhat.com>
4276
4277         * dynobj.h: Fix spelling mistake in comment.
4278         * output.cc: Likewise.
4279
4280 2011-05-31  Doug Kwan  <dougkwan@google.com>
4281             Asier Llano
4282
4283         PR gold/12826
4284         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4285         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4286         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4287         redundant arm_exidx_test.so.
4288         * testsuite/Makefile.in: Regenerate.
4289         (check_SCRIPTS): Add pr12826.sh
4290         (check_DATA): Add pr12826.stdout
4291         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4292         * testsuite/pr12826.sh: New file.
4293         * testsuite/pr12826_1.s: Ditto.
4294         * testsuite/pr12826_1.s: Ditto.
4295
4296 2011-05-30  Ian Lance Taylor  <iant@google.com>
4297
4298         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4299         sections.
4300
4301 2011-05-29  Ian Lance Taylor  <iant@google.com>
4302
4303         PR gold/12804
4304         * testsuite/Makefile.am: Use different file name for two_file_test
4305         temporary file for each incremental test.
4306         * testsuite/Makefile.in: Rebuild.
4307
4308 2011-05-29  Ian Lance Taylor  <iant@google.com>
4309
4310         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4311         binary input file is empty.
4312
4313 2011-05-27  Ian Lance Taylor  <iant@google.com>
4314
4315         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4316         (ver_test_9.so): Likewise.
4317         * testsuite/Makefile.in: Rebuild.
4318
4319 2011-05-26 Cary Coutant  <ccoutant@google.com>
4320
4321         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4322         * incremental.cc (Incremental_inputs::report_input_section): Fix
4323         comment, indentation.
4324         (Incremental_inputs::report_comdat_group): New function.
4325         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4326         of data for incremental input file entry.
4327         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4328         group count, COMDAT group signatures.
4329         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4330         an unchanged input file.
4331         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4332         Initialize new data member.
4333         (Incremental_object_entry::add_comdat_group): New function.
4334         (Incremental_object_entry::get_comdat_group_count): New function.
4335         (Incremental_object_entry::get_comdat_signature_key): New function.
4336         (Incremental_object_entry::groups_): New data member.
4337         (Incremental_inputs::report_comdat_group): New function.
4338         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4339         data for incremental input file entry.
4340         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4341         (Incremental_input_entry_reader::get_input_section): Adjust size of
4342         data for incremental input file entry.
4343         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4344         (Incremental_input_entry_reader::get_comdat_group_signature): New
4345         function.
4346         * object.cc (Sized_relobj::include_section_group): Report kept
4347         COMDAT groups for incremental links.
4348
4349 2011-05-24  David Meyer  <pdox@google.com>
4350
4351         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4352         with name parameter.  Add found_name parameter.
4353         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4354         * dirsearch.h (class Dirsearch): Update declaration.
4355
4356 2011-05-24  Ian Lance Taylor  <iant@google.com>
4357
4358         * archive.cc (Library_base::should_include_member): Pull in object
4359         from archive if it defines the entry symbol.
4360         * parameters.cc (Parameters::entry): New function.
4361         * parameters.h (class Parameters): Declare entry.
4362         * output.h (class Output_file_header): Remove entry_ field.
4363         * output.cc (Output_file_header::Output_file_header): Remove entry
4364         parameter.  Change all callers.
4365         (Output_file_header::entry): Use parameters->entry.
4366         * gold.cc (queue_middle_tasks): Likewise.
4367         * plugin.cc (Plugin_hook::run): Likewise.
4368
4369 2011-05-24 Cary Coutant  <ccoutant@google.com>
4370
4371         * gold.cc (queue_initial_tasks): Pass incremental base filename
4372         to Output_file::open_base_file; don't print error message.
4373         * incremental-dump.cc (main): Adjust call to
4374         Output_file::open_for_modification.
4375         * incremental-dump.cc (main): Likewise.
4376         * incremental.cc (Incremental_inputs::report_command_line):
4377         Ignore --incremental-base option when comparing command lines.
4378         Ignore parameter when given as separate argument.
4379         * options.h (class General_options): Add --incremental-base.
4380         * output.cc (Output_file::Output_file):
4381         (Output_file::open_base_file): Add base_name and writable parameters;
4382         read base file into new file; print error message here.
4383         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4384         callers.
4385         * output.h (Output_file::open_for_modification): Rename to...
4386         (Output_file::open_base_file): ...this; add base_name and
4387         writable parameters; adjust all callers.
4388         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4389         callers.
4390         * testsuite/Makefile.am (incremental_test_4): Test
4391         --incremental-base.
4392         * testsuite/Makefile.in: Regenerate.
4393
4394 2011-05-24 Cary Coutant  <ccoutant@google.com>
4395
4396         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4397         incremental_test_4.
4398         * testsuite/Makefile.in: Regenerate.
4399         * testsuite/two_file_test_1_v1.cc: New test source file.
4400         * testsuite/two_file_test_1b_v1.cc: New test source file.
4401         * testsuite/two_file_test_2_v1.cc: New test source file.
4402
4403 2011-05-24 Cary Coutant  <ccoutant@google.com>
4404
4405         * dynobj.h (Dynobj::do_dynobj): New function.
4406         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4407         flag and soname for shared objects.
4408         * incremental.cc (Incremental_inputs::report_object): Make
4409         either Incremental_object_entry or Incremental_dynobj_entry; add
4410         soname to string table.
4411         (Incremental_inputs::report_input_section): Add assertion.
4412         (Output_section_incremental_inputs::set_final_data_size): Adjust
4413         type of input file entry for shared libraries; adjust size of
4414         shared library info entry.
4415         (Output_section_incremental_inputs::write_input_files): Write
4416         as_needed flag for shared libraries.
4417         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4418         of input file entry for shared libraries; write soname.
4419         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4420         soname from incremental info.
4421         * incremental.h (enum Incremental_input_flags): Add
4422         INCREMENTAL_INPUT_AS_NEEDED.
4423         (Incremental_input_entry::Incremental_input_entry): Initialize new
4424         data member.
4425         (Incremental_input_entry::set_as_needed): New function.
4426         (Incremental_input_entry::as_needed): New function.
4427         (Incremental_input_entry::do_dynobj_entry): New function.
4428         (Incremental_input_entry::as_needed_): New data member.
4429         (Incremental_object_entry::Incremental_object_entry): Don't check
4430         for shared library.
4431         (Incremental_object_entry::do_type): Likewise.
4432         (class Incremental_dynobj_entry): New class.
4433         (Incremental_input_entry_reader::as_needed): New function.
4434         (Incremental_input_entry_reader::get_soname): New function.
4435         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4436         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4437         size of shared library info entry.
4438         * layout.cc (Layout::finish_dynamic_section): Don't test for
4439         incremental link when adding DT_NEEDED entries.
4440         * object.h (Object::Object): Initialize new data member.
4441         (Object::dynobj): New function.
4442         (Object::set_as_needed): New function.
4443         (Object::as_needed): New function.
4444         (Object::do_dynobj): New function.
4445         (Object::as_needed_): New data member.
4446
4447 2011-05-24 Cary Coutant  <ccoutant@google.com>
4448
4449         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4450         info; adjust display of GOT entries.
4451         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4452         vector of input objects; remove file_status_.
4453         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4454         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4455         got_plt reader; call target hooks to reserve GOT entries.
4456         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4457         of input file info header and GOT info entry.
4458         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4459         relocation info.
4460         (Got_plt_view_info::got_descriptor): Remove.
4461         (Got_plt_view_info::sym_index): New data member.
4462         (Got_plt_view_info::input_index): New data member.
4463         (Local_got_offset_visitor::visit): Write input file index.
4464         (Global_got_offset_visitor::visit): Write 0 for input file index.
4465         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4466         with sym_index and input_index.
4467         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4468         incremental info GOT entry; replace got_descriptor with input_index.
4469         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4470         map from input file index to object.
4471         (Sized_relobj_incr::do_layout): Replace direct data member reference
4472         with accessor function.
4473         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4474         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4475         Adjust size of input file info header.
4476         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4477         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4478         (Incremental_input_entry_reader::get_input_section): Adjust size of
4479         input file info header.
4480         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4481         of incremental info GOT entry.
4482         (Incremental_got_plt_reader::get_got_desc): Remove.
4483         (Incremental_got_plt_reader::get_got_symndx): New function.
4484         (Incremental_got_plt_reader::get_got_input_index): New function.
4485         (Sized_incremental_binary::Sized_incremental_binary): Remove
4486         file_status_; add input_objects_.
4487         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4488         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4489         (Sized_incremental_binary::file_is_unchanged): Remove.
4490         (Sized_incremental_binary::set_input_object): New function.
4491         (Sized_incremental_binary::input_object): New function.
4492         (Sized_incremental_binary::file_status_): Remove.
4493         (Sized_incremental_binary::input_objects_): New data member.
4494         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4495         references.
4496         (Sized_relobj_incr::invalid_address): Move to base class.
4497         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4498         class.
4499         (Sized_relobj_incr::do_output_section_offset): Likewise.
4500         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4501         (Sized_relobj_incr::section_offsets_): Likewise.
4502         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4503         function.
4504         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4505         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4506         with accessor function.
4507         (Sized_relobj_file::do_layout): Likewise.
4508         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4509         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4510         (Sized_relobj_file::compute_final_local_value): Replace refs to
4511         section_offsets_ with accessor function.
4512         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4513         * object.h (Relobj::Relobj): Initialize new data members.
4514         (Relobj::add_dyn_reloc): New function.
4515         (Relobj::first_dyn_reloc): New function.
4516         (Relobj::dyn_reloc_count): New function.
4517         (Relobj::first_dyn_reloc_): New data member.
4518         (Relobj::dyn_reloc_count_): New data member.
4519         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4520         references.
4521         (Sized_relobj::Address): New typedef.
4522         (Sized_relobj::invalid_address): Move here from child class.
4523         (Sized_relobj::Sized_relobj): Initialize new data members.
4524         (Sized_relobj::sized_relobj): New function.
4525         (Sized_relobj::is_output_section_offset_invalid): Move here from
4526         child class.
4527         (Sized_relobj::get_output_section_offset): Likewise.
4528         (Sized_relobj::local_has_got_offset): Likewise.
4529         (Sized_relobj::local_got_offset): Likewise.
4530         (Sized_relobj::set_local_got_offset): Likewise.
4531         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4532         (Sized_relobj::clear_got_offsets): New function.
4533         (Sized_relobj::section_offsets): Move here from child class.
4534         (Sized_relobj::do_output_section_offset): Likewise.
4535         (Sized_relobj::do_set_section_offset): Likewise.
4536         (Sized_relobj::Local_got_offsets): Likewise.
4537         (Sized_relobj::local_got_offsets_): Likewise.
4538         (Sized_relobj::section_offsets_): Likewise.
4539         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4540         references.
4541         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4542         class.
4543         (Sized_relobj_file::sized_relobj): New function
4544         (Sized_relobj_file::local_has_got_offset): Move to base class.
4545         (Sized_relobj_file::local_got_offset): Likewise.
4546         (Sized_relobj_file::set_local_got_offset): Likewise.
4547         (Sized_relobj_file::get_output_section_offset): Likewise.
4548         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4549         (Sized_relobj_file::do_output_section_offset): Likewise.
4550         (Sized_relobj_file::do_set_section_offset): Likewise.
4551         (Sized_relobj_file::Local_got_offsets): Likewise.
4552         (Sized_relobj_file::local_got_offsets_): Likewise.
4553         (Sized_relobj_file::section_offsets_): Likewise.
4554         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4555         (all constructors).
4556         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4557         (Output_reloc::get_symbol_index): Likewise.
4558         (Output_reloc::local_section_offset): Likewise.
4559         (Output_reloc::get_address): Likewise.
4560         (Output_reloc::symbol_value): Likewise.
4561         (Output_data_got::reserve_slot): Move to class definition.
4562         (Output_data_got::reserve_local): New function.
4563         (Output_data_got::reserve_slot_for_global): Remove.
4564         (Output_data_got::reserve_global): New function.
4565         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4566         (all constructors, two instantiations).
4567         (Output_reloc::get_relobj): New function (two instantiations).
4568         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4569         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4570         (Output_data_reloc::add_global): Adjust type of relobj.
4571         (Output_data_reloc::add_global_relative): Likewise.
4572         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4573         (Output_data_reloc::add_local): Likewise.
4574         (Output_data_reloc::add_local_relative): Likewise.
4575         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4576         (Output_data_reloc::add_local_section): Likewise.
4577         (Output_data_reloc::add_output_section): Likewise.
4578         (Output_data_reloc::add_absolute): Likewise.
4579         (Output_data_reloc::add_target_specific): Likewise.
4580         (Output_data_got::reserve_slot): Move definition here.
4581         (Output_data_got::reserve_local): New function.
4582         (Output_data_got::reserve_global): New function.
4583         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4584         section_offsets_ with accessor function.
4585         (Sized_relobj_file::write_sections): Likewise.
4586         (Sized_relobj_file::do_relocate_sections): Likewise.
4587         * target.h (Sized_target::reserve_local_got_entry): New function.
4588         (Sized_target::reserve_global_got_entry): New function.
4589         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4590         (Target_x86_64::reserve_global_got_entry): New function.
4591         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4592
4593 2011-05-23 Cary Coutant  <ccoutant@google.com>
4594
4595         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4596         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4597         bit when checking got_type.
4598         * incremental.cc (Sized_incremental_binary::setup_readers):
4599         Store symbol table and string table locations; initialize bit vector
4600         of file status flags.
4601         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4602         unchanged files.
4603         (Sized_incremental_binary::do_process_got_plt): New function.
4604         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4605         (Output_section_incremental_inputs::set_final_data_size): Record
4606         file index for each input file.
4607         (Output_section_incremental_inputs::write_got_plt): Store file index
4608         instead of input entry offset for each GOT entry.
4609         * incremental.h
4610         (Incremental_input_entry::Incremental_input_entry): Initialize new
4611         data member.
4612         (Incremental_input_entry::set_offset): Store file index.
4613         (Incremental_input_entry::get_file_index): New function.
4614         (Incremental_input_entry::file_index_): New data member.
4615         (Incremental_binary::process_got_plt): New function.
4616         (Incremental_binary::do_process_got_plt): New function.
4617         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4618         data members.
4619         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4620         (Sized_incremental_binary::set_file_is_unchanged): New function.
4621         (Sized_incremental_binary::file_is_unchanged): New function.
4622         (Sized_incremental_binary::do_process_got_plt): New function.
4623         (Sized_incremental_binary::file_status_): New data member.
4624         (Sized_incremental_binary::main_symtab_loc_): New data member.
4625         (Sized_incremental_binary::main_strtab_loc_): New data member.
4626         * output.cc (Output_data_got::Got_entry::write): Add case
4627         RESERVED_CODE.
4628         (Output_data_got::add_global): Call add_got_entry.
4629         (Output_data_got::add_global_plt): Likewise.
4630         (Output_data_got::add_global_with_rel): Likewise.
4631         (Output_data_got::add_global_with_rela): Likewise.
4632         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4633         (Output_data_got::add_global_pair_with_rela): Likewise.
4634         (Output_data_got::add_local): Call add_got_entry.
4635         (Output_data_got::add_local_plt): Likewise.
4636         (Output_data_got::add_local_with_rel): Likewise.
4637         (Output_data_got::add_local_with_rela): Likewise.
4638         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4639         (Output_data_got::add_local_pair_with_rela): Likewise.
4640         (Output_data_got::reserve_slot): New function.
4641         (Output_data_got::reserve_slot_for_global): New function.
4642         (Output_data_got::add_got_entry): New function.
4643         (Output_data_got::add_got_entry_pair): New function.
4644         (Output_section::add_output_section_data): Edit FIXME.
4645         * output.h
4646         (Output_section_data_build::Output_section_data_build): New
4647         constructor with size parameter.
4648         (Output_data_space::Output_data_space): Likewise.
4649         (Output_data_got::Output_data_got): Initialize new data member; new
4650         constructor with size parameter.
4651         (Output_data_got::add_constant): Call add_got_entry.
4652         (Output_data_got::reserve_slot): New function.
4653         (Output_data_got::reserve_slot_for_global): New function.
4654         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4655         (Output_data_got::add_got_entry): New function.
4656         (Output_data_got::add_got_entry_pair): New function.
4657         (Output_data_got::free_list_): New data member.
4658         * target.h (Sized_target::init_got_plt_for_update): New function.
4659         (Sized_target::register_global_plt_entry): New function.
4660         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4661         Initialize new data member; call init; add constructor with PLT count.
4662         (Output_data_plt_x86_64::init): New function.
4663         (Output_data_plt_x86_64::add_relocation): New function.
4664         (Output_data_plt_x86_64::reserve_slot): New function.
4665         (Output_data_plt_x86_64::free_list_): New data member.
4666         (Target_x86_64::init_got_plt_for_update): New function.
4667         (Target_x86_64::register_global_plt_entry): New function.
4668         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4669         incremental updates.
4670         (Output_data_plt_x86_64::add_relocation): New function.
4671         * testsuite/object_unittest.cc (Object_test): Set default options.
4672
4673 2011-05-16  Ian Lance Taylor  <iant@google.com>
4674
4675         * options.h (class General_options): Make -i a synonym for -r.
4676
4677 2011-05-16  Ian Lance Taylor  <iant@google.com>
4678
4679         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4680
4681 2011-05-10 Cary Coutant  <ccoutant@google.com>
4682
4683         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4684         strip_all (-s).
4685
4686 2011-05-06  Ian Lance Taylor  <iant@google.com>
4687
4688         * layout.cc (Layout::layout): If the output section flags change,
4689         update the ordering.
4690
4691 2011-04-25 Cary Coutant  <ccoutant@google.com>
4692
4693         * incremental-dump.cc (dump_incremental_inputs): Print local
4694         symbol info for each input file.
4695         * incremental.cc
4696         (Output_section_incremental_inputs::set_final_data_size): Add local
4697         symbol info to input file entries in incremental info.
4698         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4699         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4700         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4701         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4702         implementation.
4703         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4704         (Sized_incr_relobj::do_relocate): Write the local symbols.
4705         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4706         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4707         Adjust size of input file header.
4708         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4709         (Incremental_inputs_reader::get_local_symbol_count): New function.
4710         (Incremental_inputs_reader::get_input_section): Adjust size of input
4711         file header.
4712         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4713         (Sized_incr_relobj::This): New typedef.
4714         (Sized_incr_relobj::sym_size): New const data member.
4715         (Sized_incr_relobj::Local_symbol): New struct.
4716         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4717         (Sized_incr_relobj::do_local_symbol_offset): New function.
4718         (Sized_incr_relobj::local_symbol_count_): New data member.
4719         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4720         (Sized_incr_relobj::local_symbol_index_): New data member.
4721         (Sized_incr_relobj::local_symbol_offset_): New data member.
4722         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4723         (Sized_incr_relobj::local_symbols_): New data member.
4724         * object.h (Relobj::output_local_symbol_count): New function.
4725         (Relobj::local_symbol_offset): New function.
4726         (Relobj::do_output_local_symbol_count): New function.
4727         (Relobj::do_local_symbol_offset): New function.
4728         (Sized_relobj::do_output_local_symbol_count): New function.
4729         (Sized_relobj::do_local_symbol_offset): New function.
4730
4731 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4732
4733         * descriptors.cc (set_close_on_exec): New function.
4734         (Descriptors::open): Use set_close_on_exec.
4735         * output.cc (S_ISLNK): Define if not defined.
4736
4737 2011-04-22 Cary Coutant  <ccoutant@google.com>
4738
4739         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4740         global symbol map.
4741         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4742         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4743         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4744         relocations.
4745         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4746         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4747         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4748         * incremental.h
4749         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4750         function.
4751         (Incremental_binary::apply_incremental_relocs): New function.
4752         (Incremental_binary::do_apply_incremental_relocs): New function.
4753         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4754         data member.
4755         (Sized_incremental_binary::add_global_symbol): New function.
4756         (Sized_incremental_binary::global_symbol): New function.
4757         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4758         (Sized_incremental_binary::symbol_map_): New data member.
4759         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4760         * target.h (Sized_target::apply_relocation): New function.
4761         * target-reloc.h (apply_relocation): New function.
4762         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4763
4764 2011-04-22  Doug Kwan  <dougkwan@google.com>
4765
4766         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4767         flag of a SHT_ARM_EXIDX section.
4768         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4769         * testsuite/Makefile.in: Regenerate.
4770         * testsuite/arm_exidx_test.s: New file.
4771         * testsuite/arm_exidx_test.sh: Same.
4772
4773 2011-04-20 Cary Coutant  <ccoutant@google.com>
4774
4775         PR gold/12689
4776         * archive.h (Incremental_archive_entry::Archive_member):
4777         Initialize arg_serial_ (second constructor).
4778
4779 2011-04-17  Ian Lance Taylor  <iant@google.com>
4780
4781         * object.cc (Relocate_info::location): Simplify location string.
4782         * errors.cc (Errors::error_at_location): Don't print program
4783         name.
4784         (Errors::warning_at_location): Likewise.
4785         (Errors::undefined_symbol): Likewise.
4786         * testsuite/debug_msg.sh: Update accordingly.
4787
4788 2011-04-14 Cary Coutant  <ccoutant@google.com>
4789
4790         * gold/layout.cc (Layout::symtab_section_offset): New function.
4791         * gold/layout.h (Layout::symtab_section_offset): New function.
4792         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4793
4794 2011-04-12  Ian Lance Taylor  <iant@google.com>
4795
4796         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4797         with MREMAP_MAYMOVE.
4798         * output.h (class Output_file): Add map_is_allocated_ field.
4799         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4800         not available, provide stubs.  If mremap is not available, #define
4801         it to gold_mremap.
4802         (MREMAP_MAYMOVE): Define if not defined.
4803         (Output_file::Output_file): Initialize map_is_allocated_.
4804         (Output_file::resize): Check map_is_allocated_.
4805         (Output_file::map_anonymous): If mmap fails, use malloc.
4806         (Output_file::unmap): Don't do anything for an anonymous map.
4807         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4808         is not available, provide stubs.
4809         (File_read::View::~View): Use free rather than delete[].
4810         (File_read::make_view): Use malloc rather than new[].  If mmap
4811         fails, use malloc.
4812         (File_read::find_or_make_view): Use malloc rather than new[].
4813         * gold.h: Remove HAVE_REMAP code.
4814         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4815         exists.  Rename mremap to gold_mremap.  If mmap is not available
4816         don't do anything.
4817         * configure, config.in: Rebuild.
4818
4819 2011-04-11  Ian Lance Taylor  <iant@google.com>
4820
4821         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4822         initialize local variable v.
4823
4824 2011-04-11  Cary Coutant  <ccoutant@google.com>
4825
4826         * archive.cc (Archive::include_member): Adjust call to
4827         report_object.
4828         (Add_archive_symbols::run): Track argument serial numbers.
4829         (Lib_group::include_member): Likewise.
4830         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4831         * archive.h (Incremental_archive_entry::Archive_member):
4832         Initialize arg_serial_.
4833         (Archive_member::arg_serial_): New data member.
4834         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4835         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4836         incremental link.
4837         (Sized_dynobj::do_for_all_local_got_entries): New function.
4838         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4839         function.
4840         * fileread.cc (get_mtime): New function.
4841         * fileread.h (get_mtime): New function.
4842         * gold.cc (queue_initial_tasks): Check for incremental update.
4843         (process_incremental_input): New function.
4844         (queue_middle_tasks): Don't force valid target for incremental
4845         update.
4846         * incremental-dump.cc (find_input_containing_global): Adjust
4847         size of symbol info entry.
4848         (dump_incremental_inputs): Dump argument serial number and
4849         in_system_directory flag; bias shndx by 1; print symbol names
4850         when dumping per-file symbol lists; use new symbol info readers.
4851         * incremental.cc
4852         (Output_section_incremental_inputs:update_data_size): New function.
4853         (Sized_incremental_binary::setup_readers): Setup input readers
4854         for each input file; build maps for files added from libraries
4855         and scripts.
4856         (Sized_incremental_binary::check_input_args): New function.
4857         (Sized_incremental_binary::do_check_inputs): Build map of argument
4858         serial numbers to input arguments.
4859         (Sized_incremental_binary::do_file_has_changed): Rename
4860         do_file_is_unchanged to this; compare file modification times.
4861         (Sized_incremental_binary::do_init_layout): New function.
4862         (Sized_incremental_binary::do_reserve_layout): New function.
4863         (Sized_incremental_binary::do_get_input_reader): Remove.
4864         (Sized_incremental_binary::get_symtab_view): New function.
4865         (Incremental_checker::can_incrementally_link_output_file): Remove.
4866         (Incremental_inputs::report_command_line): Exclude --debug options.
4867         (Incremental_inputs::report_archive_begin): Add parameter; track
4868         argument serial numbers; don't put input file entry for archive
4869         before archive members.
4870         (Incremental_inputs::report_archive_end): Put input file entry
4871         for archive after archive members.
4872         (Incremental_inputs::report_object): Add parameter; track argument
4873         serial numbers and in_system_directory flag.
4874         (Incremental_inputs::report_script): Add parameter; track argument
4875         serial numbers.
4876         (Output_section_incremental_inputs::set_final_data_size): Adjust
4877         size of symbol info entry; check for forwarding symbols.
4878         (Output_section_incremental_inputs::write_input_files): Write
4879         in_system_directory flag and argument serial number.
4880         (Output_section_incremental_inputs::write_info_blocks): Map section
4881         indices between incremental info and original input file; store
4882         input section index for each symbol.
4883         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4884         change operator() to visit().
4885         (class Global_got_offset_visitor): Likewise.
4886         (class Global_symbol_visitor_got_plt):
4887         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4888         classes.
4889         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4890         (Sized_incr_relobj::do_read_symbols): New function.
4891         (Sized_incr_relobj::do_layout): New function.
4892         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4893         (Sized_incr_relobj::do_add_symbols): New function.
4894         (Sized_incr_relobj::do_should_include_member): New function.
4895         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4896         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4897         (Sized_incr_relobj::do_section_size): New function.
4898         (Sized_incr_relobj::do_section_name): New function.
4899         (Sized_incr_relobj::do_section_contents): New function.
4900         (Sized_incr_relobj::do_section_flags): New function.
4901         (Sized_incr_relobj::do_section_entsize): New function.
4902         (Sized_incr_relobj::do_section_address): New function.
4903         (Sized_incr_relobj::do_section_type): New function.
4904         (Sized_incr_relobj::do_section_link): New function.
4905         (Sized_incr_relobj::do_section_info): New function.
4906         (Sized_incr_relobj::do_section_addralign): New function.
4907         (Sized_incr_relobj::do_initialize_xindex): New function.
4908         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4909         (Sized_incr_relobj::do_read_relocs): New function.
4910         (Sized_incr_relobj::do_gc_process_relocs): New function.
4911         (Sized_incr_relobj::do_scan_relocs): New function.
4912         (Sized_incr_relobj::do_count_local_symbols): New function.
4913         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4914         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4915         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4916         (Sized_incr_relobj::do_relocate): New function.
4917         (Sized_incr_relobj::do_set_section_offset): New function.
4918         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4919         (Sized_incr_dynobj::do_read_symbols): New function.
4920         (Sized_incr_dynobj::do_layout): New function.
4921         (Sized_incr_dynobj::do_add_symbols): New function.
4922         (Sized_incr_dynobj::do_should_include_member): New function.
4923         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4924         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4925         (Sized_incr_dynobj::do_section_size): New function.
4926         (Sized_incr_dynobj::do_section_name): New function.
4927         (Sized_incr_dynobj::do_section_contents): New function.
4928         (Sized_incr_dynobj::do_section_flags): New function.
4929         (Sized_incr_dynobj::do_section_entsize): New function.
4930         (Sized_incr_dynobj::do_section_address): New function.
4931         (Sized_incr_dynobj::do_section_type): New function.
4932         (Sized_incr_dynobj::do_section_link): New function.
4933         (Sized_incr_dynobj::do_section_info): New function.
4934         (Sized_incr_dynobj::do_section_addralign): New function.
4935         (Sized_incr_dynobj::do_initialize_xindex): New function.
4936         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4937         (make_sized_incremental_object): New function.
4938         (Incremental_library::copy_unused_symbols): New function.
4939         (Incremental_library::do_for_all_unused_symbols): New function.
4940         * incremental.h (enum Incremental_input_flags): New type.
4941         (class Incremental_checker): Remove.
4942         (Incremental_input_entry::Incremental_input_entry): Add argument
4943         serial number.
4944         (Incremental_input_entry::arg_serial): New function.
4945         (Incremental_input_entry::set_is_in_system_directory): New function.
4946         (Incremental_input_entry::is_in_system_directory): New function.
4947         (Incremental_input_entry::arg_serial_): New data member.
4948         (Incremental_input_entry::is_in_system_directory_): New data member.
4949         (class Script_info): Move here from script.h.
4950         (Script_info::Script_info): Add filename parameter.
4951         (Script_info::filename): New function.
4952         (Script_info::filename_): New data member.
4953         (Incremental_script_entry::Incremental_script_entry): Add argument
4954         serial number.
4955         (Incremental_object_entry::Incremental_object_entry): Likewise.
4956         (Incremental_object_entry::add_input_section): Build list of input
4957         sections with map to original shndx.
4958         (Incremental_object_entry::get_input_section_index): New function.
4959         (Incremental_object_entry::shndx_): New data member.
4960         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4961         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4962         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4963         serial number.
4964         (Incremental_inputs::report_archive_begin): Likewise.
4965         (Incremental_inputs::report_object): Likewise.
4966         (Incremental_inputs::report_script): Likewise.
4967         (class Incremental_global_symbol_reader): New class.
4968         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4969         and store flags and input file type.
4970         (Incremental_input_entry_reader::arg_serial): New function.
4971         (Incremental_input_entry_reader::type): Extract type from flags.
4972         (Incremental_input_entry_reader::is_in_system_directory): New function.
4973         (Incremental_input_entry_reader::get_input_section_count): Call
4974         accessor function for type.
4975         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4976         function for type; adjust size of global symbol entry.
4977         (Incremental_input_entry_reader::get_global_symbol_count): Call
4978         accessor function for type.
4979         (Incremental_input_entry_reader::get_object_count): Likewise.
4980         (Incremental_input_entry_reader::get_object_offset): Likewise.
4981         (Incremental_input_entry_reader::get_member_count): Likewise.
4982         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4983         (Incremental_input_entry_reader::get_member_offset): Likewise.
4984         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4985         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4986         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4987         (Incremental_input_entry_reader::get_global_symbol_reader): New
4988         function.
4989         (Incremental_input_entry_reader::get_output_symbol_index): New
4990         function.
4991         (Incremental_input_entry_reader::type_): Remove.
4992         (Incremental_input_entry_reader::flags_): New data member.
4993         (Incremental_inputs_reader::input_file_offset): New function.
4994         (Incremental_inputs_reader::input_file_index): New function.
4995         (Incremental_inputs_reader::input_file): Call input_file_offset.
4996         (Incremental_inputs_reader::input_file_at_offset): New function.
4997         (Incremental_relocs_reader::get_r_type): Reformat.
4998         (Incremental_relocs_reader::get_r_shndx): Reformat.
4999         (Incremental_relocs_reader::get_r_offset): Reformat.
5000         (Incremental_relocs_reader::data): New function.
5001         (Incremental_binary::Incremental_binary): Initialize new data members.
5002         (Incremental_binary::check_inputs): Add cmdline parameter.
5003         (Incremental_binary::file_is_unchanged): Remove.
5004         (Input_reader::arg_serial): New function.
5005         (Input_reader::get_unused_symbol_count): New function.
5006         (Input_reader::get_unused_symbol): New function.
5007         (Input_reader::do_arg_serial): New function.
5008         (Input_reader::do_get_unused_symbol_count): New function.
5009         (Input_reader::do_get_unused_symbol): New function.
5010         (Incremental_binary::input_file_count): New function.
5011         (Incremental_binary::get_input_reader): Change signature to use
5012         index instead of filename.
5013         (Incremental_binary::file_has_changed): New function.
5014         (Incremental_binary::get_input_argument): New function.
5015         (Incremental_binary::get_library): New function.
5016         (Incremental_binary::get_script_info): New function.
5017         (Incremental_binary::init_layout): New function.
5018         (Incremental_binary::reserve_layout): New function.
5019         (Incremental_binary::output_file): New function.
5020         (Incremental_binary::do_check_inputs): New function.
5021         (Incremental_binary::do_file_is_unchanged): Remove.
5022         (Incremental_binary::do_file_has_changed): New function.
5023         (Incremental_binary::do_init_layout): New function.
5024         (Incremental_binary::do_reserve_layout): New function.
5025         (Incremental_binary::do_input_file_count): New function.
5026         (Incremental_binary::do_get_input_reader): Change signature.
5027         (Incremental_binary::input_args_map_): New data member.
5028         (Incremental_binary::library_map_): New data member.
5029         (Incremental_binary::script_map_): New data member.
5030         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5031         new data members.
5032         (Sized_incremental_binary::output_section): New function.
5033         (Sized_incremental_binary::inputs_reader): Add const.
5034         (Sized_incremental_binary::symtab_reader): Add const.
5035         (Sized_incremental_binary::relocs_reader): Add const.
5036         (Sized_incremental_binary::got_plt_reader): Add const.
5037         (Sized_incremental_binary::get_symtab_view): New function.
5038         (Sized_incremental_binary::Inputs_reader): New typedef.
5039         (Sized_incremental_binary::Input_entry_reader): New typedef.
5040         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5041         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5042         (Sized_incremental_binary::do_file_has_changed): New function.
5043         (Sized_incremental_binary::do_init_layout): New function.
5044         (Sized_incremental_binary::do_reserve_layout): New function.
5045         (Sized_input_reader::Inputs_reader): Remove.
5046         (Sized_input_reader::Input_entry_reader): Remove.
5047         (Sized_input_reader::do_arg_serial): New function.
5048         (Sized_input_reader::do_get_unused_symbol_count): New function.
5049         (Sized_input_reader::do_get_unused_symbol): New function.
5050         (Sized_incremental_binary::do_input_file_count): New function.
5051         (Sized_incremental_binary::do_get_input_reader): Change signature;
5052         use index instead of filename.
5053         (Sized_incremental_binary::section_map_): New data member.
5054         (Sized_incremental_binary::input_entry_readers_): New data member.
5055         (class Sized_incr_relobj): New class.
5056         (class Sized_incr_dynobj): New class.
5057         (make_sized_incremental_object): New function.
5058         (class Incremental_library): New class.
5059         * layout.cc (Free_list::num_lists): New static data member.
5060         (Free_list::num_nodes): New static data member.
5061         (Free_list::num_removes): New static data member.
5062         (Free_list::num_remove_visits): New static data member.
5063         (Free_list::num_allocates): New static data member.
5064         (Free_list::num_allocate_visits): New static data member.
5065         (Free_list::init): New function.
5066         (Free_list::remove): New function.
5067         (Free_list::allocate): New function.
5068         (Free_list::dump): New function.
5069         (Free_list::print_stats): New function.
5070         (Layout_task_runner::run): Resize output file for incremental updates.
5071         (Layout::Layout): Initialize new data members.
5072         (Layout::set_incremental_base): New function.
5073         (Layout::init_fixed_output_section): New function.
5074         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5075         incremental updates.
5076         (Layout::create_gold_note): Do not create gold note section for
5077         incremental updates.
5078         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5079         for incremental updates.
5080         (Layout::set_section_offsets): For incremental updates, allocate space
5081         from free list.
5082         (Layout::create_symtab_sections): Layout with offsets relative to
5083         start of section; for incremental updates, allocate space from free
5084         list.
5085         (Layout::create_shdrs): For incremental updates, allocate space from
5086         free list.
5087         (Layout::finish_dynamic_section): For incremental updates, do not
5088         check --as-needed (fixed in subsequent patch).
5089         * layout.h (class Free_list): New class.
5090         (Layout::set_incremental_base): New function.
5091         (Layout::incremental_base): New function.
5092         (Layout::init_fixed_output_section): New function.
5093         (Layout::allocate): New function.
5094         (Layout::incremental_base_): New data member.
5095         (Layout::free_list_): New data member.
5096         * main.cc (main): Print Free_list statistics.
5097         * object.cc (Relobj::finalize_incremental_relocs): Add
5098         clear_counts parameter; clear counts only when clear_counts is set.
5099         (Sized_relobj::Sized_relobj): Initialize new base class.
5100         (Sized_relobj::do_layout): Don't report special sections.
5101         (Sized_relobj::do_for_all_local_got_entries): New function.
5102         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5103         symtab_off to all symbol table offsets.
5104         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5105         * object.h (class Got_offset_list): Move to top of file.
5106         (Object::Object): Allow case where input_file == NULL.
5107         (Object::~Object): Likewise.
5108         (Object::input_file): Assert that input_file != NULL.
5109         (Object::lock): Allow case where input_file == NULL.
5110         (Object::unlock): Likewise.
5111         (Object::is_locked): Likewise.
5112         (Object::token): Likewise.
5113         (Object::release): Likewise.
5114         (Object::is_incremental): New function.
5115         (Object::get_mtime): New function.
5116         (Object::for_all_local_got_entries): New function.
5117         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5118         (Object::set_is_in_system_directory): New function.
5119         (Object::is_in_system_directory): New function.
5120         (Object::do_is_incremental): New function.
5121         (Object::do_get_mtime): New function.
5122         (Object::do_for_all_local_got_entries): New function.
5123         (Object::is_in_system_directory_): New data member.
5124         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5125         (class Sized_relobj_base): New class.
5126         (class Sized_relobj): Derive from Sized_relobj_base.
5127         (class Sized_relobj::Symbols): Redeclare from base class.
5128         (class Sized_relobj::local_got_offset_list): Remove.
5129         (class Sized_relobj::Output_sections): Redeclare from base class.
5130         (class Sized_relobj::do_for_all_local_got_entries): New function.
5131         (class Sized_relobj::write_local_symbols): Add offset parameter.
5132         (class Sized_relobj::local_symbol_offset_): Update comment.
5133         (class Sized_relobj::local_dynsym_offset_): Update comment.
5134         * options.cc (Input_arguments::add_file): Remove const.
5135         * options.h (Input_file_argument::Input_file_argument):
5136         Initialize arg_serial_ (all constructors).
5137         (Input_file_argument::set_arg_serial): New function.
5138         (Input_file_argument::arg_serial): New function.
5139         (Input_file_argument::arg_serial_): New data member.
5140         (Input_arguments::Input_arguments): Initialize file_count_.
5141         (Input_arguments::add_file): Remove const.
5142         (Input_arguments::number_of_input_files): New function.
5143         (Input_arguments::file_count_): New data member.
5144         (Command_line::number_of_input_files): Call
5145         Input_arguments::number_of_input_files.
5146         * output.cc (Output_segment_headers::Output_segment_headers):
5147         Set current size.
5148         (Output_section::Input_section::current_data_size): New function.
5149         (Output_section::Output_section): Initialize new data members.
5150         (Output_section::add_input_section): Don't do merge sections for
5151         an incremental link; allocate space from free list for an
5152         incremental update.
5153         (Output_section::add_output_section_data): Allocate space from
5154         free list for an incremental update.
5155         (Output_section::update_data_size): New function.
5156         (Output_section::set_fixed_layout): New function.
5157         (Output_section::reserve): New function.
5158         (Output_segment::set_section_addresses): Remove const.
5159         (Output_segment::set_section_list_addresses): Remove const; allocate
5160         space from free list for an incremental update.
5161         (Output_segment::set_offset): Adjust size of RELRO segment for an
5162         incremental update.
5163         * output.h (Output_data::current_data_size): Move here from
5164         child classes.
5165         (Output_data::pre_finalize_data_size): New function.
5166         (Output_data::update_data_size): New function.
5167         (Output_section_headers::update_data_size): new function.
5168         (Output_section_data_build::current_data_size): Move to Output_data.
5169         (Output_data_strtab::update_data_size): New function.
5170         (Output_section::current_data_size): Move to Output_data.
5171         (Output_section::set_fixed_layout): New function.
5172         (Output_section::has_fixed_layout): New function.
5173         (Output_section::reserve): New function.
5174         (Output_section::update_data_size): New function.
5175         (Output_section::has_fixed_layout_): New data member.
5176         (Output_section::free_list_): New data member.
5177         (Output_segment::set_section_addresses): Remove const.
5178         (Output_segment::set_section_list_addresses): Remove const.
5179         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5180         New function.
5181         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5182         New function.
5183         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5184         parameter when calling Add_symbols constructor; store argument
5185         serial number for members of a lib group.
5186         (Add_symbols::locks): Allow case where token == NULL.
5187         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5188         (Read_member::~Read_member): New function.
5189         (Read_member::is_runnable): New function.
5190         (Read_member::locks): New function.
5191         (Read_member::run): New function.
5192         (Check_script::~Check_script): New function.
5193         (Check_script::is_runnable): New function.
5194         (Check_script::locks): New function.
5195         (Check_script::run): New function.
5196         (Check_library::~Check_library): New function.
5197         (Check_library::is_runnable): New function.
5198         (Check_library::locks): New function.
5199         (Check_library::run): New function.
5200         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5201         (Add_symbols::library_): New data member.
5202         (class Read_member): New class.
5203         (class Check_script): New class.
5204         (class Check_library): New class.
5205         * reloc.cc (Read_relocs::is_runnable): Allow case where
5206         token == NULL.
5207         (Read_relocs::locks): Likewise.
5208         (Scan_relocs::locks): Likewise.
5209         (Relocate_task::locks): Likewise.
5210         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5211         to clear counters.
5212         (Sized_relobj::incremental_relocs_scan): Fix comment.
5213         (Sized_relobj::do_relocate): Pass output file offset to
5214         write_local_symbols.
5215         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5216         from class declaration.
5217         * script.cc (read_input_script): Allocate Script_info; pass
5218         argument serial number to report_script.
5219         * script.h (class Script_info): Move to incremental.h.
5220         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5221         * symtab.h (Symbol_table::add_from_incrobj): New function.
5222         (Symbol_table::set_file_offset): New function.
5223
5224 2011-04-05  Cary Coutant  <ccoutant@google.com>
5225
5226         * incremental-dump.cc (dump_incremental_inputs): Change signature
5227         to take a Sized_incremental_binary; change caller.  Use readers
5228         in Sized_incremental_binary.
5229         * incremental.cc
5230         (Sized_incremental_binary::find_incremental_inputs_sections):
5231         Rename do_find_incremental_inputs_sections to this.
5232         (Sized_incremental_binary::setup_readers): New function.
5233         (Sized_incremental_binary::do_check_inputs): Check
5234         has_incremental_info_ flag; move setup code to setup_readers;
5235         use input readers.
5236         (Sized_incremental_binary::do_file_is_unchanged): New function.
5237         (Sized_incremental_binary::do_get_input_reader): New function.
5238         * incremental.h (class Incremental_binary): Move to end of file.
5239         (Incremental_binary::file_is_unchanged): New function.
5240         (Incremental_binary::do_file_is_unchanged): New function.
5241         (Incremental_binary::Input_reader): New class.
5242         (Incremental_binary::get_input_reader): New function.
5243         (class Sized_incremental_binary): Move to end of file.
5244         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5245         input section reader classes.
5246         (Sized_incremental_binary::has_incremental_info): New function.
5247         (Sized_incremental_binary::inputs_reader): New function.
5248         (Sized_incremental_binary::symtab_reader): New function.
5249         (Sized_incremental_binary::relocs_reader): New function.
5250         (Sized_incremental_binary::got_plt_reader): New function.
5251         (Sized_incremental_binary::do_file_is_unchanged): New function.
5252         (Sized_incremental_binary::Sized_input_reader): New class.
5253         (Sized_incremental_binary::get_input_reader): New function.
5254         (Sized_incremental_binary::find_incremental_inputs_sections):
5255         Rename do_find_incremental_inputs_sections to this.
5256         (Sized_incremental_binary::setup_readers): New function.
5257         (Sized_incremental_binary::has_incremental_info_): New data member.
5258         (Sized_incremental_binary::inputs_reader_): New data member.
5259         (Sized_incremental_binary::symtab_reader_): New data member.
5260         (Sized_incremental_binary::relocs_reader_): New data member.
5261         (Sized_incremental_binary::got_plt_reader_): New data member.
5262         (Sized_incremental_binary::current_input_file_): New data member.
5263
5264 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5265
5266         PR gold/12640
5267         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5268         violation.
5269
5270 2011-03-30  Cary Coutant  <ccoutant@google.com>
5271
5272         * archive.cc (Archive::include_member): Adjust call to report_object.
5273         (Add_archive_symbols::run): Add script_info to call to
5274         report_archive_begin.
5275         (Lib_group::include_member): Adjust call to report_object.
5276         (Add_lib_group_symbols::run): Adjust call to report_object.
5277         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5278         blocks.  Add object count for script input files.
5279         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5280         script_info parameter; change all callers.
5281         (Incremental_inputs::report_object): Add script_info parameter;
5282         change all callers.
5283         (Incremental_inputs::report_script): Store backpointer to
5284         incremental info entry.
5285         (Output_section_incremental_inputs::set_final_data_size): Record
5286         additional information for scripts.
5287         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5288         * incremental.h (Incremental_script_entry::add_object): New function.
5289         (Incremental_script_entry::get_object_count): New function.
5290         (Incremental_script_entry::get_object): New function.
5291         (Incremental_script_entry::objects_): New data member; adjust
5292         constructor.
5293         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5294         (Incremental_inputs::report_object): Add script_info parameter.
5295         (Incremental_inputs_reader::get_object_count): New function.
5296         (Incremental_inputs_reader::get_object_offset): New function.
5297         * options.cc (Input_arguments::add_file): Return reference to
5298         new input argument.
5299         * options.h (Input_argument::set_script_info): New function.
5300         (Input_argument::script_info): New function.
5301         (Input_argument::script_info_): New data member; adjust all
5302         constructors.
5303         (Input_file_group::add_file): Return reference to new input argument.
5304         (Input_file_lib::add_file): Likewise.
5305         (Input_arguments::add_file): Likewise.
5306         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5307         * script.cc (Parser_closure::Parser_closure): Add script_info
5308         parameter; adjust all callers.
5309         (Parser_closure::script_info): New function.
5310         (Parser_closure::script_info_): New data member.
5311         (read_input_script): Report scripts earlier to incremental info.
5312         (script_add_file): Set script_info in Input_argument.
5313         (script_add_library): Likewise.
5314         * script.h (Script_options::Script_info): Rewrite class.
5315
5316 2011-03-29  Cary Coutant  <ccoutant@google.com>
5317
5318         * archive.cc (Library_base::should_include_member): Move
5319         method here from class Archive.
5320         (Archive::Archive): Initialize base class.
5321         (Archive::should_include_member): Move to base class.
5322         (Archive::do_for_all_unused_symbols): New function.
5323         (Add_archive_symbols::run): Remove redundant access to
5324         incremental_inputs.
5325         (Lib_group::Lib_group): Initialize base class.
5326         (Lib_group::do_filename): New function.
5327         (Lib_group::include_member): Pass pointer to Lib_group to
5328         report_object.
5329         (Lib_group::do_for_all_unused_symbols): New function.
5330         (Add_lib_group_symbols::run): Report archive information for
5331         incremental links.
5332         * archive.h (class Library_base): New base class.
5333         (class Archive): Derive from Library_base.
5334         (Archive::filename): Move to base class.
5335         (Archive::set_incremental_info): Likewise.
5336         (Archive::incremental_info): Likewise.
5337         (Archive::Should_include): Likewise.
5338         (Archive::should_include_member): Likewise.
5339         (Archive::Armap_entry): Remove.
5340         (Archive::Unused_symbol_iterator): Remove.
5341         (Archive::unused_symbols_begin): Remove.
5342         (Archive::unused_symbols_end): Remove.
5343         (Archive::do_filename): New function.
5344         (Archive::do_get_mtime): New function.
5345         (Archive::do_for_all_unused_symbols): New function.
5346         (Archive::task_): Move to base class.
5347         (Archive::incremental_info_): Likewise.
5348         (class Lib_group): Derive from Library_base.
5349         (Lib_group::do_filename): New function.
5350         (Lib_group::do_get_mtime): New function.
5351         (Lib_group::do_for_all_unused_symbols): New function.
5352         (Lib_group::task_): Move to base class.
5353         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5354         function.
5355         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5356         function.
5357         * incremental.cc (Incremental_inputs::report_archive_begin):
5358         Use Library_base; call library's get_mtime; add incremental inputs
5359         entry before members.
5360         (class Unused_symbol_visitor): New class.
5361         (Incremental_inputs::report_archive_end): Use Library_base; use
5362         visitor class to record unused symbols; don't add incremental inputs
5363         entry after members.
5364         (Incremental_inputs::report_object): Use Library_base.
5365         * incremental.h
5366         (Incremental_archive_entry::Incremental_archive_entry): Remove
5367         unused Archive parameter.
5368         (Incremental_inputs::report_archive_begin): Use Library_base.
5369         (Incremental_inputs::report_archive_end): Likewise.
5370         (Incremental_inputs::report_object): Likewise.
5371         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5372         function.
5373         * object.h (Object::for_all_global_symbols): New function.
5374         (Object::do_for_all_global_symbols): New function.
5375         (Sized_relobj::do_for_all_global_symbols): New function.
5376         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5377         function.
5378         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5379         function.
5380
5381 2011-03-27  Ian Lance Taylor  <iant@google.com>
5382
5383         * archive.cc (Archive::interpret_header): Return -1 if something
5384         goes wrong.  Change callers accordingly.
5385
5386 2011-03-25  Cary Coutant  <ccoutant@google.com>
5387
5388         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5389         * testsuite/Makefile.in: Regenerate.
5390
5391 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5392
5393         * plugin.cc (get_view): New.
5394         (Plugin::load): Pass get_view to the plugin.
5395         (Plugin_manager::get_view): New.
5396
5397 2011-03-21  Ian Lance Taylor  <iant@google.com>
5398
5399         * testsuite/final_layout.sh: Rewrite to not use dc.
5400         * testsuite/relro_test.sh: Fail if dc is not present.
5401
5402 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5403
5404         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5405         Change == to -eq.
5406         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5407         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5408         Change == to -eq.
5409         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5410         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5411
5412 2011-03-14  Ian Lance Taylor  <iant@google.com>
5413
5414         * script-sections.cc (Sort_output_sections::script_compare):
5415         Rename from is_before, change return type.
5416         (Sort_output_sections::operator()): Adjust accordingly.
5417
5418 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5419
5420         PR gold/12572
5421         * testsuite/odr_violation2.cc: Add comment to make all error line
5422         numbers double digits.
5423         * testsuite/debug_msg.sh: Adjust expected errors.
5424
5425 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5426
5427         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5428         but mark earlier ones as non-canonical
5429         (offset_to_iterator): Update search target and example
5430         (do_addr2line): Return extra lines in a vector*
5431         (format_file_lineno): Extract from do_addr2line
5432         (one_addr2line): Add vector* out-param
5433         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5434         when a lineno entry appeared last for its instruction
5435         (Dwarf_line_info): Add vector* out-param
5436         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5437         * symtab.cc (Odr_violation_compare): Include the lineno in the
5438         comparison again.
5439         (linenos_from_loc): New. Combine the canonical line for an
5440         address with its other lines.
5441         (True_if_intersect): New. Helper functor to make
5442         std::set_intersection a query.
5443         (detect_odr_violations): Compare sets of lines instead of just
5444         one line for each function. This became less deterministic, but
5445         has fewer false positives.
5446         * symtab.h: Declarations.
5447         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5448         mix an optimized and non-optimized object in the same binary
5449         (odr_violation2.so): Same.
5450         * testsuite/Makefile.in: Regenerate from Makefile.am.
5451         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5452         * testsuite/debug_msg.sh: Update line numbers and add
5453         assertions.
5454         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5455         non-optimized context.
5456         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5457         isn't inlined, and use OdrDerived in an optimized context.
5458         * testsuite/odr_header1.h: Defines OdrDerived, where
5459         optimization will change the
5460         first-instruction-in-the-destructor's file and line number.
5461         * testsuite/odr_header2.h: Defines OdrBase.
5462
5463 2011-03-09  Ian Lance Taylor  <iant@google.com>
5464
5465         * fileread.cc (File_read::clear_views): Don't delete the whole
5466         file view.
5467
5468 2011-03-08  Ian Lance Taylor  <iant@google.com>
5469
5470         PR gold/12525
5471         * fileread.cc: #include <climits>.
5472         (GOLD_IOV_MAX): Define.
5473         (File_read::read_multiple): Limit number of entries by iov_max.
5474         * fileread.h (class File_read): Always set max_readv_entries to
5475         128.
5476
5477 2011-03-07  Ian Lance Taylor  <iant@google.com>
5478
5479         PR gold/12525
5480         * options.h (class General_options): Add -dy and -dn.
5481
5482 2011-03-02  Cary Coutant  <ccoutant@google.com>
5483
5484         * testsuite/script_test_9.t: Add TLS segment.
5485
5486 2011-03-02  Simon Baldwin  <simonb@google.com>
5487
5488         * configure.ac: Add check for gnu_indirect_function support in
5489         the toolchain building binutils.
5490         * configure: Rebuild.
5491
5492 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5493
5494         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5495         plugin only symbols.
5496         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5497         in plugin files as not needed in the symbol table.
5498
5499 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5500
5501         * output.cc (Output_section::add_input_section): Delay fill
5502         generation for section ordering.
5503
5504 2011-02-09  Ian Lance Taylor  <iant@google.com>
5505
5506         PR gold/12316
5507         * object.h (class Sized_relobj): Remove clear_local_symbols.
5508         * reloc.cc (Sized_relobj::do_relocate): Don't call
5509         clear_local_symbols.
5510
5511 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5512
5513         * plugin.cc (is_visible_from_outside): Return true for symbols
5514         in the -u option.
5515
5516 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5517
5518         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5519         filename.
5520
5521 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5522
5523         * icf.h (is_section_foldable_candidate): Change type of parameter
5524         to std::string.
5525         * icf.cc (Icf::find_identical_sections): Change type of local variable
5526         section_name to be std::string.
5527         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5528
5529 2011-01-25  Ian Lance Taylor  <iant@google.com>
5530
5531         * script.cc (script_add_extern): Rewrite to use
5532         add_symbol_reference.
5533
5534 2011-01-25  Doug Kwan  <dougkwan@google.com>
5535
5536         * icf.cc (get_section_contents): Always lock section's object.
5537
5538 2011-01-24  Ian Lance Taylor  <iant@google.com>
5539
5540         * options.h (class General_options): Accept
5541         --no-detect-odr-violations.
5542
5543 2011-01-24  Ian Lance Taylor  <iant@google.com>
5544
5545         * version.cc (version_string): Bump to 1.11.
5546
5547 2011-01-24  Ian Lance Taylor  <iant@google.com>
5548
5549         * plugin.cc (class Plugin_rescan): Define new class.
5550         (Plugin_manager::claim_file): Set any_claimed_.
5551         (Plugin_manager::save_archive): New function.
5552         (Plugin_manager::save_input_group): New function.
5553         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5554         necessary.
5555         (Plugin_manager::new_undefined_symbol): New function.
5556         (Plugin_manager::rescan): New function.
5557         (Plugin_manager::rescannable_defines): New function.
5558         (Plugin_manager::add_input_file): Set any_added_.
5559         * plugin.h (class Plugin_manager): define new fields rescannable_,
5560         undefined_symbols_, any_claimed_, and any_added_.  Declare
5561         Plugin_rescan as friend.  Declare new functions.
5562         (Plugin_manager::Rescannable): Define type.
5563         (Plugin_manager::Rescannable_list): Define type.
5564         (Plugin_manager::Undefined_symbol_list): Define type.
5565         (Plugin_manager::Plugin_manager): Initialize new fields.
5566         * archive.cc (Archive::defines_symbol): New function.
5567         (Add_archive_symbols::run): Pass archive to plugins if any.
5568         * archive.h (class Archive): Declare defines_symbol.
5569         * readsyms.cc (Input_group::~Input_group): New function.
5570         (Finish_group::run): Pass input_group to plugins if any.
5571         * readsyms.h (class Input_group): Declare destructor.
5572         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5573         any.
5574
5575 2011-01-10  Ian Lance Taylor  <iant@google.com>
5576
5577         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5578         section as relro.
5579         (Layout::set_segment_offsets): Reset increase_relro before calling
5580         set_section_addresses a second time.
5581
5582 2011-01-04  Cary Coutant  <ccoutant@google.com>
5583
5584         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5585         sections before NOBITS sections.
5586
5587 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5588
5589         * version.cc (print_version): Update copyright to 2011.
5590
5591 2010-12-23  Cary Coutant  <ccoutant@google.com>
5592
5593         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5594         of OS to this->add.  Add OD parameter to second form of the function.
5595
5596 2010-12-20  Ian Lance Taylor  <iant@google.com>
5597
5598         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5599         second of two consecutive entries with same offset.
5600
5601 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5602
5603         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5604         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5605         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5606         to avoid unneeded links against $(LDADD).
5607         * testsuite/Makefile.in: Regenerate.
5608
5609 2010-12-15  Ian Lance Taylor  <iant@google.com>
5610
5611         PR gold/12324
5612         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5613         for R_X86_64_32 and R_X86_64_PC32.
5614         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5615         ver_matching_def_pic.o.
5616         (ver_matching_def_pic.o): New target.
5617
5618 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5619
5620         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5621         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5622         Move definition before File_read::View member definitions.
5623         (File_read::View::~View): Initialize and hold lock before
5624         updating current_mapped_bytes.
5625
5626 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5627
5628         * dwarf_reader.cc: Remove outdated comment.
5629         * gold-threads.cc: Fix typo in error message.
5630         * archive.cc: Fix typos in comments.
5631         * archive.h: Likewise.
5632         * arm-reloc-property.cc: Likewise.
5633         * arm-reloc-property.h: Likewise.
5634         * arm-reloc.def: Likewise.
5635         * arm.cc: Likewise.
5636         * attributes.h: Likewise.
5637         * cref.cc: Likewise.
5638         * ehframe.cc: Likewise.
5639         * fileread.h: Likewise.
5640         * gold.h: Likewise.
5641         * i386.cc: Likewise.
5642         * icf.cc: Likewise.
5643         * incremental.h: Likewise.
5644         * int_encoding.cc: Likewise.
5645         * layout.h: Likewise.
5646         * main.cc: Likewise.
5647         * merge.h: Likewise.
5648         * object.cc: Likewise.
5649         * object.h: Likewise.
5650         * options.cc: Likewise.
5651         * readsyms.cc: Likewise.
5652         * reduced_debug_output.cc: Likewise.
5653         * reloc.cc: Likewise.
5654         * script-sections.cc: Likewise.
5655         * sparc.cc: Likewise.
5656         * symtab.h: Likewise.
5657         * target-reloc.h: Likewise.
5658         * target.cc: Likewise.
5659         * target.h: Likewise.
5660         * timer.cc: Likewise.
5661         * timer.h: Likewise.
5662         * x86_64.cc: Likewise.
5663
5664 2010-12-09  Cary Coutant  <ccoutant@google.com>
5665
5666         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5667         stack.
5668         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5669         parameter; change all callers.
5670         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5671         * options.h (warn_execstack): New option.
5672
5673 2010-12-07  Doug Kwan  <dougkwan@google.com>
5674
5675         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5676         like function call relocations.
5677
5678 2010-12-07  Ian Lance Taylor  <iant@google.com>
5679
5680         * archive.cc (Archive::get_elf_object_for_member): Permit
5681         punconfigured to be NULL.
5682         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5683         (Archive::include_member): Pass NULL to get_elf_object_for_member
5684         if we searched for the archive and this is the first included
5685         object.
5686
5687 2010-12-01  Ian Lance Taylor  <iant@google.com>
5688
5689         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5690         track_relocs_type_ field.
5691         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5692         Set track_relocs_type_.
5693         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5694         contents when using RELA relocs.
5695         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5696         reloc_map_.
5697         * reloc.cc (Track_relocs::next_addend): New function.
5698         * reloc.h (class Track_relocs): Declare next_addend.
5699
5700 2010-12-01  Ian Lance Taylor  <iant@google.com>
5701
5702         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5703         virtual destructor.
5704
5705 2010-12-01  Ian Lance Taylor  <iant@google.com>
5706
5707         * README: Update compilers known to work and fail.
5708
5709 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5710
5711         * configure.in: For --enable-gold, handle value `default' instead of
5712         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5713         not the default.
5714         * configure: Regenerate.
5715
5716 2010-11-18  Doug Kwan  <dougkwan@google.com>
5717
5718         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5719         and right_alignment to be zero.  Store result alignment only if it is
5720         greater than existing alignment.
5721
5722 2010-11-16  Cary Coutant  <ccoutant@google.com>
5723
5724         PR gold/12220
5725         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5726         Check for ".zdebug_line".
5727
5728 2010-11-16  Doug Kwan  <dougkwan@google.com>
5729             Cary Coutant  <ccoutant@google.com>
5730
5731         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5732         by reference; adjust all callers.
5733         * output.cc (Output_segment::set_section_addresses): Adjust references
5734         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5735         list is empty.
5736         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5737         end at page boundary.
5738
5739 2010-11-16  Cary Coutant  <ccoutant@google.com>
5740
5741         PR gold/12220
5742         * layout.cc (Layout::choose_output_section): Transform names of
5743         compressed sections even when using a script with a SECTIONS clause.
5744         (Layout::output_section_name): Remove code to transform
5745         compressed debug section names.
5746         * output.cc (Output_section::add_input_section): Use uncompressed
5747         section size when tracking input sections.
5748
5749 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5750
5751         * symtab.h (Symbol::NON_PIC_REF): Remove.
5752         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5753         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5754         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5755         (Symbol::use_plt_offset): Take a flags argument and pass it
5756         directly to needs_dynamic_reloc.  Restrict check for undefined
5757         weak symbols to function calls.
5758         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5759         (Target_arm::Scan::global): Use it.
5760         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5761         (Target_arm::Relocate::relocate): Likewise.
5762         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5763         parameter with an r_type parameter.  Use get_reference_flags
5764         to get the flags.
5765         (Target_arm::Relocate::relocate): Update accordingly.
5766         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5767         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5768         (Target_i386::Scan::global): Likewise.
5769         (Target_i386::Relocate::relocate): Likewise.
5770         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5771         parameter with an r_type parameter.  Use get_reference_flags
5772         to get the flags.
5773         (Target_i386::Relocate::relocate): Update accordingly.
5774         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5775         (Target_powerpc::Scan::global): Use it.
5776         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5777         (Target_powerpc::Relocate::relocate): Likewise.
5778         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5779         (Target_sparc::Scan::global): Use it.
5780         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5781         (Target_sparc::Relocate::relocate): Likewise.
5782         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5783         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5784         (Target_x86_64::Scan::global): Likewise.
5785         (Target_x86_64::Relocate::relocate): Likewise.
5786
5787 2010-11-08  Doug Kwan  <dougkwan@google.com>
5788             Cary Coutant  <ccoutant@google.com>
5789
5790         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5791         (Arm_exidx_merge_section::section_contents_): New data member.
5792         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5793         (Arm_input_section::~Arm_input_section): De-allocate memory.
5794         (Arm_input_section::original_contents_): New data member.
5795         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5796         in parameters instead of calling Object::section_contents without
5797         locking.
5798         (Arm_output_section::group_section): New parameter TASK.  Pass it
5799         to callees that need locking objects.
5800         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5801         to lock EXIDX input sections.  Fix a formatting issue.  Call
5802         Arm_exidx_merged_section::build_contents to create merged section
5803         contents.
5804         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5805         to lock object of stub table owner.
5806         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5807         TEXT_SIZE to initialize data member TEXT_SIZE_.
5808         (Arm_exidx_input_section::addralign): Fix typo in comment.
5809         (Arm_exidx_input_section::text_size): New method.
5810         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5811         that require locking objects.  Lock objects before scanning for stubs
5812         and updating local symbols.
5813         (Arm_input_section<big_endian>::init): Copy contents of original
5814         input section.
5815         (Arm_input_section<big_endian>::do_write): Use saved contents of
5816         original input section instead of calling Object::section_contents
5817         without locking.
5818         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5819         size without calling Object::section_size().
5820         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5821         for size.  Allocate a buffer for merged EXIDX entries.
5822         (Arm_exidx_merged_section::build_contents): New method.
5823         (Arm_exidx_merged_section::do_write): Move merge section contents
5824         building code to Arm_exidx_merged_section::build_contetns.  Write
5825         out contetns in buffer instead of building it on the fly.
5826         (Arm_relobj::make_exidx_input_section): Also pass text section size
5827         to Arm_exidx_input_section constructor.
5828         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5829         (Arm_dynobj::do_read_symbols): Fix memory leak.
5830         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5831         * target.h: (class Task): Add forward declaration.
5832         (Target::relax): Add new parameter TASK and pass it to
5833         Target::do_relax().
5834         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5835
5836 2010-11-05  Cary Coutant  <ccoutant@google.com>
5837
5838         PR gold/10708
5839         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5840         object when reading from the file.
5841         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5842         second layout pass.
5843         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5844         when reading section contents.
5845         (get_section_contents): Likewise.
5846         (icf::find_identical_sections): Likewise.
5847         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5848         object when reading from the file.
5849         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5850         the object when doing deferred section layout.
5851
5852 2010-11-03  Nick Clifton  <nickc@redhat.com>
5853
5854         PR gold/12001
5855         * script.h (class Symbol_assignment: name): New member.  Returns
5856         the name of the symbol.
5857         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5858         Returns true if the given symbol name is on the list of
5859         assignments wating to be processed.
5860         * archive.cc (should_incldue_member): If the symbol is undefined,
5861         check to see if it is on the list of symbols pending assignment.
5862
5863 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5864
5865         * script-sections.cc (Script_sections::find_memory_region): Check
5866         for a NULL output section pointer.
5867
5868 2010-10-29  Doug Kwan  <dougkwan@google.com>
5869
5870         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5871         Output_section::add_relaxed_input_section.
5872         * output.cc (Output_section::add_relaxed_input_section): Add new
5873         arguments LAYOUT and NAME.  Set section order index.
5874         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5875         Copy section order index.
5876         * output.h (Output_section::add_relaxed_input_section): Add new
5877         arguments LAYOUT and NAME.
5878
5879 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5880
5881         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5882         NATIVE_OR_CROSS_LINKER.
5883         * testsuite/Makefile.in: Regenerate.
5884
5885 2010-10-20  Doug Kwan  <dougkwan@google.com>
5886
5887         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5888         without SHF_LINK_ORDER flags.
5889         * layout.cc (Layout::choose_output_section): Do not filter
5890         SHF_LINK_ORDER flag in a relocatable link.
5891
5892 2010-10-17  Cary Coutant  <ccoutant@google.com>
5893
5894         * output.h (Output_segment::set_section_addresses): Change function
5895         signature.  Update all callers.
5896         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5897         sections.
5898         (Output_segment::set_section_addresses): Align after last TLS
5899         section.  Add padding before last relro section instead of after.
5900
5901 2010-10-17  Doug Kwan  <dougkwan@google.com>
5902
5903         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5904         GOT output section to be writable.
5905
5906 2010-10-14  Cary Coutant  <ccoutant@google.com>
5907
5908         * debug.h (DEBUG_INCREMENTAL): New flag.
5909         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5910         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5911         mode.
5912         * incremental.cc (report_command_line): Ignore all forms of
5913         --incremental.
5914         * layout.cc (Layout::Layout): Check parameters for incremental link
5915         mode.
5916         * options.cc (General_options::parse_incremental): New function.
5917         (General_options::parse_no_incremental): New function.
5918         (General_options::parse_incremental_full): New function.
5919         (General_options::parse_incremental_update): New function.
5920         (General_options::incremental_mode_): New data member.
5921         (General_options::finalize): Check incremental_mode_.
5922         * options.h (General_options): Update help text for --incremental.
5923         Add --no-incremental, --incremental-full, --incremental-update.
5924         (General_options::Incremental_mode): New enum type.
5925         (General_options::incremental_mode): New function.
5926         (General_options::incremental_mode_): New data member.
5927         * parameters.cc (Parameters::incremental_mode_): New data member.
5928         (Parameters::set_options): Set incremental_mode_.
5929         (Parameters::set_incremental_full): New function.
5930         (Parameters::incremental): New function.
5931         (Parameters::incremental_update): New function.
5932         (set_parameters_incremental_full): New function.
5933         * parameters.h (Parameters::set_incremental_full): New function.
5934         (Parameters::incremental): New function.
5935         (Parameters::incremental_update): New function.
5936         (Parameters::incremental_mode_): New data member.
5937         (set_parameters_incremental_full): New function.
5938         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5939         incremental link mode.
5940         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5941         (Sized_relobj::do_relocate_sections): Likewise.
5942         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5943         option.
5944         * testsuite/Makefile.in: Regenerate.
5945         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5946
5947 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5948
5949         * script-sections.h (class Script_sections): Make
5950         Sections_elements typedef public.
5951         * script-sections.cc (class Sort_output_sections): Add elements_
5952         field.  Add constructor which sets it; change all callers.
5953         (Sort_output_sections::is_before): New function.
5954         (Sort_output_sections::operator()): Call is_before.
5955         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5956         conditional.
5957         * testsuite/script_test_10.sh: New test. Test script section
5958         order.
5959         * testsuite/script_test_10.t: Likewise.
5960         * testsuite/script_test_10.s: Likewise.
5961         * testsuite/Makefile.am: Wrap the cross linker tests and the
5962         common tests into NATIVE_OR_CROSS_LINKER.
5963         (check_SCRIPTS): Add script_test_10.sh.
5964         (check_DATA): Add script_test_10.stdout.
5965         (script_test_10.o, script_test_10): New targets.
5966         (script_test_10.stdout): New target.
5967         * configure, testsuite/Makefile.in: Regenerate.
5968
5969 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5970
5971         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5972         error for the deprecated relocations.
5973         (Target_arm::Scan::global): Likewise.
5974         (Target_arm::Relocate::relocate): Likewise.
5975
5976 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5977
5978         * fileread.cc (Input_file::find_file): Initialize *found_name
5979         and *namep when using the fallback search for case 4.
5980
5981 2010-10-11  Cary Coutant  <ccoutant@google.com>
5982
5983         * options.h (class General_options): Redefine -z lazy as an alias for
5984         the negation of -z now.
5985
5986 2010-10-11  Ian Lance Taylor  <iant@google.com>
5987
5988         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5989         binding.
5990
5991 2010-10-06  Nick Clifton  <nickc@redhat.com>
5992
5993         * script-sections.cc(class Memory_region): Remove
5994         current_lma_offset_ field.  Rename current_vma_offset_ to
5995         current_offset_.  Add last_section_ field.
5996         (Memory_region::get_current_vma_address): Rename to
5997         get_current_address.
5998         (Memory_region::get_current_lma_address): Delete.
5999         (Memory_region::increment_vma_offset): Rename to
6000         increment_offset.
6001         (Memory_region::increment_lma_offset): Delete.
6002         (Memory_region::attributes_compatible): New method.  Returns
6003         true if the provided section is compatible with the region.
6004         (Memory_region::get_last_section): New method.  Returns the last
6005         section to use the region.
6006         (Memory_region::set_last_section): New method.  Stores the last
6007         section to use the region.
6008         (Script_sections::block_in_region): New method.  Returns true if
6009         a block of memory is contained within a region.
6010         (Script_sections::find_memory_region): New method.  Locates a
6011         memory region to be used to set a VMA or LMA address.
6012         (Output_section_definition::set_section_addresses): Add code to
6013         check for addresses set by memory regions.
6014         (Output_segment::set_section_addresses): Remove memory region
6015         walking code.
6016         (Script_sections::create_segment): Add a warning if a header
6017         segment is created outside of any region.
6018         * script-sections.h (class Script_sections): Add prototypes for
6019         find_memory_region and block_in_region methods.
6020         * testsuite/memory_test.s: Use .long instead of .word.
6021         * testsuite/memory_test.t: Add some more output sections.
6022         * testsuite/memory_test.sh: Update expected output.
6023
6024 2010-10-02  Doug Kwan  <dougkwan@google.com>
6025
6026         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6027         defintion to symtab.h
6028         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6029         declaration to defintion.
6030
6031 2010-10-01  Nick Clifton  <nickc@redhat.com>
6032
6033         * expression.cc (eval): Replace dummy argument with NULL.
6034         (eval_maybe_dot): Check for a NULL result section pointer.
6035         (Symbol_expression::value): Likewise.
6036         (Dot_expression::value): Likewise.
6037         (BINARY_EXPRESSION): Likewise.
6038         (Max_expression::value): Likewise.
6039         (Min_expression::value): Likewise.
6040         (Absolute_expression::value): Likewise.
6041         (Addr_expression::value_from_output_section): Likewise.
6042         (Loaddddr_expression::value_from_output_section): Likewise.
6043         (Segment_start_expression::value): Likewise.
6044         * script-sections.cc
6045         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6046         argument with NULL.
6047         (Sections_elememt_dot_assignment::set_section_addresses):
6048         Likewise.
6049         (Output_data_expression::do_write_to_buffer): Likewise.
6050         (Output_section_definition::finalize_symbols): Likewise.
6051         (Output_section_definition::set_section_addresses): Likewise.
6052
6053 2010-09-30  Doug Kwan  <dougkwan@google.com>
6054
6055         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6056
6057 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6058
6059         * target.h (Target::can_icf_inline_merge_sections): New virtual
6060         function.
6061         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6062         virtual function.
6063         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6064         virtual function.
6065         * icf.cc (get_section_contents): Inline merge sections only when
6066         target allows it.
6067
6068 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6069
6070         * configure: Regenerate.
6071
6072 2010-09-17  Ian Lance Taylor  <iant@google.com>
6073
6074         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6075         * testsuite/Makefile.am (memory_test.o): New target.
6076         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6077         memory_test.t.
6078         * testsuite/Makefile.in: Rebuild.
6079
6080 2010-09-17  Doug Kwan  <dougkwan@google.com>
6081
6082         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6083         defintion if relocation uses GOT entries of the symbol.
6084         * testsuite/icf_safe_test.sh: Fix test.
6085         * testsuite/icf_safe_so_test.sh: Fix test.
6086
6087 2010-09-16  Cary Coutant  <ccoutant@google.com>
6088
6089         * script_sections.cc (class Memory_region): Remove "NULL" from
6090         vector initializations.
6091
6092 2010-09-15  Cary Coutant  <ccoutant@google.com>
6093
6094         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6095         Resolve forwarding symbols.
6096
6097 2010-09-15  Doug Kwan  <dougkwan@google.com>
6098
6099         * gold/testsuite/script_test_3.t: Add ARM special sections.
6100         * gold/testsuite/script_test_4.t: Same.
6101         * gold/testsuite/script_test_5.t: Same.
6102         * gold/testsuite/script_test_6.t: Same.
6103         * gold/testsuite/script_test_7.t: Same.
6104         * gold/testsuite/script_test_7.t: Same.
6105         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6106
6107 2010-09-14  Cary Coutant  <ccoutant@google.com>
6108
6109         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6110         (Target_x86_64::Relocate::relocate_tls): Replace check for
6111         saw_tls_block_reloc_ with test for executable section.
6112
6113 2010-09-12  Cary Coutant  <ccoutant@google.com>
6114
6115         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6116         position-independent executables to shared libraries need dynamic
6117         relocations.
6118         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6119         position-independent executables.
6120         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6121         * testsuite/Makefile.in: Regenerate.
6122
6123 2010-09-10  Nick Clifton  <nickc@redhat.com>
6124
6125         PR gold/11997
6126         * testsuite/memory_test.t: Discard any sections that are not
6127         needed.
6128
6129 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6130
6131         PR gold/11996
6132         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6133         "This::" to work around a bug in gcc 4.2.
6134
6135         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6136
6137 2010-09-09  Rafael Espindola  <espindola@google.com>
6138
6139         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6140         sections with different PF_X flags in the same segment.
6141         (Layout::find_first_load_seg): Search all segments to find the first
6142         one.
6143         * options.h (rosegment): New.
6144
6145 2010-09-08  Rafael Espindola  <espindola@google.com>
6146
6147         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6148
6149 2010-09-08  Doug Kwan  <dougkwan@google.com>
6150
6151         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6152         (Arm_relobj::do_relocate_sections): Add new parameter for output
6153         file to match the parent.
6154         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6155         of local symbols instead of input values.  Update code to track
6156         changes in gold::relocate_section.
6157         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6158         (Sized_relobj::compute_final_local_value_internal): New methods.
6159         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6160         body into private version of Sized_relobj::compute_final_local_value.
6161         Call the inline method.
6162         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6163         merged symbol value if there is one.
6164         (Symbol_value::has_output_value): New method defintiion.
6165         (Sized_relobj::Compute_final_local_value_status): New enum type.
6166         (Sized_relobj::compute_final_local_value): New methods.
6167         (Sized_relobj::compute_final_local_value_internal): New methods.
6168         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6169         and arm_cortex_a8.sh.
6170         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6171         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6172         New tests.
6173         * Makefile.in: Regenerate.
6174         * testsuite/arm_bl_out_of_range.s: Update test.
6175         * testsuite/thumb_bl_out_of_range.s: Ditto.
6176         * testsuite/thumb_blx_out_of_range.s: Ditto.
6177         * testsuite/arm_branch_out_of_range.sh: New file.
6178         * testsuite/arm_cortex_a8.sh: Ditto.
6179         * testsuite/arm_cortex_a8_b.s: Ditto.
6180         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6181         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6182         * testsuite/arm_cortex_a8_bl.s: Ditto.
6183         * testsuite/arm_cortex_a8_blx.s: Ditto.
6184         * testsuite/arm_cortex_a8_local.s: Ditto.
6185         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6186         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6187
6188 2010-09-08  Rafael Espindola  <espindola@google.com>
6189
6190         * Makefile.am (memory_test.stdout): Run readelf with -W.
6191         * Makefile.in: Regenerate.
6192         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6193         64 bit output.
6194
6195 2010-09-08  Rafael Espindola  <espindola@google.com>
6196
6197         * script-sections.cc (Script_sections::add_memory_region): Convert
6198         field precision to int.
6199         * script.cc (script_set_section_region, script_set_section_region):
6200         Convert field precision to int.
6201
6202 2010-09-08  Rafael Espindola  <espindola@google.com>
6203
6204         * arm.cc (do_finalize_sections): Create the __exidx_start and
6205         __exdix_end symbols even when the section is missing.
6206
6207 2010-09-08  Nick Clifton  <nickc@redhat.com>
6208
6209         * README: Remove claim that MEMORY is not supported.
6210         * expression.cc (script_exp_function_origin)
6211         (script_exp_function_length): Move from here to ...
6212         * script.cc: ... here.
6213         (script_set_section_region, script_add_memory)
6214         (script_parse_memory_attr, script_include_directive): New
6215         functions.
6216         * script-sections.cc
6217         (class Memory_region): New class.
6218         (class Output_section_definition): Add set_memory_region,
6219         set_section_vma, set_section_lma and get_section_name methods.
6220         (class Script_Sections): Add add_memory_region,
6221         find_memory_region, find_memory_region_origin,
6222         find_memory_region_length and set_memory_region methods.
6223         Have set_section_addresses method walk the list of set memory
6224         regions.
6225         Extend the print methos to display memory regions.
6226         * script-sections.h: Add prototypes for new methods.
6227         Add enum for MEMORY region attributes.
6228         * yyscript.y: Add support for parsing MEMORY regions.
6229         * script-c.h: Add prototypes for new functions.
6230         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6231         * testsuite/Makefile.in: Regenerate.
6232         * testsuite/memory_test.sh: New script.
6233         * testsuite/memory_test.s: New assembler source file.
6234         * testsuite/memory_test.t: New linker script.
6235
6236 2010-08-27  Doug Kwan  <dougkwan@google.com>
6237
6238         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6239         reference override an existing dynamic weak reference.
6240         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6241         * testsuite/Makefile.in: Regenerate.
6242         * testsuite/dyn_weak_ref.sh: New file.
6243         * testsuite/dyn_weak_ref_1.c: Ditto.
6244         * testsuite/dyn_weak_ref_2.c: Ditto.
6245
6246 2010-08-27  Ian Lance Taylor  <iant@google.com>
6247
6248         * incremental.h (class Incremental_input_entry): Add virtual
6249         destructor.
6250
6251 2010-08-27  Ian Lance Taylor  <iant@google.com>
6252
6253         * testsuite/start_lib_test_3.c: Mark t3 as used.
6254
6255 2010-08-27  Nick Clifton  <nickc@redhat.com>
6256
6257         * options.cc (version_script): Fix small typo in previous
6258         whitespace tidyup.
6259
6260 2010-08-25  Nick Clifton  <nickc@redhat.com>
6261
6262         * archive.cc: Formatting fixes: Remove whitespace between
6263         typename and following asterisk.  Remove whitespace between
6264         function name and opening parenthesis.
6265         * archive.h: Likewise.
6266         * arm.cc: Likewise.
6267         * attributes.cc: Likewise.
6268         * attributes.h: Likewise.
6269         * common.cc: Likewise.
6270         * copy-relocs.cc: Likewise.
6271         * dirsearch.h: Likewise.
6272         * dynobj.cc: Likewise.
6273         * ehframe.cc: Likewise.
6274         * ehframe.h: Likewise.
6275         * expression.cc: Likewise.
6276         * fileread.cc: Likewise.
6277         * fileread.h: Likewise.
6278         * gc.h: Likewise.
6279         * gold-threads.cc: Likewise.
6280         * gold.cc: Likewise.
6281         * i386.cc: Likewise.
6282         * icf.h: Likewise.
6283         * incremental-dump.cc: Likewise.
6284         * incremental.cc: Likewise.
6285         * layout.cc: Likewise.
6286         * layout.h: Likewise.
6287         * main.cc: Likewise.
6288         * merge.cc: Likewise.
6289         * merge.h: Likewise.
6290         * object.cc: Likewise.
6291         * object.h: Likewise.
6292         * options.cc: Likewise.
6293         * options.h: Likewise.
6294         * output.cc: Likewise.
6295         * output.h: Likewise.
6296         * plugin.cc: Likewise.
6297         * plugin.h: Likewise.
6298         * powerpc.cc: Likewise.
6299         * reloc.cc: Likewise.
6300         * script-c.h: Likewise.
6301         * script-sections.cc: Likewise.
6302         * script.cc: Likewise.
6303         * stringpool.cc: Likewise.
6304         * symtab.cc: Likewise.
6305         * symtab.h: Likewise.
6306         * target.cc: Likewise.
6307         * timer.cc: Likewise.
6308         * timer.h: Likewise.
6309         * version.cc: Likewise.
6310         * x86_64.cc: Likewise.
6311
6312 2010-08-24  Nick Clifton  <nickc@redhat.com>
6313
6314         PR 11899
6315         * layout.cc (segment_precedes): Sort segments by their physical
6316         addresses, if they have been set.
6317
6318 2010-08-23  Cary Coutant  <ccoutant@google.com>
6319
6320         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6321         symbols data.
6322         (Lib_group::include_member): Unlock object after deleting its
6323         symbols data.
6324         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6325         the bug fixed here.
6326
6327 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6328             Cary Coutant  <ccoutant@google.com>
6329
6330         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6331         constructor, and set_blocker.
6332         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6333         readsyms_blocker_.
6334         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6335         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6336         * testsuite/Makefile.am (start_lib_test): New test case.
6337         * testsuite/Makefile.in: Regenerate.
6338         * testsuite/start_lib_test_main.c: New file.
6339         * testsuite/start_lib_test_1.c: New file.
6340         * testsuite/start_lib_test_2.c: New file.
6341         * testsuite/start_lib_test_3.c: New file.
6342
6343 2010-08-19  Ian Lance Taylor  <iant@google.com>
6344
6345         * Makefile.in: Rebuild with automake 1.11.1.
6346         * aclocal.m4: Likewise.
6347         * testsuite/Makefile.in: Likewise.
6348
6349 2010-08-19  Ian Lance Taylor  <iant@google.com>
6350
6351         PR 10893
6352         * i386.cc (class Output_data_plt_i386): Update declarations.
6353         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6354         local_ifuncs_ fields.
6355         (Target_i386::do_plt_section_for_global): New function.
6356         (Target_i386::do_plt_section_for_local): New function.
6357         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6358         parameter; change all callers.  Initialize global_ifuncs_ and
6359         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6360         __rel_iplt_end.
6361         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6362         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6363         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6364         symbols.
6365         (Target_i386::make_plt_section): New function, broken out of
6366         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6367         (Target_i386::make_plt_entry): Call make_plt_section.
6368         (Target_i386::make_local_ifunc_plt_entry): New function.
6369         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6370         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6371         R_386_IRELATIVE to switch.
6372         (Target_i386::Scan::global): Likewise.
6373         (Target_i386::Relocate::relocate): Likewise.
6374         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6375         switch.
6376         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6377         (Target_x86_64::do_plt_section_for_global): New function.
6378         (Target_x86_64::do_plt_section_for_local): New function.
6379         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6380         parameter; change all callers.  If doing a static link define
6381         __rela_iplt_start and __rela_iplt_end.
6382         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6383         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6384         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6385         to point to .plt.
6386         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6387         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6388         switch.
6389         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6390         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6391         R_X86_64_IRELATIVE to switch.
6392         (Target_x86_64::Scan::global): Likewise.
6393         (Target_x86_64::Relocate::relocate): Likewise.
6394         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6395         switch.
6396         * target.h (class Target): Add plt_section_for_global and
6397         plt_section_for_local functions.  Add do_plt_section_for_global
6398         and do_plt_section_for_local virtual functions.
6399         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6400         clarifying comments.
6401         (Symbol::use_plt_offset): Handle IFUNC symbol.
6402         * object.cc (Sized_relobj::Sized_relobj): Initialize
6403         local_plt_offsets_.
6404         (Sized_relobj::local_has_plt_offset): New function.
6405         (Sized_relobj::local_plt_offset): New function.
6406         (Sized_relobj::set_local_plt_offset): New function.
6407         (Sized_relobj::do_count): Handle IFUNC symbol.
6408         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6409         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6410         is_ifunc_symbol functions.
6411         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6412         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6413         local_plt_offsets_ field.
6414         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6415         * output.h (class Output_section_data): Add non-const
6416         output_section function.
6417         (class Output_data_got): Update declarations.
6418         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6419         Add use_plt_offset parameter to global and local constructors.
6420         Change all callers.  Change local_sym_index_ field to 31 bits.
6421         Change GSYM_CODE and CONSTANT_CODE accordingly.
6422         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6423         doing a static link don't set sh_link field.
6424         (Output_data_got::Got_entry::write): Use PLT offset if
6425         appropriate.
6426         (Output_data_got::add_global_plt): New function.
6427         (Output_data_got::add_local_plt): New function.
6428         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6429         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6430         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6431         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6432         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6433         IFUNC conditional.
6434         * testsuite/ifunc-sel.h: New file.
6435         * testsuite/ifuncmain1.c: New file.
6436         * testsuite/ifuncmain1vis.c: New file.
6437         * testsuite/ifuncmod1.c: New file.
6438         * testsuite/ifuncdep2.c: New file.
6439         * testsuite/ifuncmain2.c: New file.
6440         * testsuite/ifuncmain3.c: New file.
6441         * testsuite/ifuncmod3.c: New file.
6442         * testsuite/ifuncmain4.c: New file.
6443         * testsuite/ifuncmain5.c: New file.
6444         * testsuite/ifuncmod5.c: New file.
6445         * testsuite/ifuncmain6pie.c: New file.
6446         * testsuite/ifuncmod6.c: New file.
6447         * testsuite/ifuncmain7.c: New file.
6448         * configure, testsuite/Makefile.in: Rebuild.
6449
6450 2010-08-18  Ian Lance Taylor  <iant@google.com>
6451
6452         * incremental.cc
6453         (Output_section_incremental_inputs::write_input_files): Add cast
6454         to avoid signed/unsigned comparison warning.
6455         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6456
6457 2010-08-12  Cary Coutant  <ccoutant@google.com>
6458
6459         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6460
6461 2010-08-13  Ian Lance Taylor  <iant@google.com>
6462
6463         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6464
6465 2010-08-12  Cary Coutant  <ccoutant@google.com>
6466             Doug Kwan  <dougkwan@google.com>
6467
6468         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6469         defintion overrides non-weak undef, remember that the original undef
6470         is not weak.
6471         * symtab.cc (Symbol_table::sized_write_global): For undef without
6472         an original weak binding, set binding to global in output.
6473         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6474         * testsuite/Makefile.in: Regenerate.
6475         * testsuite/strong_ref_weak_def.sh: New file.
6476         * testsuite/strong_ref_weak_def_1.c: Ditto.
6477         * testsuite/strong_ref_weak_def_2.c: Ditto.
6478
6479 2010-08-12  Cary Coutant  <ccoutant@google.com>
6480
6481         * testsuite/incremental_test.sh: Rewrite.
6482         * testsuite/incremental_test_1.c: Rewrite.
6483         * testsuite/incremental_test_2.c: Rewrite.
6484
6485 2010-08-12  Cary Coutant  <ccoutant@google.com>
6486
6487         * arm.cc (Target_arm::got_size): Add const.
6488         (Target_arm::got_entry_count): New function.
6489         (Target_arm::plt_entry_count): New function.
6490         (Target_arm::first_plt_entry_offset): New function.
6491         (Target_arm::plt_entry_size): New function.
6492         (Output_data_plt_arm::entry_count): New function.
6493         (Output_data_plt_arm::first_plt_entry_offset): New function.
6494         (Output_data_plt_arm::get_plt_entry_size): New function.
6495         * i386.cc (Target_i386::got_size): Add const.
6496         (Target_i386::got_entry_count): New function.
6497         (Target_i386::plt_entry_count): New function.
6498         (Target_i386::first_plt_entry_offset): New function.
6499         (Target_i386::plt_entry_size): New function.
6500         (Output_data_plt_i386::entry_count): New function.
6501         (Output_data_plt_i386::first_plt_entry_offset): New function.
6502         (Output_data_plt_i386::get_plt_entry_size): New function.
6503         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6504         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6505         * incremental.cc: Include target.h.
6506         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6507         parameter.  Adjust all callers.  Find incremental_got_plt section.
6508         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6509         section.
6510         (Output_section_incremental_inputs::set_final_data_size): Calculate
6511         size of incremental_got_plt section.
6512         (Output_section_incremental_inputs::do_write): Write the
6513         incremental_got_plt section.
6514         (Got_plt_view_info): New struct.
6515         (Local_got_offset_visitor): New class.
6516         (Global_got_offset_visitor): New class.
6517         (Global_symbol_visitor_got_plt): New class.
6518         (Output_section_incremental_inputs::write_got_plt): New function.
6519         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6520         Add parameter.  Adjust all callers.
6521         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6522         (Incremental_inputs::got_plt_section): New function.
6523         (Incremental_inputs::got_plt_section_): New data member.
6524         (Incremental_got_plt_reader): New class.
6525         * layout.cc (Layout::create_incremental_info_sections): Add the
6526         incremental_got_plt section.
6527         * object.h (Got_offset_list::get_list): New function.
6528         (Got offset_list::for_all_got_offsets): New function.
6529         (Sized_relobj::local_got_offset_list): New function.
6530         * powerpc.cc (Target_powerpc::got_size): Add const.
6531         (Target_powerpc::got_entry_count): New function.
6532         (Target_powerpc::plt_entry_count): New function.
6533         (Target_powerpc::first_plt_entry_offset): New function.
6534         (Target_powerpc::plt_entry_size): New function.
6535         (Output_data_plt_powerpc::entry_count): New function.
6536         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6537         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6538         * sparc.cc (Target_sparc::got_size): Add const.
6539         (Target_sparc::got_entry_count): New function.
6540         (Target_sparc::plt_entry_count): New function.
6541         (Target_sparc::first_plt_entry_offset): New function.
6542         (Target_sparc::plt_entry_size): New function.
6543         (Output_data_plt_sparc::entry_count): New function.
6544         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6545         (Output_data_plt_sparc::get_plt_entry_size): New function.
6546         * symtab.h (Symbol::got_offset_list): New function.
6547         (Symbol_table::for_all_symbols): New function.
6548         * target.h (Sized_target::got_entry_count): New function.
6549         (Sized_target::plt_entry_count): New function.
6550         (Sized_target::plt_entry_size): New function.
6551         * x86_64.cc (Target_x86_64::got_size): Add const.
6552         (Target_x86_64::got_entry_count): New function.
6553         (Target_x86_64::plt_entry_count): New function.
6554         (Target_x86_64::first_plt_entry_offset): New function.
6555         (Target_x86_64::plt_entry_size): New function.
6556         (Output_data_plt_x86_64::entry_count): New function.
6557         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6558         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6559
6560 2010-08-12  Cary Coutant  <ccoutant@google.com>
6561
6562         * archive.cc: Include incremental.h.
6563         (Archive::Archive): Initialize incremental_info_.
6564         (Archive::include_member): Record archive members in incremental info.
6565         (Add_archive_symbols::run): Record begin and end of an archive in
6566         incremental info.
6567         (Lib_group::include_member): Record objects in incremental info.
6568         * archive.h (Incremental_archive_entry): Forward declaration.
6569         (Archive::set_incremental_info): New member function.
6570         (Archive::incremental_info): New member function.
6571         (Archive::Unused_symbol_iterator): New class.
6572         (Archive::unused_symbols_begin): New member function.
6573         (Archive::unused_symbols_end): New member function.
6574         (Archive::incremental_info_): New data member.
6575         * incremental-dump.cc (find_input_containing_global): New function.
6576         (dump_incremental_inputs): Dump new incremental info sections.
6577         * incremental.cc: Include symtab.h.
6578         (Output_section_incremental_inputs): New class.
6579         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6580         new incremental info sections.
6581         (Sized_incremental_binary::do_check_inputs): Likewise.
6582         (Incremental_inputs::report_archive): Remove.
6583         (Incremental_inputs::report_archive_begin): New function.
6584         (Incremental_inputs::report_archive_end): New function.
6585         (Incremental_inputs::report_object): New function.
6586         (Incremental_inputs::finalize_inputs): Remove.
6587         (Incremental_inputs::report_input_section): New function.
6588         (Incremental_inputs::report_script): Rewrite.
6589         (Incremental_inputs::finalize): Do nothing but finalize string table.
6590         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6591         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6592         (Incremental_inputs::create_data_sections): New function.
6593         (Incremental_inputs::relocs_entsize): New function.
6594         (Output_section_incremental_inputs::set_final_data_size): New function.
6595         (Output_section_incremental_inputs::do_write): New function.
6596         (Output_section_incremental_inputs::write_header): New function.
6597         (Output_section_incremental_inputs::write_input_files): New function.
6598         (Output_section_incremental_inputs::write_info_blocks): New function.
6599         (Output_section_incremental_inputs::write_symtab): New function.
6600         * incremental.h (Incremental_script_entry): Forward declaration.
6601         (Incremental_object_entry): Forward declaration.
6602         (Incremental_archive_entry): Forward declaration.
6603         (Incremental_inputs): Forward declaration.
6604         (Incremental_inputs_header_data): Remove.
6605         (Incremental_inputs_header): Remove.
6606         (Incremental_inputs_header_write): Remove.
6607         (Incremental_inputs_entry_data): Remove.
6608         (Incremental_inputs_entry): Remove.
6609         (Incremental_inputs_entry_write): Remove.
6610         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6611         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6612         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6613         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6614         Likewise.
6615         (Incremental_input_entry): New class.
6616         (Incremental_script_entry): New class.
6617         (Incremental_object_entry): New class.
6618         (Incremental_archive_entry): New class.
6619         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6620         (Incremental_inputs::report_inputs): Remove.
6621         (Incremental_inputs::report_archive): Remove.
6622         (Incremental_inputs::report_archive_begin): New function.
6623         (Incremental_inputs::report_archive_end): New function.
6624         (Incremental_inputs::report_object): Change prototype.
6625         (Incremental_inputs::report_input_section): New function.
6626         (Incremental_inputs::report_script): Change prototype.
6627         (Incremental_inputs::get_reloc_count): New function.
6628         (Incremental_inputs::set_reloc_count): New function.
6629         (Incremental_inputs::create_data_sections): New function.
6630         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6631         (Incremental_inputs::inputs_section): New function.
6632         (Incremental_inputs::symtab_section): New function.
6633         (Incremental_inputs::relocs_section): New function.
6634         (Incremental_inputs::get_stringpool): Add const.
6635         (Incremental_inputs::command_line): Add const.
6636         (Incremental_inputs::inputs): Remove.
6637         (Incremental_inputs::command_line_key): New function.
6638         (Incremental_inputs::input_file_count): New function.
6639         (Incremental_inputs::input_files): New function.
6640         (Incremental_inputs::relocs_entsize): New function.
6641         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6642         (Incremental_inputs::finalize_inputs): Remove.
6643         (Incremental_inputs::Input_info): Remove.
6644         (Incremental_inputs::lock_): Remove.
6645         (Incremental_inputs::inputs_): Change type.
6646         (Incremental_inputs::inputs_map_): Remove.
6647         (Incremental_inputs::current_object_entry_): New data member.
6648         (Incremental_inputs::inputs_section_): New data member.
6649         (Incremental_inputs::symtab_section_): New data member.
6650         (Incremental_inputs::relocs_section_): New data member.
6651         (Incremental_inputs::reloc_count_): New data member.
6652         (Incremental_inputs_reader): New class.
6653         (Incremental_symtab_reader): New class.
6654         (Incremental_relocs_reader): New class.
6655         * layout.cc (Layout::finalize): Move finalization of incremental info
6656         and creation of incremental info sections to follow finalization of
6657         symbol table.  Set offsets for postprocessing sections.
6658         (Layout::create_incremental_info_sections): Call
6659         Incremental_inputs::create_data_sections.  Add incremental symtab
6660         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6661         sections to layout after input sections.
6662         * layout.h (struct Timespec): Forward declaration.
6663         (Layout::incremental_inputs): Add const.
6664         (Layout::create_incremental_info_sections): Add parameter.
6665         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6666         * object.cc: Include incremental.h.
6667         (Relobj::finalize_incremental_relocs): New function.
6668         (Sized_relobj::do_layout): Record input sections in incremental info.
6669         * object.h (Object::output_section): New function.
6670         (Object::output_section_offset): Moved from Relobj.
6671         (Object::get_incremental_reloc_base): New function.
6672         (Object::get_incremental_reloc_count): New function.
6673         (Object::do_output_section): New function.
6674         (Object::do_output_section_offset): Moved from Relobj.
6675         (Object::do_get_incremental_reloc_base): New function.
6676         (Object::do_get_incremental_reloc_count): New function.
6677         (Object::Object): Initialize new data members.
6678         (Relobj::output_section): Renamed do_output_section and moved to
6679         protected.
6680         (Relobj::output_section_offset): Moved to Object.
6681         (Relobj::do_get_incremental_reloc_base): New function.
6682         (Relobj::do_get_incremental_reloc_count): New function.
6683         (Relobj::allocate_incremental_reloc_counts): New function.
6684         (Relobj::count_incremental_reloc): New function.
6685         (Relobj::finalize_incremental_relocs): New function.
6686         (Relobj::next_incremental_reloc_index): New function.
6687         (Relobj::reloc_counts_): New data member.
6688         (Relobj::reloc_bases_): New data member.
6689         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6690         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6691         (Sized_relobj::incremental_relocs_scan): New function.
6692         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6693         (Sized_relobj::incremental_relocs_write): New function.
6694         (Sized_relobj::incremental_relocs_write_reltype): New function.
6695         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6696         incremental link.
6697         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6698         archives and object files elsewhere.
6699         (Add_symbols::run): Report object files here.
6700         (Finish_group::run): Report end of archive at end of group.
6701         * reloc.cc: Include layout.h, incremental.h.
6702         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6703         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6704         (Sized_relobj::incremental_relocs_scan): New function.
6705         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6706         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6707         (Sized_relobj::incremental_relocs_write): New function.
6708         (Sized_relobj::incremental_relocs_write_reltype): New function.
6709         * script.cc (read_input_script): Rewrite test for incremental link.
6710         Change call to Incremental_inputs::report_script.
6711         * symtab.h (Symbol_table::first_global_index): New function.
6712         (Symbol_table::output_count): New function.
6713
6714 2010-08-12  Doug Kwan  <dougkwan@google.com>
6715
6716         * arm.cc (Target_arm::merge_object_attributes): Check command line
6717         options --no-wchar-size-warning and --no-enum-size-warning.
6718         * options.h (General_options): Add ld-compatible options
6719         --no-enum-size-warning and --no-wchar-size-warning.
6720
6721 2010-08-04  Ian Lance Taylor  <iant@google.com>
6722
6723         * x86_64.cc (Target_x86_64::Scan::local): Use
6724         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6725         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6726         (Target_x86_64::Scan::global): Likewise.
6727         (Target_x86_64::Relocate::relocate): Likewise.
6728         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6729         Likewise.
6730
6731 2010-08-03  Cary Coutant  <ccoutant@google.com>
6732
6733         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6734         to reserve space in merged_strings vector. Keep total input size
6735         for stats.
6736         (Output_merge_string::do_print_merge_stats): Print total input size.
6737         * merge.h (Output_merge_string): Add input_size_ field.
6738         * stringpool.cc (Stringpool_template::string_length): Move
6739         implementations out of Stringpool_template class and place in
6740         stringpool.h.
6741         * stringpool.h (string_length): Move out of Stringpool_template.
6742
6743 2010-08-03  Ian Lance Taylor  <iant@google.com>
6744
6745         PR 11712
6746         * layout.cc (relaxation_loop_body): If address of load segment is
6747         set, adjust address to include headers if possible.
6748
6749 2010-08-03  Ian Lance Taylor  <iant@google.com>
6750
6751         * version.cc (version_string): Bump to 1.10.
6752
6753 2010-08-03  Ian Lance Taylor  <iant@google.com>
6754
6755         PR 11805
6756         * layout.h (enum Output_section_order): Define.
6757         (class Layout): Update declarations.
6758         * layout.cc (Layout::get_output_section): Add order parameter.
6759         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6760         is_first_non_relro parameters.  Change all callers.
6761         (Layout::choose_output_section): Likewise.
6762         (Layout::add_output_section_data): Likewise.
6763         (Layout::make_output_section): Likewise.  Set order.
6764         (Layout::default_section_order): New function.
6765         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6766         * output.cc (Output_section::Output_section): Initialize order_.
6767         Don't initialize deleted fields.
6768         (Output_segment::Output_segment): Don't initialize deleted
6769         fields.
6770         (Output_segment::add_output_section_to_load): New function
6771         replacing add_output_section.  Change all callers to call this or
6772         add_output_section_to_nonload.
6773         (Output_segment::add_output_section_to_nonload): New function.
6774         (Output_segment::remove_output_section): Rewrite.
6775         (Output_segment::add_initial_output_data): Likewise.
6776         (Output_segment::has_any_data_sections): Likewise.
6777         (Output_segment::is_first_section_relro): Likewise.
6778         (Output_segment::maximum_alignment): Likewise.
6779         (Output_segment::has_dynamic_reloc): New function replacing
6780         dynamic_reloc_count.  Change all callers.
6781         (Output_segment::has_dynamic_reloc_list): New function replacing
6782         dynamic_reloc_count_list.  Change all callers.
6783         (Output_segment::set_section_addresses): Rewrite.
6784         (Output_segment::set_offset): Rewrite.
6785         (Output_segment::find_first_and_last_list): Remove.
6786         (Output_segment::set_tls_offsets): Rewrite.
6787         (Output_segment::first_section_load_address): Likewise.
6788         (Output_segment::output_section_count): Likewise.
6789         (Output_segment::section_with_lowest_load_address): Likewise.
6790         (Output_segment::write_section_headers): Likewise.
6791         (Output_segment::print_sections_to_map): Likewise.
6792         * output.h (class Output_data): Remove dynamic_reloc_count_
6793         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6794         (Output_data::add_dynamic_reloc): Rewrite.
6795         (Output_data::has_dynamic_reloc): New function.
6796         (Output_data::dynamic_reloc_count): Remove.
6797         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6798         is_last_relro_, is_first_non_relro_, is_interp_,
6799         is_dynamic_linker_section_ fields.  Add order and set_order
6800         functions.  Remove is_relro_local, set_is_relro_local,
6801         is_last_relro, set_is_last_relro, is_first_non_relro,
6802         set_is_first_non_relro functions, is_interp, set_is_interp,
6803         is_dynamic_linker_section, and set_is_dynamic_linker_section
6804         functions.
6805         (class Output_segment): Change Output_data_list from std::list to
6806         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6807         output_bss_ fields.  Update declarations.
6808
6809 2010-08-02  Ian Lance Taylor  <iant@google.com>
6810
6811         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6812         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6813         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6814
6815 2010-08-02  Ian Lance Taylor  <iant@google.com>
6816
6817         PR 11855
6818         * script.cc (Script_options::Script_options): Initialize
6819         symbol_definitions_ and symbol_references_.
6820         (Script_options::add_symbol_assignment): Update
6821         symbol_definitions_ and symbol_references_.
6822         (Script_options::add_symbol_reference): New function.
6823         (script_symbol): New function.
6824         * script.h (class Script_options): Add symbol_definitions_ and
6825         symbol_references_ fields.
6826         (Script_options::referenced_const_iterator): New type.
6827         (Script_options::referenced_begin): New function.
6828         (Script_options::referenced_end): New function.
6829         (Script_options::is_referenced): New function.
6830         (Script_options::any_unreferenced): New function.
6831         * script-c.h (script_symbol): Declare.
6832         * yyscript.y (exp): Call script_symbol.
6833         * symtab.cc: Include "script.h".
6834         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6835         Change all callers.  Check symbols referenced by scripts.
6836         (Symbol_table::add_undefined_symbols_from_command_line): Add
6837         layout parameter.  Change all callers.
6838         (Symbol_table::do_add_undefined_symbols_from_command_line):
6839         Likewise.  Break out loop body.  Check symbols referenced by
6840         scripts.
6841         (Symbol_table::add_undefined_symbol_from_command_line): New
6842         function broken out of
6843         do_add_undefined_symbols_from_command_line.
6844         * symtab.h (class Symbol_table): Update declarations.
6845         * archive.cc: Include "layout.h".
6846         (Archive::should_include_member): Add layout parameter.  Change
6847         all callers.  Check for symbol mentioned in expression.
6848         * archive.h (class Archive): Update declaration.
6849         * object.cc (Sized_relobj::do_should_include_member): Add layout
6850         parameter.
6851         * object.h (Object::should_include_member): Add layout parameter.
6852         Change all callers.
6853         (Object::do_should_include_member): Add layout parameter.
6854         (class Sized_relobj): Update declaration.
6855         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6856         parameter.
6857         * dynobj.h (class Sized_dynobj): Update declaration.
6858         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6859         layout parameter.
6860         * plugin.h (class Sized_pluginobj): Update declaration.
6861
6862 2010-08-02  Ian Lance Taylor  <iant@google.com>
6863
6864         PR 11866
6865         * output.cc (Output_segment::set_offset): Search for the first and
6866         last sections rather than assuming that the list is in order.
6867         (Output_segment::find_first_and_last_list): New function.
6868         * output.h (class Output_segment): Update declarations.
6869         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6870         (relro_strip_test_SOURCES): New variable.
6871         (relro_strip_test_DEPENDENCIES): New variable.
6872         (relro_strip_test_LDFLAGS): New variable.
6873         (relro_strip_test_LDADD): New variable.
6874         (relro_strip_test.so): New target.
6875
6876 2010-08-02  Ian Lance Taylor  <iant@google.com>
6877
6878         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6879         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6880         (Target_i386::got_tlsdesc_section): New function.
6881         (Target_i386::got_section): Create space for GOT entries for
6882         TLSDESC relocations.
6883         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6884         R_386_TLS_GOTDESC.
6885         (Target_i386::Scan::global): Likewise.
6886         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6887         using TLSDESC GOT.
6888         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6889         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6890         (Target_x86_64::got_tlsdesc_section): New function.
6891         (Target_x86_64::got_section): Create space for GOT entries for
6892         TLSDESC relocations.
6893         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6894         R_386_TLS_GOTDESC.
6895         (Target_x86_64::Scan::global): Likewise.
6896         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6897         using TLSDESC GOT.
6898
6899 2010-08-02  Ian Lance Taylor  <iant@google.com>
6900
6901         * testsuite/final_layout.sh: Use dc to convert from hex to
6902         decimal.
6903
6904 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6905
6906         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6907         paramter to the call to gold::gc_process_relocs.
6908         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6909         paramter to the call to gold::gc_process_relocs.
6910         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6911         parameter to the call to gold::gc_process_relocs.
6912         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6913         template parameter to the call to gold::gc_process_relocs.
6914         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6915         paramter to the call to gold::gc_process_relocs.
6916         * gc.h (get_embedded_addend_size): New function.
6917         (gc_process_relocs): Save the size of the reloc for use by ICF.
6918         * icf.cc (get_section_contents): Get the addend from the text section
6919         for SHT_REL relocation sections.
6920         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6921         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6922         * int_encoding.h (read_from_pointer): New overloaded function.
6923         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6924         * testsuite/icf_sht_rel_addend_test.sh: New file.
6925         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6926         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6927
6928 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6929
6930         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6931         * Makefile.in: Regenerate.
6932         * testsuite/Makefile.in: Regenerate.
6933
6934 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6935
6936         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6937         * gold/testsuite/debug_msg.cc: Likewise.
6938         * gold/testsuite/odr_violation1.cc
6939         * gold/testsuite/odr_violation2.cc
6940
6941 2010-07-21  Cary Coutant  <ccoutant@google.com>
6942
6943         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6944         string, and length fields.
6945         (Output_merge_string::Merged_strings_list): New type.
6946         (Output_merge_string::Merged_strings_lists): New typedef.
6947         (Output_merge_string): Replace merged_strings_ with
6948         merged_strings_lists_.
6949         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6950         Merged_strings_list per input object and section.  Don't store pointer
6951         to the string.  Don't store length with each merged string entry.
6952         (Output_merge_string::finalize_merged_data): Loop over list of merged
6953         strings lists.  Recompute length of each merged string.
6954
6955 2010-07-15  Cary Coutant  <ccoutant@google.com>
6956
6957         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6958         here.
6959
6960 2010-07-14  Ian Lance Taylor  <iant@google.com>
6961
6962         * descriptors.cc (Descriptors::open): Report correct name in error
6963         message.
6964
6965 2010-07-13  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Arm_input_section::Arm_input_section): For a
6968         SHT_ARM_EXIDX section, always keeps the input sections.
6969         (Arm_input_section::set_exidx_section_link): New method.
6970         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6971         has_errors_ to false.
6972         (Arm_exidx_input_section::has_errors,
6973         Arm_exidx_input_section::set_has_errors): New methods.
6974         (Arm_exidx_input_section::has_errors_): New data member.
6975         (Arm_relobj::get_exidx_shndx_list): New method.
6976         (Arm_output_section::append_text_sections_to_list): Do not skip
6977         section without SHF_EXECINSTR.
6978         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6979         errors.
6980         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6981         section header.  Make error messages more verbose.  Check for
6982         a non-executable section linked to an EXIDX section.
6983         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6984         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6985         check that there is no deferred EXIDX section if we exit early.
6986         Instead of not making an EXIDX section in case of an error, make one
6987         and set the has_errors flag of it.
6988         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6989         in a relocatable link.
6990         (Target_arm::do_relax): Look for the EXIDX output section instead of
6991         assuming that it is called .ARM.exidx.
6992         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6993         section list.  Do not check for SHF_EXECINSTR section flags but
6994         skip any input section with errors.
6995         * output.cc (Output_section::Output_section): Initialize
6996         always_keeps_input_sections_ to false.
6997         (Output_section::add_input_section): Check for
6998         always_keeps_input_sections_.
6999         *  output.h (Output_section::always_keeps_input_sections,
7000         Output_section::set_always_keeps_input_sections): New methods.
7001         (Output_section::always_keeps_input_sections): New data member.
7002
7003 2010-07-13  Rafael Espindola  <espindola@google.com>
7004
7005         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7006         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7007
7008 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7009             Ian Lance Taylor  <iant@google.com>
7010
7011         * output.h (Output_section_lookup_maps::add_merge_section):
7012         Correct check of whether value was inserted.
7013         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7014         (Output_section_lookup_maps::add_relaxed_input_section):
7015         Likewise.
7016         * arm.cc (Target_arm::got_section): Remove used local os.
7017         * i386.cc (Target_i386::got_section): Likewise.
7018         * x86_64.cc (Target_x86_64::got_section): Likewise.
7019         * sparc.cc (Target_sparc::got_section): Likewise.
7020         (Target_sparc::relocate): Remove unused local have_got_offset.
7021         * powerpc.cc (Target_powerpc::relocate): Likewise.
7022
7023 2010-07-13  Ian Lance Taylor  <iant@google.com>
7024
7025         * compressed_output.cc (zlib_decompress): Fix signature in
7026         !HAVE_ZLIB_H case.
7027
7028         * archive.cc (Archive::include_member): Unlock an external member
7029         of a thin archive.  Don't bother to delete an object we know is
7030         NULL.
7031
7032 2010-07-12  Cary Coutant  <ccoutant@google.com>
7033
7034         * compressed_output.cc (zlib_decompress): New function.
7035         (get_uncompressed_size): New function.
7036         (decompress_input_section): New function.
7037         * compressed_output.h (get_uncompressed_size): New function.
7038         (decompress_input_section): New function.
7039         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7040         Handle compressed debug sections.
7041         * layout.cc (is_compressed_debug_section): New function.
7042         (Layout::output_section_name): Map compressed section names to
7043         canonical names.
7044         * layout.h (is_compressed_debug_section): New function.
7045         (is_debug_info_section): Recognize compressed debug sections.
7046         * merge.cc: Include compressed_output.h.
7047         (Output_merge_data::do_add_input_section): Handle compressed
7048         debug sections.
7049         (Output_merge_string::do_add_input_section): Handle compressed
7050         debug sections.
7051         * object.cc: Include compressed_output.h.
7052         (Sized_relobj::Sized_relobj): Initialize new data members.
7053         (build_compressed_section_map): New function.
7054         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7055         * object.h (Object::section_is_compressed): New method.
7056         (Object::do_section_is_compressed): New method.
7057         (Sized_relobj::Compressed_section_map): New type.
7058         (Sized_relobj::do_section_is_compressed): New method.
7059         (Sized_relobj::compressed_sections_): New data member.
7060         * output.cc (Output_section::add_input_section): Handle compressed
7061         debug sections.
7062         * reloc.cc: Include compressed_output.h.
7063         (Sized_relobj::write_sections): Handle compressed debug sections.
7064
7065 2010-07-08  Cary Coutant  <ccoutant@google.com>
7066
7067         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7068         weak when resolving to a dynamic def.
7069         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7070         for weak undef/dynamic def cases. Adjust callers.
7071         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7072         undef_binding_weak_.
7073         (Symbol_table::sized_write_globals): Adjust symbol binding.
7074         (Symbol_table::sized_write_symbol): Add binding parameter.
7075         * symtab.h (Symbol::set_undef_binding): New method.
7076         (Symbol::is_undef_binding_weak): New method.
7077         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7078         (Symbol_table::should_override): Add new parameter.
7079         (Symbol_table::sized_write_symbol): Add new parameter.
7080
7081         * testsuite/weak_undef_file1.cc: Add new test case.
7082         * testsuite/weak_undef_file2.cc: Fix header comment.
7083         * testsuite/weak_undef_test.cc: Add new test case.
7084
7085 2010-06-29  Doug Kwan  <dougkwan@google.com>
7086
7087         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7088         Initialize USE_SYMBOL_.
7089         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7090         definition.
7091         (Arm_reloc_property::uses_symbol_): New data member declaration.
7092         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7093         uses symbol value and symbol is undefined but not weakly undefined.
7094
7095 2010-06-28  Rafael Espindola  <espindola@google.com>
7096
7097         * plugin.cc (Plugin::load): Use dlerror.
7098
7099 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7100
7101         * symtab.cc (detect_odr_violations): When reporting an ODR
7102         violation, report an object where the symbol is defined.
7103
7104 2010-06-25  Doug Kwan  <dougkwan@google.com>
7105
7106         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7107         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7108         definition.
7109         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7110         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7111         target hook to detect function points.
7112         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7113         * icf.h (Icf::check_section_for_function_pointers): Change type of
7114         parameter SECTION_NAME to const reference to std::string.  Use
7115         target hook to determine if section may have unsafe pointers.
7116         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7117         method definition.
7118
7119 2010-06-21  Rafael Espindola  <espindola@google.com>
7120
7121         * fileread.cc (Input_file::find_fie): New
7122         (Input_file::open): Use Input_file::find_fie.
7123         * fileread.h (Input_file::find_fie): New
7124         * plugin.cc (set_extra_library_path): New.
7125         (Plugin::load): Add set_extra_library_path to the transfer vector.
7126         (Plugin_manager::set_extra_library_path): New.
7127         (Plugin_manager::add_input_file): Use the extra search path if set.
7128         (set_extra_library_path(): New.
7129         * plugin.h (Plugin_manager): Add set_extra_library_path and
7130         extra_search_path_.
7131
7132 2010-06-19  Cary Coutant  <ccoutant@google.com>
7133
7134         * layout.cc (gdb_sections): Add .debug_types.
7135         (lines_only_debug_sections): Likewise.
7136
7137 2010-06-18  Rafael Espindola  <espindola@google.com>
7138
7139         * plugin.cc (add_input_file,add_input_library)
7140         (Plugin_manager::add_input_file): Make filename arguments const.
7141         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7142         const.
7143
7144 2010-06-16  Doug Kwan  <dougkwan@google.com>
7145
7146         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7147         .ARM.attributes section if we have not merged any input
7148         attributes sections.
7149
7150 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7151
7152         * arm.cc: Allow combining objects with no EABI version
7153         information.
7154
7155 2010-06-15  Rafael Espindola  <espindola@google.com>
7156
7157         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7158
7159 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7160
7161         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7162         (struct iovec): Correct !HAVE_READV definition.
7163
7164 2010-06-10  Cary Coutant  <ccoutant@google.com>
7165
7166         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7167         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7168         reloc sections.
7169         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7170
7171         PR 11683
7172         * symtab.h (Symbol::is_placeholder): New member function.
7173         * target-reloc.h (relocate_section): Check for placeholder symbols.
7174
7175         * testsuite/Makefile.am (plugin_test_8): New test.
7176         (plugin_test_9): New test.
7177         * testsuite/Makefile.in: Regenerate.
7178
7179 2010-06-09  Nick Clifton  <nickc@redhat.com>
7180
7181         * yyscript.y (input_list_element): Allow strings prefixed with
7182         the '-' character.  Treat these as libraries.
7183         * script.cc (script_add_library): New function.  Adds a library
7184         specified by "-l<name>" found in an input script.
7185         * script-c.h: Add prototype for script_add_library.
7186
7187 2010-06-07  Doug Kwan  <dougkwan@google.com>
7188
7189         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7190         Restrict stub-group size to be within long conditional branch
7191         range when working around cortex-A8 erratum.
7192
7193 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7194
7195         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7196         #ifdef typo.
7197
7198 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7199
7200         PR gold/11658
7201         * output.cc
7202         (Output_section::Input_section_sort_entry::compare_section_ordering):
7203         Change to return non-zero correctly.
7204         (Output_section::Input_section_sort_section_order_index_compare
7205         ::operator()): Change to fix ambiguity in comparisons.
7206
7207 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7208
7209         * gold.h (is_wildcard_string): New function.
7210         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7211         (Layout::layout_eh_frame): Ditto.
7212         (Layout::find_section_order_index): New method.
7213         (Layout::read_layout_from_file): New method.
7214         * layout.h (Layout::find_section_order_index): New method.
7215         (Layout::read_layout_from_file): New method.
7216         (Layout::input_section_position_): New private member.
7217         (Layout::input_section_glob_): New private member.
7218         * main.cc (main): Call read_layout_from_file here.
7219         * options.h (--section-ordering-file): New option.
7220         * output.cc (Output_section::input_section_order_specified_): New
7221         member.
7222         (Output_section::Output_section): Initialize new member.
7223         (Output_section::add_input_section): Add new parameter.
7224         Keep input sections when --section-ordering-file is used.
7225         (Output_section::set_final_data_size): Sort input sections when
7226         section ordering file is specified.
7227         (Output_section::Input_section_sort_entry): Add new parameter.
7228         Check sorting type.
7229         (Output_section::Input_section_sort_entry::compare_section_ordering):
7230         New method.
7231         (Output_section::Input_section_sort_compare::operator()): Change to
7232         consider section_order_index.
7233         (Output_section::Input_section_sort_init_fini_compare::operator()):
7234         Change to consider section_order_index.
7235         (Output_section::Input_section_sort_section_order_index_compare
7236         ::operator()): New method.
7237         (Output_section::sort_attached_input_sections): Change to sort
7238         according to section order when specified.
7239         (Output_section::add_input_section<32, true>): Add new parameter.
7240         (Output_section::add_input_section<64, true>): Add new parameter.
7241         (Output_section::add_input_section<32, false>): Add new parameter.
7242         (Output_section::add_input_section<64, false>): Add new parameter.
7243         * output.h (Output_section::add_input_section): Add new parameter.
7244         (Output_section::input_section_order_specified): New
7245         method.
7246         (Output_section::set_input_section_order_specified): New method.
7247         (Input_section::Input_section): Initialize section_order_index_.
7248         (Input_section::section_order_index): New method.
7249         (Input_section::set_section_order_index): New method.
7250         (Input_section::section_order_index_): New member.
7251         (Input_section::Input_section_sort_section_order_index_compare): New
7252         struct.
7253         (Output_section::input_section_order_specified_): New member.
7254         * script-sections.cc (is_wildcard_string): Delete and move modified
7255         method to gold.h.
7256         (Output_section_element_input::Output_section_element_input): Modify
7257         call to is_wildcard_string.
7258         (Output_section_element_input::Input_section_pattern
7259         ::Input_section_pattern): Ditto.
7260         (Output_section_element_input::Output_section_element_input): Ditto.
7261         * testsuite/Makefile.am (final_layout): New test case.
7262         * testsuite/Makefile.in: Regenerate.
7263         * testsuite/final_layout.cc: New file.
7264         * testsuite/final_layout.sh: New file.
7265
7266 2010-06-01  Rafael Espindola  <espindola@google.com>
7267
7268         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7269
7270 2010-06-01  Rafael Espindola  <espindola@google.com>
7271
7272         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7273         visibility of symbols.
7274
7275 2010-05-27  Doug Kwan  <dougkwan@google.com>
7276
7277         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7278         from start of output section instead of address for a local symbol
7279         in a merged or relaxed section when doing a relocatable link.
7280
7281 2010-05-26  Rafael Espindola  <espindola@google.com>
7282
7283         PR 11604
7284         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7285         adding sections the garbage collector removed.
7286         * gold/testsuite/Makefile.am: Add test.
7287         * gold/testsuite/Makefile.in: Regenerate.
7288         * gold/testsuite/plugin_test_7.sh: New.
7289         * gold/testsuite/plugin_test_7_1.c: New.
7290         * gold/testsuite/plugin_test_7_2.c: New.
7291
7292 2010-05-26  Rafael Espindola  <espindola@google.com>
7293
7294         * script-sections.cc (Output_section_definition::set_section_addresses):
7295         Check for --section-start.
7296
7297 2010-05-26  Doug Kwan  <dougkwan@google.com>
7298
7299         * arm.cc (Arm_scan_relocatable_relocs): New class.
7300         (Target_arm::relocate_special_relocatable): New method.
7301         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7302         (Arm_relocate_functions::thumb_branch_common): Same.
7303         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7304         instead of Default_scan_relocatable_relocs.
7305         * target-reloc.h (relocate_for_relocatable): Let target handle
7306         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7307         * target.h (Sized_target::relocate_special_relocatable): New method.
7308
7309 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7310
7311         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7312
7313 2010-05-23  Doug Kwan  <dougkwan@google.com>
7314
7315         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7316         instead of a cast.
7317         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7318         with a direct branch, not a conditional branch, to a stub.
7319         * merge.cc (Output_merge_base::record_input_section): New method
7320         defintion.
7321         (Output_merge_data::do_add_input_section): Record input section if
7322         keeps-input-sections flag is set.
7323         (Output_merge_string::do_add_input_section): Ditto.
7324         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7325         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7326         INPUT_SECTIONS_.
7327         (Output_merge_base::keeps_input_sections,
7328         Output_merge_base::set_keeps_input_sections,
7329         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7330         method definitions.
7331         (Output_merge_base::Input_sections): New type declaration.
7332         (Output_merge_base::input_sections_begin,
7333         Output_merge_base::input_sections_end,
7334         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7335         (Output_merge_base::bool keeps_input_sections_,
7336         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7337         Output_merge_base::input_sections_): New data members.
7338         (Output_merge_data::do_set_keeps_input_sections): New method
7339         defintion.
7340         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7341         * output.cc (Output_section::Input_section::relobj): Move method
7342         defintion from class declaration to here and handle merge sections.
7343         (Output_section::Input_section::shndx): Ditto.
7344         (Output_section::Output_section): Remove initializations of removed
7345         data members and initialize new data member LOOKUP_MAPS_.
7346         (Output_section::add_input_section): Set keeps-input-sections flag
7347         for a newly created merge output section as appropriate.  Adjust code
7348         to use Output_section_lookup_maps class.
7349         (Output_section::add_relaxed_input_section): Adjst code for lookup
7350         maps code refactoring.
7351         (Output_section::add_merge_input_section): Add a new parameter
7352         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7353         class.  If adding input section to a newly created merge output
7354         section fails, remove the new merge section.
7355         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7356         Adjust code for use of the Output_section_lookup_maps class.
7357         (Output_section::find_merge_section): Ditto.
7358         (Output_section::build_lookup_maps): New method defintion.
7359         (Output_section::find_relaxed_input_section): Adjust code to use
7360         Output_section_lookup_maps class.
7361         (Output_section::get_input_sections): Export merge sections.  Adjust
7362         code to use Output_section_lookup_maps class.
7363         (Output_section:::add_script_input_section): Adjust code to use
7364         Output_section_lookup_maps class.  Update lookup maps for merge
7365         sections also.
7366         (Output_section::discard_states): Use Output_section_lookup_maps.
7367         (Output_section::restore_states): Same.
7368         * output.h (Merge_section_properties): Move class defintion out of
7369         Output_section.
7370         (Output_section_lookup_maps): New class.
7371         (Output_section::Input_section::is_merge_section): New method
7372         defintion.
7373         (Output_section::Input_section::relobj): Move defintion out of class
7374         defintion.  Declare method only.
7375         (Output_section::Input_section::shndx): Ditto.
7376         (Output_section::Input_section::output_merge_base): New method defintion.
7377         (Output_section::Input_section::u2_.pomb): New union field.
7378         (Output_section::Merge_section_by_properties_map,
7379         Output_section::Output_section_data_by_input_section_map,
7380         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7381         Remove types.
7382         (Output_section::add_merge_input_section): Add new parameter
7383         KEEPS_INPUT_SECTIONS.
7384         (Output_section::build_lookup_maps): New method declaration.
7385         (Output_section::merge_section_map_,
7386         Output_section::merge_section_by_properties_map_,
7387         Output_section::relaxed_input_section_map_,
7388         Output_section::is_relaxed_input_section_map_valid_): Remove data
7389         members.
7390         (Output_section::lookup_maps_): New data member.
7391
7392 2010-05-21  Doug Kwan  <dougkwan@google.com>
7393
7394         PR gold/11619
7395         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7396         avoid a compilation error.
7397
7398 2010-05-19  Rafael Espindola  <espindola@google.com>
7399
7400         * script-sections.cc (Output_section_definition::allocate_to_segment):
7401         Update the phdrs_list even when the output section is NULL.
7402         * testsuite/Makefile.am: Add test.
7403         * testsuite/Makefile.in: Regenerate.
7404         * testsuite/script_test_9.cc: New.
7405         * testsuite/script_test_9.sh: New.
7406         * testsuite/script_test_9.t: New.
7407
7408 2010-05-19  Doug Kwan  <dougkwan@google.com>
7409
7410         * arm.cc (Arm_input_section::original_size): New method.
7411         (Arm_input_section::do_addralign): Add a cast.
7412         (Arm_input_section::do_output_offset): Remove static cast.
7413         (Arm_input_section::original_addralign,
7414          Arm_input_section::original_size_): Change type to uint32_t.
7415         (Arm_input_section::init): Add safe casts for section alignment
7416         and size.
7417         (Arm_input_section::set_final_data_size): Do not set address and
7418         offset of stub table.
7419         (Arm_output_section::fix_exidx_coverage): Change use of of
7420         Output_section::Simple_input_section to that of
7421         Output_section::Input_section.
7422         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7423         except for the first pass.
7424         * output.cc (Output_section::get_input_sections): Change type of
7425         input_sections to std::list<Input_section>.
7426         (Output_section::add_script_input_section): Rename from
7427         Output_section::add_simple_input_section.  Change type of SIS
7428         parameter from Simple_input_section to Input_section.
7429         * output.h (Output_section::Simple_input_section): Remove class.
7430         (Output_section::Input_section): Change class visibility to public.
7431         (Output_section::Input_section::addralign): Use stored alignments
7432         for special input sections if set.
7433         (Output_section::Input_section::set_addralign): New method.
7434         (Output_section::get_input_sections): Change parameter type from
7435         list of Simple_input_section to list of Input_section.
7436         (Output_section::add_script_input_section): Rename from
7437         Output_section::add_simple_input_section. Change first parameter's
7438         type from Simple_input_section to Input_section and remove the
7439         second and third parameters.
7440         * script-sections.cc (Input_section::Input_section_list): Change
7441         type to list of Output_section::Input_section/
7442         (Input_section_info::Input_section_info): Change parameter type of
7443         INPUT_SECTION to Output_section::Input_section.
7444         (Input_section_info::input_section): Change return type.
7445         (Input_section_info::input_section_): Change type to
7446         Output_section::Input_section.
7447         (Output_section_element_input::set_section_addresses): Adjust code
7448         to use Output_section::Input_section instead of
7449         Output_section::Simple_input_section.  Adjust code for renaming
7450         of Output_section::add_simple_input_section.
7451         (Orphan_output_section::set_section_addresses): Ditto.
7452
7453 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7454
7455         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7456         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7457
7458 2010-05-18  Rafael Espindola  <espindola@google.com>
7459
7460         * options.cc (General_options::finalize): Handle -nostdlib.
7461         * options.h (nostdlib): New option.
7462         * script.cc (script_add_search_dir): Handle -nostdlib.
7463
7464 2010-05-12  Doug Kwan  <dougkwan@google.com>
7465
7466         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7467         attributes section only if there no attributes section after merging.
7468         (Target_arm::merge_object_attributes): Move value of
7469         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7470         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7471         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7472         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7473         and arm_attr_merge_7.stdout.
7474         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7475         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7476         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7477         arm_attr_merge_7b.o): New rules.
7478         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7479         arm_attr_merge_7
7480         * testsuite/Makefile.in: Regenerate.
7481         * testsuite/arm_attr_merge.sh: New file.
7482         * testsuite/arm_attr_merge_[67][ab].s: Same.
7483
7484 2010-05-05  Nick Clifton  <nickc@redhat.com>
7485
7486         * po/es.po: Updated Spanish translation.
7487
7488 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7489
7490         * Makefile.am (install-exec-local): Properly install gold as
7491         default cross linker.
7492         * Makefile.in: Regenerated.
7493
7494 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7495             Nick Clifton  <nickc@redhat.com>
7496
7497         * configure.ac (install_as_default): Define and set to false
7498         unless --enable-gold or --enable-gold=both/gold has been
7499         specified.
7500         * configure: Regenerate.
7501
7502         * Makefile.am (install-exec-local): Install the executable as
7503         'ld.gold'.  If install_as_default is true then also install it as
7504         'ld'.
7505         * Makefile.in: Regenerated.
7506
7507 2010-04-24  Ian Lance Taylor  <iant@google.com>
7508
7509         * layout.cc (Layout::layout_reloc): In relocatable link don't
7510         combine reloc sections for grouped sections.
7511
7512 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7513
7514         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7515         sections that are not ordinary to icf.
7516         * icf.cc (get_section_contents): Handle relocation pointing to section
7517         with no object or shndx information.
7518         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7519         * testsuite/Makefile.in: Regenerate.
7520         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7521         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7522
7523 2010-04-22  Ian Lance Taylor  <iant@google.com>
7524
7525         * expression.cc (Expression::Expression_eval_info): Add
7526         result_alignment_pointer field.
7527         (Expression::eval_with_dot): Add result_alignment_pointer
7528         parameter.  Change all callers.
7529         (Expression::eval_maybe_dot): Likewise.
7530         (class Binary_expression): Add alignment_pointer parameter to
7531         left_value and right_value.  Change all callers.
7532         (BINARY_EXPRESSION): Set result alignment.
7533         (class Trinary_expression): Add alignment_pointer parameter to
7534         arg2_value and arg3_value.  Change all callers.
7535         (Trinary_cond::value): Set result alignment.
7536         (Max_expression::value, Min_expression::value): Likewise.
7537         (Align_expression::value): Likewise.
7538         * script-sections.cc (class Sections_element): Add dot_alignment
7539         parameter to set_section_addresses virtual function.  Update
7540         instantiations.
7541         (class Output_section_element): Likewise.
7542         (Script_sections::create_segments): Add dot_alignment parameter.
7543         Change all callers.
7544         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7545         (Script_sections::set_phdrs_clause_addresses): Likewise.
7546         * script-sections.h: Update declarations.
7547         * script.h: Update declarations.
7548         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7549         min_p_align.
7550         * testsuite/script_test_3.t: Set large alignment.
7551         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7552         segment has expected alignment.
7553
7554 2010-04-22  Nick Clifton  <nickc@redhat.com>
7555
7556         * po/gold.pot: Updated by the Translation project.
7557         * po/vi.po: Updated Vietnamese translation.
7558
7559 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7560
7561         * testsuite/Makefile.am (check_PROGRAMS): Add
7562         icf_virtual_function_folding_test.
7563         * testsuite/Makefile.in: Regenerated.
7564
7565 2010-04-15  Andrew Haley  <aph@redhat.com>
7566
7567         * options.h (merge_exidx_entries): New option.
7568         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7569         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7570         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7571         (Target_arm::merge_exidx_entries): New function.
7572         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7573         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7574         to Arm_exidx_fixup constructor.
7575         Add new arg, merge_exidx_entries.
7576         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7577         Arm_output_section::fix_exidx_coverage.
7578
7579 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7580
7581         * icf.cc (get_section_contents): Check for preemptible functions.
7582         Ignore addend when appropriate.
7583         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7584         section folded.
7585         (add_from_relobj): Check for section folded.
7586         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7587         * symtab.h (should_add_dynsym_entry): Add new parameter.
7588         * target-reloc.h (scan_relocs): Check for section folded.
7589         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7590         Check reloc types for function pointers in shared objects.
7591         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7592         case.
7593         (icf_preemptible_functions_test): New test case.
7594         (icf_string_merge_test): New test case.
7595         * testsuite.Makefile.in: Regenerate.
7596         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7597         bar_glob.  Refactor code.
7598         * testsuite/icf_preemptible_functions_test.cc: New file.
7599         * testsuite/icf_preemptible_functions_test.sh: New file.
7600         * testsuite/icf_string_merge_test.cc: New file.
7601         * testsuite/icf_string_merge_test.sh: New file.
7602         * testsuite/icf_virtual_function_folding_test.cc: New file.
7603         * testsuite/icf_virtual_function_folding_test.sh: New file.
7604
7605 2010-04-14  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7608         for local symbol recounting if we remove a section due to ICF.
7609         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7610         there are no regular objects in input.
7611
7612 2010-04-13  Doug Kwan  <dougkwan@google.com>
7613
7614         * arm.cc (Arm_input_section::set_final_data_size): Compute
7615         accurate final data size instead of using current data size.
7616
7617 2010-04-09  Doug Kwan  <dougkwan@google.com>
7618
7619         * layout.cc (Layout::choose_output_section): Handle script section
7620         types.
7621         (Layout::make_output_section_for_script): Add section type parameter.
7622         Handle script section types.
7623         * layout.h (Layout::make_output_section_for_script): Add section
7624         type parameter.
7625         * output.cc (Output_section::Output_section): Initialize data member
7626         is_noload_.
7627         (Output_section::do_reset_address_and_file_offset): Do not set address
7628         to 0 if section is a NOLOAD section.
7629         * output.h (Output_section::is_noload): New method.
7630         (Output_section::set_is_noload): Ditto.
7631         (Output_section::is_noload_): New data member.
7632         * script-c.h (Script_section_type): New enum type.
7633         (struct Parser_output_section_header): Add new file section_type.
7634         * script-sections.cc (Sections_element::output_section_name): Add
7635         parameter for returning script section type.
7636         (Output_section_definition::output_section_name): Ditto.
7637         (Output_section_definition::section_type)P; New method.
7638         (Output_section_definiton::script_section_type_name): Ditto.
7639         (Output_section_definition::script_section_type_): New data member.
7640         (Output_section_definition::Output_section_definition): Initialize
7641         data member Output_section_definition::script_section_type_.
7642         (Output_section_definition::create_sections): Pass script section type
7643         to Layout::make_output_section_for_script.
7644         (Output_section_definition::output_section_name): Return script
7645         section type to caller.
7646         (Output_section_definition::set_section_address): Do not advance
7647         dot value and load address if section type is NOLOAD.  Set address
7648         of NOLOAD sections regardless of section flags.
7649         (Output_section_definition::print): Print section type if it is
7650         not SCRIPT_SECTION_TYPE_NONE.
7651         (Output_section_definition::section_type): New method.
7652         (Output_section_definition::script_section_type_name): Ditto.
7653         (Script_sections::output_section_name): Add new parameter
7654         PSECTION_TYPE for returning script section type.  Pass it to
7655         section elements.  Handle discard sections.
7656         (Sort_output_sections::operator()): Handle NOLOAD sections.
7657         * script-sections.h (Script_sections::Section_type): New enum type.
7658         (Script_sections::output_section_name): Add a new parameter for
7659         returning script section type.
7660         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7661         INFO and NOLOAD.
7662         * yyscript.y (union): Add new field SECTION_TYPE.
7663         (COPY, DSECT, INFO, NOLOAD): New tokens.
7664         (opt_address_and_section_type): Change type to output_section_header.
7665         (section_type): New non-terminal
7666         (section_header): Handle section type.
7667         (opt_address_and_section_type): Return section type value.
7668
7669 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7670
7671         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7672         * testsuite/plugin_common_test_2.c (foo): Likewise.
7673
7674 2010-04-08  Doug Kwan  <dougkwan@google.com>
7675
7676         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7677         Output_merge_data.
7678         * output.cc (Output_section::add_merge_input_section): Simplify
7679         code and return status of Output_merge_base::add_input_section.
7680         Update merge section map only if Output_merge_base::add_input_section
7681         returns true.
7682
7683 2010-04-07  Doug Kwan  <dougkwan@google.com>
7684
7685         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7686         if section is marked as containing instructions but has no mapping
7687         symbols.
7688         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7689         correct section index.
7690         (Arm_relobj::find_linked_text_section): Ditto.
7691
7692 2010-04-07  Cary Coutant  <ccoutant@google.com>
7693
7694         * archive.cc (include_member): Destroy Read_symbols_data object before
7695         releasing file.
7696         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7697         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7698         (Read_symbols_data::~Read_symbols_data) New destructor.
7699         (Section_relocs::Section_relocs) New constructor.
7700         (Section_relocs::~Section_relocs) New destructor.
7701         (Read_relocs_data::Read_relocs_data) New constructor.
7702         (Read_relocs_data::~Read_relocs_data) New destructor.
7703         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7704         pointers to NULL after deleting.
7705
7706 2010-04-07  Doug Kwan  <dougkwan@google.com>
7707
7708         * arm.cc: Replace "endianity" with "endianness" in comments.
7709         (Arm_exidx_cantunwind): Ditto.
7710         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7711         (Arm_relobj::merge_flags_and_attributes): New method.
7712         (Arm_relobj::merge_flags_and_attributes_): New data member.
7713         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7714         (Arm_relobj::scan_sections_for_stubs): Ditto.
7715         (Arm_relobj::do_read_symbols): Check to see if we really want to
7716         merge processor-specific flags and attributes.  Exit early if
7717         an object is empty except for section names and the undefined symbol.
7718         (Target_arm::do_finalize_sections): Move check for ELF format to
7719         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7720         attributes from a regular object only when we have determined that
7721         it is aapropriate.  Do not create an .ARM.attributes section in
7722         output if there is no regular input object.
7723         (Target_arm::merge_processor_specific_flags): Check
7724         --warn-mismatch before printing any error.
7725         (Target_arm::merge_object_attributes): Ditto.
7726         * gold.cc (queue_middle_tasks): Handle the case in which there is
7727         no regular object in input.
7728         * options.cc (General_options::parse_EB): New method.
7729         (General_options::parse_EL): Same.
7730         (General_options::General_options): Initialize endianness_.
7731         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7732         New options.
7733         (General_options::Endianness): New enum.
7734         (General_options::endianness): New method.
7735         (General_options::endianness_): New data member.
7736         * parameters.cc (Parameters::set_options): Check target endianness.
7737         (Parameters::set_target_once): Ditto.
7738         (Parameters::check_target_endianness): New method.
7739         (parameters_force_valid_target): If either -EL or -EB is specified,
7740         use it to define endianness of default target.
7741         * parameters.h (Parameters::check_target_endianness): New method
7742         declaration.
7743         * target.h (class Target): Change "endianity" to "endianness"
7744         in comments.
7745
7746 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7747
7748         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7749         * configure: Regenerate.
7750         * Makefile.in: Regenerate.
7751         * testsuite/Makefile.in: Regenerate.
7752
7753 2010-04-06  Cary Coutant  <ccoutant@google.com>
7754
7755         gcc PR lto/42757
7756         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7757         prevailing definitions of common symbols.
7758         * testsuite/plugin_test_6.sh: New test case.
7759         * testsuite/plugin_common_test_1.c: New test case.
7760         * testsuite/plugin_common_test_2.c: New test case.
7761         * testsuite/Makefile.am (plugin_test_6): New test case.
7762         * testsuite/Makefile.in: Regenerate.
7763
7764 2010-04-06  Nick Clifton  <nickc@redhat.com>
7765
7766         * po/vi.po: New Vietnamese translation.
7767
7768 2010-03-30  Doug Kwan  <dougkwan@google.com>
7769
7770         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7771
7772 2010-03-25  Doug Kwan  <dougkwan@google.com>
7773
7774         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7775         to avoid a conversion warning on a 32-bit host.
7776
7777 2010-03-24  Ian Lance Taylor  <iant@google.com>
7778
7779         * testsuite/script_test_3.t: Add a TLS segment.
7780         * testsuite/Makefile.am (check_PROGRAMS): Add
7781         tls_phdrs_script_test.
7782         (tls_phdrs_script_test_SOURCES): Define.
7783         (tls_phdrs_script_test_DEPENDENCIES): Define.
7784         (tls_phdrs_script_test_LDFLAGS): Define.
7785         (tls_phdrs_script_test_LDADD): Define.
7786         * testsuite/Makefile.in: Rebuild.
7787
7788 2010-03-23  Cary Coutant  <ccoutant@google.com>
7789
7790         * fileread.cc (find_or_make_view): Fix comment.
7791
7792 2010-03-23  Ian Lance Taylor  <iant@google.com>
7793
7794         * script-sections.cc (class Orphan_section_placement): Define
7795         PLACE_TLS and PLACE_TLS_BSS.
7796         (Orphan_section_placement::Orphan_section_placement): Initialize
7797         new places.
7798         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7799         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7800         (tls_script_test_SOURCES): Define.
7801         (tls_script_test_DEPENDENCIES): Define.
7802         (tls_script_test_LDFLAGS): Define.
7803         (tls_script_test_LDADD): Define.
7804         * testsuite/Makefile.in: Rebuild.
7805
7806 2010-03-22  Doug Kwan  <dougkwan@google.com>
7807
7808         * arm.cc (Arm_relocate_functions::abs8,
7809         Arm_relocate_functions::abs16): Use correct check for overflow
7810         specified in the ARM ELF specs.
7811         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7812         target of a BLX instruction specially.
7813         (Reloc_stub::stub_type_for_reloc): Ditto.
7814         (Relocate::relocate): Use symbolic names instead of numeric relocation
7815         codes to report error.
7816         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7817         workaround.
7818         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7819         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7820         thumb2_blx_out_of_range.stdout
7821         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7822         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7823         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7824         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7825         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7826         thumb2_blx_in_range, thumb2_blx_in_range.o,
7827         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7828         thumb2_blx_out_of_range.o): New rules.
7829         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7830         thumb2_blx_in_range and thumb2_blx_out_of_range.
7831         * testsuite/Makefile.in: Regenerate.
7832         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7833         * testsuite/thumb_blx_in_range.s: New file.
7834         * testsuite/thumb_blx_out_of_range.s: New file.
7835
7836 2010-03-22  Rafael Espindola  <espindola@google.com>
7837
7838         * archive.cc (Should_include): Move to archive.h.
7839         (should_include_member): Make it a member of Archive.
7840         (Lib_group): New.
7841         (Add_lib_group_symbols): New.
7842         * archive.h: Include options.h.
7843         (Archive_member): Moved from Archive.
7844         (Should_include): Moved from archive.cc.
7845         (Lib_group): New.
7846         (Add_lib_group_symbols): New.
7847         * dynobj.cc (do_should_include_member): New.
7848         * dynobj.h (do_should_include_member): New.
7849         * gold.cc (queue_initial_tasks): Update call to queue.
7850         * main.cc (main): Print lib group stats.
7851         * object.cc (do_should_include_member): New.
7852         * object.h: Include archive.h.
7853         (Object::should_include_member): New.
7854         (Object::do_should_include_member): New.
7855         (Sized_relobj::do_should_include_member): New.
7856         * options.cc (General_options::parse_start_lib): New.
7857         (General_options::parse_end_lib): New.
7858         (Input_arguments::add_file): Handle lib groups.
7859         (Input_arguments::start_group): Check we are not in a lib.
7860         (Input_arguments::start_lib): New.
7861         (Input_arguments::end_lib): New.
7862         * options.h (General_options): Add start_lib and end_lib.
7863         (Input_argument::lib_): New.
7864         (Input_argument::lib): New.
7865         (Input_argument::is_lib): New.
7866         (Input_file_lib): New.
7867         (Input_arguments::in_lib_): New.
7868         (Input_arguments::in_lib): New.
7869         (Input_arguments::start_lib): New.
7870         (Input_arguments::end_lib_): New.
7871         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7872         in unused members as preempted.
7873         (Sized_pluginobj::do_should_include_member): New.
7874         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7875         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7876         return the blocker.
7877         (Read_symbols::do_whole_lib_group): New.
7878         (Read_symbols::do_lib_group): New.
7879         (Read_symbols::do_read_symbols): Handle lib groups.
7880         (Read_symbols::get_name): Handle lib groups.
7881         * readsyms.h (Read_symbols): Add an archive member pointer.
7882         (Read_symbols::do_whole_lib_group): New.
7883         (Read_symbols::do_lib_group): New.
7884         (Read_symbols::member_): New.
7885         * script.cc (read_input_script): Update call to queue_soon.
7886
7887 2010-03-19  Doug Kwan  <dougkwan@google.com>
7888
7889         * arm.cc (Stub_table::Stub_table): Initialize new data members
7890         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7891         (Stub_table::add_reloc_stub): Assign stub offset and update
7892         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7893         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7894         New data members.
7895         (Stub_table::update_data_size_and_addralign): Use
7896         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7897         instead of going over all reloc stubs.
7898         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7899         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7900         Stringpool_template::offset_ to size of Stringpool_char.
7901         (Stringpool_template::new_key_offset): Remove code to initialize
7902         Stringpool_template::offset_.
7903         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7904         Stringpool_template::offset_ to zero.
7905
7906 2010-03-15  Doug Kwan  <dougkwan@google.com>
7907
7908         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7909         offset_.
7910         (Stringpool_template::new_key_offset): New method.
7911         (Stringpool_template::add_string): Assign offsets when adding new
7912         strings.
7913         (Stringpool_template::set_string_offsets): Do not set string offsets
7914         when not optimizing.
7915         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7916         member size_.
7917         (Chunked_vector::clear): Clear size_.
7918         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7919         (Chunked_vector::size): Return size_.
7920         (Chunked_vector::push_back): Use size_ to find insert position.
7921         (Chunked_vector::size_): New data member.
7922         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7923         (Stringpool_template::new_key_offset): New method declaration.
7924         (Stringpool_template::offset_): New data member.
7925
7926 2010-03-15   Rafael Espindola  <espindola@google.com>
7927
7928         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7929         Add_symbols' constructor.
7930         * readsyms.h (Add_symbols): Remove the input_group member.
7931
7932 2010-03-10  Ian Lance Taylor  <iant@google.com>
7933
7934         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7935         target to ask whether a reference to a symbol requires a stack
7936         split.
7937         * target.h (Target::is_call_to_non_split): New function.
7938         (Target::do_is_call_to_non_split): Declare virtual function.
7939         * target.cc: Include "symtab.h".
7940         (Target::do_is_call_to_non_split): New function.
7941         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7942
7943 2010-03-10  Cary Coutant  <ccoutant@google.com>
7944
7945         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7946         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7947         (File_read::open[2]): Add whole_file_view_ to list of views.
7948         (File_read::make_view): Remove test of whole_file_view_.
7949         (File_read::find_or_make_view): Create whole_file_view_ if
7950         necessary.
7951         (File_read::clear_views): Replace bool parameter with enum;
7952         adjust all callers.  Don't delete views with permanent data;
7953         do delete cached views and views from archives if
7954         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7955         if clearing the corresponding view.
7956         * fileread.h (File_read::Clear_views_mode): New enum.
7957         (File_read::View::is_permanent_view): New method.
7958         (File_read::clear_views): Replace bool parameter
7959         with enum; adjust all callers.
7960         * options.h (General_options): Change keep_files_mapped option;
7961         add map_whole_files.
7962         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7963         releasing the file.
7964         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7965         the file.
7966
7967 2010-03-10  David S. Miller  <davem@davemloft.net>
7968
7969         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7970
7971 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7972
7973         * icf.cc (get_section_contents): Add '@' marker after processing the
7974         merge reloc.
7975
7976 2010-03-08  Doug Kwan  <dougkwan@google.com>
7977
7978         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7979         due to a conversion warning.
7980         (Arm_relobj::update_output_local_symbol_count): Check for local
7981         symbol with unset output index.
7982
7983 2010-03-05  Ian Lance Taylor  <iant@google.com>
7984
7985         * options.h (class General_options): Add --spare-dynamic-tags.
7986         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7987         --spare-dynamic-tags.
7988
7989 2010-03-05  Ian Lance Taylor  <iant@google.com>
7990
7991         * incremental.cc: Include "libiberty.h".
7992
7993 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7994
7995         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7996         function, is_info_ member.
7997         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7998         (Versions::Versions): Update caller.
7999         (Versions::define_base_version): Likewise.
8000         (Versions::add_def): Likewise.
8001
8002 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8003
8004         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8005         (Scan::possible_function_pointer_reloc): New function.
8006         (Scan::local_reloc_may_be_function_pointer): Change to call
8007         possible_function_pointer_reloc.
8008         (Scan::global_reloc_may_be_function_pointer): Ditto.
8009         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8010         relocations in ".data.rel.ro._ZTV" section.
8011         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8012         * testsuite/icf_safe_so_test.cc: Ditto.
8013         * testsuite/icf_safe_test.cc: Ditto.
8014         * testsuite/icf_safe_test.sh: Ditto.
8015
8016 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8017             Ian Lance Taylor  <iant@google.com>
8018
8019         * target-reloc.h (relocate_section): Check the symbol table index
8020         for -1U before setting the local symbol index.
8021         (scan_relocatable_relocs): If copying the relocation, record that
8022         the local symbol is required.
8023         * object.h (Symbol_value::is_output_symtab_index_set): New
8024         function.
8025         (Symbol_value::may_be_discarded_from_output_symtab): New
8026         function.
8027         (Symbol_value::has_output_symtab_entry): New function.
8028         (Symbol_value::needs_output_symtab_entry): Remove.
8029         (Symbol_value::output_symtab_index): Make sure the symbol index is
8030         set.
8031         (Symbol_value::set_output_symtab_index): Make sure the symbol
8032         index is not set.  Make sure the new index is valid.
8033         (Symbol_value::set_must_have_output_symtab_entry): New function.
8034         (Symbol_value::has_output_dynsym_entry): New function.
8035         (Symbol_value::set_output_dynsym_index): Make sure the new index
8036         is valid.
8037         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8038         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8039         local symbol if permitted.
8040         (Sized_relobj::do_finalize_local_symbols): Call
8041         is_output_symtab_index_set rather than needs_output_symtab_entry.
8042         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8043         rather than needs_output_symtab_entry.  Call
8044         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8045         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8046         is_output_symtab_index_set rather than needs_output_symtab_entry.
8047         * testsuite/discard_locals_relocatable_test.c: New file.
8048         * testsuite/discard_locals_test.sh: Test -r.
8049         * testsuite/Makefile.am (check_DATA): Add
8050         discard_locals_relocatable_test1.syms,
8051         discard_local_relocatable_test2.syms.
8052         (MOSTLYCLEANFILES): Likewise.  Also add
8053         discard_locals_relocatable_test1.lout and
8054         discard_locals_relocatable_test2.out.
8055         (discard_locals_relocatable_test1.syms): New target.
8056         (discard_locals_relocatable_test.o): New target.
8057         (discard_locals_relocatable_test1.out): New target.
8058         (discard_locals_relocatable_test2.syms): New target.
8059         (discard_locals_relocatable_test2.out): New target.
8060         (various): Add missing ../ld-new dependencies.
8061         * testsuite/Makefile.in: Rebuild.
8062
8063 2010-03-03  Nick Clifton  <nickc@redhat.com>
8064
8065         * po/fi.po: New Finnish translation.
8066
8067 2010-03-01  Doug Kwan  <dougkwan@google.com>
8068
8069         * layout.cc (Layout::Layout): Force section types of .init_array*,
8070         .preinit_array* and .fini_array* sections.
8071         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8072         Fix check of return value of std::string::find.().
8073         (Output_section::Input_section_sort_compare::operator()): Remove
8074         comment about .init_array.
8075         (Output_section::Input_section_sort_init_fini_compare::operator()):
8076         New method.
8077         (Output_section::sort_attached_input_sections): Handle .init_array
8078         and .fini_array specially.
8079         * output.h (Output_section::Inut_section_sort_compare): Update
8080         comment.
8081         (Output_section::Input_section_sort_init_fini_compare): New struct.
8082
8083 2010-02-26  Doug Kwan  <dougkwan@google.com>
8084
8085         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8086         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8087         * testsuite/debug_msg.sh: Avoid matching source line number for
8088         use of global variable undef_int.
8089
8090 2010-02-26  Doug Kwan  <dougkwan@google.com>
8091
8092         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8093         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8094         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8095         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8096         * options.cc (General_options::General_options): Initialize member
8097         fix_v4bx_.
8098         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8099         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8100         and rm_no_fix_v4bx.stdout
8101         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8102         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8103         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8104         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8105         and arm_no_fix_v4bx.
8106         * Makefile.in: Regenerate.
8107         * testsuite/arm_fix_v4bx.s: New file.
8108         * testsuite/arm_fix_v4bx.sh: Ditto.
8109
8110 2010-02-24  Doug Kwan  <dougkwan@google.com>
8111
8112         * arm.cc (Target_arm::got_section): Make the .got section the first
8113         non RELRO section in the data segment.
8114         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8115         suffixes of section names.
8116
8117 2010-02-24  Doug Kwan  <dougkwan@google.com>
8118
8119         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8120         flags and attributes merging if an input file is a binary file.
8121         * fileread.cc (Input_file::open): Record format of original file.
8122         * fileread.h (Input_file::Format): New enum type.
8123         (Input_file::Input_file): Initialize data member format_.
8124         (Input_file::format): New method definition.
8125         (Input_file::format_):: New data member.
8126
8127 2010-02-24  Doug Kwan  <dougkwan@google.com>
8128
8129         * arm.cc (Arm_output_data_got): New class.
8130         (ARM_TCB_SIZE): New constant
8131         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8132         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8133         If user uses a script with a SECTIONS clause, issue only a warning
8134         for a misplaced EXIDX input section.  Otherwise, issue an error.
8135         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8136         garbage collection.
8137         (Target_arm::got_mode_index_entry): Handle static linking.
8138         (Target_arm::Scan::local): Ditto.
8139         (Target_arm::Scan::global): Ditto.
8140         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8141         all incorrectly implemented relocations.
8142         (Target_arm::fix_exidx_coverage): Pass layout to
8143         Arm_output_section::fix_exidx_coverage.
8144         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8145         from ".ARM.exidx." and ".ARM.extab.".
8146
8147 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8148
8149         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8150         section if it does not already exist.
8151         * attributes.cc (Attributes_section_data::Attributes_section_data):
8152         Don't crash if size is zero.
8153
8154 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8155             Ian Lance Taylor  <iant@google.com>
8156
8157         * gold.cc (queue_middle_tasks): If no input files were opened,
8158         exit.
8159         * workqueue.h (Task_function::Task_function): Assert that there is
8160         a blocker.
8161
8162 2010-02-22  Doug Kwan  <dougkwan@google.com>
8163
8164         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8165         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8166         types to avoid warnings due to different uint64_t implementations
8167         on different hosts.
8168
8169 2010-02-21  Doug Kwan  <dougkwan@google.com>
8170
8171         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8172         handling of the maximum backward branch offset.
8173         (Arm_relocate_functions::thumb_branch_common): Ditto.
8174         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8175         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8176         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8177         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8178         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8179         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8180         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8181         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8182         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8183         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8184         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8185         thumb2_bl_out_of_range.o): New rules.
8186         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8187         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8188         thumb2_bl_out_of_range
8189         * testsuite/Makefile.in: Regenerate.
8190         * testsuite/arm_bl_in_range.s: New file.
8191         * testsuite/arm_bl_out_of_range.s: Ditto.
8192         * testsuite/arm_branch_in_range.sh: Ditto.
8193         * testsuite/arm_branch_range.t: Ditto.
8194         * testsuite/thumb2_branch_range.t: Ditto.
8195         * testsuite/thumb_bl_in_range.s: Ditto.
8196         * testsuite/thumb_bl_out_of_range.s: Ditto.
8197         * testsuite/thumb_branch_range.t: Ditto.
8198
8199 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8200
8201         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8202         Add reloc offset information.
8203         * icf.cc (get_section_contents): Change iterators to point to the new
8204         vectors. Add reloc offset information to the contents.
8205         * icf.h (Icf::Sections_reachable_info): New typedef.
8206         (Icf::Sections_reachable_list): New typedef.
8207         (Icf::Offset_info): New typedef.
8208         (Icf::Reloc_info): New struct typedef.
8209         (Icf::Reloc_info_list): New typedef.
8210         (Icf::symbol_reloc_list): Delete method.
8211         (Icf::addend_reloc_list): Delete method.
8212         (Icf::section_reloc_list): Delete method.
8213         (Icf::reloc_info_list): New method.
8214         (Icf::reloc_info_list_): New member.
8215
8216 2010-02-19  Doug Kwan  <dougkwan@google.com>
8217
8218         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8219         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8220         * arm.cc (Arm_relocation_functions): New forward declaration.
8221         (Target_arm::Target_arm): Initialize new data members
8222         got_mod_index_offset_ and tls_base_symbol_defined_.
8223         (Target_arm::Relocate::relocate_tls): New method.
8224         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8225          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8226         New methods.
8227         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8228         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8229         (Target_arm::got_mod_index_offset_,
8230         Target_arm::tls_base_symbol_defined_): New data members.
8231         (Target_arm::Scan::local, Target::Scan::global,
8232         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8233         relocations.
8234
8235 2010-02-18  Doug Kwan  <dougkwan@google.com>
8236
8237         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8238         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8239         text section as a parameter becuase some broken tools may not set
8240         the link in section header.
8241         (Target_arm::has_got_section): New method.
8242         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8243         without any mapping symbol as data only.  Remove warning.
8244         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8245         link in its section header, try to discover the link by inspecting the
8246         REL31 relocation at the beginning of the section.
8247         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8248         in error message.
8249         (Target_arm::Scan::global): Treat any reference to the symbol
8250         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8251
8252 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8253
8254         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8255         (Scan::global_reloc_may_be_function_pointer): New function.
8256         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8257         (Scan::global_reloc_may_be_function_pointer): New function.
8258         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8259         (Scan::global_reloc_may_be_function_pointer): New function.
8260         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8261         (Scan::global_reloc_may_be_function_pointer): New function.
8262         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8263         (Scan::global_reloc_may_be_function_pointer): New function.
8264         (Scan::possible_function_pointer_reloc): New function.
8265         (Target_x86_64::can_check_for_function_pointers): New function.
8266         * gc.h (gc_process_relocs): Scan relocation types to determine if
8267         function pointers were taken for targets that support it.
8268         * icf.cc (Icf::find_identical_sections): Include functions for
8269         folding in safe ICF whose pointer is not taken.
8270         * icf.h (Secn_fptr_taken_set): New typedef.
8271         (fptr_section_id_): New member.
8272         (section_has_function_pointers): New function.
8273         (set_section_has_function_pointers): New function.
8274         (check_section_for_function_pointers): New function.
8275         * options.h: Fix comment for safe ICF option.
8276         * target.h (can_check_for_function_pointers): New function.
8277         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8278         Modify icf_safe_test for X86-64.
8279         * testsuite/Makefile.in: Regenerate.
8280         * testsuite/icf_safe_so_test.cc: New file.
8281         * testsuite/icf_safe_so_test.sh: New file.
8282         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8283         (main): Change to take pointer to function kept_func_3.
8284         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8285         folding is done correctly for X86-64.
8286
8287 2010-02-12  David S. Miller  <davem@davemloft.net>
8288
8289         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8290         is_symbolless parameter.
8291         (Output_reloc<SHT_REL>::is_symbolless): New.
8292         (Output_reloc<SHT_REL>::is_symbolless_): New.
8293         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8294         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8295         (Output_reloc<SHT_RELA>::is_symbolless): New.
8296         (Output_data_reloc::add_global): Handle is_symbolless.
8297         (Output_data_reloc::add_global_relative): Likewise.
8298         (Output_data_reloc::add_local): Likewise.
8299         (Output_data_reloc::add_local_relative): Likewise.
8300         (Output_data_reloc::add_symbolless_global_addend): New.
8301         (Output_data_reloc::add_symbolless_local_addend): New.
8302         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8303         is_symbolless.
8304         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8305         instead of ->is_relative_
8306         (Output_reloc::write): Likewise.
8307         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8308         (Output_reloc::write_rel): Simplify.
8309
8310         * sparc.cc (Target_sparc::Scan::local): Use
8311         ->add_symbolless_local_addend as needed.
8312         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8313         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8314         based upon relocation offset.
8315
8316 2010-02-11  Doug Kwan  <dougkwan@google.com>
8317
8318         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8319         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8320         beginning of function.
8321         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8322         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8323         parameter is_32bit in calls to should_apply_static_reloc.
8324         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8325         (check_DATA): Add arm_abs_global.stdout.
8326         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8327         arm_abs_global.stdout): New rules.
8328         (MOSTLLYCLEANFILES): Add arm_abs_global
8329         * Makefile.in: Regenerate.
8330         * testsuite/arm_abs_global.s: New file.
8331         * testsuite/arm_abs_global.sh: Ditto.
8332         * testsuite/arm_abs_lib.s: Ditto.
8333
8334 2010-02-11  Ian Lance Taylor  <iant@google.com>
8335
8336         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8337         Read_relocs task.
8338         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8339         Allocate_commons_task first.
8340         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8341         task, rather than symtab_lock_.
8342         (Gc_process_relocs::~Gc_process_relocs): New function.
8343         (Gc_process_relocs::is_runnable): Check this_blocker_.
8344         (Gc_process_relocs::locks): Use next_blocker_ rather than
8345         blocker_.
8346         (Scan_relocs::~Scan_relocs): New function.
8347         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8348         symtab_lock_.
8349         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8350         next_blocker_.
8351         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8352         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8353         constructor accordingly.
8354         (class Gc_process_relocs): Likewise.
8355         (class Scan_relocs): Likewise.
8356         * common.h (class Allocate_commons_task): Remove symtab_lock_
8357         field, and corresponding constructor parameter.
8358         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8359         symtab_lock_.
8360         (Allocate_commons_task::locks): Likewise.
8361
8362 2010-02-11  Ian Lance Taylor  <iant@google.com>
8363
8364         * gold-threads.h (class Once): Define.
8365         (class Initialize_lock): Rewrite as child of Once.
8366         * gold-threads.cc (class Once_initialize): Define.
8367         (once_pointer_control): New static variable.
8368         (once_pointer, once_arg): New static variables.
8369         (c_run_once): New static function.
8370         (Once::Once, Once::run_once, Once::internal_run): New functions.
8371         (class Initialize_lock_once): Remove.
8372         (initialize_lock_control): Remove.
8373         (initialize_lock_pointer): Remove.
8374         (initialize_lock_once): Remove.
8375         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8376         (Initialize_lock::initialize): Rewrite.
8377         (Initialize_lock::do_run_once): New function.
8378         * archive.cc (Archive::interpret_header): Only clear name if it is
8379         not already empty.
8380         * fileread.cc: Include "gold-threads.h"
8381         (file_counts_lock): New static variable.
8382         (file_counts_initialize_lock): Likewise.
8383         (File_read::release): Only increment counts when using --stats.
8384         Use a lock around the increment.
8385         * parameters.cc (class Set_parameters_target_once): Define.
8386         (set_parameters_target_once): New static variable.
8387         (Parameters::Parameters): Move here from parameters.h.
8388         (Parameters::set_target): Rewrite.
8389         (Parameters::set_target_once): New function.
8390         (Parameters::clear_target): Move here and rewrite.
8391         * parameters.h (class Parameters): Update declarations.  Add
8392         set_parameters_target_once_ field.
8393         (Parameters::Parameters): Move to parameters.cc.
8394         (Parameters::clear_target): Likewise.
8395         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8396         task.
8397         (Start_group::~Start_group): New function.
8398         (Start_group::is_runnable): New function.
8399         (Start_group::locks, Start_group::run): New functions.
8400         (Finish_group::run): Change saw_undefined to size_t.
8401         * readsyms.h (class Start_group): Define.
8402         (class Finish_group): Change saw_undefined_ field to size_t.
8403         (Finish_group::Finish_group): Remove saw_undefined and
8404         this_blocker parameters.  Change all callers.
8405         (Finish_group::set_saw_undefined): New function.
8406         (Finish_group::set_blocker): New function.
8407         * symtab.h (class Symbol_table): Change saw_undefined to return
8408         size_t.  Change saw_undefined_ field to size_t.
8409         * target-select.cc (Set_target_once::do_run_once): New function.
8410         (Target_selector::Target_selector): Initialize set_target_once_
8411         field.  Don't initialize lock_ and initialize_lock_ fields.
8412         (Target_selector::instantiate_target): Rewrite.
8413         (Target_selector::set_target): New function.
8414         * target-select.h (class Set_target_once): Define.
8415         (class Target_selector): Update declarations.  Make
8416         Set_target_once a friend.  Remove lock_ and initialize_lock_
8417         fields.  Add set_target_once_ field.
8418
8419 2010-02-10  Ian Lance Taylor  <iant@google.com>
8420
8421         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8422         queueing any tasks.
8423         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8424         (queue_middle_tasks): Add all blockers before queueing any tasks.
8425         (queue_final_tasks): Likewise.
8426         * token.h (Task_token::add_blockers): New function.
8427         * object.h (Input_objects::number_of_relobjs): New function.
8428
8429 2010-02-10  Ian Lance Taylor  <iant@google.com>
8430
8431         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8432         shared, not if not position independent.
8433         * x86_64.cc (Relocate::relocate_tls): Likewise.
8434         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8435         (tls_pie_pic_test): New target.
8436         * testsuite/Makefile.in: Rebuild.
8437
8438         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8439         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8440         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8441         * testsuite/Makefile.in: Rebuild.
8442
8443 2010-02-09  David S. Miller  <davem@davemloft.net>
8444
8445         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8446         R_SPARC_RELATIVE using ->add_local_relative().
8447         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8448
8449         * output.h (Output_data_dynamic::add_section_size): New method
8450         that takes two Output_data objects.
8451         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8452         entry param.  Handle it in initializers.
8453         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8454         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8455         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8456         arg.
8457         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8458         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8459         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8460         for dynrel_includes_plt.
8461         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8462         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8463         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8464         before .rela.plt
8465         (Target_sparc::do_finalize_sections): Update to pass true for
8466         dynrel_includes_plt.
8467         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8468         output before .rela.plt
8469         (Target_powerpc::do_finalize_sections): Update to pass true for
8470         dynrel_includes_plt when 32-bit.
8471
8472 2010-02-08  Doug Kwan  <dougkwan@google.com>
8473
8474         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8475         method.
8476         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8477         Arm_relobj::scan_section_for_cortex_a8_stubs,
8478         Arm_relobj::do_relocation_section): Instead of calling
8479         Output_section::output_address, use faster
8480         Arm_relobj::simple_input_section_output_address.
8481
8482 2010-02-08  David S. Miller  <davem@davemloft.net>
8483
8484         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8485         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8486         relocation helper function.
8487
8488         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8489         just like R_SPARC_GOT{10,13,22}.
8490         (Target_sparc::Scan::local): Likewise.
8491         (Target_sparc::Relocate:relocate): Likewise.
8492
8493 2010-02-06  Ian Lance Taylor  <iant@google.com>
8494
8495         * configure.ac: Rewrite targetobjs duplicate removal code to use
8496         only shell constructs.
8497         * configure: Rebuild.
8498
8499 2010-02-05  Doug Kwan  <dougkwan@google.com>
8500
8501         PR 11247
8502         * arm.cc (Arm_relobj::section_is_scannable): New method.
8503         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8504         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8505
8506 2010-02-04  Doug Kwan  <dougkwan@google.com>
8507
8508         PR 11247
8509         * arm-reloc-property.cc (cstdio): Include.
8510         * configure.ac (targetobjs): Remove duplicates.
8511         * configure: Regenerate.
8512         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8513         big and little endian version for a given address size.
8514
8515 2010-02-03  Doug Kwan  <dougkwan@google.com>
8516
8517         * arm-reloc-property.cc
8518         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8519         definition.
8520         * arm-reloc-property.h
8521         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8522         New method definition.
8523         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8524         declaration.
8525         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8526         overflow to N.
8527         (GOT_PREL): Change implemented to Y.
8528         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8529         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8530         (Arm_relocate_functions::movw_abs_nc): Remove method.
8531         (Arm_relocate_functions::movt_abs): Ditto.
8532         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8533         (Arm_relocate_functions::thm_movt_abs): Ditto.
8534         (Arm_relocate_functions::movw_rel_nc): Ditto.
8535         (Arm_relocate_functions::movw_rel): Ditto.
8536         (Arm_relocate_functions::movt_rel): Ditto.
8537         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8538         (Arm_relocate_functions:thm_movw_rel): Ditto.
8539         (Arm_relocate_functions:thm_movt_rel): Ditto.
8540         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8541         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8542         New method definitions.
8543         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8544         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8545         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8546         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8547         (Target_arm::Relocate::relocate): Check for non-static or
8548         unimplemented relocation code and exit early.  Change calls to
8549         Target_arm::reloc_uses_thumb_bit and
8550         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8551         instead.  Refactor code to handle similar relocations to increase
8552         code sharing.  Remove check for unsupported relocation code in switch
8553         statement.
8554         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8555         relocation property table to find out size.  Change error message to
8556         print out the name of a relocation code instead of the numeric value.
8557         (Target_arm::scan_reloc_for_stub): Use relocation property table
8558         instead of calling Target_arm::reloc_uses_thumb_bit().
8559
8560 2010-02-02  Doug Kwan  <dougkwan@google.com>
8561
8562         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8563         types of relaxed input section.
8564
8565 2010-02-02  Doug Kwan  <dougkwan@google.com>
8566
8567         * Makefile.am (HFILES): Add arm-reloc-property.h.
8568         (DEFFILES): New.
8569         (TARGETSOURCES): Add arm-reloc-property.cc
8570         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8571         (libgold_a_SOURCES): $(DEFFILES)
8572         * Makefile.in: Regenerate.
8573         * arm-reloc-property.cc: New file.
8574         * arm-reloc-property.h: New file.
8575         * arm-reloc.def: New file.
8576         * arm.cc: Update comments.
8577         (arm-reloc-property.h): New included header.
8578         (arm_reloc_property_table): New global variable.
8579         (Target_arm::do_select_as_default_target): New method definition.
8580         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8581         arm-reloc-property to targ_extra_obj.
8582         * parameters.cc (set_parameters_target): Call
8583         Target::select_as_default_target().
8584         * target.h (Target::select_as_default_target): New method definition.
8585         (Target::do_select_as_default_target): Same.
8586
8587 2010-02-01  Doug Kwan  <dougkwan@google.com>
8588
8589         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8590         first_output_text_section_.
8591         (Arm_exidx_fixup::first_output_text_section): New method definition.
8592         (Arm_exidx_fixup::first_output_text_section_): New data member.
8593         (Arm_exidx_fixup::process_exidx_section): Record the first text
8594         output section seen.
8595         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8596         and entsize in output section header.
8597
8598 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8599
8600         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8601         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8602         (Arm_relocate_functions::thm_alu11): New Method.
8603         (Arm_relocate_functions::thm_pc8): New Method.
8604         (Arm_relocate_functions::thm_pc12): New Method.
8605         (Target_arm::Scan::local): Handle the relocations.
8606         (Target_arm::Scan::global): Likewise.
8607         (Target_arm::Relocate::relocate): Likewise.
8608         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8609
8610 2010-01-29  Doug Kwan  <dougkwan@google.com>
8611
8612         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8613         of relocation types as ld.
8614
8615 2010-01-29  Doug Kwan  <dougkwan@google.com>
8616
8617         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8618         to public.
8619         (Arm_relocate_functions::thumb_branch_common): Ditto.
8620         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8621         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8622         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8623         Arm_relocate_functions::jump24): Remove.
8624         (Target_arm::Relocate::relocate): Adjust code to call
8625         Arm_relocation_functions::arm_branch_common and
8626         Arm_relocation_functions::thumb_branch_common instead of their removed
8627         wrappers.  Merge switch-cases together to reduce source code size.
8628
8629 2010-01-29  Doug Kwan  <dougkwan@google.com>
8630
8631         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8632         output_local_symbol_count_needs_update_.
8633         (Arm_relobj::output_local_symbol_count_needs_update,
8634          Arm_relobj::set_output_local_symbol_count_needs_update,
8635          Arm_relobj::update_output_local_symbol_count): New methods.
8636         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8637         member.
8638         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8639         of pointed function as in a R_ARM_PREL31 relocation.
8640         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8641         for output local symbol count updating.
8642         (Target_arm::do_relax): Update output local symbol counts in objects
8643         if necessary.
8644         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8645
8646 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8647
8648         * arm.cc: Added support for the ARM relocations:
8649         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8650         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8651         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8652         movw_prel_nc).
8653         (Arm_relocate_functions::movw_rel): New method.
8654         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8655         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8656         thm_movw_prel_nc).
8657         (Arm_relocate_functions::thm_movw_rel): New method.
8658         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8659         thm_movt_prel).
8660         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8661         relocations.
8662         (Target_arm::Scan::global): Likewise.
8663         (Target_arm::Relocate::relocate): Likewise.
8664         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8665         Likewise.
8666
8667 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8668
8669         * arm.cc: Added support for ARM group relocations.
8670         (Target_arm::reloc_needs_sym_origin): New method.
8671         (Arm_relocate_functions::calc_grp_kn): New method.
8672         (Arm_relocate_functions::calc_grp_residual): New method.
8673         (Arm_relocate_functions::calc_grp_gn): New method.
8674         (Arm_relocate_functions::arm_grp_alu): New Method.
8675         (Arm_relocate_functions::arm_grp_ldr): New Method.
8676         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8677         (Arm_relocate_functions::arm_grp_ldc): New Method.
8678         (Target_arm::Scan::local): Handle the ARM group relocations.
8679         (Target_arm::Scan::global): Likewise.
8680         (Target_arm::Relocate::relocate): Likewise.
8681         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8682         Likewise.
8683
8684 2010-01-26  Doug Kwan  <dougkwan@google.com>
8685
8686         * arm.cc (set): Include.
8687         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8688         pointer type.
8689         (Arm_output_section::Text_section_list): New type.
8690         (Arm_output_section::append_text_sections_to_list): New method.
8691         (Arm_output_section::fix_exidx_coverage): Ditto.
8692         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8693         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8694         Relobj::set_section_offset() instead of
8695         Sized_relobj::invalidate_section_offset().
8696         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8697         parameter for section headers. Ignore relocation sections for
8698         unallocated sections and EXIDX sections.
8699         (Target_arm::fix_exidx_coverage): New method.
8700         (Target_arm::output_section_address_less_than): New type.
8701         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8702         linked text section instead of the EXIDX section.
8703         (Arm_output_section::create_stub_group): Add an assertion to check
8704         that this is not an EXIDX output section.
8705         (Arm_output_section::append_text_sections_to_list): New method.
8706         (Arm_output_section::fix_exidx_coverage): Ditto.
8707         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8708         Arm_relobj::section_needs_reloc_stub_scanning.
8709         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8710         first pass.
8711         (Target_arm::fix_exidx_coverage): New method.
8712         * object.h (Relobj::set_output_section): New method.
8713         (Sized_relobj::invalidate_section_offset): Remove method.
8714         (Sized_relobj::do_invalidate_section_offset): Remove method.
8715         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8716
8717 2010-01-25  Doug Kwan  <dougkwan@google.com>
8718
8719         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8720         Fix warning due to signed and unsigned comparison on a 32-bit host.
8721
8722 2010-01-22  Doug Kwan  <dougkwan@google.com>
8723
8724         * arm.cc (Target_arm::do_relax): Record an output section for section
8725         offset adjustment it contains any stub table that has changed.
8726         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8727         offsets in an output section if necessary.
8728         * output.cc (Output_section::Output_section): Initialize
8729         section_offsets_need_adjustments_.
8730         (Output_section::add_input_section_for_script): Renamed to
8731         Output_section::add_simple_input_section.
8732         (Output_section::save_states): Add a comment.
8733         (Output_section::discard_states): New method defintion.
8734         (Output_section::adjust_section_offsets): Same.
8735         * output.h (Output_section::add_input_section_for_script): Renamed to
8736         Output_section::add_simple_input_section.
8737         (Output_section::discard_states): New method declaration.
8738         (Output_section::adjust_section_offsets): Same.
8739         (Output_section::section_offsets_need_adjustment,
8740         Output_section::set_section_offsets_need_adjustment): New method
8741         definitions.
8742         (Output_section::section_offsets_need_adjustment_): New data member.
8743         * script-sections.cc
8744         (Output_section_element_input::set_section_address): Adjust code for
8745         renaming of Output_section::add_input_section_for_script.
8746         (Orphan_output_section::set_section_address): Same.
8747
8748 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8749
8750         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8751         Fix_v4bx enum values .
8752         * gold/options.h (General_options): New option definitions.
8753         (General_options::fix_v4bx): New method.
8754         (General_options::Fix_v4bx): New enum.
8755         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8756         (General_options::parse_fix_v4bx_interworking): New method.
8757
8758 2010-01-22  Doug Kwan  <dougkwan@google.com>
8759
8760         * arm.cc (Arm_exidx_fixup): New class.
8761
8762 2010-01-21  Doug Kwan  <dougkwan@google.com>
8763
8764         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8765         classes.
8766         (Arm_exidx_section_offset_map): New type.
8767
8768 2010-01-21  Doug Kwan  <dougkwan@google.com>
8769
8770         * arm.cc (Arm_exidx_input_section): New class.
8771         (Arm_relobj::exidx_input_section_by_link,
8772         Arm_relobj::exidx_input_section_by_shndx,
8773         Arm_relobj::make_exidx_input_section): New methods.
8774         (read_arm_attributes_section): Remove.
8775         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8776         information about them.
8777         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8778         to here.
8779
8780 2010-01-20  Doug Kwan  <dougkwan@google.com>
8781
8782         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8783         Input_section_specifier to Section_id.
8784         (Target_arm::new_arm_input_section: Adjust code for change of key
8785         type.
8786         (Target_arm::find_arm_input_section): Ditto.
8787         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8788         (Section_id): Remove.
8789         (Garbage_collection::Section_id_hash): Remove.
8790         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8791         (Section_id): Remove.
8792         (Icf::Section_id_hash): Remove.
8793         * object.h (Section_id, Const_section_id, Section_id_hash,
8794         Const_section_id_hash): New type definitions.
8795         * output.cc (Output_section::add_relaxed_input_section): Change to
8796         use Const_section_id instead of Input_section_specifier as key type.
8797         (Output_section::add_merge_input_section): Ditto.
8798         (Output_section::build_relaxation_map): Change to use Section_id
8799         instead of Input_section_specifier as key type.
8800         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8801         Ditto.
8802         (Output_section::convert_input_sections_to_relaxed_sections): Change
8803         to use Const_section_id instead of Input_section_specifier as key type.
8804         (Output_section::find_merge_section): Ditto.
8805         (Output_section::find_relaxed_input_section): Ditto.
8806         * output.h (Input_section_specifier): Remove class.
8807         (Output_section::Output_section_data_by_input_section_map): Change
8808         key type to Const_section_id.
8809         (Output_section::Output_relaxed_input_section_by_input_section_map):
8810         Ditto.
8811         (Output_section::Relaxation_map): Change key type to Section_id.
8812
8813 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8814
8815         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8816         (class Arm_v4bx_stub): New class.
8817         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8818         (Stub_factory::make_arm_v4bx_stub): New method.
8819         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8820         (Stub_table::empty): Handle v4bx stubs.
8821         (Stub_table::add_arm_v4bx_stub): New method.
8822         (Stub_table::find_arm_v4bx_stub): New method.
8823         (Arm_relocate_functions::v4bx): New method.
8824         (Target_arm::fix_v4bx): New method.
8825         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8826         (Stub_table::relocate_stubs): Likewise.
8827         (Stub_table::do_write): Likewise.
8828         (Stub_table::update_data_size_and_addralign): Likewise.
8829         (Stub_table::finalize_stubs):  Likewise.
8830         (Target_arm::Scan::local): Likewise.
8831         (Target_arm::Scan::global): Likewise.
8832         (Target_arm::do_finalize_sections): Likewise.
8833         (Target_arm::Relocate::relocate): Likewise.
8834         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8835         Likewise.
8836         (Target_arm::scan_reloc_for_stub): Likewise.
8837         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8838
8839 2010-01-19  Ian Lance Taylor  <iant@google.com>
8840
8841         * output.cc (Output_section_headers::do_sized_write): Write large
8842         segment count to sh_info field.
8843         (Output_file_header::do_sized_write): For large segment count,
8844         write PN_XNUM to e_phnum field.
8845
8846 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8847
8848         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8849         (Arm_relocate_functions::thm_jump8): New function.
8850         (Arm_relocate_functions::thm_jump11): New function.
8851         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8852         R_ARM_THM_JUMP11.
8853         (Target_arm::Scan::global): Likewise.
8854         (Target_arm::Relocate::relocate): Likewise.
8855         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8856         Likewise.
8857
8858 2010-01-14  Doug Kwan  <dougkwan@google.com>
8859
8860         * arm.cc (map, utility): Include headers.
8861         (Target_arm::apply_cortex_a8_workaround): New method.
8862         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8863         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8864         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8865         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8866         the --[no-]fix-cortex-a8 command line options.
8867         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8868         (Target_arm::relocate_stub): Use addend in instruction template.
8869         * options.h (DEFINE_bool): Set the user-set flag.
8870         (General_options): Add --[no-]-fix-cortex options.
8871         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8872         : Update fast look-up map after conversion.
8873
8874 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8875
8876         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8877         in the first pass of do_layout.
8878
8879 2010-01-13  Doug Kwan  <dougkwan@google.com>
8880
8881         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8882         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8883         apparent compiler problem of not folding static constant integral
8884         data members of elfcpp::Elf_sizes<32>.
8885
8886 2010-01-13  Doug Kwan  <dougkwan@google.com>
8887
8888         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8889         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8890         Arm_relobj::scan_section_for_cortex_a8_erratum,
8891         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8892         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8893         sections to scan for relocation stubs into a new method
8894         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8895         relocation and Cortex-A8 stub scanning.
8896         (Target_arm::do_relax): Force stubs to be after stubbed sections
8897         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8898         the beginning of a new relaxation pass.  Update a comment.
8899         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8900
8901 2010-01-12  Ian Lance Taylor  <iant@google.com>
8902
8903         * target-reloc.h (visibility_error): New inline function.
8904         (relocate_section): Call visibility_error.
8905         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8906         (MOSTLYCLEANFILES): Likewise.
8907         (protected_4_pic.o, protected_3.err): New targets.
8908         * testsuite/protected_4.cc: New file.
8909
8910 2010-01-12  Doug Kwan  <dougkwan@google.com>
8911
8912         * arm.cc (Cortex_a8_reloc): New class.
8913         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8914         and cortex_a8_relocs_info_.
8915         (Target_arm::fix_cortex_a8): New method definition.
8916         (Target_arm::Cortex_a8_relocs_info): New type.
8917         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8918         New data member declarations.
8919         (Target_arm::scan_reloc_for_stub): Record information about
8920         relocations for THUMB branches that might be exempted from the
8921         Cortex-A8 workaround.
8922         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8923         at the beginning of a relaxation pass.
8924
8925 2010-01-12  Doug Kwan  <dougkwan@google.com>
8926
8927         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8928         (Arm_relobj::Mapping_symbol_position,
8929          Arm_reloj::Mapping_symbol_position_less,
8930          Arm_relobj::Mapping_symbols_info): New types.
8931         (Target_arm::is_mapping_symbol_name): New method definition.
8932         (Arm_relobj::do_count_local_symbols): Save information about mapping
8933         symbols.
8934
8935 2010-01-11  Doug Kwan  <dougkwan@google.com>
8936
8937         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8938         Arm_relocate_functions::thumb32_branch_upper,
8939         Arm_relocate_functions::thumb32_branch_lower,
8940         Arm_relocate_functions::thumb32_cond_branch_offset,
8941         Arm_relocate_functions::thumb32_cond_branch_upper,
8942         Arm_relocate_functions::thumb32_cond_branch_lower,
8943         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8944         branch offset encoding.
8945         (Arm_relocate_functions::thumb_branch_common): Use new branch
8946         offset encoding methods to avoid code duplication.
8947         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8948         (Stub_addend_reader::operator()): Use new branch encoding method
8949         to avoid code duplication.
8950
8951 2010-01-11  Doug Kwan  <dougkwan@google.com>
8952
8953         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8954         (Target_arm::do_finalize_sections): Define special EXIDX section
8955         symbols only if referenced.
8956         * gc.h (Garbage_collection::add_reference): New method.
8957         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8958         code duplication.
8959
8960 2010-01-11  Ian Lance Taylor  <iant@google.com>
8961
8962         * script.cc (Version_script_info::build_expression_list_lookup):
8963         Change complaing about duplicate wildcard match from error to
8964         warning.
8965
8966         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8967         of 2009-12-30.
8968         (Version_script_info::Version_script_info): Initialize globs_,
8969         default_version_, default_is_global_, and exact_.  Don't
8970         initialize globals_ or locals_.
8971         (Version_script_info::build_lookup_tables): Build local symbols
8972         first.
8973         (Version_script_info::unquote): New function.
8974         (Version_script_info::add_exact_match): New function.
8975         (Version_script_info::build_expression_list_lookup): Remove lookup
8976         parameter.  Add is_global parameter.  Change all callers.  Handle
8977         wildcard pattern specially.  Unquote pattern.  Call
8978         add_exact_match.
8979         (Version_script_info::get_name_to_match): New function.
8980         (Version_script_info::get_symbol_version): New function.
8981         (Version_script_info::get_symbol_version_helper): Remove.
8982         (Version_script_info::check_unmatched_names): Call unquote.
8983         * script.h (class Version_script_info): Change get_symbol_version
8984         to be non-inline and add is_global parameter; change all callers.
8985         Rewrite symbol_is_local.  Update declarations.  Define struct
8986         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8987         Remove globals_ and locals_ members.  Add exact_, globs_,
8988         default_version_, is_global_.
8989         (Version_script_info::Glob): Remove pattern, add expression and
8990         is_global.  Update constructor.  Change all callers.
8991         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8992         default version.
8993         (Versions::symbol_section_contents): If a symbol is undefined, or
8994         defined in a dynamic object, set the version index to
8995         VER_NDX_LOCAL.
8996         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8997         symbol_is_local.
8998         (Symbol_table::add_from_pluginobj): Likewise.
8999         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9000
9001 2010-01-11  Doug Kwan  <dougkwan@google.com>
9002
9003         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9004         (incremental_dump_LDADD): Add linking option for libintl.
9005         * Makefile.in: Regenerate.
9006
9007 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9008
9009         PR gold/11144
9010         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9011         instead of -Ds.
9012         * testsuite/Makefile.in: Regenerated.
9013
9014 2010-01-10  Doug Kwan  <dougkwan@google.com>
9015
9016         * options.h (DEFINE_var): Use parentheses around argument varname__
9017         in macro body to avoid any unintended subsequent substitutions.
9018
9019 2010-01-10  Ian Lance Taylor  <iant@google.com>
9020
9021         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9022         candidates before doing symbol resolution.
9023
9024         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9025         ODR candidates if only one is weak.
9026
9027 2010-01-08  Ian Lance Taylor  <iant@google.com>
9028
9029         * script.cc (Version_script_info::build_expression_list_lookup):
9030         Don't warn about ambiguous version, just record the ambiguity.
9031         (Version_script_info::get_symbol_version_helper): Give error if
9032         version is ambiguous.
9033
9034 2010-01-08  Doug Kwan  <dougkwan@google.com>
9035
9036         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9037         prev_data_size_ and prev_addralign_.  Remove initializer for
9038         deleted data member has_been_changed_.
9039         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9040         to determine if the table is empty.
9041         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9042         Remove.
9043         (Stub_table::add_reloc_stub): Define method in class definition
9044         instead of just declaring it there.
9045         (Stub_table::add_cortex_a8_stub): New method definition.
9046         (Stub_table::update_data_size_and_addralign): Ditto.
9047         (Stub_table::finalize_stubs): Ditto.
9048         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9049         (Stub_table::do_addralign_): Return address alignment in the
9050         (Stub_table::do_reset_address_and_file_offset): Define method in
9051         class definition instead of declaring it there.  Set current data
9052         size to be the data size of the previous pass.
9053         (Stub_table::set_final_data_size): Use current data size as the
9054         final data size.
9055         (Stub_table::relocate_stub): Change parameter type of stub from
9056         Reloc_stub pointer to Stub pointer.
9057         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9058         (Stub_table::Cortex_a8_stub_list): New typedef.
9059         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9060          Stub_table::prev_addralign_): New data member.
9061         (Arm_relobj::Arm_relobj): Initialize data member
9062         section_has_cortex_a8_workaround_.
9063         (Arm_relobj::section_has_cortex_a8_workaround,
9064          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9065          definitions.
9066         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9067         declarations.
9068         (Target_arm::relocate_stub): Change parameter type of stub from
9069         Reloc_stub pointer to Stub pointer.
9070         (Insn_template::size, Insn_template::alignment): Handle
9071         THUMB16_SPECIAL_TYPE.
9072         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9073          Stub_table::update_data_size_and_addralign,
9074          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9075         definitions.
9076         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9077         (Stub_table::do_write): Ditto.
9078         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9079
9080 2010-01-08  Ian Lance Taylor  <iant@google.com>
9081
9082         PR 11108
9083         * symtab.h (class Symbol): Remove fields is_target_special_ and
9084         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9085         (Symbol::is_defined_in_discarded_section): New function.
9086         (Symbol::set_is_defined_in_discarded_section): New function.
9087         (Symbol::has_plt_offset): Rewrite.
9088         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9089         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9090         Don't initialize is_target_special_ or has_plt_offset_.
9091         Initialize is_defined_in_discarded_section_.
9092         (Symbol_table::add_from_relobj): If appropriate, set
9093         is_defined_in_discarded_section.
9094         * resolve.cc (Symbol::override_base_with_special): Don't test
9095         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9096         * target-reloc.h (relocate_section): Do special handling for
9097         symbols defined in discarded sections for global symbols as well
9098         as local symbols.
9099
9100 2010-01-08  Ian Lance Taylor  <iant@google.com>
9101
9102         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9103         the SHT_SYMTAB case.
9104
9105 2010-01-08  Ian Lance Taylor  <iant@google.com>
9106
9107         * object.cc (Sized_relobj::do_layout): Don't get confused if
9108         layout_eh_frame returns NULL.
9109
9110 2010-01-08  Ian Lance Taylor  <iant@google.com>
9111
9112         PR 11084
9113         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9114         dynamic symbol table, use the normal symbol table.
9115         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9116         symbol table.
9117
9118 2010-01-08  Ian Lance Taylor  <iant@google.com>
9119
9120         PR 11072
9121         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9122         sections.
9123
9124 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9125
9126         * version.cc (print_version): Change to "Copyright 2010".
9127
9128 2010-01-08  Ian Lance Taylor  <iant@google.com>
9129
9130         PR 10287
9131         PR 11063
9132         * i386.cc (class Target_i386): Change return type of plt_section
9133         to be non-const.
9134         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9135         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9136         tls_desc_rel_ field.
9137         (Output_data_plt_i386::rel_tls_desc): New function.
9138         (Target_i386::rel_tls_desc_section): New function.
9139         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9140         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9141         R_386_TLS_DESC reloc in rel_tls_desc_section.
9142         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9143         Define struct Tlsdesc_info.
9144         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9145         (Target_x86_64::do_reloc_symbol_index): New function.
9146         (Target_x86_64::add_tlsdesc_info): New function.
9147         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9148         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9149         tlsdesc_rel_ field.
9150         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9151         all callers.
9152         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9153         (Target_x86_64::rela_tlsdesc_section): New function.
9154         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9155         handling.
9156         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9157         (Target_x86_64::do_reloc_addend): New function.
9158         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9159         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9160         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9161         (Output_reloc::type): New function.
9162         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9163         (Output_reloc::is_target_specific): New function.
9164         (Output_reloc::target_arg): New function.
9165         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9166         absolute relocs and target specific relocs.
9167         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9168         add_target_specific.
9169         (class Output_data_reloc) [SHT_RELA]: Likewise.
9170         * output.cc (Output_reloc::Output_reloc): Add four new versions
9171         for absolute relocs and target specific relocs.
9172         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9173         (Output_reloc::get_symbol_index): Likewise.
9174         (Output_reloc::local_section_offset): Check that local_sym_index_
9175         is not TARGET_CODE or 0.
9176         (Output_reloc::symbol_value): Likewise.
9177         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9178         reloc.
9179         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9180         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9181         functions.
9182         * layout.cc (add_target_dynamic_tags): Use output section for
9183         DT_PLTRELSZ and DT_JMPREL.
9184
9185 2010-01-07  Ian Lance Taylor  <iant@google.com>
9186
9187         PR 11061
9188         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9189         function.
9190         (class Output_data_reloc_generic): Define.
9191         (class Output_data_reloc_base): Change base class to
9192         Output_data_reloc_generic.  Change add() method to call
9193         bump_relative_reloc_count for a relative reloc.  Remove
9194         sort_relocs_ field.
9195         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9196         to sort_relocs().
9197         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9198         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9199         appropriate.
9200         * layout.h (class Layout): Update declaration.
9201
9202 2010-01-07  Ian Lance Taylor  <iant@google.com>
9203
9204         * output.h (class Output_data): Add const version of
9205         output_section and do_output_section.
9206         (class Output_section_data): Add const version of
9207         do_output_section.
9208         (class Output_section): Likewise.
9209         * layout.cc (Layout::add_target_dynamic_tags): New function.
9210         * layout.h (class Layout): Update declarations.
9211         * arm.cc (Target_arm::do_finalize_sections): Use
9212         add_target_dynamic_tags.
9213         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9214         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9215         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9216         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9217
9218 2010-01-07  Ian Lance Taylor  <iant@google.com>
9219
9220         PR 11042
9221         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9222         object as needed.
9223
9224 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9225             Ian Lance Taylor  <iant@google.com>
9226
9227         PR 11019
9228         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9229         Xindex::read_symtab_xindex.
9230
9231 2010-01-07  Doug Kwan  <dougkwan@google.com>
9232
9233         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9234         (Insn_template::thumb16_bcond_insn): New method declaration.
9235         (Insn_template): Fix spelling.
9236         (Stub::thumb16_special): New method declaration.
9237         (Stub::do_write): Define virtual method which was previously pure
9238         virtual.
9239         (Stub::do_thumb16_special): New method declaration.
9240         (Stub::do_fixed_endian_write): New template member.
9241         (Reloc_stub::do_write): Remove.
9242         (Reloc_stub::do_fixed_endian_write): Remove.
9243         (Cortex_a8_stub): New class definition.
9244         (Stub_factory::make_cortex_a8_stub): New method definition.
9245         (Stub_factory::Stub_factory): Add missing static storage class
9246         qualifier for elf32_arm_stub_a8_veneer_blx.
9247
9248 2010-01-07  Ian Lance Taylor  <iant@google.com>
9249
9250         PR 10980
9251         * options.h (class General_options): Add --warn-unresolved-symbols
9252         and --error-unresolved-symbols.
9253         * errors.cc (Errors::undefined_symbol): Implement
9254         --warn-unresolved-symbols.
9255
9256         * options.h (class General_options): Add -z text and -z textoff.
9257         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9258
9259 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9260
9261         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9262         (Garbage_collection::cident_sections): New function.
9263         (Garbage_collection::add_cident_section): New function.
9264         (Garbage_collection::cident_sections_): New member.
9265         (gc_process_relocs): Add references to sections whose names are C
9266         identifiers.
9267         * gold.h (cident_section_start_prefix): New constant.
9268         (cident_section_stop_prefix): New constant.
9269         (is_cident): New function.
9270         * layout.cc (Layout::define_section_symbols): Replace string constants
9271         with the newly defined constants.
9272         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9273         C identifiers.
9274         * testsuite/Makefile.am: Add gc_orphan_section_test.
9275         * testsuite/Makefile.in: Regenerate.
9276         * testsuite/gc_orphan_section_test.cc: New file.
9277         * testsuite/gc_orphan_section_test.sh: New file.
9278
9279 2010-01-06  Ian Lance Taylor  <iant@google.com>
9280
9281         PR 10980
9282         * options.h (class General_options): Add --warn-shared-textrel.
9283         * layout.cc (Layout::finish_dynamic_section): Implement
9284         --warn-shared-textrel.
9285
9286         PR 10980
9287         * options.h (class General_options): Add --warn-multiple-gp.
9288
9289 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9290
9291         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9292         $(THREADSLIB) and $(LIBDL).
9293         * Makefile.in: Rebuild.
9294
9295 2010-01-06  Ian Lance Taylor  <iant@google.com>
9296
9297         PR 10980
9298         * options.cc (General_options::parse_section_start): New function.
9299         (General_options::section_start): New function.
9300         (General_options::General_options): Initialize all members.
9301         * options.h: Include <map>
9302         (class General_options): Add --section-start.  Add section_starts_
9303         member.
9304         * layout.cc (Layout::attach_allocated_section_to_segment): If
9305         --section-start was used, set the address of the segment.  Remove
9306         local sort_sections.
9307         (Layout::relaxation_loop_body): If the address of the load segment
9308         has been set by --section-start, don't use it.
9309         * output.h (Output_segment::update_flags_for_output_section): New
9310         function.
9311         * output.cc (Output_segment::add_output_section): Call
9312         update_flags_for_output_section.
9313
9314 2010-01-05  Ian Lance Taylor  <iant@google.com>
9315
9316         PR 10980
9317         * options.h (class General_options): Add --undefined-version.
9318         * script.cc (struct Version_expression): Add was_matched_by_symbol
9319         field.
9320         (Version_script_info::matched_symbol): New function.
9321         (Version_script_info::get_symbol_version_helper): Call
9322         matched_symbol.
9323         (Version_script_info::check_unmatched_names): New function.
9324         * script.h (class Version_script_info): Update declarations.
9325         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9326
9327         * options.h (class General_options): Use DEFINE_bool_alias for
9328         allow_multiple_definition.
9329         * resolve.cc (Symbol_table::should_override): Don't test
9330         allow_multiple_definition.
9331
9332         PR 10980
9333         * options.h (class General_options): Add --cref.
9334         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9335         until after printing cref table.
9336         * cref.cc: Include "symtab.h".
9337         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9338         (Cref_table_compare::operator()): New function.
9339         (Cref_inputs::gather_cref): New function.
9340         (filecol): New static const.
9341         (Cref_inputs::print_cref): New function.
9342         (Cref::print_cref): New function.
9343         * cref.h: Include <cstdio>.
9344         (class Cref): Update declarations.
9345         * mapfile.h (Mapfile::file): New function.
9346         * object.h (class Object): Define Symbols.  Declare virtual
9347         do_get_global_symbols.
9348         (Object::get_global_symbols): New function.
9349         * object.cc (Input_objects::add_object): Pass object to cref_ if
9350         --cref.
9351         (Input_objects::archive_start): Likewise.
9352         (Input_objects::archive_stop): Likewise.
9353         (Input_objects::print_cref): New function.
9354         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9355         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9356         --cref.
9357         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9358         function.
9359         * plugin.h (class Sized_pluginobj): Update declarations.
9360
9361 2010-01-05  Ian Lance Taylor  <iant@google.com>
9362
9363         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9364         to is_default_version.  Rename insdef to insdefault.
9365         (Symbol_table::add_from_relobj): Rename def to is_default_version
9366         and local to is_forced_local.
9367         (Symbol_table::add_from_pluginobj): Likewise.
9368         (Symbol_table::add_from_dynobj): Likewise.
9369         (Symbol_table::define_special_symbol): Rename insdef to
9370         insdefault.
9371
9372 2010-01-04  Ian Lance Taylor  <iant@google.com>
9373
9374         PR 10980
9375         * options.h (class General_options): Add
9376         --allow-multiple-definition and -z muldefs.
9377         * resolve.cc (Symbol_table::should_override): Don't warn about a
9378         multiple symbol definition if --allow-multiple-definition or -z
9379         muldefs.
9380
9381         PR 10980
9382         * options.h (class General_options): Add --add-needed and
9383         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9384         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9385         error if --copy-dt-needed-entries aka --add-needed is used and
9386         would cause a change in behaviour.
9387
9388         PR 10980
9389         * options.h (class General_options): Add -G as a short version of
9390         --shared.  Add no-op options -assert, -g, and -i.
9391
9392 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9393
9394         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9395         check for .text or .gnu.linkonce.t sections.
9396         * icf.cc (Icf::find_identical_sections): Ditto.
9397         Change the detection for mangled function name within the section
9398         name.
9399         * icf.h (is_section_foldable_candidate): New function.
9400
9401 2009-12-30  Ian Lance Taylor  <iant@google.com>
9402
9403         PR 10980
9404         * options.h (class General_options): Permit two dashes with
9405         --retain-symbols-file.
9406
9407 2009-12-30  Ian Lance Taylor  <iant@google.com>
9408
9409         PR 10979
9410         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9411         don't put the file header and segment headers in the text
9412         segment.
9413
9414         PR 10979
9415         * common.cc (Sort_commons::operator()): Stabilize sort when both
9416         entries are NULL.
9417         (Symbol_table::do_allocate_commons_list): When allocating common
9418         symbols, skip a symbol which is no longer common.
9419         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9420         an object before checking its type.
9421         * testsuite/common_test_2.c: New file.
9422         * testsuite/common_test_3.c: New file.
9423         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9424         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9425         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9426         (common_test_2_pic.o, common_test_2.so): New targets.
9427         (common_test_3_pic.o, common_test_3.so): New targets.
9428         * testsuite/Makefile.in: Rebuild.
9429
9430         PR 10979
9431         * script.cc (read_input_script): If we see a new SECTIONS clause,
9432         and we have added an input section, give an error.
9433         * layout.h (class Layout): Add have_added_input_section function.
9434         Add have_added_input_section_ field.
9435         * layout.cc (Layout::Layout): Initialize
9436         have_added_input_section_.
9437         (Layout::layout): Set have_added_input_section_.
9438         (Layout::layout_eh_frame): Likewise.
9439
9440 2009-12-30  Ian Lance Taylor  <iant@google.com>
9441
9442         PR 10931
9443         * options.h (class General_options): Add --sort-common option.
9444         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9445         * common.cc (Sort_common): Add sort_order parameter to
9446         constructor.  Add sort_order_ field.
9447         (Sort_commons::operator): Check sort_order_.
9448         (Symbol_table::allocate_commons): Determine the sort order.
9449         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9450         Change all callers.
9451         (Symbol_table::do_allocate_commons_list): Likewise.
9452
9453 2009-12-30  Ian Lance Taylor  <iant@google.com>
9454
9455         PR 10916
9456         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9457         symbols from this object, don't change the visibility of an
9458         undefined symbol.
9459         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9460
9461 2009-12-30  Ian Lance Taylor  <iant@google.com>
9462
9463         PR 10861
9464         * script.h (class Version_script_info): Define Language enum.
9465         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9466         new fields globals_, locals_, and is_finalized_.
9467         * script.cc: Various formatting fixes.
9468         (class Parser_closure): Change language_stack_ from a vector of
9469         std::string to one of Version_script_info::Language.  Adjust all
9470         uses accordingly.
9471         (class Lazy_demangler): Remove.
9472         (struct Version_expression): Change language from std::string to
9473         Version_script_info::Language.
9474         (Version_script_info::Version_script_info): New function.
9475         (Version_script_info::~Version_script_info): Don't call clear.
9476         (Version_script_info::finalize): New function.
9477         (Version_script_info::build_lookup_tables): New function.
9478         (Version_script_info::build_expression_list_lookup): New
9479         function.
9480         (Version_script_info::get_symbol_version_helper): Rewrite to use
9481         lookup tables.
9482         (Version_script_info::print_expression_list): Adjust to use
9483         Version_script_info::Language.
9484         (script_push_lex_into_version_mode): Check that the version script
9485         has not been finalized.
9486         (version_script_push_lang): Change language string to
9487         Version_script_info::Language.
9488         * options.cc (Command_line::version_script): New function.
9489         * options.h (class General_options): Add finalize_dynamic_list
9490         function.  Change version_script from declaration to definition.
9491         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9492         * testsuite/version_script.map: Remove duplicate def of foo.
9493         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9494         version_script.map.
9495         * testsuite/Makefile.in: Rebuild.
9496
9497 2009-12-30  Ian Lance Taylor  <iant@google.com>
9498
9499         PR 10843
9500         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9501         if the input symbol index is 0, make the output symbol index 0.
9502
9503 2009-12-30  Ian Lance Taylor  <iant@google.com>
9504
9505         PR 10670
9506         * options.h (class General_options): Add -x/--discard-all.
9507         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9508         --discard-all.  If the local symbol needs a dynamic entry, check
9509         that before handling --discard-locals.
9510
9511 2009-12-30  Ian Lance Taylor  <iant@google.com>
9512
9513         PR 10450
9514         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9515         flags to PF_R.
9516         (Output_segment::add_output_section): Don't change the flags if
9517         the type is PT_TLS.
9518
9519         PR 10450
9520         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9521         GNU hash table if they need a dynamic value.  Otherwise, don't add
9522         them if they are defined in a dynamic object or are forced local.
9523
9524 2009-12-29  Ian Lance Taylor  <iant@google.com>
9525
9526         PR 10450
9527         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9528         .gnu.hash table for a 32-bit target.
9529
9530         PR 10450
9531         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9532         regular and a dynamic object only needs a dynamic symbol table
9533         entry if it is externally visible.
9534
9535         PR 10450
9536         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9537         constructor.  Add global_offset_table_ field.
9538         (Target_i386::got_section): Set global_offset_table_.
9539         (Target_i386::do_finalize_sections): Set global_offset_table_
9540         size.
9541         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9542         in constructor.  Add global_offset_table_ field.
9543         (Target_x86_64::got_section): Set global_offset_table_.
9544         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9545         size.
9546
9547         * layout.cc (Layout::Layout): Initialize increase_relro_.
9548         (Layout::get_output_section): Add is_relro, is_last_relro, and
9549         is_first_non_relro parameters.  Change all callers.
9550         (Layout::choose_output_section): Likewise.
9551         (Layout::add_output_section_data): Likewise.
9552         (Layout::make_output_section): Likewise.
9553         (Layout::set_segment_offsets): Clear increase_relro when using a
9554         linker script.
9555         * layout.h (class Layout): Add increase_relro method.  Add
9556         increase_relro_ field.  Update declarations.
9557         * output.cc (Output_section::Output_section): Initialize
9558         is_last_relro_ and is_first_non_relro_.
9559         (Output_segment::add_output_section): Group relro sections is
9560         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9561         (Output_segment::maximum_alignment): Remove relro handling.
9562         (Output_segment::set_section_addresses): Add increase_relro
9563         parameter.  Change all callers.  Add initial alignment to align
9564         relro sections on separate page.  Remove old relro handling.
9565         (Output_segment::set_section_list_addresses): Remove in_relro
9566         parameter.  Change all callers.
9567         (Output_segment::set_offset): Add increase parameter.  Change all
9568         callers.  Remove old relro handling.
9569         * output.h (class Output_section): Add new methods: is_last_relro,
9570         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9571         Add is_last_relro_ and is_first_non_relro_ fields.
9572         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9573         Create separate .got.plt section.  Call increase_relro.
9574         * x86_64.cc (Target_x86_64::got_section): Likewise.
9575         * testsuite/relro_script_test.t: Add .got.plt.
9576
9577         PR 10450
9578         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9579         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9580         (Layout::finalize): Call set_dynamic_symbol_size.
9581         (Layout::set_dynamic_symbol_size): New function.
9582         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9583         set_dynamic_symbol_size.
9584
9585         PR 10450
9586         * output.h (class Output_section): Add is_entsize_zero_ field.
9587         * output.cc (Output_section::Output_section): Initialize
9588         is_entsize_zero_.
9589         (Output_section::set_entsize): If two different entsizes are
9590         requested, force it to zero.
9591         (Output_section::add_input_section): Set flags for .debug_str
9592         before updating section flags.  Set entsize.
9593         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9594         and SHF_STRING if all input sections have those flags.
9595
9596 2009-12-29   Rafael Espindola  <espindola@google.com>
9597
9598         * main.cc (main): Fix the sys time reporting.
9599         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9600         reporting.
9601
9602 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9603
9604         * options.cc (General_options::parse_version): Allow -v to exit
9605         without an error if there is nothing to link.
9606
9607 2009-12-29  Ian Lance Taylor  <iant@google.com>
9608
9609         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9610         using a version of gcc before 4.1.
9611         * configure: Rebuild.
9612
9613 2009-12-28  Chris Demetriou  <cgd@google.com>
9614
9615         * attributes.cc (Output_attributes_section_data::do_write): Use
9616         std::vector::front rather than std::vector::data.
9617
9618 2009-12-28  Ian Lance Taylor  <iant@google.com>
9619
9620         * symtab.h (class Symbol_table): Add enum Defined.
9621         * resolve.cc (Symbol_table::should_override): Add defined
9622         parameter.  Change all callers.  Test whether object is NULL
9623         before calling a method on it.
9624         (Symbol_table::report_resolve_problem): Add defined parameter.
9625         Change all callers.
9626         (Symbol_table::should_override_with_special): Likewise.
9627         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9628         parameter.  Change all callers.
9629         (Symbol_table::do_define_in_output_data): Likewise.
9630         (Symbol_table::define_in_output_segment): Likewise.
9631         (Symbol_table::do_define_in_output_segment): Likewise.
9632         (Symbol_table::define_as_constant): Likewise.
9633         (Symbol_table::do_define_as_constant): Likewise.
9634         * script.h (class Symbol_assignment): Add is_defsym parameter to
9635         constructor; change all callers.
9636         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9637         parameter.  Change all callers.  Add is_defsym_ field.
9638         (class Parser_closure): Add parsing_defsym parameter to
9639         constructor; change all callers.  Add parsing_defsym accessor
9640         function.  Add parsing_defsym_ field.
9641
9642 2009-12-28  Ian Lance Taylor  <iant@google.com>
9643
9644         * gold.cc (queue_middle_tasks): Fix formatting.
9645         * object.cc (Relobj::is_section_name_included): Likewise.
9646
9647 2009-12-23  Ian Lance Taylor  <iant@google.com>
9648
9649         * i386.cc (Target_i386::do_calls_non_split): Recognize
9650         -fsplit-stack prologue for a function with a static chain.
9651         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9652         -fsplit-stack prologue when using %r11.
9653
9654 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9655
9656         * options.cc (General_options::parse_version): Make -v continue and do
9657         the link like GNU ld does.
9658
9659 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9660
9661         * Makefile.am (CCFILES): Add timer.cc.
9662         (HFILES): Add timer.h.
9663         * configure.ac: Check for sysconf and times.
9664         * main.cc: include timer.h.
9665         (main): Use Timer instead of get_run_time.
9666         * timer.cc: New.
9667         * timer.h: New.
9668         * workqueue.cc: include timer.h.
9669         (Workqueue::find_and_run_task):
9670         Report user, sys and wall time.
9671         * Makefile.in: Regenerate.
9672         * config.in: Regenerate.
9673         * configure: Regenerate.
9674
9675 2009-12-16  Doug Kwan  <dougkwan@google.com>
9676
9677         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9678         sections.
9679         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9680         relaxed input sections.
9681         * output.cc (Output_section::find_relaxed_input_section): Change
9682         return type to Output_relaxed_input_section pointer.  Adjust code
9683         for new type of relaxed_input_section_map_.
9684         * output.h (Output_section::find_relaxed_input_section): Change
9685         return type to Output_relaxed_input_section pointer.
9686         (Output_section::Output_relaxed_input_section_by_input_section_map):
9687         New type.
9688         (Output_section::relaxed_input_section_map_): Change type to
9689         Output_section::Output_relaxed_input_section_by_input_section_map.
9690         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9691         input section.
9692
9693 2009-12-15  Ian Lance Taylor  <iant@google.com>
9694
9695         * layout.cc (Layout::create_shstrtab): Only write out after input
9696         sections if we are compressing debug sections.
9697
9698 2009-12-15  Ian Lance Taylor  <iant@google.com>
9699
9700         * archive.cc (Archive::add_symbols): Only look up a symbol without
9701         a version if there is, in fact, a version.
9702
9703 2009-12-14  Ian Lance Taylor  <iant@google.com>
9704
9705         Revert -Wshadow changes, all changes from:
9706         2009-12-11  Doug Kwan  <dougkwan@google.com>
9707         2009-12-11  Nick Clifton  <nickc@redhat.com>
9708         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9709
9710 2009-12-11  Doug Kwan  <dougkwan@google.com>
9711
9712         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9713         due to -Wshadow.
9714         * attributes.cc (Object_attribute::size): Ditto.
9715         (Attributes_section_data::size): Ditto.
9716         (Attributes_section_data::Attributes_section_data): Ditto.
9717         (Output_attributes_section_data::do_write): Ditto.
9718         * attributes.h (Object_attribute::set_type): Ditto.
9719         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9720
9721 2009-12-11  Nick Clifton  <nickc@redhat.com>
9722
9723         * archive.cc: Fix shadowed variable warnings.
9724         * arm.cc: Likewise.
9725         * compressed_output.cc: Likewise.
9726         * compressed_output.h: Likewise.
9727         * configure: Likewise.
9728         * dwarf_reader.cc: Likewise.
9729         * dynobj.cc: Likewise.
9730         * dynobj.h: Likewise.
9731         * ehframe.cc: Likewise.
9732         * ehframe.h: Likewise.
9733         * errors.cc: Likewise.
9734         * expression.cc: Likewise.
9735         * fileread.cc: Likewise.
9736         * fileread.h: Likewise.
9737         * freebsd.h: Likewise.
9738         * i386.cc: Likewise.
9739         * icf.cc: Likewise.
9740         * incremental.h: Likewise.
9741         * layout.cc: Likewise.
9742         * layout.h: Likewise.
9743         * mapfile.cc: Likewise.
9744         * merge.cc: Likewise.
9745         * merge.h: Likewise.
9746         * object.cc: Likewise.
9747         * object.h: Likewise.
9748         * options.h: Likewise.
9749         * output.cc: Likewise.
9750         * output.h: Likewise.
9751         * parameters.cc: Likewise.
9752         * plugin.cc: Likewise.
9753         * powerpc.cc: Likewise.
9754         * reduced_debug_output.cc: Likewise.
9755         * reduced_debug_output.h: Likewise.
9756         * reloc.cc: Likewise.
9757         * reloc.h: Likewise.
9758         * resolve.cc: Likewise.
9759         * script-sections.cc: Likewise.
9760         * script.cc: Likewise.
9761         * script.h: Likewise.
9762         * sparc.cc: Likewise.
9763         * symtab.cc: Likewise.
9764         * symtab.h: Likewise.
9765         * target-select.cc: Likewise.
9766         * target-select.h: Likewise.
9767         * token.h: Likewise.
9768         * workqueue.cc: Likewise.
9769         * workqueue.h: Likewise.
9770         * x86_64.cc: Likewise.
9771
9772 2009-12-10  Doug Kwan  <dougkwan@google.com>
9773
9774         * arm.cc (attributes.h): New include.
9775         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9776         (Arm_relobj::~Arm_relobj): Delete object pointed by
9777         attributes_section_data_.
9778         (Arm_relobj::attributes_section_data): New method definition.
9779         (Arm_relobj::attributes_section_data_): New data member declaration.
9780         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9781         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9782         attributes_section_data_.
9783         (Arm_dynobj::attributes_section_data): New method definition.
9784         (Arm_dynobj::attributes_section_data_): New data member declaration.
9785         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9786         initialization value of may_use_blx_ to false.
9787         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9788         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9789         object attributes to compute results instead of hard-coding.
9790         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9791         Target_arm::get_secondary_compatible_arch,
9792         Target_arm::set_secondary_compatible_arch
9793         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9794         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9795         New method declarations.
9796         (Target_arm::get_aeabi_object_attribute): New method definition.
9797         (Target_arm::attributes_section_data_): New data member declaration.
9798         (read_arm_attributes_section): New template definition.
9799         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9800         (Arm_dynobj::do_read_symbols): Ditto.
9801         (Target_arm::do_finalize_sections): Merge attributes sections from
9802         input.  Check for BLX use after attributes section merging.
9803         Fix __exidx_start and __exidx_end visibility.  Create an
9804         .ARM.attributes section if necessary.
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         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9810         New method definitions.
9811
9812 2009-12-09  Ian Lance Taylor  <iant@google.com>
9813
9814         * plugin.cc (Plugin::load): Don't cast from void* to a function
9815         pointer.
9816
9817 2009-12-09  Ian Lance Taylor  <iant@google.com>
9818
9819         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9820         information fields.
9821
9822 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9823
9824         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9825         Replace two_file_shared_1.so with two_file_shared_2.so.
9826         * testsuite/Makefile.in: Regenerated.
9827
9828 2009-12-08  Doug Kwan  <dougkwan@google.com>
9829
9830         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9831         (HFILES): Add attributes.h and int_encoding.h.
9832         * Makefile.in: Regenerate.
9833         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9834         function definitions to int_encoding.cc
9835         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9836         prototypes to int_encoding.h
9837         * reduced_debug_output.cc (int_encoding.h): New include.
9838         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9839         function definitions to int_encoding.cc
9840         (insert_into_vector, read_from_pointer): Move template definitions to
9841         int_encoding.h
9842         * attributes.cc: New file.
9843         * attributes.h: New file.
9844         * int_encoding.cc: New file.
9845         * int_encoding.h: New file.
9846
9847 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9848
9849         PR gold/11055
9850         * incremental-dump.cc (dump_incremental_inputs): New.
9851         (main): Use dump_incremental_inputs.
9852
9853 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9854
9855         PR gold/10893
9856         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9857         checking elfcpp::STT_FUNC.
9858         (Target_i386::Relocate::relocate): Likewise.
9859         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9860
9861         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9862         symbols from shared libraries into normal FUNC symbols.
9863
9864         * symtab.h (Symbol): Add is_func and use it.
9865
9866 2009-12-05  Doug Kwan  <dougkwan@google.com>
9867
9868         * arm.cc (Target_arm::arm_info): Initialize new fields
9869         attributes_section and attributes_vendor.
9870         * i386.cc (Target_i386::i386_info): Same.
9871         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9872         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9873         fields attributes_section and attributes_vendor.
9874         * sparc.cc (Target_sparc::sparc_info): Same.
9875         * target.h (Target::attributes_section, Target::attributes_vendor,
9876         Target::is_attributes_section, Target::attribute_arg_type,
9877         Target::attributes_order): New method definitions.
9878         (Target::Target_info::attributes_section,
9879         Target::Target_info::attributes_vendor): New fields.
9880         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9881         virtual method definitions.
9882         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9883         attributes_section and attributes_vendor.
9884         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9885
9886 2009-12-05  Doug Kwan  <dougkwan@google.com>
9887
9888         * arm.cc: Update comments about interworking and stub generation.
9889         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9890         considered as non-PIC.
9891         (Arm_relocate_functions::base_abs): Fix formatting.
9892         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9893         of function to use GOT entry address instead of offset.
9894         (Target_arm::Scan::global): Issue an error if a symbol would need a
9895         PLT does not get one because it is untyped.  Remove code to create
9896         dynamic symbols for relative branches.
9897         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9898         takes unsigned integer instead of boolean.
9899
9900 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9901
9902         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9903         (two_file_test_LDADD): Likewise.
9904         (common_test_1_LDADD): Likewise.
9905         (exception_test_LDADD) Likewise.
9906         (weak_test_LDADD): Likewise.
9907         (many_sections_test_LDADD): Likewise.
9908         (initpri1_LDADD): Likewise.
9909         (script_test_1_LDADD): Likewise.
9910         (script_test_2_LDADD): Likewise.
9911         (justsyms_LDADD): Likewise.
9912         (binary_test_LDADD): Likewise.
9913         (large_LDADD): Likewise.
9914         * testsuite/Makefile.in: Regenerated.
9915
9916 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9917
9918         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9919         (Symbol_table::override_with_special): Likewise.
9920         (Symbol_table::add_from_object): Likewise.
9921
9922 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9923
9924         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9925         Don't set the data_offset twice.
9926
9927 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9928
9929         * testsuite/Makefile.in: Regenerate.
9930
9931 2009-12-03  Doug Kwan  <dougkwan@google.com>
9932
9933         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9934         (Target_arm::do_finalize_sections): Add parameter for symbol table
9935         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9936         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9937         parameter for symbol table pointer.
9938         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9939         an additional parameter for a pointer to symbol table.
9940         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9941         parameter for a symbol table pointer.
9942         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9943         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9944         Ditto.
9945         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9946         parameter for a symbol table pointer.
9947
9948 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9949
9950         * incremental.cc (Incremental_inputs_header)
9951         (Incremental_inputs_header_write, Incremental_inputs_entry)
9952         (Incremental_inputs_entry_write): Move ...
9953         * incremental.h (Incremental_inputs_header)
9954         (Incremental_inputs_header_write, Incremental_inputs_entry)
9955         (Incremental_inputs_entry_write): here.
9956
9957 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9958
9959         * incremental.cc (make_sized_incremental_binary): Set the target.
9960         Error if it is incompatible.
9961         * output.h (Output_file): Add filename method.
9962
9963 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9964
9965         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9966         from the get_* methods.
9967
9968 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9969
9970         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9971         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9972         Write 0 for the data_offset of scripts.
9973
9974 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9975
9976         * testsuite/Makefile.am: Add the incremental_test.sh test.
9977         * testsuite/incremental_test.sh: New.
9978         * testsuite/incremental_test_1.c: New.
9979         * testsuite/incremental_test_2.c: New.
9980
9981 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9982
9983         * incremental-dump.cc (main): Fix typos.
9984
9985 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9986
9987         PR gold/11025
9988         * incremental-dump.cc (main): Use llu to print 64 bit values.
9989
9990 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9991             H.J. Lu  <hongjiu.lu@intel.com>
9992
9993         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9994         $(LIBDL).
9995         (incremental_dump_LDADD): Likewise.
9996         * Makefile.in: Regenerated.
9997
9998 2009-11-25  Doug Kwan  <dougkwan@google.com>
9999
10000         Revert:
10001
10002         2009-11-25  Doug Kwan  <dougkwan@google.com>
10003
10004                 * arm.cc (Target_arm::Target_arm): Move method definition
10005                 outside of class definition.  Add code to handle
10006                 --target1-rel, --target1-abs and --target2= options.
10007                 (Target_arm::get_reloc_reloc_type): Change method to be
10008                 non-static and const.
10009                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10010                 New data member declaration.
10011                 (Target_arm::Scan::local, Target_arm::Scan::global,
10012                 Target_arm::Relocate::relocate,
10013                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10014                 Adjust call to Target_arm::get_real_reloc_type.
10015                 (Target_arm::get_real_reloc_type): Use command line options
10016                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10017                 * options.h (--target1-rel, --target1-abs, --target2): New
10018                 ARM-only options.
10019
10020 2009-11-25  Doug Kwan  <dougkwan@google.com>
10021
10022         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10023         class definition.  Add code to handle --target1-rel, --target1-abs
10024         and --target2= options.
10025         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10026         and const.
10027         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10028         member declaration.
10029         (Target_arm::Scan::local, Target_arm::Scan::global,
10030         Target_arm::Relocate::relocate,
10031         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10032         call to Target_arm::get_real_reloc_type.
10033         (Target_arm::get_real_reloc_type): Use command line options to
10034         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10035         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10036         options.
10037
10038 2009-11-25  Doug Kwan  <dougkwan@google.com>
10039
10040         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10041         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10042         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10043         formatting.
10044         (Arm_relocate_functions::thm_call): Replace body with a call to
10045         Arm_relocate_functions::thumb_branch_common.
10046         (Arm_relocate_functions::thm_jump24,
10047         Arm_relocate_functions::thm_xpc22): New method definitions.
10048         (Arm_relocate_functions::thumb_branch_common): New method definition.
10049         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10050         operator.
10051         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10052         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10053
10054 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10055
10056         * Makefile.am: Build incremental-dump
10057         * Makefile.in: Regenerate.
10058         * incremental-dump.cc: New.
10059         * incremental.cc (Incremental_inputs_header_data,
10060         Incremental_inputs_entry_data): Move to incremental.h
10061         * incremental.h: (Incremental_inputs_header_data,
10062         Incremental_inputs_entry_data): Move from incremental.cc
10063
10064 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10065
10066         * incremental.cc (Incremental_inputs_header,
10067         Incremental_inputs_header_write, Incremental_inputs_entry,
10068         Incremental_inputs_entry_write): Add a typedef with the data type.
10069
10070 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10071
10072         * incremental.cc (Incremental_inputs_header,
10073         Incremental_inputs_header_write, Incremental_inputs_entry,
10074         Incremental_inputs_entry_write): Update comment about which
10075         type has the filed descriptions.
10076
10077 2009-11-15  Doug Kwan  <dougkwan@google.com>
10078
10079         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10080         (Arm_relocate_functions::arm_branch_common): Change method defintion
10081         in class definition to a method declaration and update list of formal
10082         parameters.
10083         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10084         Arm_relocation_functions::jump24): Adjust call to
10085         Arm_relocate_functions::arm_branch_common.  Update list of formal
10086         parameters.
10087         (Arm_relocate_functions::xpc25): New method definition.
10088         (Arm_relocate_functions::arm_branch_common): Move method defintion
10089         out from class definition.  Use stubs for mode-switching and extending
10090         branch ranges.
10091         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10092         specially.  Change code to enable use of stubs in ARM branches.
10093
10094 2009-11-10  Doug Kwan  <dougkwan@google.com>
10095
10096         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10097         in method declaration.
10098         (Target_arm::relocate_stub): New method declaration.
10099         (Target_arm::default_target): Change to return a pointer instead of
10100         a const reference.
10101         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10102         Target_arm::default_target.
10103         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10104         method definition.
10105         (Target_arm::relocate_section): Adjust view.
10106         (Target_arm::relocate_stub): New method definition.
10107
10108 2009-11-10  Doug Kwan  <dougkwan@google.com>
10109
10110         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10111         a format warning.
10112         * incremental.cc (open_incremental_binary): Initialized local
10113         variables to avoid warnings.
10114         * object.cc (make_elf_object): Ditto.
10115         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10116         a format warning.
10117
10118 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10119
10120         PR gold/10930
10121         * testsuite/plugin_test.c: Include "config.h".
10122
10123 2009-11-09  Doug Kwan  <dougkwan@google.com>
10124
10125         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10126         (arm_symbol_value): Remove.
10127         (Arm_relocate_functions::arm_branch_common,
10128         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10129         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10130         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10131         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10132         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10133         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10134         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10135         Arm_relocate_functions::thm_mobw_abs_nc,
10136         Arm_relocate_functions::thm_mov_abs,
10137         Arm_relocate_functions::movw_prel_nc,
10138         Arm_relocate_functions::thm_movt_abs,
10139         Arm_relocate_functions::movt_prel,
10140         Arm_relocate_functions::thm_movw_prel_nc,
10141         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10142         (Target_arm::Relocate::relocate): Only decompose address into two
10143         parts if relocation type uses the thumb-bit and pass the actual
10144         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10145         calls to methods in Arm_relocate_functions for this change.
10146
10147 2009-11-08  Ian Lance Taylor  <iant@google.com>
10148
10149         PR 10925
10150         * reloc.cc: Instantiate
10151         Sized_relobj::initialize_input_to_output_maps and
10152         Sized_relobj:free_input_to_output_maps.
10153
10154 2009-11-06  Ian Lance Taylor  <iant@google.com>
10155
10156         PR 10876
10157         * defstd.cc (in_segment): Set only_if_ref true for "end".
10158
10159 2009-11-06  Doug Kwan  <dougkwan@google.com>
10160
10161         * arm.cc (class Reloc_stub): Correct a comment.
10162         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10163         (Target_arm::scan_section_for_stubs): New method declaration.
10164         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10165         Change methods from private to protected.
10166         (Target_arm::do_may_relax): New method definition.
10167         (Target_arm::do_relax, Target_arm::group_sections,
10168         Target_arm::scan_reloc_for_stub,
10169         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10170         (Target_arm::arm_input_section_map_): New data member declaration.
10171         (Target_arm::scan_reloc_for_stub,
10172         Target_arm::scan_reloc_section_for_stubs,
10173         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10174         Target_arm::do_relax): New method definitions.
10175
10176 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10177
10178         * configure.ac: Check for (struct stat)::st_mtim
10179         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10180         * config.in: Regenerate.
10181         * configure: Regenerate.
10182
10183 2009-11-05  Ian Lance Taylor  <iant@google.com>
10184
10185         PR 10910
10186         * output.cc (Output_segment::add_output_section): Add missing
10187         return statement.
10188
10189 2009-11-04  Ian Lance Taylor  <iant@google.com>
10190
10191         PR 10880
10192         * object.h (class Object): Add is_needed and set_is_needed
10193         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10194         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10195         defined in a dynamic object and referenced by a regular object,
10196         set is_needed for the dynamic object.
10197         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10198         if the file is marked with as_needed and it is not needed.
10199
10200 2009-11-04  Ian Lance Taylor  <iant@google.com>
10201
10202         PR 10887
10203         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10204         tags if data is discarded by linker script.
10205         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10206         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10207         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10208         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10209
10210 2009-11-04  Ian Lance Taylor  <iant@google.com>
10211
10212         * layout.cc (Layout::get_output_section): Add is_interp and
10213         is_dynamic_linker_section parameters.  Change all callers.
10214         (Layout::choose_output_section): Likewise.
10215         (Layout::make_output_section): Likewise.
10216         (Layout::add_output_section_data): Add is_dynamic_linker_section
10217         parameter.  Change all callers.
10218         * layout.h (class Layout): Update declarations.
10219         * output.h (class Output_section): Add is_interp, set_is_interp,
10220         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10221         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10222         generate_code_fills_at_write_ to a bitfield.
10223         * output.cc (Output_section::Output_sections): Initialize new
10224         fields.
10225         (Output_segment::add_output_section): Add do_sort parameter.
10226         Change all callers.
10227
10228 2009-11-03  Ian Lance Taylor  <iant@google.com>
10229
10230         PR 10860
10231         * options.h (class General_options): Add --warn-common.
10232         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10233         merging two common symbols.
10234         (Symbol_table::should_override): Handle --warn-common when merging
10235         a common symbol with a defined symbol.  Use report_resolve_problem
10236         for multiple definitions.
10237         (Symbol_table::report_resolve_problem): New function.
10238         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10239
10240 2009-11-03  Doug Kwan  <dougkwan@google.com>
10241
10242         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10243         stub_factory_.
10244         (Target_arm::stub_factory): New method definition.
10245         (Target_arm::new_arm_input_section,
10246         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10247         Target_arm::reloc_uses_thumb_bit): New method declarations.
10248         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10249         New type definitions.
10250         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10251         member declarations.
10252         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10253         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10254         New method definitions.
10255
10256 2009-11-03  Ian Lance Taylor  <iant@google.com>
10257
10258         * options.h (class General_options): Add --warn_constructors.
10259
10260 2009-11-03  Ian Lance Taylor  <iant@google.com>
10261
10262         PR 10893
10263         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10264         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10265
10266 2009-11-03  Ian Lance Taylor  <iant@google.com>
10267
10268         PR 10895
10269         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10270         --msgid-bugs-address.
10271         (install-pdf): New target.
10272         (install-data_yes): Look up one directory to find mkinstalldirs.
10273
10274 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10275
10276         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10277         tree.
10278
10279 2009-10-30  Doug Kwan  <dougkwan@google.com>
10280
10281         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10282
10283 2009-10-30  Doug Kwan  <dougkwan@google.com>
10284
10285         * arm.cc (Stub_addend_reader): New struct template definition
10286         and partial specializations.
10287         (Stub_addend_reader::operator()): New method definition for a
10288         partially specialized template.
10289
10290 2009-10-30  Doug Kwan  <dougkwan@google.com>
10291
10292         * arm.cc (Arm_relobj::processor_specific_flags): New method
10293         definition.
10294         (Arm_relobj::do_read_symbols): New method declaration.
10295         (Arm_relobj::processor_specific_flags_): New data member declaration.
10296         (Arm_dynobj): New class definition.
10297         (Target_arm::do_finalize_sections): Add input_objects parameter.
10298         (Target_arm::do_adjust_elf_header): New method declaration.
10299         (Target_arm::are_eabi_versions_compatible,
10300         (Target_arm::merge_processor_specific_flags): New method declaration.
10301         (Target_arm::do_make_elf_object): New overloaded method definitions
10302         and declaration.
10303         (Arm_relobj::do_read_symbols): New method definition.
10304         (Arm_dynobj::do_read_symbols): Ditto.
10305         (Target_arm::do_finalize_sections): Add input_objects parameters.
10306         Merge processor-specific flags from all input objects.
10307         (Target_arm::are_eabi_versions_compatible,
10308         Target_arm::merge_processor_specific_flags,
10309         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10310         New method definitions.
10311         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10312         Input_objects pointer type parameter.
10313         * layout.cc (Layout::finalize): Pass input objects to target's.
10314         finalize_sections function.
10315         * output.cc (Output_file_header::do_sized_write): Set ELF file
10316         header's processor-specific flags.
10317         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10318         Input_objects pointer type parameter.
10319         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10320         * target.h (Input_objects): New forward class declaration.
10321         (Target::processor_specific_flags,
10322         Target::are_processor_specific_flags_sect): New method definitions.
10323         (Target::finalize_sections): Add input_objects parameter.
10324         (Target::Target): Initialize processor_specific_flags_ and
10325         are_processor_specific_flags_set_.
10326         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10327         parameter.
10328         (Target::set_processor_specific_flags): New method definition.
10329         (Target::processor_specific_flags_,
10330         Target::are_processor_specific_flags_set_): New data member
10331         declarations.
10332         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10333         Input_objects pointer type parameter.
10334
10335 2009-10-30  Doug Kwan  <dougkwan@google.com>
10336
10337         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10338
10339 2009-10-28  Ian Lance Taylor  <iant@google.com>
10340
10341         * object.h (class Relobj): Drop options parameter from
10342         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10343         do_scan_relocs, do_relocate.  Change all callers.
10344         (class Sized_relobj): Drop options parameters from
10345         do_gc_process_relocs, do_scan_relocs, do_relocate,
10346         do_relocate_sections, relocate_sections, emit_relocs_scan,
10347         emit_relocs_scan_reltype.  Change all callers.
10348         (struct Relocate_info): Remove options field and all references to
10349         it.
10350         * reloc.h (class Read_relocs): Remove options constructor
10351         parameter and options_ field.  Change all callers.
10352         (class Gc_process_relocs, class Scan_relocs): Likewise.
10353         (class Relocate_task): Likewise.
10354         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10355         all callers.
10356         (scan_relocatable_relocs): Likewise.
10357         * target.h (class Sized_target): Remove options parameter from
10358         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10359         all callers.
10360         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10361         callers.
10362         * arm.cc: Update functions to remove options parameters.
10363         * i386.cc: Likewise.
10364         * powerpc.cc: Likewise.
10365         * sparc.cc: Likewise.
10366         * x86_64.cc: Likewise.
10367         * testsuite/testfile.cc: Likewise.
10368
10369 2009-10-28  Doug Kwan  <dougkwan@google.com>
10370
10371         * arm.cc (Arm_relobj): New class definition.
10372         (Arm_relobj::scan_sections_for_stubs,
10373         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10374         New method definitions.
10375
10376 2009-10-28  Cary Coutant  <ccoutant@google.com>
10377
10378         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10379         (Plugin::cleanup_done_): New member.
10380         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10381         (Plugin_manager::cleanup_done_): Remove.
10382         (Plugin_manager::add_input_file): Edit error message.
10383         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10384         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10385
10386 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10387
10388         * fileread.cc: (File_read::View::~View): Use the new
10389         data_ownership_ filed.
10390         (File_read::~File_read): Dispose the new whole_file_view_.
10391         (File_read::open): Mmap the whole file if needed.
10392         (File_read::open): Use whole_file_view_ instead of contents_.
10393         (File_read::find_view): Use whole_file_view_ if applicable.
10394         (File_read::do_read): Use whole_file_view_ instead of contents_.
10395         (File_read::make_view): Use whole_file_view_ instead of contents_,
10396         update File_read::View::View call.
10397         (File_read::find_or_make_view): Update File_read::View::View
10398         call.
10399         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10400         remove contents_
10401         (File_read::View::Data_ownership): New enum.
10402         (File_read::View::View): Replace bool mapped_ with Data_ownership
10403         argument.
10404         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10405         (File_read::View::data_ownership_): New field.
10406         (File_read::contents_): Remove (replaced by whole_file_view_).
10407         (File_read::whole_file_view_): New field.
10408         * options.h (class General_options): Add --keep-files-mapped.
10409
10410 2009-10-27  Cary Coutant  <ccoutant@google.com>
10411
10412         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10413         * testsuite/Makefile.am (plugin_test_5): New test case.
10414         * testsuite/Makefile.in: Regenerate.
10415
10416 2009-10-25  Doug Kwan  <dougkwan@google.com>
10417
10418         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10419         from private to protected to allow access by child class.
10420         (Sized_relobj::do_relocate_sections): New method declaration.
10421         (Sized_relobj::relocate_sections): Virtualize.
10422         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10423         Sized_relobj::relocate_sections.  Instantiate template explicitly
10424         for different target sizes and endianity.
10425
10426 2009-10-24  Doug Kwan  <dougkwan@google.com>
10427
10428         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10429         (Arm_input_section::as_arm_input_section): New method.
10430         (Arm_output_section): New class definition.
10431         (Arm_output_section::create_stub_group,
10432         Arm_output_section::group_sections): New method definitions.
10433
10434 2009-10-22  Doug Kwan  <dougkwan@google.com>
10435
10436         * arm.cc (Arm_input_section): New class definition.
10437         (Arm_input_section::init, Arm_input_section:do_write,
10438         Arm_input_section::set_final_data_size,
10439         Arm_input_section::do_reset_address_and_file_offset): New method
10440         definitions.
10441
10442 2009-10-21  Doug Kwan  <dougkwan@google.com>
10443
10444         * arm.cc (Stub_table, Arm_input_section): New forward class
10445         declarations.
10446         (Stub_table): New class defintion.
10447         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10448         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10449         New method definition.
10450
10451 2009-10-21  Doug Kwan  <dougkwan@google.com>
10452
10453         * arm.cc: Update copyright comments.
10454         (Target_arm): New forward class template declaration.
10455         (Arm_address): New type.
10456         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10457         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10458         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10459         constants.
10460         (Insn_template): Same.
10461         (DEF_STUBS): New macro.
10462         (Stub_type): New enum type.
10463         (Stub_template): New class definition.
10464         (Stub): Same.
10465         (Reloc_stub): Same.
10466         (Stub_factory): Same.
10467         (Target_arm::Target_arm): Initialize may_use_blx_ and
10468         should_force_pic_veneer_.
10469         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10470         Target_arm::should_force_pic_veneer,
10471         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10472         Target_arm::using_thumb_only, Target_arm:;default_target): New
10473         method defintions.
10474         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10475         New data member declarations.
10476         (Insn_template::size, Insn_template::alignment): New method defintions.
10477         (Stub_template::Stub_template): New method definition.
10478         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10479         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10480         (Stub_factory::Stub_factory): New method definition.
10481         * gold.h (string_hash): New template.
10482         * output.h (Input_section_specifier::hash_value): Use
10483         gold::string_hash.
10484         (Input_section_specifier::string_hash): Remove.
10485         * stringpool.cc (Stringpool_template::string_hash): Use
10486         gold::string_hash.
10487
10488 2009-10-20  Doug Kwan  <dougkwan@google.com>
10489
10490         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10491         symbols of relaxed input sections.
10492         * output.h (Output_section::find_relaxed_input_section): Make
10493         method public.
10494
10495 2009-10-16  Doug Kwan  <dougkwan@google.com>
10496
10497         * dynobj.cc (Versions::Versions): Initialize version_script_.
10498         Only insert base version symbol definition for a shared object
10499         if version script defines any version versions.
10500         (Versions::define_base_version): New method definition.
10501         (Versions::add_def): Check that base version is not needed.
10502         (Versions::add_need): Define base version lazily.
10503         * dynobj.h (Versions::define_base_version): New method declaration.
10504         (Versions::needs_base_version_): New data member declaration.
10505         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10506         (check_DATA): Add no_version_test.stdout.
10507         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10508         New make rules.
10509         * testsuite/Makefile.in: Regenerate.
10510         * testsuite/no_version_test.c: New file.
10511         * testsuite/no_version_test.sh: Ditto.
10512
10513 2009-10-16  Doug Kwan  <dougkwan@google.com>
10514
10515         * expression.cc (class Segment_start_expression): New class definition.
10516         (Segment_start_expression::value): New method definition.
10517         (script_exp_function_segment_start): Return a new
10518         Segment_start_expression.
10519         * gold/script-c.h (script_saw_segment_start_expression): New function
10520         prototype.
10521         * script-sections.cc (Script_sections::Script_sections): Initialize
10522         SAW_SEGMENT_START_EXPRESSION_ to false.
10523         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10524         and -Tbbs options to specify section addresses if given in
10525         command line and no SEGMENT_START expression is seen in a script.
10526         * script-sections.h (Script_sections::saw_segment_start_expression,
10527         Script_sections::set_saw_segment_start_expression): New method
10528         definition.
10529         (Script_sections::saw_segment_start_expression_): New data member
10530         declaration.
10531         * script.cc (script_saw_segment_start_expression): New function.
10532         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10533         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10534         script_test_7.sh and script_test_8.sh.
10535         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10536         script_test_8.stdout.
10537         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10538         (script_test_6, script_test_6.stdout, script_test_7,
10539         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10540         * Makefile.in: Regenerate.
10541         * testsuite/script_test_6.sh: New file.
10542         * testsuite/script_test_6.t: Same.
10543         * testsuite/script_test_7.sh: Same.
10544         * testsuite/script_test_7.t: Same.
10545         * testsuite/script_test_8.sh: Same.
10546
10547 2009-10-16  Doug Kwan  <dougkwan@google.com>
10548
10549         * output.cc (Output_segment::set_section_list_address): Cast
10550         expressions to unsigned long long type to avoid format warnings.
10551
10552 2009-10-15  Ian Lance Taylor  <iant@google.com>
10553
10554         * script.cc (Script_options::add_symbol_assignment): Always add a
10555         dot assignment to script_sections_.
10556         * script-sections.cc (Script_sections::add_dot_assignment):
10557         Initialize if necessary.
10558
10559         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10560         program headers with no load segment if there is a linker script.
10561
10562         * layout.cc (Layout::set_segment_offsets): Align the file offset
10563         to the segment aligment for -N or -n with no load segment.
10564         * output.cc (Output_segment::add_output_section): Don't crash if
10565         the first section is a TLS section.
10566         (Output_segment::set_section_list_addresses): Print an error
10567         message if the address moves backward in a linker script.
10568         * script-sections.cc
10569         (Output_section_element_input::set_section_addresses): Don't
10570         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10571         (Orphan_output_section::set_section_addresses): Likewise.
10572
10573 2009-10-15  Doug Kwan  <dougkwan@google.com>
10574
10575         * layout.cc (Layout::finish_dynamic_section): Generate tags
10576         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10577         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10578         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10579
10580 2009-10-14  Ian Lance Taylor  <iant@google.com>
10581
10582         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10583         fields.
10584         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10585         data_shdr fields of relinfo.
10586         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10587         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10588         R_386_TLS_LDO_32, adjust based on section flags.
10589         (Target_i386::Relocate::fix_up_ldo): Remove.
10590
10591 2009-10-13  Ian Lance Taylor  <iant@google.com>
10592
10593         Add support for -pie.
10594         * options.h (class General_options): Add -pie and
10595         --pic-executable.
10596         (General_options::output_is_position_independent): Test -pie.
10597         (General_options::output_is_executable): Return true if not shared
10598         and not relocatable.
10599         (General_options::output_is_pie): Remove.
10600         * options.cc (General_options::finalize): Reject incompatible uses
10601         of -pie.
10602         * gold.cc (queue_middle_tasks): A -pie link is not static.
10603         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10604         * symtab.cc (Symbol::final_value_is_known): Return false if
10605         output_is_position_independent.
10606         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10607         output_is_position_independent.
10608         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10609         output_is_position_independent.
10610         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10611         output_is_position_independent.
10612         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10613         two_file_pie_test.
10614         (basic_pie_test.o, basic_pie_test): New targets.
10615         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10616         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10617         (two_file_pie_test): New target.
10618         * testsuite/Makefile.in: Rebuild.
10619         * README: Remove note saying that -pie is not supported.
10620
10621 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10622
10623         * options.h (class General_options): Add -init and -fini.
10624         * layout.cc (Layout::finish_dynamic_section): Emit
10625         given init and fini functions.
10626
10627 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10628
10629         * gc.h (gc_process_relocs): Check if icf is enabled using new
10630         function.
10631         * gold.cc (queue_initial_tasks): Likewise.
10632         (queue_middle_tasks): Likewise.
10633         * object.cc (do_layout): Likewise.
10634         * symtab.cc (is_section_folded): Likewise.
10635         * main.cc (main): Likewise.
10636         * reloc.cc (Read_relocs::run): Likewise.
10637         (Sized_relobj::do_scan_relocs): Likewise.
10638         * icf.cc (is_function_ctor_or_dtor): New function.
10639         (Icf::find_identical_sections): Check if function is ctor or dtor when
10640         safe icf is chosen.
10641         * options.h (General_options::icf): Change option to be an enum.
10642         (Icf_status): New enum.
10643         (icf_enabled): New method.
10644         (icf_safe_folding): New method.
10645         (set_icf_status): New method.
10646         (icf_status_): New variable.
10647         * (options.cc) (General_options::finalize): Set icf_status_.
10648         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10649         icf_test and icf_keep_unique_test to use the --icf enum flag.
10650         * testsuite/icf_safe_test.sh: New file.
10651         * testsuite/icf_safe_test.cc: New file.
10652
10653 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10654
10655         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10656         includes to gc.h and icf.h.
10657         * arm.cc: Include gc.h.
10658         * gold.cc: Likewise.
10659         * i386.cc: Likewise.
10660         * powerpc.cc: Likewise.
10661         * sparc.cc: Likewise.
10662         * x86_64.cc: Likewise.
10663         * gc.h: Include icf.h.
10664
10665 2009-10-11  Ian Lance Taylor  <iant@google.com>
10666
10667         * plugin.cc: Include "gold.h" before other header files.
10668
10669 2009-10-10  Chris Demetriou  <cgd@google.com>
10670
10671         * options.h (Input_file_argument::Input_file_type): New enum.
10672         (Input_file_argument::is_lib_): Replace with...
10673         (Input_file_argument::type_): New member.
10674         (Input_file_argument::Input_file_argument): Take Input_file_type
10675         'type' rather than boolean 'is_lib' as second argument.
10676         (Input_file_argument::is_lib): Use type_.
10677         (Input_file_argument::is_searched_file): New function.
10678         (Input_file_argument::may_need_search): Handle is_searched_file.
10679         * options.cc (General_options::parse_library): Support -l:filename.
10680         (General_options::parse_just_symbols): Update for Input_file_argument
10681         changes.
10682         (Command_line::process): Likewise.
10683         * archive.cc (Archive::get_file_and_offset): Likewise.
10684         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10685         * script.cc (read_script_file, script_add_file): Likewise.
10686         * fileread.cc (Input_file::Input_file): Likewise.
10687         (Input_file::will_search_for): Handle is_searched_file.
10688         (Input_file::open): Likewise.
10689         * readsyms.cc (Read_symbols::get_name): Likewise.
10690         * testsuite/Makefile.am (searched_file_test): New test.
10691         * testsuite/Makefile.in: Regenerate.
10692         * testsuite/searched_file_test.cc: New file.
10693         * testsuite/searched_file_test_lib.cc: New file.
10694
10695 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10696             Ian Lance Taylor  <iant@google.com>
10697
10698         * descriptor.cc: Include <cstdio> and "binary-io.h".
10699         (Descriptors::open): Open the files in binary mode always.
10700         * script.cc (Lex::get_token): Treat \r as whitespace.
10701
10702 2009-10-09  Ian Lance Taylor  <iant@google.com>
10703
10704         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10705
10706 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10707             Ian Lance Taylor  <iant@google.com>
10708
10709         * configure.ac: Check for readv function also.
10710         * fileread.cc (readv): Define if not HAVE_READV.
10711         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10712         does not exist.
10713         * config.in: Regenerate.
10714         * configure: Regenerate.
10715
10716 2009-10-09  Doug Kwan  <dougkwan@google.com>
10717
10718         * layout.cc (Layout::make_output_section): Call target hook to make
10719         ordinary output section.
10720         (Layout::finalize): Adjust parameter list of call the
10721         Target::may_relax().
10722         * layout.h (class Layout::section_list): New method.
10723         * merge.h (Output_merge_base::entsize): Change visibility to public.
10724         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10725         New methods.
10726         (Output_merge_string::do_is_string): New method.
10727         * object.cc (Sized_relobj::do_setup): renamed from
10728         Sized_relobj::set_up.
10729         * object.h (Sized_relobj::adjust_shndx,
10730         Sized_relobj::initializ_input_to_output_maps,
10731         Sized_relobj::free_input_to_output_maps): Change visibilities to
10732         protected.
10733         (Sized_relobj::setup): Virtualize.
10734         (Sized_relobj::do_setup): New method declaration.
10735         (Sized_relobj::invalidate_section_offset,
10736         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10737         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10738         * options.cc (parse_int): New function.
10739         * options.h (parse_int): New declaration.
10740         (DEFINE_int): New macro.
10741         (stub_group_size): New option.
10742         * output.cc (Output_section::Output_section): Initialize memebers
10743         merge_section_map_, merge_section_by_properties_map_,
10744         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10745         (Output_section::add_input_section): Handled deferred code-fill
10746         generation and remove an old comment.
10747         (Output_section::add_relaxed_input_section): New method definition.
10748         (Output_section::add_merge_input_section): Use merge section by
10749         properties map to speed to search.  Update merge section maps
10750         as appropriate.
10751         (Output_section::build_relaxation_map): New method definition.
10752         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10753         Same.
10754         (Output_section::relax_input_section): Renamed to
10755         Output_section::convert_input_sections_to_relaxed_sections and change
10756         interface to take a vector of pointers to relaxed sections.
10757         (Output_section::find_merge_section,
10758         Output_section::find_relaxed_input_section): New method definitions.
10759         (Output_section::is_input_address_mapped,
10760         Output_section::output_offset, Output_section::output_address):
10761         Use output section data maps to speed up searching.
10762         (Output_section::find_starting_output_address): Add comments.
10763         (Output_section::do_write,
10764         Output_section::write_to_postprocessing_buffer): Do code-fill
10765         generation as appropriate.
10766         (Output_section::get_input_sections): Invalidate relaxed input section
10767         map.
10768         (Output_section::restore_states): Adjust type of checkpoint .
10769         Invalidate relaxed input section map.
10770         * output.h (Output_merge_base): New class declaration.
10771         (Input_section_specifier): New class defintion.
10772         (class Output_relaxed_input_section) Change base class to
10773         Output_section_data_build.
10774         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10775         base class initializer.
10776         (Output_section::add_relaxed_input_section): New method declaration.
10777         (Output_section::Input_section): Change visibility to protected.
10778         (Output_section::Input_section::relobj,
10779         Output_section::Input_section::shndx): Handle relaxed input sections.
10780         Output_section::input_sections) Change visibility to protected.  Also
10781         define overload to return a non-const pointer.
10782         (Output_section::Merge_section_properties): New class defintion.
10783         (Output_section::Merge_section_by_properties_map,
10784         Output_section::Output_section_data_by_input_section_map,
10785         Output_section::Relaxation_map): New types.
10786         (Output_section::relax_input_section): Rename method to
10787         Output_section::convert_input_sections_to_relaxed_sections and change
10788         interface to take a vector of relaxed section pointers.
10789         (Output_section::find_merge_section,
10790         Output_section::find_relaxed_input_section,
10791         Output_section::build_relaxation_map,
10792         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10793         New method declarations.
10794         (Output_section::merge_section_map_
10795         Output_section::merge_section_by_properties_map_,
10796         Output_section::relaxed_input_section_map_,
10797         Output_section::is_relaxed_input_section_map_valid_,
10798         Output_section::generate_code_fills_at_write_): New data members.
10799         * script-sections.cc
10800         (Output_section_element_input::set_section_addresses): Call
10801         current_data_size and addralign methods of relaxed input sections.
10802         (Orphan_output_section::set_section_addresses): Call current_data_size
10803         and addralign methods of relaxed input sections.
10804         * symtab.cc (Symbol_table::compute_final_value): Extract template
10805         from the body of Symbol_table::sized_finalize_symbol.
10806         (Symbol_table::sized_finalized_symbol): Call
10807         Symbol_table::compute_final_value.
10808         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10809         (Symbol_table::compute_final_value): New templated method declaration.
10810         * target.cc (Target::do_make_output_section): New method defintion.
10811         * target.h (Target::make_output_section): New method declaration.
10812         (Target::relax): Add more parameters for input objects, symbol table
10813         and layout.  Adjust call to do_relax.
10814         (Target::do_make_output_section): New method declaration.
10815         (Target::do_relax): Add parameters for input objects, symbol table
10816         and layout.
10817
10818 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10819
10820         * pread.c: Include stdio.h.
10821
10822 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10823
10824         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10825         defined.
10826
10827 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10828
10829         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10830         Change read_shndx type to unsigned int.
10831         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10832         int.
10833         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10834         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10835         Change read_shndx type to unsigned int.
10836         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10837         int.
10838         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10839         * layout.cc (Layout::create_symtab_sections): Cast the result of
10840         local_symcount * symsize to off_t in the gold_assert.
10841
10842 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10843
10844         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10845         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10846         R_ARM_BASE_ABS.
10847         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10848         (Arm_relocate_functions::thm_abs5): New function.
10849         (Arm_relocate_functions::abs12): New function.
10850         (Arm_relocate_functions::abs16): New function.
10851         (Arm_relocate_functions::base_abs): New function.
10852         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10853         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10854         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10855         R_ARM_BASE_ABS.
10856         (Scan::global): Likewise.
10857         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10858         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10859         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10860         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10861         R_ARM_BASE_ABS.
10862
10863 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10864
10865         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10866         (Arm_relocate_functions::movt_prel): New function.
10867         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10868         (Arm_relocate_functions::thm_movt_prel): New function.
10869         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10870         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10871         (Scan::global, Relocate::relocate): Likewise.
10872         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10873
10874 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10875
10876         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10877         Incremental_checker.
10878         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10879         unsigned int.
10880         (class Incremental_inputs_header): New class.
10881         (Incremental_inputs_header_writer): Edit comment.
10882         (Incremental_inputs_entry): New class.
10883         (Incremental_inputs_entry_writer): Edit comment.
10884         (Sized_incremental_binary::do_find_incremental_inputs_section):
10885         Add *strtab_shndx parameter, fill it.
10886         (Sized_incremental_binary::do_check_inputs): New method.
10887         (Incremental_checker::can_incrementally_link_output_file): Use
10888         Sized_incremental_binary::check_inputs.
10889         (Incremental_inputs::report_command_line): Save command line in
10890         command_line_.
10891         * incremental.h:
10892         (Incremental_binary::find_incremental_inputs_section): New
10893         method.
10894         (Incremental_binary::do_find_incremental_inputs_section): Add
10895         strtab_shndx parameter.
10896         (Incremental_binary::do_check_inputs): New pure virtual method.
10897         (Sized_incremental_binary::do_check_inputs): Declare.
10898         (Incremental_checker::Incremental_checker): Add incremental_inputs
10899         parameter, use it to initialize incremental_inputs_.
10900         (Incremental_checker::incremental_inputs_): New field.
10901         (Incremental_checker::command_line): New method.
10902         (Incremental_checker::inputs): New method.
10903         (Incremental_checker::command_line_): New field.
10904
10905 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10906
10907         * incremental.cc: Include <cstdarg> and "target-select.h".
10908         (vexplain_no_incremental): New function.
10909         (explain_no_incremental): New function.
10910         (Incremental_binary::error): New method.
10911         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10912         method.
10913         (make_sized_incremental_binary): New function.
10914         (open_incremental_binary): New function.
10915         (can_incrementally_link_file): Add checks if output is ELF and has
10916         inputs section.
10917         * incremental.h: Include "elfcpp_file.h" and "output.h".
10918         (Incremental_binary): New class.
10919         (Sized_incremental_binary): New class.
10920         (open_incremental_binary): Declare.
10921         * object.cc (is_elf_object): Use
10922         elfcpp::Elf_recognizer::is_elf_file.
10923         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10924         * output.h (Output_file::filesize): New method.
10925
10926 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10927
10928         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10929         New function.
10930         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10931         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10932         function.
10933         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10934         function.
10935         (Arm_relocate_functions::movw_abs_nc): New function.
10936         (Arm_relocate_functions::movt_abs): New function.
10937         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10938         (Arm_relocate_functions::thm_movt_abs): New function.
10939         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10940         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10941         (Scan::global): Likewise.
10942         (Relocate::relocate): Likewise.
10943         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10944
10945 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10946
10947         * arm.cc (Arm_relocate_functions::got_prel) New function.
10948         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10949         (Relocate::relocate): Likewise.
10950         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10951
10952 2009-10-06  Ian Lance Taylor  <iant@google.com>
10953
10954         * options.h (class General_options): Define
10955         split_stack_adjust_size parameter.
10956         * object.h (class Object): Add uses_split_stack_ and
10957         has_no_split_stack_ fields.  Add uses_split_stack and
10958         has_no_split_stack accessor functions.  Declare
10959         handle_split_stack_section.
10960         (class Reloc_symbol_changes): Define.
10961         (class Sized_relobj): Define Function_offsets.  Declare
10962         split_stack_adjust, split_stack_adjust_reltype, and
10963         find_functions.
10964         * object.cc (Object::handle_split_stack_section): New function.
10965         (Sized_relobj::do_layout): Call handle_split_stack_section.
10966         * dynobj.cc (Sized_dynobj::do_layout): Call
10967         handle_split_stack_section.
10968         * reloc.cc (Sized_relobj::relocate_sections): Call
10969         split_stack_adjust for executable sections in split_stack
10970         objects.  Pass reloc_map to relocate_section.
10971         (Sized_relobj::split_stack_adjust): New function.
10972         (Sized_relobj::split_stack_adjust_reltype): New function.
10973         (Sized_relobj::find_functions): New function.
10974         * target-reloc.h: Include "object.h".
10975         (relocate_section): Add reloc_symbol_changes parameter.  Change
10976         all callers.
10977         * target.h (class Target): Add calls_non_split method.  Declare
10978         do_calls_non_split virtual method.  Declare match_view and
10979         set_view_to_nop.
10980         * target.cc: Include "elfcpp.h".
10981         (Target::do_calls_non_split): New function.
10982         (Target::match_view): New function.
10983         (Target::set_view_to_nop): New function.
10984         * gold.cc (queue_middle_tasks): Give an error if mixing
10985         split-stack and non-split-stack objects with -r.
10986         * i386.cc (Target_i386::relocate_section): Add
10987         reloc_symbol_changes parameter.
10988         (Target_i386::do_calls_non_split): New function.
10989         * x86_64.cc (Target_x86_64::relocate_section): Add
10990         reloc_symbol_changes parameter.
10991         (Target_x86_64::do_calls_non_split): New function.
10992         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10993         parameter.
10994         * powerpc.cc (Target_powerpc::relocate_section): Add
10995         reloc_symbol_changes parameter.
10996         * sparc.cc (Target_sparc::relocate_section): Add
10997         reloc_symbol_changes parameter.
10998         * configure.ac: Call AM_CONDITIONAL for the default target.
10999         * configure: Rebuild.
11000         * testsuite/Makefile.am (TEST_AS): New variable.
11001         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11002         (check_DATA): Add split_i386 and split_x86_64 files.
11003         (SPLIT_DEFSYMS): Define.
11004         (split_i386_[1234n].o): New targets.
11005         (split_i386_[124]): New targets.
11006         (split_i386_[1234r].stdout): New targets.
11007         (split_x86_64_[1234n].o): New targets.
11008         (split_x86_64_[124]): New targets.
11009         (split_x86_64_[1234r].stdout): New targets.
11010         (MOSTLYCLEANFILES): Add new executables.
11011         * testsuite/split_i386.sh: New file.
11012         * testsuite/split_x86_64.sh: New file.
11013         * testsuite/split_i386_1.s: New file.
11014         * testsuite/split_i386_2.s: New file.
11015         * testsuite/split_i386_3.s: New file.
11016         * testsuite/split_i386_4.s: New file.
11017         * testsuite/split_i386_n.s: New file.
11018         * testsuite/split_x86_64_1.s: New file.
11019         * testsuite/split_x86_64_2.s: New file.
11020         * testsuite/split_x86_64_3.s: New file.
11021         * testsuite/split_x86_64_4.s: New file.
11022         * testsuite/split_x86_64_n.s: New file.
11023         * testsuite/testfile.cc (Target_test): Update relocation_section
11024         function.
11025         * testsuite/Makefile.in: Rebuild.
11026
11027 2009-10-06  Ian Lance Taylor  <iant@google.com>
11028
11029         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11030         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11031         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11032         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11033         the address on ldo_addrs_.
11034         (Target_i386::Relocate::fix_up_ldo): New function.
11035
11036 2009-10-06   Rafael Espindola  <espindola@google.com>
11037
11038         * plugin.cc (add_input_library): New.
11039         (Plugin::load): Add add_input_library to tv.
11040         (Plugin_manager::add_input_file): Add the is_lib argument.
11041         (add_input_file): Update call to Plugin_manager::add_input_file.
11042         (add_input_library): New.
11043         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11044
11045 2009-09-30  Doug Kwan  <dougkwan@google.com>
11046
11047         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11048         symbol and call Symbol::may_need_copy_reloc to determine if
11049         a copy reloc is needed.
11050         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11051         nocopyreloc is given in command line.
11052         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11053         given in command line.
11054         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11055         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11056         of the removed Target_i386::may_need_copy_reloc.
11057         * options.h (copyreloc): New option with default value false.
11058         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11059         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11060         instead of the removed Target_powerpc::may_need_copy_reloc.
11061         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11062         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11063         instead of the removed Target_sparc::may_need_copy_reloc.
11064         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11065         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11066         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11067         instead of the removed Target_x86_64::may_need_copy_reloc.
11068
11069 2009-09-30  Ian Lance Taylor  <iant@google.com>
11070
11071         * object.h (class Object): Remove target_ field, and target,
11072         sized_target, and set_target methods.
11073         (Object::sized_target): Remove.
11074         (class Sized_relobj): Update declarations.  Remove sized_target.
11075         * object.cc (Sized_relobj::setup): Remove target parameter.
11076         Change all callers.
11077         (Input_objects::add_object): Don't do anything with the target.
11078         (make_elf_sized_object): Add punconfigured parameter.  Change all
11079         callers.  Set or test parameter target.
11080         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11081         Change all callers.
11082         * parameters.cc (Parameters::set_target): Change parameter type to
11083         be non-const.
11084         (Parameters::default_target): Remove.
11085         (set_parameters_target): Change parameter type to be non-const.
11086         (parameters_force_valid_target): New function.
11087         (parameters_clear_target): New function.
11088         * parameters.h (class Parameters): Update declarations.  Remove
11089         default_target method.  Add sized_target and clear_target
11090         methods.  Change target_ to be non-const.
11091         (set_parameters_target): Update declaration.
11092         (parameters_force_valid_target): Declare.
11093         (parameters_clear_target): Declare.
11094         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11095         as NULL if we aren't searching.
11096         (Add_symbols::run): Don't check for compatible target.
11097         * fileread.cc (Input_file::open_binary): Call
11098         parameters_force_valid_target.
11099         * gold.cc (queue_middle_tasks): Likewise.
11100         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11101         set_target on object.
11102         * dynobj.h (class Sized_dynobj): Update declarations.
11103         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11104         make_elf_object returns NULL.
11105         (Archive::include_member): Don't check whether object target is
11106         compatible.
11107         * output.cc (Output_section::add_input_section): Get target from
11108         parameters.
11109         (Output_section::relax_input_section): Likewise.
11110         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11111         parameters.
11112         (Sized_relobj::do_scan_relocs): Likewise.
11113         (Sized_relobj::relocate_sections): Likewise.
11114         * resolve.cc (Symbol_table::resolve): Likewise.
11115         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11116         parameter.  Change all callers.
11117         (Symbol_table::add_from_object): Get target from parameters.
11118         (Symbol_table::add_from_relobj): Don't check object target.
11119         (Symbol_table::add_from_dynobj): Likewise.
11120         (Symbol_table::define_special_symbol): Get target from
11121         parameters.
11122         * symtab.h (class Symbol_table): Update declaration.
11123         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11124         parameter.  Change all callers.  Clear parameter target.
11125         (Binary_test): Test target here.
11126         * testsuite/object_unittest.cc (gold_testsuite): Remove
11127         target_test_pointer parameter.  Change all callers.
11128         (Object_test): Test target here.
11129
11130 2009-09-26  Ian Lance Taylor  <iant@google.com>
11131
11132         * testsuite/initpri1.c: Don't try to use constructor priorities if
11133         compiling with gcc before 4.3.
11134
11135 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11136
11137         * testsuite/retain_symbols_file_test.sh (check_present): Change
11138         output file name to retain_symbols_file_test.stdout.
11139         (check_absent): Likewise.
11140
11141 2009-09-18  Craig Silverstein  <csilvers@google.com>
11142
11143         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11144         * options.cc: Include <cerrno> and <fstream>.
11145         (General_options::finalize): Parse -retain-symbols-file tag.
11146         * options.h: New flag.
11147         (General_options): New method should_retain_symbol, new
11148         variable symbols_to_retain.
11149         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11150         should_retain_symbol map.
11151         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11152         * testsuite/Makefile.in: Regenerate.
11153         * testsuite/retain_symbols_file_test.sh: New file.
11154
11155 2009-09-18  Nick Clifton  <nickc@redhat.com>
11156
11157         * po/es.po: Updated Spanish translation.
11158
11159 2009-09-17  Doug Kwan  <dougkwan@google.com>
11160
11161         * debug.h (DEBUG_RELAXATION): New constant.
11162         (DEBUG_ALL): Add DEBUG_RELAXATION.
11163         (debug_string_to_enum): Add relaxation debug option.
11164         * layout.cc
11165         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11166         Layout::Relaxation_debug_check::read_sections,
11167         Layout::Relaxation_debug_check::read_sections): New method definitions.
11168         (Layout::Layout): Initialize data members
11169         record_output_section_data_from_scrips_,
11170         script_output_section_data_list_ and relaxation_debug_check_.
11171         (Layout::save_segments, Layout::restore_segments,
11172         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11173         Layout::relaxation_loop_body): New method definitions.
11174         (Layout::finalize): Support relaxation.  Move section layout code to
11175         Layout::relaxation_loop_body.
11176         (Layout::set_asection_address_from_script): Move code for orphan
11177         section placement out.
11178         (Layout::place_orphan_sections_in_script): New method definition.
11179         * layout.h (Output_segment_headers, Output_file_header):
11180         New forward class declarations.
11181         (Layout::~Layout): Define.
11182         (Layout::new_output_section_data_from_script): New method definition.
11183         (Layout::place_orphan_sections_in_script): New method declaration.
11184         (Layout::Segment_states): New type declaration.
11185         (Layout::save_segments, Layout::restore_segments,
11186         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11187         Layout::relaxation_loop_body): New method declarations.
11188         (Layout::Output_section_data_list): New type declaration.
11189         (Layout::Relaxation_debug_check): New class definition.
11190         (Layout::record_output_section_data_from_script_,
11191         Layout::script_output_section_data_list_, Layout::segment_states_,
11192         Layout::relaxation_debug_check_): New data members.
11193         * output.cc: (Output_section_headers::do_size): New method definition.
11194         (Output_section_headers::Output_section_headers): Move size
11195         computation to Output_section_headers::do_size.
11196         (Output_segment_headers::do_size): New method definition.
11197         (Output_file_header::Output_file_header): Move size computation to
11198         Output_file_header::do_size and call it.
11199         (Output_file_header::do_size): New method definition.
11200         (Output_data_group::Output_data_group): Adjust call to
11201         Output_section_data.
11202         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11203         (Output_symtab_xindex::do_write): Add array bound check.
11204         (Output_section::Input_section::print_to_mapfile): Handle
11205         RELAXED_INPUT_SECTION_CODE.
11206         (Output_section::Output_section): Initialize data member checkpoint_.
11207         (Output_section::~Output_section): Delete checkpoint object pointed
11208         by checkpoint_.
11209         (Output_section::add_input_section): Always add an Input_section if
11210         relaxing.
11211         (Output_section::add_merge_input_section): Add assert.
11212         (Output_section::relax_input_section): New method definition.
11213         (Output_section::set_final_data_size): Set load address to zero for
11214         an unallocated section.
11215         (Output_section::do_address_and_file_offset_have_reset_values):
11216         New method definition.
11217         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11218         Handle relaxed input section.
11219         (Output_section::sort_attached_input_sections): Checkpoint input
11220         section list lazily.
11221         (Output_section::get_input_sections): Change type of input_sections to
11222         list of Simple_input_section pointers.  Checkpoint input section list
11223         lazily.  Also handle relaxed input sections.
11224         (Output_section::add_input_section_for_script): Take a reference to
11225         a Simple_input_section object instead of Relobj pointer and section
11226         index as parameter.  Handle relaxed input sections.
11227         (Output_section::save_states, Output_section::restore_states): New
11228         method definitions.
11229         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11230         (Output_data::is_data_size_fixed): New method definition.
11231         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11232         if it is fixed.
11233         (Output_data::address_and_file_offset_have_reset_values): New method
11234         definition.
11235         (Output_data::do_address_and_file_offset_have_reset_values): New method
11236         definition.
11237         (Output_data::set_data_size): Check that data size is not fixed.
11238         (Output_data::fix_data_size): New method definition.
11239         (Output_data::is_data_size_fixed_): New data member.
11240         (Output_section_headers::set_final_data_size): New method definition.
11241         (Output_section_headers::do_size): New method declaration.
11242         (Output_segment_headers::set_final_data_size): New method definition.
11243         (Output_segment_headers::do_size): New method declaration.
11244         (Output_file_header::set_final_data_size)::New method definition.
11245         (Output_file_header::do_size)::New method declaration.
11246         (Output_section_data::Output_section_data): Add new parameter
11247         is_data_size_fixed and use it to fix data size.
11248         (Output_data_const::Output_data_const): Adjust call to base class
11249         constructor and fix data size.
11250         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11251         base class constructor and fix data size.
11252         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11253         base class constructor and fix data size.
11254         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11255         class constructor and fix data size.
11256         (Output_data_group::set_final_data_size): New method definition.
11257         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11258         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11259         class constructor and fix data size.
11260         (Output_relaxed_input_section): New class definition.
11261         (Output_section::Simple_input_section): New class definition.
11262         (Output_section::get_input_sections): Adjust parameter list.
11263         (Output_section::add_input_section_for_script): Same.
11264         (Output_section::save_states, Output_section::restore_states,
11265         Output_section::do_address_and_file_offset_have_reset_values,
11266         (Output_section::Input_section::Input_section): Handle
11267         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11268         Output_relaxed_input_section.
11269         (Output_section::Input_section::is_input_section,
11270         Output_section::Input_section::set_output_section): Handle relaxed
11271         input section.
11272         (Output_section::Input_section::is_relaxed_input_section,
11273         Output_section::Input_section::output_section_data,
11274         Output_section::Input_section::relaxed_input_section): New method
11275         definitions.
11276         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11277         value.
11278         (Output_section::Input_section::u1_): Update comments.
11279         (Output_section::Input_section::u2_): Add new union member poris.
11280         (Output_section::Checkpoint_output_section): New classs definition.
11281         (Output_section::relax_input_section): New method declaration.
11282         (Output_section::checkpoint_): New data member.
11283         (Output_segment): Update comments.
11284         (Output_segment::Output_segment): Un-privatize copy constructor.
11285         (Output_segment::operator=): Un-privatize.
11286         * script-sections.cc (Output_section_element::Input_section_list):
11287         Change element type to Output_section::Simple_input_section.
11288         (Output_section_element_dot_assignment::set_section_addresses):
11289         Register output section data for relaxation clean up.
11290         (Output_data_exression::Output_data_expression): Adjust call to base
11291         constructor to fix data size.
11292         (Output_section_element_data::set_section_addresses): Register
11293         Output_data_expression object for relaxation clean up.
11294         (struct Input_section_info): Replace Relobj pointer and section index
11295         pair with Output_section::Simple_input_section and Convert struct to a
11296         class.
11297         (Input_section_sorter::operator()): Adjust access to
11298         Input_section_info data member to use accessors.
11299         (Output_section_element_input::set_section_addresses): Use layout
11300         parameter.  Adjust code to use Output_section::Simple_input_section
11301         and Input_secction_info classes.  Register filler for relaxation
11302         clean up.
11303         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11304         and section index pair with Output_section::Simple_input_section
11305         class.  Adjust code accordingly.
11306         (Phdrs_element::release_segment): New method definition.
11307         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11308         segment list.
11309         (Script_sections::release_segments): New method definition.
11310         * gold/script-sections.h (Script_sections::release_segments): New
11311         method declaration.
11312         * gold/target.h (Target::may_relax, Target::relax,
11313         Target::do_may_relax, Target::do_relax): New method definitions.
11314
11315 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11316
11317         * arm.cc (has_signed_unsigned_overflow): New function.
11318         (Arm_relocate_functions::abs8): New function.
11319         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11320         (Target_arm::Scan::global): Likewise.
11321         (Target_arm::relocate::relocate): Likewise.
11322         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11323         Likewise.
11324
11325 2009-09-16  Cary Coutant  <ccoutant@google.com>
11326
11327         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11328         * testsuite/Makefile.in: Regenerate.
11329
11330 2009-09-11  Nick Clifton  <nickc@redhat.com>
11331
11332         * po/gold.pot: Updated by the Translation project.
11333
11334 2009-09-08  Cary Coutant  <ccoutant@google.com>
11335
11336         * output.cc (Output_file::open): Add execute permission to empty file.
11337         * testsuite/Makefile.am (permission_test): New test.
11338         * testsuite/Makefile.in: Regenerate.
11339
11340 2009-09-02  Ian Lance Taylor  <iant@google.com>
11341
11342         * output.cc (Output_file::resize): Call map_no_anonymous rather
11343         than map.
11344
11345 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11346
11347         * gold.cc: Include "incremental.h".
11348         (queue_initial_tasks): Call Incremental_checker methods.
11349         * incremental.cc: Include "output.h".
11350         (Incremental_checker::can_incrementally_link_output_file): New
11351         method.
11352         * incremental.h (Incremental_checker): New class.
11353
11354         * output.cc (Output_file::open_for_modification): New method.
11355         (Output_file::map_anonymous): Changed return type to bool.  Record
11356         map in base_ field.
11357         (Output_file::map_no_anonymous): New method, broken out of map.
11358         (Output_file::map): Use map_no_anonymous and map_anonymous.
11359         * output.h (class Output_file): Update declarations.
11360
11361 2009-08-24  Cary Coutant  <ccoutant@google.com>
11362
11363         * options.h (Command_line::Pre_options): New class.
11364         (Command_line::pre_options): New member.
11365         * options.cc (gold::options::ready_to_register): New variable.
11366         (One_option::register_option): Do nothing if not registering options.
11367         Assert if same short option registered twice.
11368         (General_options::General_options): Turn off option registration when
11369         done constructing.
11370         (Command_line::Pre_options::Pre_options): New constructor.
11371
11372 2009-08-24  Cary Coutant  <ccoutant@google.com>
11373
11374         * options.h (General_options::no_keep_memory): Remove incorrect
11375         short option.
11376
11377 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11378
11379         * Makefile.am (am__skiplex, am__skipyacc): New.
11380         * Makefile.in: Regenerate.
11381
11382 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11383
11384         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11385         (INCLUDES): ... this.
11386         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11387         (AM_CPPFLAGS): Renamed from ...
11388         (INCLUDE): ... this.
11389         * Makefile.in, testsuite/Makefile.in: Regenerate.
11390
11391         * Makefile.in: Regenerate.
11392         * aclocal.m4: Likewise.
11393         * config.in: Likewise.
11394         * configure: Likewise.
11395         * testsuite/Makefile.in: Likewise.
11396
11397         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11398         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11399         * Makefile.in: Regenerate.
11400         * testsuite/Makefile.in: Regenerate.
11401
11402 2009-08-19  Cary Coutant  <ccoutant@google.com>
11403
11404         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11405         symbols in shared libraries overridden by hidden or internal symbols
11406         in the main program.
11407
11408 2009-08-19  Chris Demetriou  <cgd@google.com>
11409
11410         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11411         checking source file names in error messages.
11412
11413 2009-08-18  Doug Kwan  <dougkwan@google.com>
11414
11415         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11416         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11417         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11418         an elfcpp::Ehdr as parameter.
11419         * object.cc (Object::set_target): Remove the version that looks up
11420         a target and sets it.
11421         (Sized_relobj::setup): Take a Target object instead of
11422         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11423         (make_elf_sized_object): Find target and ask target to
11424         make an ELF object.
11425         * object.h: (Object::set_target): Remove the version that looks up
11426         a target and sets it.
11427         (Sized_relobj::setup): Take a Target object instead of
11428         an elfcpp:Ehdr as parameter.
11429         * target.cc: Include dynobj.h.
11430         (Target::do_make_elf_object_implementation): New.
11431         (Target::do_make_elf_object): New.
11432         * target.h (Target::make_elf_object): New template declaration.
11433         (Target::do_make_elf_object): New method declarations.
11434         (Target::do_make_elf_object_implementation): New template declaration.
11435
11436 2009-08-14  Ian Lance Taylor  <iant@google.com>
11437
11438         * gold.h (FUNCTION_NAME): Define.
11439         (gold_unreachable): Use FUNCTION_NAME.
11440
11441 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11442
11443         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11444         symbol in the --keep-unique list is not found.
11445
11446 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11447
11448         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11449         been maked as --keep-unique.
11450         (Icf::unfold_section): New function.
11451         * icf.h (Icf::unfold_section): New function.
11452         * options.h (General_options::keep_unique): New option.
11453         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11454         * testsuite/Makefile.in: Regenerate.
11455         * testsuite/icf_keep_unique_test.sh: New file.
11456         * testsuite/icf_keep_unique_test.cc: New file.
11457
11458 2009-08-12  Cary Coutant  <ccoutant@google.com>
11459
11460         PR 10471
11461         * resolve.cc (Symbol_table::resolve): Check for references from
11462         dynamic objects to hidden and internal symbols.
11463         * testsuite/Makefile.am (hidden_test.sh): New test.
11464         * testsuite/Makefile.in: Regenerate.
11465         * testsuite/hidden_test.sh: New script.
11466         * testsuite/hidden_test_1.c: New test source.
11467         * testsuite/hidden_test_main.c: New test source.
11468
11469 2009-08-11  Doug Kwan  <dougkwan@google.com>
11470
11471         * arm.cc: Update comments.
11472         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11473         segment to locate the .ARM.exidx section if present.
11474
11475 2009-08-09  Doug Kwan  <dougkwan@google.com>
11476
11477         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11478         patch.
11479
11480 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11481         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11482         compiler warnings.
11483
11484 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11485
11486         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11487         valid tls_segment only for non-debug-section relocations.
11488         * testsuite/Makefile.am: Add gc_tls_test.
11489         * testsuite/Makefile.in: Regenerate.
11490         * testsuite/gc_tls_test.cc: New file.
11491         * testsuite/gc_tls_test.sh: New file.
11492
11493 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11494
11495         * icf.cc: New file.
11496         * icf.h: New file.
11497         * Makefile.am (CCFILES): Add icf.cc.
11498         (HFILES): Add icf.h
11499         * Makefile.in: Regenerate.
11500         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11501         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11502         section, symbol and addend information for the relocs.
11503         * gold.cc (queue_middle_tasks): Call identical code folding.
11504         * gold.h: Add defines for multimap.
11505         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11506         to the call of finalize_local_symbols.
11507         * main.cc (main): Create object of class Icf.
11508         * object.cc (Sized_relobj::do_layout): Allow this function to be
11509         called twice during icf.
11510         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11511         to sections marked as identical by icf.
11512         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11513         when available.
11514         (Sized_relobj::do_section_entsize): New function.
11515         * object.h (Object::section_entsize): New function.
11516         (Object::do_section_entsize): New pure virtual function.
11517         (Relobj::finalize_local_symbols): Add new parameter.
11518         (Relobj::do_section_entsize): New function.
11519         * options.h (General_options::icf): New option.
11520         (General_options::icf_iterations): New option.
11521         (General_options::print_icf_sections): New option.
11522         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11523         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11524         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11525         icf.
11526         * symtab.cc (Symbol_table::is_section_folded): New function.
11527         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11528         to sections marked as identical by icf.
11529         * symtab.h (Symbol_table::set_icf): New function.
11530         (Symbol_table::icf): New function.
11531         (Symbol_table::is_section_folded): New function.
11532         (Symbol_table::icf_): New data member.
11533         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11534         * testsuite/Makefile.am: Add commands to build icf_test.
11535         * testsuite/Makefile.in: Regenerate.
11536         * testsuite/icf_test.sh: New file.
11537         * testsuite/icf_test.cc: New file.
11538
11539 2009-07-24  Chris Demetriou  <cgd@google.com>
11540
11541         * layout.cc (is_compressible_debug_section): Fix incorrect
11542         comment about compressed section names.
11543
11544 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11545
11546         PR 10419
11547         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11548
11549 2009-07-16  Ian Lance Taylor  <iant@google.com>
11550
11551         PR 10400
11552         * layout.h: #include <map>.
11553         (class Kept_section): Change from struct to class.  Add accessors
11554         and setters.  Add section size to Comdat_group mapping.  Change
11555         Comdat_group to std::map.  Add is_comdat_ field.  Add
11556         linkonce_size field in union.
11557         (class Layout): Update declaration of find_or_add_kept_section.
11558         Don't declare find_kept_object.
11559         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11560         parameter.  Add object, shndx, is_comdat, and is_group_name
11561         parameters.  Change all callers.  Adjust for new Kept_section.
11562         (Layout::find_kept_object): Remove.
11563         * object.cc (Sized_relobj::include_section_group): Update use of
11564         Kept_section.  Rename secnum to shndx.  Only record
11565         Kept_comdat_section if sections are the same size.
11566         (Sized_relobj::include_linkonce_section): Update use of
11567         Kept_section.  Only record Kept_comdat_section if sections are the
11568         same size.  Set size of linkonce section.
11569         (Sized_relobj::map_to_kept_section): Update call to
11570         get_kept_comdat_section.
11571         * object.h (class Sized_relobj): Rename fields in
11572         Kept_comdat_section to drop trailing underscores; change object
11573         field to Relobj*.  Change Kept_comdat_section_table to store
11574         struct rather than pointer.
11575         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11576         Add kept_object and kept_shndx parameters.  Change all callers.
11577         (Sized_relobj::get_kept_comdat_section): Change return type to
11578         bool.  Add kept_object and kept_shndx parameters.  Change all
11579         callers.
11580         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11581         Layout::find_or_add_kept_section.
11582
11583 2009-07-09  Ian Lance Taylor  <iant@google.com>
11584
11585         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11586         Reserve space in the hash table.
11587
11588 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11589
11590         * fileread.cc (File_read::get_mtime): New method.
11591         * fileread.h (Timespec): New structure.
11592         (File_read::get_mtime): New method.
11593         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11594         Renamed from timestamp_nsec.
11595         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11596         Elf_Xword.
11597         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11598         timestamp_nsec.
11599         (Incremental_inputs::report_archive): Save mtime; style fix.
11600         (Incremental_inputs::report_obejct): Save mtime; style fix.
11601         (Incremental_inputs::report_script): Save mtime; style fix.
11602         (Incremental_inputs::finalize_inputs): Style fix.
11603         (Incremental_inputs::finalize): Style fix.
11604         (Incremental_inputs::create_input_section_data): Store inputs
11605         mtime.
11606         * incremental.h (Incremental_inputs::report_script): Add mtime
11607         argument.
11608         (Incremental_inputs::Input_info::Input_info): Intialize only one
11609         union member.
11610         (Incremental_inputs::Input_info::archive): Move to nameless
11611         union.
11612         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11613         (Incremental_inputs::Input_info::script): Move to nameless union.
11614         (Incremental_inputs::mtime): New field.
11615         * script.cc (read_input_script): Pass file mtime to
11616         Incremental_input.
11617         * script.h (Script_info::inputs): Style fix.
11618
11619 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11620
11621         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11622         instead of 32.
11623
11624 2009-06-24  Ian Lance Taylor  <iant@google.com>
11625
11626         PR 10156
11627         * layout.cc (Layout::choose_output_section): If we find an
11628         existing section, update the flags.
11629         (Layout::create_notes): New function, broken out of
11630         Layout::finalize.
11631         (Layout::finalize): Don't create note sections.
11632         (Layout::create_note): Don't crash if linker script discards
11633         section.
11634         (Layout::create_gold_note): Likewise.
11635         (Layout::create_build_id): Likewise.  Don't set
11636         after_input_sections on the section.
11637         (Layout::create_executable_stack_info): Remove target parameter.
11638         Change caller.
11639         * layout.h (class Layout): Declare create_notes.  Update
11640         declaration of create_executable_stack_info.
11641         * gold.cc (queue_middle_tasks): Call create_notes.
11642         * output.cc (Output_section::update_flags_for_input_section): Move
11643         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11644         invalid.
11645         * output.h (Output_data::mark_address_invalid): New function.
11646         (class Output_section): Only declare, not define,
11647         update_flags_for_input_section.  Remove set_flags.
11648
11649 2009-06-24  Ian Lance Taylor  <iant@google.com>
11650
11651         * script-sections.cc (Output_section_definition::
11652         set_section_addresses): Rename shadowing local load_address to
11653         laddr.
11654
11655 2009-06-24  Ian Lance Taylor  <iant@google.com>
11656
11657         PR 10244
11658         * reloc.cc (relocate_sections): Skip empty relocation sections.
11659
11660 2009-06-23  Ian Lance Taylor  <iant@google.com>
11661
11662         PR 10156
11663         * layout.cc (Layout::create_note): Use choose_output_section
11664         rather than make_output_section.
11665
11666 2009-06-23  Ian Lance Taylor  <iant@google.com>
11667
11668         PR 10237
11669         * options.cc (General_options::parse_V): Set printed_version_.
11670         (General_options::General_options): Initialize printed_version_.
11671         * options.h (class General_options): Add printed_version_ field.
11672         * gold.cc (queue_initial_tasks): If there are no input files,
11673         don't give a fatal error if we printed the version information.
11674         (queue_middle_tasks): If using -r with a shared object, give a
11675         fatal error rather than an ordinary error.
11676
11677 2009-06-23  Ian Lance Taylor  <iant@google.com>
11678
11679         PR 10219
11680         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11681         (Layout::make_output_section): Set have_stabstr_section_ if we see
11682         a .stab*str section.
11683         (Layout::finalize): Call link_stabs_sections.
11684         (Layout::link_stabs_sections): New file.
11685         * layout.h (class Layout): Add have_stabstr_section_ field.
11686         Declare link_stabs_sections.
11687
11688 2009-06-23  Doug Kwan  <dougkwan@google.com>
11689
11690         * Makefile.am (libgold_a_LIBADD): New.
11691         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11692         * Makefile.in: Regenerate.
11693         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11694         * configure: Regenerate.
11695         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11696         * fileread.cc: Include sys/state.h
11697         * gold.h: Declare memmem and strndup if found missing.
11698         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11699
11700 2009-06-23  Ian Lance Taylor  <iant@google.com>
11701
11702         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11703         * configure: Rebuild.
11704
11705 2009-06-23  Ian Lance Taylor  <iant@google.com>
11706
11707         PR 10147
11708         * object.cc (Object::section_contents): Don't try to get a view if
11709         the section has length zero.
11710         (Object::handle_gnu_warning_section): If the section is empty, use
11711         the name of the section as the warning.
11712
11713 2009-06-23  Ian Lance Taylor  <iant@google.com>
11714
11715         PR 10133
11716         * stringpool.h (class Stringpool_template): Add optimize_ field.
11717         (Stringpool_template::set_optimize): New function.
11718         * stringpool.cc (Stringpool_template::Stringpool_template):
11719         Initialize optimize_ field.
11720         (Stringpool_template::set_string_offsets): Test local optimize
11721         fild rather than parameter.
11722         * layout.cc (Layout::Layout): Call set_optimize on the section
11723         name stringpool.
11724
11725 2009-06-22  Ian Lance Taylor  <iant@google.com>
11726
11727         PR 10030
11728         * yyscript.y: Parse TARGET.
11729         * script.cc (script_set_target): New function.
11730         * script-c.h (script_set_target): Declare.
11731         * options.cc (General_options::string_to_object_format): Rename
11732         from string_to_object_format in anonymous namespace.  Change
11733         callers.
11734         * options.h (class General_options): Declare
11735         string_to_object_format.
11736
11737 2009-06-22  Ian Lance Taylor  <iant@google.com>
11738
11739         * script-sections.cc (Script_sections::create_segments): Don't put
11740         program headers in a PT_LOAD segment if -n or -N.
11741
11742 2009-06-22  Ian Lance Taylor  <iant@google.com>
11743
11744         PR 10141
11745         * options.h (class General_options): Add -z lazy and -z now.  Sort
11746         -z options into alphabetical order.
11747         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11748
11749 2009-06-21  Ian Lance Taylor  <iant@google.com>
11750
11751         * layout.cc (Layout::make_output_section): Call
11752         Target::new_output_section.
11753         (Layout::attach_allocated_section_to_segment): Put large section
11754         sections in a separate load segment with the large segment flag
11755         set.
11756         (Layout::segment_precedes): Sort large data segments after other
11757         load segments.
11758         (align_file_offset): New static function.
11759         (Layout::set_segment_offsets): Use align_file_offset.
11760         * output.h (class Output_section): Add is_small_section_ and
11761         is_large_section_ fields.
11762         (Output_section::is_small_section): New function.
11763         (Output_section::set_is_small_section):  New function.
11764         (Output_section::is_large_section): New function.
11765         (Output_section::set_is_large_section): New function.
11766         (Output_section::is_large_data_section): New function.
11767         (class Output_segment): Add is_large_data_segment_ field.
11768         (Output_segment::is_large_data_segment): New function.
11769         (Output_segment::set_is_large_data_segment): New function.
11770         * output.cc (Output_section::Output_section): Initialize new
11771         fields.
11772         (Output_segment::Output_segment): Likewise.
11773         (Output_segment::add_output_section): Add assertion that large
11774         data sections always go in large data segments.  Force small data
11775         sections to the end of the list of data sections.  Force small BSS
11776         sections to the start of the list of BSS sections.  For large BSS
11777         sections to the end of the list of BSS sections.
11778         * symtab.h (class Symbol): Declare is_common_shndx.
11779         (Symbol::is_defined): Check Symbol::is_common_shndx.
11780         (Symbol::is_common): Likewise.
11781         (class Symbol_table): Define enum Commons_section_type.  Update
11782         declarations.  Add small_commons_ and large_commons_ fields.
11783         * symtab.cc (Symbol::is_common_shndx): New function.
11784         (Symbol_table::Symbol_table): Initialize new fields.
11785         (Symbol_table::add_from_object): Put small and large common
11786         symbols in the right list.
11787         (Symbol_table::sized_finalized_symbol): Check
11788         Symbol::is_common_shndx.
11789         (Symbol_table::sized_write_globals): Likewise.
11790         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11791         common symbol lists.  Don't call do_allocate_commons_list if the
11792         list is empty.
11793         (Symbol_table::do_allocate_commons_list): Remove is_tls
11794         parameter.  Add comons_section_type parameter.  Change all
11795         callers.  Handle small and large common symbols.
11796         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11797         Symbol::is_common_shndx.
11798         * resolve.cc (symbol_to_bits): Likewise.
11799         * target.h (Target::small_common_shndx): New function.
11800         (Target::small_common_section_flags): New function.
11801         (Target::large_common_shndx): New function.
11802         (Target::large_common_section_flags): New function.
11803         (Target::new_output_section): New function.
11804         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11805         small_common_section_flags, and large_common_section_flags
11806         fields.
11807         (Target::do_new_output_section): New virtual function.
11808         * arm.cc (Target_arm::arm_info): Initialize new fields.
11809         * i386.cc (Target_i386::i386_info): Likewise.
11810         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11811         Likewise.
11812         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11813         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11814         (Target_x86_64::do_new_output_section): New function.
11815         * configure.ac: Define conditional MCMODEL_MEDIUM.
11816         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11817         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11818         (large_LDFLAGS): Define.
11819         * testsuite/large.c: New file.
11820         * testsuite/testfile.cc (Target_test::test_target_info):
11821         Initialize new fields.
11822         * configure, testsuite/Makefile.in: Rebuild.
11823
11824 2009-06-05  Doug Kwan  <dougkwan@google.com>
11825
11826         * Makefile.am (CCFILES): Add target.cc.
11827         * Makefile.in: Regenerate.
11828         * i386.cc (class Target_i386): Define new virtual method to
11829         override do_is_local_label_name in parent.
11830         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11831         local symbols if --discard-locals or -X is given.
11832         * options.h (class General_options): Declare new options
11833         '--discard-locals' and '-X' for discarding locals.
11834         * target.h (class Target): Define new methods is_local_label_name.
11835         Declare new virtual method do_is_local_label_name.
11836         * target.cc: New file.
11837         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11838         (check_SCRIPTS): Add discard_locals_test.sh.
11839         (check_DATA): Add discard_local_tests.syms.
11840         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11841         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11842         * testsuite/Makefile.in: Regenerate.
11843         * testsuite/discard_locals_test.c: New file.
11844         * testsuite/discard_locals_test.sh: Same.
11845
11846 2009-06-05  Doug Kwan  <dougkwan@google.com>
11847
11848         * object.cc (Sized_relobj::Sized_relobj): Initialize
11849         discarded_eh_frame_shndx_ to -1U.
11850         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11851         section.
11852         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11853         a discarded .eh_frame section.
11854         (Sized_relobj::do_finalize_local_symbols): Ditto.
11855         * object.h (class Sized_relobj): Declare new member
11856         discarded_eh_frame_shndx_.
11857         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11858         (local_labels_test.o, local_labels_test): New rules.
11859         * testsuite/Makefile.in: Regenerate.
11860
11861 2009-06-04  Doug Kwan  <dougkwan@google.com>
11862
11863         * layout.cc (Layout::section_name_mapping): Add mapping for
11864         special ARM sections.
11865
11866 2009-06-03  Doug Kwan  <dougkwan@google.com>
11867
11868         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11869         (utils::has_overflow): Same.
11870
11871 2009-06-03  Ian Lance Taylor  <iant@google.com>
11872
11873         * layout.cc (Layout::section_name_mapping): New array, replacing
11874         Layout::linkonce_mapping.
11875         (Layout::section_name_mapping_count): New variable, replacing
11876         Layout::linkonce_mapping_count.
11877         (Layout::linkonce_output_name): Remove.
11878         (Layout::output_section_name): Rewrite.
11879         * layout.h (class Layout): Rename Linkonce_mapping to
11880         Section_name_mapping, linkonce_mapping to section_name_mapping,
11881         linkonce_mapping_count to section_name_mapping_count.  Don't
11882         declare linkonce_output_name.
11883
11884 2009-06-03  Doug Kwan  <dougkwan@google.com>
11885
11886         * gold/arm.cc (namespace utils): New.
11887         (Target_arm::reloc_is_non_pic): Define new method.
11888         (class Arm_relocate_functions): New.
11889         (Target_arm::Relocate::relocate): Handle relocation types used by
11890         Android.
11891
11892 2009-06-03  Ian Lance Taylor  <iant@google.com>
11893
11894         * arm.cc (Target_arm::scan::global): Use || instead of |.
11895
11896 2009-06-02  Doug Kwan  <dougkwan@google.com>
11897
11898         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11899         issued_non_pic_error_.
11900         (class Target_arm::Scan): Declare new method check_non_pic.
11901         Define new method symbol_needs_plt_entry.
11902         Declare new data member issued_non_pic_error_.
11903         (class Target_arm::Relocate): Declare new method
11904         should_apply_static_reloc.
11905         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11906         (Target_arm::Scan::check_non_pic): Define new method.
11907         (Target_arm::Scan::local): Handle a small subset of reloc types used
11908         by Android.
11909         (Target_arm::Scan::local): Same.
11910         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11911
11912 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11913
11914         * incremental.cc (Incremental_inputs::report_command_line): Filter
11915         out --incremental-* options.
11916
11917 2009-05-29  Doug Kwan  <dougkwan@google.com>
11918
11919         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11920         template class.
11921         (class Target_arm): Update comment.
11922         (Target_arm::Target_arm): Initialize new data members GOT_,
11923         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11924         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11925         and Target_arm::rel_dyn_section.
11926         Declare new_enum Target_arm::Got_type.
11927         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11928         and DYNBSS_.
11929         Update commments for member do_dynsym_value.
11930         (Target_arm::got_size, Target_arm::plt_section,
11931         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11932         new methods inside class defintion.
11933         (Target_arm::got_section): Define new method.
11934         (Target_arm::rel_dyn_section): Same.
11935         (Output_data_plt_arm): New template class.
11936         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11937         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11938         (Output_data_plt_arm::add_entry): Same.
11939         (Output_data_plt_arm::first_plt_entry): Define new
11940         static data member for PLT instruction template.
11941         (Output_data_plt_arm::plt_entry): Same.
11942         (Output_data_plt_arm::do_write): Define new method.
11943         (Target_arm::make_plt_entry): Same.
11944         (Target_arm::do_finalize_sections): Same.
11945         (Target_arm::do_dynsym_value): Same.
11946
11947 2009-05-28  Doug Kwan  <dougkwan@google.com>
11948
11949         * Makefile.am (TARGETSOURCES): Add arm.cc.
11950         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11951         * Makefile.in: Regenerate.
11952         * arm.cc: New file.
11953         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11954
11955 2009-05-26  Doug Kwan  <dougkwan@google.com>
11956
11957         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11958         (General_options::check_excluded_libs): Strip off directories in
11959         archive name before matching like GNU ld does.
11960         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11961         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11962         (exclude_libs_test_LDFLAGS): Add linker option
11963         -Wl,--exclude-libs,libexclude_libs_test_3
11964         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11965         an explicit archive without using -l.
11966         (alt/libexclude_libs_test_3.a): New make rule.
11967         * testsuite/Makefile.in: Regenerate.
11968         * testsuite/exclude_libs_test.c : Declare lib3_default().
11969         (main): Call it.
11970         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11971         * exclude_libs_test_3.c: New file.
11972
11973 2009-05-26  Nick Clifton  <nickc@redhat.com>
11974
11975         * po/id.po: New Indonesian translation.
11976         * po/gold.pot: Updated template file.
11977
11978 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11979
11980         * testsuite/Makefile.am: Add -ffunction-sections to compile
11981         gc_comdat_test files.  Add -Wl,--gc-sections to build
11982         gc_comdat_test.
11983         * testsuite/Makefile.in: Regenerate.
11984         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11985
11986 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11987
11988         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11989         kept comdat section was garbage collected.
11990         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11991         * testsuite/Makefile.in: Regenerate.
11992         * testsuite/gc_comdat_test.sh: New file.
11993         * testsuite/gc_comdat_test_1.cc: New file.
11994         * testsuite/gc_comdat_test_2.cc: New file.
11995
11996 2009-05-19  Doug Kwan  <dougkwan@google.com>
11997
11998         * archive.cc (Archive::Archive): Move constructor from archive.h
11999         to here.  Initialize no_export_.
12000         (Archive::get_elf_object_for_member): Set no_export flag of object.
12001         * archive.h (Archive::Archive): Move constructor body to
12002         archive.cc.
12003         (Archive::no_export): New method.
12004         (Archive::no_export_): New field.
12005         * object.h (Object::Object): Initialize no_export_ to false.
12006         (Object::no_export, Object::set_no_export): New methods.
12007         (Object::no_export_): New field.
12008         * options.cc (General_options::parse_exclude_libs): New method.
12009         (General_options::check_excluded_libs) Same.
12010         * options.h (exclude_libs): New option.
12011         (General_options::check_excluded_libs): New method declaration.
12012         (General_options::excluded_libs_): New field.
12013         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12014         default or protected visibility if an object has no-export flag set.
12015         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12016         (check_SCRIPTS): Add exclude_libs_test.sh.
12017         (check_DATA): Add exclude_libs_test.syms.
12018         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12019         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12020         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12021         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12022         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12023         libexclude_libs_test_2.a): New rules.
12024         * testsuite/Makefile.in: Regenerate.
12025         * testsuite/exclude_libs_test.c: New file.
12026         * testsuite/exclude_libs_test.sh: Ditto.
12027         * testsuite/exclude_libs_test_1.c: Ditto.
12028         * testsuite/exclude_libs_test_2.c: Ditto.
12029
12030 2009-05-15  Ian Lance Taylor  <iant@google.com>
12031
12032         * configure.ac: Check for declarations for cases where libiberty.h
12033         checks HAVE_DECL_xxx.
12034         * configure, config.in: Rebuild.
12035
12036 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12037
12038         * gold.h (Incremental_argument_list): Remove (invalid) forward
12039         declaration.
12040         * incremental.cc (Incremental_inputs::report_achive): New method.
12041         (Incremental_inputs::report_object): New method.
12042         (Incremental_inputs::report_script): New method.
12043         (Incremental_inputs::finalize_inputs): New method.
12044         (Incremental_inputs::finalize): Call finalize_inputs().
12045         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12046         Create inputs entries.
12047         * incremental.h (Incremental_input_type): New enum.
12048         (Incremental_inputs::Incremental_input): Initialize new fields.
12049         (Incremental_inputs::report_inputs): New method.
12050         (Incremental_inputs::report_achive): New method.
12051         (Incremental_inputs::report_object): New method.
12052         (Incremental_inputs::report_script): New method.
12053         (Incremental_inputs::finalize_inputs): New method.
12054         (Incremental_inputs::Input_info): New struct.
12055         (Incremental_inputs::Input_info_map): New typedef.
12056         (Incremental_inputs::lock_): New field.
12057         (Incremental_inputs::Inputs_): New field.
12058         (Incremental_inputs::Inputs_map): New field.
12059         * main.cc (main): Call Incremental_input::report_inputs.
12060         * options.h (Input_argument_list): Typedef moved from
12061         Input_arguments.
12062         (Input_file_group::Files): Remove, use ::Input_argument_list.
12063         (Input_file_group::Input_argument_list): Remove, use
12064         ::Input_argument_list.
12065         * plugin.cc (Plugin_manager::add_input_file): Add error in
12066         incremental build.
12067         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12068         functions.
12069         * script.cc (read_input_script): Call
12070         Incremental_input::report_script.
12071         * script.h (Script_info): New class.
12072
12073 2009-04-27  Ian Lance Taylor  <iant@google.com>
12074
12075         * x86_64.cc (do_adjust_output_section): Set entsize to
12076         plt_entry_size.
12077
12078 2009-04-23  Elliott Hughes  <enh@google.com>
12079
12080         * output.cc (Output_file::close): After short writes, continue
12081         writing from the correct offset in the buffer being written.
12082
12083 2009-04-23  Chris Demetriou  <cgd@google.com>
12084
12085         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12086         * configure: Regenerate.
12087         * config.in: Regenerate.
12088         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12089         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12090
12091 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12092
12093         * incremental.cc (Incremental_inputs_header_data): Renamed from
12094         Incremental_input_header_data.
12095         (Incremental_inputs_header_data::data_size): New field.
12096         (Incremental_inputs_header_data::put_input_file_count): Renamed
12097         from input_file_count.
12098         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12099         from command_line_offset.
12100         (Incremental_inputs_header_data::put_reserved): Renamed from
12101         put_reserved.
12102         (Incremental_inputs_entry_data): Renamed from
12103         Incremental_input_entry_data.
12104         (Incremental_inputs_entry_data::data_size): New field.
12105         (Incremental_inputs::report_command_line): New method.
12106         (Incremental_inputs::finalize): New method.
12107         (Incremental_inputs::create_incremental_inputs_data): New method.
12108         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12109         * incremental.h: New file.
12110         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12111         (Layout::finalize): Create incremental inputs section in
12112         incremental builds.
12113         (Layout::create_incremental_info_sections): New method.
12114         * layout.h (Layout::incremental_inputs): New method.
12115         (Layout::create_incremental_info_sections): New method.
12116         (Layout::incremental_inputs_): New field.
12117         * main.cc (main): Notify Incremental_input of the command line.
12118
12119 2009-04-01  Ian Lance Taylor  <iant@google.com>
12120             Mikolaj Zalewski  <mikolajz@google.com>
12121
12122         * gold.h (reserve_unordered_map): Define, three versions, one for
12123         each version of Unordered_map.
12124         * layout.cc (Layout::Layout): Remove options parameter.  Add
12125         number_of_input_files parameter.  Don't initialize options_.
12126         Initialize number_of_input_files_ and resized_signatures_.  Move
12127         sections_are_attached_.
12128         (Layout::layout_group): Reserve space for group_signatures_.
12129         (Layout::find_or_add_kept_section): Change name parameter to be a
12130         reference.  Resize signatures_ map when it gets large enough.
12131         (Layout::layout_eh_frame): Use parameters->options() instead of
12132         this->options_.
12133         (Layout::make_output_section): Likewise.
12134         (Layout::attach_allocated_section_to_segment): Likewise.
12135         (Layout::finalize, Layout::create_executable_stack): Likewise.
12136         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12137         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12138         * layout.h (class Layout): Update declarations.  Remove options_
12139         field.  Add number_of_input_files_ and resized_signatures_
12140         fields.  Move sections_are_attached_ field.
12141         * main.cc (main): Pass number of input files to Layout
12142         constructor.  Don't pass options.
12143
12144 2009-03-30  Ian Lance Taylor  <iant@google.com>
12145
12146         * ffsll.c (ffsll): Correct implementation.
12147
12148 2009-03-27  Ian Lance Taylor  <iant@google.com>
12149
12150         * ffsll.c: New file.
12151         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12152         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12153         * ftruncate.c (ftruncate): Declare before definition.
12154         * mremap.c (mremap): Likewise.
12155         * pread.c (pread): Likewise.
12156         * configure, Makefile.in, config.in: Rebuild.
12157
12158         * mremap.c: New file.
12159         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12160         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12161         (mremap): Declare if HAVE_MREMAP is not defined.
12162         * configure, Makefile.in, config.in: Rebuild.
12163
12164 2009-03-27  Cary Coutant  <ccoutant@google.com>
12165
12166         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12167         position independent.
12168         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12169         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12170
12171 2009-03-24  Cary Coutant  <ccoutant@google.com>
12172
12173         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12174         an executable.
12175         (needs_dynamic_reloc): Likewise.
12176
12177 2009-03-24  Ian Lance Taylor  <iant@google.com>
12178
12179         * yyscript.y (file_cmd): Recognize EXTERN.
12180         (extern_name_list, extern_name_list_body): New nonterminals.
12181         * script.cc (script_add_extern): Define.
12182         * script-c.h (script_add_extern): Declare.
12183
12184 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12185
12186         * object.cc (is_elf_object): Define.
12187         * object.h (is_elf_object): Declare.
12188         * archive.cc (Archive::get_elf_object_for_member): Call
12189         is_elf_object.
12190         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12191
12192 2009-03-24  Elliott Hughes  <enh@google.com>
12193
12194         * output.cc (Output_file::map_anonymous): Define.
12195         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12196         try an anonymous one.  Report the size if the mmap fails.
12197         * output.h (class Output_file): Declare map_anonymous.
12198
12199 2009-03-24  Ian Lance Taylor  <iant@google.com>
12200
12201         * target-select.cc (instantiate_target): Don't acquire the lock if
12202         the instantiated_target_ field has already been set.
12203
12204 2009-03-23  Ian Lance Taylor  <iant@google.com>
12205
12206         * gold-threads.h (class Initialize_lock): Define.
12207         * gold-threads.cc (class Initialize_lock_once): Define.
12208         (initialize_lock_control): New static variable.
12209         (initialize_lock_pointer): New static variable.
12210         (initialize_lock_once): New static function.
12211         (Initialize_lock::Initialize_lock): Define.
12212         (Initialize_lock::initialize): Define.
12213         * target-select.h: Include "gold-threads.h".
12214         (class Target_selector): Add lock_ and initialize_lock_ fields.
12215         Don't define instantiate_target, just declare it.
12216         * target-select.cc (Target_selector::Target_selector): Initialize
12217         new fields.
12218         (Target_selector::instantiate_target): Define.
12219         * descriptors.h: Include "gold-threads.h".
12220         (class Descriptors): Add initialize_lock_ field.
12221         * descriptors.cc (Descriptors::Descriptors): Initialize new
12222         field.
12223         (Descriptors::open): Use initialize_lock_ field
12224         * errors.h (class Errors): Add initialize_lock_ field.
12225         * errors.cc (Errors::Errors): Initialize new field.
12226         (Errors::initialize_lock): Use initialize_lock_ field.
12227         * powerpc.cc (class Target_selector_powerpc): Remove
12228         instantiated_target_ field.  In do_recognize call
12229         instantiate_target rather than do_instantiate_target.  In
12230         do_instantiate_target just allocate a new target.
12231         * sparc.cc (class Target_selector_sparc): Likewise.
12232
12233         * freebsd.h: New file.
12234         * i386.cc: Include "freebsd.h".
12235         (Target_i386): Derive from Target_freebsd rather than
12236         Sized_target.
12237         (Target_selector_i386): Derive from Target_selector_freebsd rather
12238         than Target_selector.
12239         * x86_64.cc: Include "freebsd.h".
12240         (Target_x86_64): Derive from Target_freebsd rather than
12241         Sized_target.
12242         (Target_selector_x86_64): Derive from Target_selector_freebsd
12243         rather than Target_selector.
12244         * target.h (class Target): Add adjust_elf_header and
12245         do_adjust_elf_header.
12246         * output.cc (Output_file_header:: do_sized_write): Call target
12247         adjust_elf_header routine.
12248         * configure.tgt: Set targ_osabi.
12249         * configure.ac: Define GOLD_DEFAULT_OSABI.
12250         * parameters.cc (Parameters::default_target): Pass
12251         GOLD_DEFAULT_OSABI to select_target.
12252         * target-select.h (class Target_selector): Make instantiate_target
12253         protected rather than private.
12254         * Makefile.am (HFILES): Add freebsd.h.
12255         * configure, Makefile.in, config.in: Rebuild.
12256
12257         * merge.cc (do_add_input_section): Correct pend value.  Change
12258         message about last entry not being null terminated from error to
12259         warning.
12260
12261 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12262
12263         * incremental.cc: New file.
12264         * Makefile.am (CCFILES): Add incremental.cc.
12265         * Makefile.in: Rebuild.
12266
12267 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12268
12269         * layout.cc (Layout::output_section_name): Preserve names
12270         of '.note.' sections.
12271
12272 2009-03-19  Ian Lance Taylor  <iant@google.com>
12273
12274         * descriptors.cc (Descriptors::open): Check that the options are
12275         valid before using them.
12276
12277 2009-03-18  Ian Lance Taylor  <iant@google.com>
12278
12279         * script-sections.h: Include <list>.
12280         (class Script_sections): Change Sections_elements from std::vector
12281         to std::list.  Typedef public Elements_iterator.  Add
12282         orphan_section_placement_, data_segment_align_start_, and
12283         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12284         field.
12285         * script-sections.cc (class Orphan_section_placement): New class.
12286         (class Sections_element): Add virtual functions is_relro and
12287         orphan_section_init.  Remove virtual function place_orphan_here.
12288         (class Output_section_definition): Add is_relro and
12289         orphan_section_init.  Remove place_orphan_here.
12290         (class Orphan_output_section): Likewise.
12291         (Script_sections::Script_sections): Update for field changes.
12292         (Script_sections::data_segment_align): Set saw_data_segment_align_
12293         and data_segment_align_start_, not data_segment_align_index.
12294         (Script_sections::data_segment_relro_end): Check
12295         saw_data_segment_align_.  Use data_segment_align_start_ rather
12296         than data_segment_align_index_.
12297         (Script_sections::place_orphan): Rewrite to use
12298         Orphan_section_placement.
12299
12300 2009-03-17  Ian Lance Taylor  <iant@google.com>
12301
12302         * archive.cc (Archive::add_symbols): Check for a version attached
12303         to the symbol name in the archive map.
12304         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12305         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12306         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12307         (ver_test_11.a): New target.
12308         * testsuite/Makefile.in: Rebuild.
12309
12310         * configure.ac: Check for chsize and posix_fallocate.  Replace
12311         ftruncate.
12312         * ftruncate.c: New file, from gnulib.
12313         * output.cc (posix_fallocate): Define dummy version if not
12314         HAVE_POSIX_FALLOCATE.
12315         (Output_file::map): Call posix_fallocate rather than lseek and
12316         write.
12317         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12318         * configure, Makefile.in, config.in: Rebuild.
12319
12320 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12321
12322         * layout.h (Layout::create_note): Add section_name parameter.
12323         * layout.cc (Layout::create_note): Likewise.
12324         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12325
12326 2009-03-17  Ian Lance Taylor  <iant@google.com>
12327
12328         * descriptors.cc: Include "options.h".
12329         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12330         (Descriptors::open): Always use O_CLOEXEC when opening a new
12331         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12332         then set FD_CLOEXEC.
12333
12334         * sparc.cc (class Target_sparc): Add has_got_section.
12335         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12336         make sure we have a GOT section.
12337
12338         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12339         (Target_sparc::Scan::local): Likewise.
12340         (Target_sparc::Scan::global): Likewise.
12341         (Target_sparc::Relocate::relocate): Likewise.
12342         (Target_sparc::Relocate::relocate_tls): Likewise.
12343
12344         * symtab.cc (Symbol_table::define_default_version): New function,
12345         broken out of add_from_object.
12346         (Symbol_table::add_from_object): Call define_default_version.
12347         (Symbol_table::define_special_symbol): Add resolve_oldsym
12348         parameter.  Change all callers.  If the version for a symbol comes
12349         from a version script, resolve it with the symbol with the same
12350         name with no version.  Also add the symbol without a version if
12351         appropriate.
12352         (do_define_in_output_data): If resolving with oldsym, don't delete
12353         sym.
12354         (do_define_in_output_segment): Likewise.
12355         (do_define_as_constant): Likewise.
12356         * symtab.h (class Symbol_table): Update declarations.
12357
12358 2009-03-13  Ian Lance Taylor  <iant@google.com>
12359
12360         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12361         (Read_symbols::requeue): New function.
12362         (Read_symbols::do_read_symbols): If make_elf_object fails because
12363         the target type is not configured, and the file was searched for,
12364         issue a warning and retry with the next directory.
12365         (Add_symbols::run): If the file has an incompatible format, and
12366         it was searched for, requeue the Read_symbols task.  On error,
12367         release the object.
12368         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12369         dirindex parameter to constructor.  Change all callers.  Declare
12370         incompatible_warning and requeue.
12371         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12372         input_argument_ and input_group_ fields.  Add them to
12373         constructor.  Change all callers.
12374         (class Read_script): Add dirindex_ field.  Add it to constructor.
12375         Change all callers.
12376         * archive.cc (Archive::setup): Remove input_objects parameter.
12377         Change all callers.
12378         (Archive::get_file_and_offset): Likewise.
12379         (Archive::read_all_symbols): Likewise.
12380         (Archive::read_symbols): Likewise.
12381         (Archive::get_elf_object_for_member): Remove input_objects
12382         parameter.  Add punconfigured parameter.  Change all callers.
12383         (Archive::add_symbols): Change return type to bool.  Check return
12384         value of include_member.
12385         (Archive::include_all_members): Likewise.
12386         (Archive::include_member): Change return type to bool.  Return
12387         false if first included object has incompatible target.  Set
12388         included_member_ field.
12389         (Add_archive_symbols::run): If add_symbols returns false, requeue
12390         Read_symbols task.
12391         * archive.h (class Archive): Add included_member_ field.
12392         Initialize it in constructor.  Add input_file and searched_for
12393         methods.  Update declarations.
12394         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12395         input_argument_ fields.  Add them to constructor.  Change all
12396         callers.
12397         * script.cc: Include "target-select.h".
12398         (class Parser_closure): Add skip_on_incompatible_target_ and
12399         found_incompatible_target_ fields.  Add
12400         skip_on_incompatible_target parameter to constructor.  Change all
12401         callers.  Add methods skip_on_incompatible_target,
12402         clear_skip_on_incompatible_target, found_incompatible_target, and
12403         set_found_incompatible_target.
12404         (read_input_script): Add dirindex parameter.  Change all callers.
12405         If parser finds an incompatible target, requeue Read_symbols
12406         task.
12407         (script_set_symbol): Clear skip_on_incompatible_target in
12408         closure.
12409         (script_add_assertion, script_parse_option): Likewise.
12410         (script_start_sections, script_add_phdr): Likewise.
12411         (script_check_output_format): New function.
12412         * script.h (read_input_script): Update declaration.
12413         * script-c.h (script_check_output_format): Declare.
12414         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12415         (ignore_cmd): Remove OUTPUT_FORMAT.
12416         * fileread.cc (Input_file::Input_file): Add explicit this.
12417         (Input_file::will_search_for): New function.
12418         (Input_file::open): Add pindex parameter.  Change all callers.
12419         * fileread.h (class Input_file): Add input_file_argument method.
12420         Declare will_search_for.  Update declarations.
12421         * object.cc (make_elf_object): Add punconfigured parameter.
12422         Change all callers.
12423         * object.h (class Object): Make input_file public.  Add
12424         searched_for method.
12425         (make_elf_object): Update declaration.
12426         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12427         restart search.
12428         * dirsearch.h (class Dirsearch): Update declaration.
12429         * options.h (class General_options): Add --warn-search-mismatch.
12430         * parameters.cc (Parameters::is_compatible_target): New function.
12431         * parameters.h (class Parameters): Declare is_compatible_target.
12432         * workqueue.cc (Workqueue::add_blocker): New function.
12433         * workqueue.h (class Workqueue): Declare add_blocker.
12434
12435         * fileread.cc (Input_file::open): Remove options parameter.
12436         Change all callers.
12437         (Input_file::open_binary): Likewise.
12438         * script.cc (read_input_script): Likewise.
12439         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12440         options parameter from constructor.  Change all callers.
12441         (class Read_script): Likewise.
12442         * fileread.h (class Input_file): Update declarations.
12443         * script.h (read_input_script): Update declaration.
12444
12445 2009-03-10  Nick Clifton  <nickc@redhat.com>
12446
12447         * po/es.po: New Spanish translation.
12448
12449 2009-03-06  Cary Coutant  <ccoutant@google.com>
12450
12451         * options.cc (parse_short_option): Keep dash_z from registering itself.
12452
12453 2009-03-03  Ian Lance Taylor  <iant@google.com>
12454
12455         PR 9918
12456         * target-reloc.h (relocate_section): Pass output_section to
12457         relocate.
12458         * i386.cc (Target_i386::should_apply_static_reloc): Add
12459         output_section parameter.  Change all callers.
12460         (Target_i386::Relocate::relocate): Add output_section parameter.
12461         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12462         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12463         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12464         * testsuite/two_file_shared.sh: New script.
12465         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12466         (check_DATA): Add two_file_shared.dbg.
12467         (two_file_shared.dbg): New target.
12468         * testsuite/Makefile.in: Rebuild.
12469
12470 2009-03-01  Ian Lance Taylor  <iant@google.com>
12471
12472         * configure.ac: Check for byteswap.h.
12473         * configure: Rebuild.
12474         * config.in: Rebuild.
12475
12476 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12477
12478         * layout.cc (Layout::find_or_add_kept_section): New function.
12479         (Layout::add_comdat): Removed.
12480         * layout.h (struct Kept_section): Move out of class Layout.
12481         Remove trailing underscores from field names.  Add group_sections
12482         field.  Rename group_ field to is_group.  Change all uses.
12483         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12484         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12485         comdat_groups_ field.
12486         (Sized_relobj::include_section_group): Use
12487         find_or_add_kept_section and Kept_section::group_sections.
12488         (Sized_relobj::include_linkonce_section): Likewise.
12489         * object.cc (class Sized_relobj): Don't define Comdat_group or
12490         Comdat_group_table.  Remove find_comdat_group and
12491         add_comdat_group.  Remove comdat_groups_ field.
12492         * plugin.cc (include_comdat_group): Use
12493         Layout::find_or_add_kept_section.
12494
12495 2009-02-28  Ian Lance Taylor  <iant@google.com>
12496
12497         * README: --gc-sections and map files are now supported.  Document
12498         some build requirements.
12499
12500         PR 6992
12501         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12502         relocatable link set the value of the section symbol to zero.
12503         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12504         relocatable link don't include the section address in the local
12505         symbol value.
12506
12507 2009-02-27  Ian Lance Taylor  <iant@google.com>
12508
12509         PR 6811
12510         * options.h (class Search_directory): Add is_system_directory.
12511         (class General_options): Declare is_in_system_directory.
12512         * options.cc (get_relative_sysroot): Make static.
12513         (get_default_sysroot): Make static.
12514         (General_optoins::is_in_system_directory): New function.
12515         * fileread.cc (Input_file::is_in_system_directory): New function.
12516         * fileread.h (class Input_file): Declare is_in_system_directory.
12517         * object.h (class Object): Add is_in_system_directory.
12518         (class Input_objects): Remove system_library_directory_ field.
12519         * object.cc (Input_objects::add_object): Don't set
12520         system_library_directory_.
12521         (input_objects::found_in_system_library_directory): Remove.
12522         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12523         parameter.  Change all callers.
12524         (Symbol_table::sized_write_globals): Likewise.
12525         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12526         Call Object::is_in_system_directory.
12527         * symtab.h (class Symbol_table): Update declarations.
12528
12529         PR 5990
12530         * descriptors.h (Open_descriptor): Add is_on_stack field.
12531         * descriptors.cc (Descriptors::open): If the descriptor is on the
12532         top of the stack, remove it.  Initialize is_on_stack field.
12533         (Descriptors::release): Only add pod to stack if it is not on the
12534         stack already.
12535         (Descriptors::close_some_descriptor): Clear stack_next and
12536         is_on_stack fields.
12537
12538         PR 7091
12539         * output.cc (Output_section::find_starting_output_address): Rename
12540         from starting_output_address; add PADDR parameter; change return
12541         type.
12542         * output.h (class Output_section): Declare
12543         find_starting_output_address instead of starting_output_address.
12544         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12545         section symbol for which we can't find a merge section.
12546
12547         PR 9836
12548         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12549         hidden or internal, force the symbol to be local.
12550         * resolve.cc (Symbol::override_visibility): Define.
12551         (Symbol::override_base): Use override_visibility.
12552         (Symbol_table::resolve): Likewise.
12553         (Symbol::override_base_with_special): Likewise.
12554         (Symbol_table::override_with_special): If the visibility is hidden
12555         or internal, force the symbol to be local.
12556         * symtab.h (class Symbol): Add set_visibility and
12557         override_visibility.
12558         * testsuite/ver_test_1.sh: New file.
12559         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12560         (check_DATA): Add ver_test_1.syms.
12561         (ver_test_1.syms): New target.
12562         * testsuite/Makefile.in: Rebuild.
12563
12564 2009-02-25  Cary Coutant  <ccoutant@google.com>
12565
12566         * layout.cc (Layout::choose_output_section): Don't rename sections
12567         when using a linker script that has a SECTIONS clause.
12568         * Makefile.in: Regenerate.
12569
12570         * testsuite/Makefile.am (script_test_5.sh): New test case.
12571         * testsuite/Makefile.in: Regenerate.
12572         * testsuite/script_test_5.cc: New file.
12573         * testsuite/script_test_5.sh: New file.
12574         * testsuite/script_test_5.t: New file.
12575
12576 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12577
12578         * archive.cc (Archive::include_member): Update calls to add_symbols.
12579         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12580         the Layout argument.
12581         * dynobj.h (do_add_symbols): Add the Layout argument.
12582         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12583         Layout argument.
12584         * object.h (Object::add_symbols): Add the Layout argument.
12585         (Object::do_add_symbols): Add the Layout argument.
12586         (Sized_relobj::do_add_symbols): Add the Layout argument.
12587         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12588         Unify the two versions.
12589         (Add_plugin_symbols): Remove.
12590         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12591         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12592         (Add_plugin_symbols): Remove.
12593         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12594         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12595         (Add_symbols::run): Make it work with Pulginobj.
12596
12597 2009-02-06  Ian Lance Taylor  <iant@google.com>
12598
12599         * object.cc (Sized_relobj::do_layout): Make info message start
12600         with lower case letter.
12601
12602 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12603
12604         * binary.cc: Fix file comment.
12605
12606         * options.h (enum Incremental_disposition): Define.
12607         (class General_options): Add new options: --incremental,
12608         --incremental_changed, --incremental_unchanged,
12609         --incremental_unknown.  Add incremental_disposition_ and
12610         implicit_incremental_ fields.
12611         (General_options::incremental_disposition): New function.
12612         (class Position_dependent_options): Add incremental_disposition
12613         option.
12614         (Position_dependent_options::copy_from_options): Set incremental
12615         dispositions.
12616         * options.cc (General_options::parse_incremental_changed): New
12617         function.
12618         (General_options::parse_incremental_unchanged): New function.
12619         (General_options::parse_incremental_unknown): New function.
12620         (General_options::General_options): Initialize new fields
12621         incremental_disposition_ and implicit_incremental_.
12622         (General_options::finalize): Check for uasge of --incremental-*
12623         without --incremental.
12624
12625 2009-02-06  Chris Demetriou  <cgd@google.com>
12626
12627         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12628         pointer and to report location as the file name associated with
12629         the symbol.
12630         (gold_undefined_symbol_at_location): New function to replace the
12631         old gold_undefined_symbol functionality.
12632         * target-reloc.h (relocate_section): Update to use
12633         gold_undefined_symbol_at_location.
12634         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12635         Call gold_undefined_symbol function rather than gold_error.
12636         * errors.h (Errors::undefined_symbol): Take location as a
12637         string, rather than calculating it from a relocation.
12638         * errors.cc (Errors::fatal): Print "fatal error:" before the
12639         formatted message.
12640         (Errors::error, Errors::error_at_location): Print "error: "
12641         before the formatted message.
12642         (Errors::undefined_symbol): Take location as a string, rather
12643         than calculating it from a relocation.
12644         (gold_undefined_symbol_at_location): New function akin to
12645         old gold_undefined_symbol, calculates location from relocation.
12646         (gold_undefined_symbol): Change to take only a Symbol pointer
12647         and to report location as the file name associated with the symbol.
12648         * testsuite/debug_msg.sh: Update for changed error messages.
12649         * testsuite/undef_symbol.sh: Likewise.
12650
12651 2009-02-04  Duncan Sands  <baldrick@free.fr>
12652
12653         PR 9812
12654         * reduced_debug_output.h
12655         (Output_reduced_debug_abbrev_section::failed): Use format for
12656         gold_warning.
12657         (Output_reduced_debug_info_section::faild): Likewise.
12658
12659 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12660
12661         * script.cc (Lazy_demangler): New class.
12662         (Version_script_info::get_symbol_version_helper): Demangle a
12663         symbol only once.
12664
12665 2009-01-29  Cary Coutant  <ccoutant@google.com>
12666
12667         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12668         to __tls_get_addr.
12669         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12670
12671 2009-01-28  Ian Lance Taylor  <iant@google.com>
12672
12673         * version.cc (version_string): Bump to 1.9.
12674
12675         * gold.h: Include <cstring> and <stdint.h>.
12676         * version.cc: Include <cstdio>.
12677         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12678         warning.
12679         * reduced_debug_output.cc (insert_into_vector): Rename from
12680         Insert_into_vector; change all callers.  Use Swap_unaligned to
12681         avoid aliasing issue; remove union since it is unnecessary.
12682
12683 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12684
12685         * Makefile.am (CCFILES): Add gc.cc.
12686         (HFILES): Add gc.h.
12687         * Makefile.in: Regenerate.
12688         * gold.cc (Gc_runner): New class.
12689         (queue_initial_tasks): Call garbage collection related tasks
12690         when corresponding options are invoked.
12691         (queue_middle_gc_tasks): New function.
12692         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12693         processed early before laying out sections during garbage collection.
12694         * gold.h (queue_middle_gc_tasks): New function.
12695         (is_prefix_of): Move from "layout.cc".
12696         * i386.cc (Target_i386::gc_process_relocs): New function.
12697         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12698         * main.cc (main): Create object of class "Garbage_collection".
12699         * object.cc (Relobj::copy_symbols_data): New function.
12700         (Relobj::is_section_name_included): New function.
12701         (Sized_relobj::do_layout): Allow this function to be called twice
12702         during garbage collection and defer layout of section during the
12703         first call.
12704         * object.h (Relobj::get_symbols_data): New function.
12705         (Relobj::is_section_name_included): New function.
12706         (Relobj::copy_symbols_data): New function.
12707         (Relobj::set_symbols_data): New function.
12708         (Relobj::get_relocs_data): New function.
12709         (Relobj::set_relocs_data): New function.
12710         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12711         (Relobj::gc_process_relocs): New function.
12712         (Relobj::do_gc_process_relocs): New pure virtual function.
12713         (Relobj::sd_): New data member.
12714         (Sized_relobj::is_output_section_offset_invalid): New function.
12715         (Sized_relobj::do_gc_process_relocs): New function.
12716         * options.h (General_options::gc_sections): Modify to not be a no-op.
12717         (General_options::print_gc_sections): New option.
12718         * plugin.cc (Plugin_finish::run): Remove function call to
12719         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12720         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12721         * reloc.cc (Read_relocs::run): Add task to process relocs and
12722         determine unreferenced sections when doing garbage collection.
12723         (Gc_process_relocs): New class.
12724         (Sized_relobj::do_gc_process_relocs): New function.
12725         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12726         sections that are garbage collected.
12727         * reloc.h (Gc_process_relocs): New class.
12728         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12729         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12730         symbols whose corresponding sections are garbage collected.
12731         (Symbol_table::Symbol_table): Add new parameter for the garbage
12732         collection object.
12733         (Symbol_table::gc_mark_undef_symbols): New function.
12734         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12735         (Symbol_table::gc_mark_dyn_syms): New function.
12736         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12737         as garbage.
12738         (Symbol_table::add_from_object): Likewise.
12739         (Symbol_table::add_from_relobj): When building shared objects, do not
12740         treat externally visible symbols as garbage.
12741         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12742         table information for static and relocatable links.
12743         * symtab.h (Symbol_table::set_gc): New function.
12744         (Symbol_table::gc): New function.
12745         (Symbol_table::gc_mark_undef_symbols): New function.
12746         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12747         (Symbol_table::gc_mark_dyn_syms): New function.
12748         (Symbol_table::gc_): New data member.
12749         * target.h (Sized_target::gc_process_relocs): New pure virtual
12750         function.
12751         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12752         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12753
12754 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12755
12756         * options.h (General_options::gc_sections): Define as a no-op for now.
12757         (General_options::no_keep_memory): Ditto.
12758         (General_options::Bshareable): Define.
12759         * options.cc (General_options::finalize): Honor -Bshareable.
12760
12761 2009-01-20  Andreas Schwab  <schwab@suse.de>
12762
12763         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12764         read the value in the contents, since we don't use it.  Use the
12765         template endianness when writing.
12766         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12767
12768 2009-01-19  Andreas Schwab  <schwab@suse.de>
12769
12770         * configure.tgt (powerpc64-*): Fix targ_obj.
12771
12772 2009-01-15  Ian Lance Taylor  <iant@google.com>
12773
12774         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12775         local symbols when stripping all symbols.
12776
12777 2009-01-14  Cary Coutant  <ccoutant@google.com>
12778
12779         * output.cc (Output_reloc): Add explicit instantiations.
12780
12781 2009-01-14  Cary Coutant  <ccoutant@google.com>
12782
12783         * archive.cc (Archive::get_elf_object_for_member): Remove call
12784         to File_read::claim_for_plugin.
12785         * descriptors.cc (Descriptors::open): Remove reference to
12786         is_claimed.
12787         (Descriptors::claim_for_plugin): Remove.
12788         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12789         (Descriptors::is_claimed): Remove.
12790         (claim_descriptor_for_plugin): Remove.
12791         * fileread.cc (File_read::claim_for_plugin): Remove.
12792         * fileread.h (File_read::claim_for_plugin): Remove.
12793         (File_read::descriptor): Reopen descriptor if necessary.
12794         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12795         (Plugin_manager::all_symbols_read): Add task parameter. Change
12796         all callers.
12797         (Plugin_manager::get_input_file): New function.
12798         (Plugin_manager::release_input_file): New function.
12799         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12800         corresponding data member.
12801         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12802         and pass to base constructor. Change all callers.
12803         (get_input_file, release_input_file): New functions.
12804         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12805         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12806         (Plugin_manager::all_symbols_read): Add task parameter.
12807         (Plugin_manager::get_input_file): New function.
12808         (Plugin_manager::release_input_file): New function.
12809         (Plugin_manager::task_): New data member.
12810         (Pluginobj::Pluginobj): Add filesize parameter.
12811         (Pluginobj::filename): New function.
12812         (Pluginobj::descriptor): New function.
12813         (Pluginobj::filesize): New function.
12814         (Pluginobj::filesize_): New data member.
12815         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12816         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12817         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12818
12819         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12820         with archive libraries.
12821         * testsuite/Makefile.in: Regenerate.
12822         * testsuite/plugin_test.c (struct sym_info): New type.
12823         (get_input_file, release_input_file): New static variables.
12824         (onload): Capture new transfer vector entries.
12825         (claim_file_hook): Stop reading at end of file according to filesize.
12826         Factor out parsing of readelf output into separate function.
12827         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12828         APIs and get the source file name from the symbol table.  Convert
12829         source file name to corresponding object file name.  Print info
12830         message when adding new input files.
12831         (parse_readelf_line): New function.
12832         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12833         * testsuite/plugin_test_2.sh: Likewise.
12834         * testsuite/plugin_test_3.sh: Likewise.
12835         * testsuite/plugin_test_4.sh: New test case.
12836
12837 2009-01-07  Ian Lance Taylor  <iant@google.com>
12838
12839         * version.cc (version_string): Bump to 1.8.
12840
12841 2008-12-23  Cary Coutant  <ccoutant@google.com>
12842
12843         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12844         * plugin.cc (Plugin_manager::finish): Rename as
12845         layout_deferred_objects.  Move cleanup to separate function.
12846         (Plugin_manager::cleanup): New function.
12847         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12848         separately.
12849         * plugin.h (Plugin_manager::finish): Rename as
12850         layout_deferred_objects.
12851         (Plugin_manager::cleanup): New function.
12852         (Plugin_manager::cleanup_done): New field.
12853
12854 2008-12-23  Cary Coutant  <ccoutant@google.com>
12855
12856         * plugin.cc (is_visible_from_outside): New function.
12857         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12858         so we don't return "IR only" status for exported symbols or -r links.
12859
12860         * testsuite/Makefile.am (plugin_test_3): New test case.
12861         * testsuite/Makefile.in: Regenerate.
12862         * testsuite/plugin_test_3.sh: New file.
12863
12864 2008-12-22  Cary Coutant  <ccoutant@google.com>
12865
12866         * object.cc (Sized_relobj::layout_section): New function.
12867         (Sized_relobj::do_layout): Defer layout of input sections until after
12868         plugin has provided replacement files.
12869         (Sized_relobj::do_layout_deferred_sections): New function.
12870         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12871         (Relobj::layout_deferred_sections): New function.
12872         (Relobj::do_layout_deferred_sections): New function.
12873         (Sized_relobj::do_layout_deferred_sections): New function.
12874         (Sized_relobj::layout_section): New function.
12875         (Sized_relobj::Deferred_layout): New structure.
12876         (Sized_relobj::deferred_layout_): New field.
12877         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12878         Change all callers.  Layout deferred sections.
12879         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12880         references.
12881         (Plugin_hook::run): Move code from do_plugin_hook inline.
12882         (Plugin_hook::do_plugin_hook): Remove.
12883         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12884         (Plugin_manager::finish): Renamed, was cleanup.
12885         (Plugin_manager::should_defer_layout): New function.
12886         (Plugin_manager::add_deferred_layout_object): New function.
12887         (Plugin_manager::Deferred_layout_list): New type.
12888         (Plugin_manager::deferred_layout_objects_): New field.
12889         (Plugin_hook::do_plugin_hook): Remove.
12890
12891 2008-12-17  Ian Lance Taylor  <iant@google.com>
12892
12893         * options.h (class General_options): Add --no case for
12894         --export-dynamic.
12895
12896 2008-12-16  Cary Coutant  <ccoutant@google.com>
12897
12898         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12899         vector.
12900         (Plugin_manager::claim_file): Create plugin object even if
12901         plugin did not call the add_symbols callback.
12902         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12903         asking for more symbols than were added.
12904         * testsuite/Makefile.am (plugin_test_1): Add test case with
12905         no global symbols.
12906         (empty.syms): New target.
12907         * testsuite/Makefile.in: Regenerate.
12908         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12909         message. Don't call add_symbols if no globals.
12910         (all_symbols_read_hook): Don't provide replacement for empty
12911         claimed file.
12912
12913 2008-12-12  Ian Lance Taylor  <iant@google.com>
12914
12915         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12916         r_type == 0 for a local symbol with r_sym == 0.
12917         (scan_relocatable_relocs): Pass r_sym to
12918         local_non_section_strategy.
12919         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12920         r_sym parameter.
12921
12922         * configure.ac: Update test for TLS descriptors: they are
12923         supported as of glibc 2.9.
12924         * configure: Rebuild.
12925
12926 2008-12-11  Ian Lance Taylor  <iant@google.com>
12927
12928         PR 7091
12929         * target-reloc.h (Default_scan_relocatable_relocs): For each
12930         function, map r_type == 0 to RELOC_DISCARD.
12931
12932 2008-12-10  Cary Coutant  <ccoutant@google.com>
12933
12934         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12935         object to override a kept COMDAT group from a plugin object.
12936
12937 2008-12-09  Ian Lance Taylor  <iant@google.com>
12938
12939         PR 7088
12940         * yyscript.y (file_cmd): Handle INPUT.
12941
12942         * testsuite/initpri1.c: Change all declarations to be full
12943         prototypes by adding void, to avoid compiler warnings.
12944
12945 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12946
12947         * options.cc (General_options::parse_plugin_opt): New.
12948         (General_options::add_plugin): The argument now is just the filename.
12949         (General_options::add_plugin_option): New.
12950         * options.h (plugin_opt): New.
12951         (add_plugin): Change argument name.
12952         (add_plugin_option): New.
12953         * plugin.cc (Plugin::load): Don't parse the plugin option.
12954         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12955         (Plugin::add_option): New.
12956         (Plugin::args_): Change type.
12957         (Plugin::filename_): New.
12958         (Plugin_manager::add_plugin_option): New.
12959         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12960         * testsuite/Makefile.in: Regenerate.
12961
12962 2008-12-05  Cary Coutant  <ccoutant@google.com>
12963
12964         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12965         Handle --strip-lto-sections option.
12966         * options.h (strip_lto_sections): New option.
12967
12968 2008-12-01  Cary Coutant  <ccoutant@google.com>
12969
12970         * plugin.cc (ld_plugin_message): Change format parameter to const.
12971         Fix mismatch between new[] and delete.
12972
12973 2008-11-14  Cary Coutant  <ccoutant@google.com>
12974
12975         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12976         instead of -1U.
12977
12978 2008-11-05  Craig Silverstein  <csilvers@google.com>
12979
12980         * options.cc (General_options::parse_dynamic_list): New function.
12981         * options.h (General_options): New flags dynamic_list,
12982         dynamic_list_data, dynamic_list_cpp_new, and
12983         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12984         (General_options::in_dynamic_list): New function.
12985         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12986         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12987         (Lex::can_continue_name): Likewise.
12988         (yylex): Likewise.
12989         (read_script_file): New parameter script_options.
12990         (read_dynamic_list): New function.
12991         (Script_options::define_dynamic_list): New function.
12992         (dynamic_list_keyword_parsecodes): New variable.
12993         (dynamic_list_keywords): New variable.
12994         * script.h (Script_options::define_dynamic_list): New function
12995         prototype.
12996         (read_dynamic_list): New function prototype.
12997         * symtab.cc (strprefix): New macro.
12998         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12999         dynamic_list_data, dynamic_list_cpp_new, and
13000         dynamic_list_cpp_typeinfo.
13001         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13002         (dynamic_list_expr): New rule.
13003         (dynamic_list_nodes): Likewise.
13004         (dynamic_list_node): Likewise.
13005         * testsuite/Makefile.am (dynamic_list): New test.
13006         * testsuite/Makefile.in: Regenerated.
13007         * testsuite/dynamic_list.t: New file.
13008         * testsuite/dynamic_list.sh: New file.
13009
13010 2008-11-05  Craig Silverstein  <csilvers@google.com>
13011
13012         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13013         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13014         (t11_last): Likewise.
13015         * testsuite/ver_test_6.c (main): Likewise.
13016
13017 2008-10-07  Cary Coutant  <ccoutant@google.com>
13018
13019         * options.c (General_options::finalize): Add check for -static and
13020         -shared.
13021         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13022         is not empty.
13023
13024 2008-10-02  Cary Coutant  <ccoutant@google.com>
13025
13026         * plugin.cc (make_sized_plugin_object): Fix conditional
13027         compilation to work when not all targets are enabled.
13028
13029 2008-09-29  Cary Coutant  <ccoutant@google.com>
13030
13031         * archive.cc (Archive::get_file_and_offset): Use filename instead
13032         of name to get library path.
13033         (Archive::include_member): Unlock external member of a thin archive.
13034
13035         * testsuite/Makefile.am (TEST_AR): New variable.
13036         (thin_archive_test_1): New test.
13037         (thin_archive_test_2): New test.
13038         * testsuite/Makefile.in: Regenerate.
13039         * testsuite/thin_archive_main.cc: New file.
13040         * testsuite/thin_archive_test_1.cc: New file.
13041         * testsuite/thin_archive_test_2.cc: New file.
13042         * testsuite/thin_archive_test_3.cc: New file.
13043         * testsuite/thin_archive_test_4.cc: New file.
13044
13045 2008-09-29  Cary Coutant  <ccoutant@google.com>
13046
13047         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13048         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13049         instead of -1U.
13050         (Sized_relobj::do_finalize_local_symbols): Likewise.
13051         (Sized_relobj::map_to_kept_section): Likewise.
13052         * object.h (Sized_relobj::invalid_address): New constant.
13053         (Sized_relobj::do_output_section_offset): Check for invalid_address
13054         and return -1ULL.
13055         * output.cc (Output_reloc::local_section_offset): Use constant
13056         invalid_address instead of -1U.
13057         (Output_reloc::get_address): Likewise.
13058         (Output_section::output_address): Change -1U to -1ULL.
13059         * output.h (Output_reloc::invalid_address): New constant.
13060         * reloc.cc (Sized_relobj::write_sections): Use constant
13061         invalid_address instead of -1U.
13062         (Sized_relobj::relocate_sections): Likewise.
13063         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13064         values for merge sections.
13065         * target-reloc.h (relocate_for_relocatable): Use constant
13066         invalid_address instead of -1U.
13067
13068 2008-09-19  Cary Coutant  <ccoutant@google.com>
13069
13070         Add plugin functionality for link-time optimization (LTO).
13071         * configure.ac (plugins): Add --enable-plugins option.
13072         * configure: Regenerate.
13073         * config.in: Regenerate.
13074         * Makefile.am (LIBDL): New variable.
13075         (CCFILES): Add plugin.cc.
13076         (HFILES): Add plugin.h.
13077         (ldadd_var): Add LIBDL.
13078         * Makefile.in: Regenerate.
13079
13080         * archive.cc: Include "plugin.h".
13081         (Archive::setup): Don't preread archive symbols when using a plugin.
13082         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13083         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13084         files.
13085         (Archive::include_member): Add symbols from plugin objects.
13086         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13087         * descriptors.cc (Descriptors::open): Check for file descriptors
13088         abandoned by plugins.
13089         (Descriptors::claim_for_plugin): New function.
13090         * descriptors.h (Descriptors::claim_for_plugin): New function.
13091         (Open_descriptor::is_claimed): New field.
13092         (claim_descriptor_for_plugin): New function.
13093         * fileread.cc (File_read::claim_for_plugin): New function.
13094         * fileread.h (File_read::claim_for_plugin): New function.
13095         (File_read::descriptor): New function.
13096         * gold.cc: Include "plugin.h".
13097         (queue_initial_tasks): Add task to call plugin hooks for generating
13098         new object files.
13099         * main.cc: Include "plugin.h".
13100         (main): Load plugin libraries.
13101         * object.h (Pluginobj): Declare.
13102         (Object::pluginobj): New function.
13103         (Object::do_pluginobj): New function.
13104         (Object::set_target): New function.
13105         * options.cc: Include "plugin.h".
13106         (General_options::parse_plugin): New function.
13107         (General_options::General_options): Initialize plugins_ field.
13108         (General_options::add_plugin): New function.
13109         * options.h (Plugin_manager): Declare.
13110         (General_options): Add --plugin option.
13111         (General_options::has_plugins): New function.
13112         (General_options::plugins): New function.
13113         (General_options::add_plugin): New function.
13114         (General_options::plugins_): New field.
13115         * plugin.cc: New file.
13116         * plugin.h: New file.
13117         * readsyms.cc: Include "plugin.h".
13118         (Read_symbols::do_read_symbols): Check for archive before checking
13119         for ELF file.  Call plugin hooks to claim files.
13120         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13121         from a real object file; force override when processing replacement
13122         files.
13123         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13124         (Symbol::init_base_object): Likewise.
13125         (Symbol::init_base_output_data): Likewise.
13126         (Symbol::init_base_output_segment): Likewise.
13127         (Symbol::init_base_constant): Likewise.
13128         (Symbol::init_base_undefined): Likewise.
13129         (Symbol::output_section): Assert that object is not a plugin.
13130         (Symbol_table::add_from_pluginobj): New function.
13131         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13132         undefined.
13133         (Symbol_table::sized_write_globals): Likewise.
13134         (Symbol_table::add_from_pluginobj): Instantiate template.
13135         * symtab.h (Sized_pluginobj): Declare.
13136         (Symbol::in_real_elf): New function.
13137         (Symbol::set_in_real_elf): New function.
13138         (Symbol::in_real_elf_): New field.
13139         (Symbol_table::add_from_pluginobj): New function.
13140
13141         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13142         (LIBDL): New variable.
13143         (LDADD): Add LIBDL.
13144         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13145         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13146         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13147         (MOSTLYCLEANFILES): Likewise.
13148         * testsuite/Makefile.in: Regenerate.
13149         * testsuite/plugin_test.c: New file.
13150         * testsuite/plugin_test_1.sh: New file.
13151         * testsuite/plugin_test_2.sh: New file.
13152
13153 2008-09-16  Ian Lance Taylor  <iant@google.com>
13154
13155         * target-reloc.h (relocate_section): Check whether a symbol is
13156         defined by the ABI before reporting an undefined symbol error.
13157         * target.h (Target::is_defined_by_abi): Make parameter const.
13158         (Target::do_is_defined_by_abi): Likewise.
13159         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13160         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13161         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13162         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13163         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13164         * testsuite/Makefile.in: Rebuild.
13165
13166         * fileread.cc (make_view): Add casts to avoid warning.
13167
13168 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13169
13170         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13171         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13172
13173 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13174
13175         * options.h (General_options::output_is_executable): New.
13176         (General_options::output_is_pie): New.
13177         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13178         for shared libraries.
13179         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13180
13181 2008-09-11  Chris Demetriou  <cgd@google.com>
13182
13183         * options.h (origin): New -z option.
13184         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13185         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13186         in DT_FLAGS_1.
13187
13188 2008-09-05  Cary Coutant  <ccoutant@google.com>
13189
13190         * fileread.cc (File_read::make_view): Add check for attempt to map
13191         beyond end of file.
13192
13193 2008-09-05  Cary Coutant  <ccoutant@google.com>
13194
13195         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13196         explicit instantiations.
13197
13198 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13199
13200         PR gold/6858
13201         * options.cc (General_options::finalize): Allow undefined symbols
13202         in shlibs if linking -shared.
13203
13204         PR gold/6859
13205         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13206         symbols as not needing a dynsym entry.
13207
13208 2008-08-20  Craig Silverstein  <csilvers@google.com>
13209
13210         * fileread.cc (File_read::open): Do not lock the file unless it
13211         was successfully opened.
13212
13213 2008-08-14  Cary Coutant  <ccoutant@google.com>
13214
13215         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13216         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13217         * testsuite/tls_test.cc (struct int128): 128-bit struct
13218         for testing TLS relocs with non-zero addend.
13219         (v12): New TLS variable.
13220         (t12): New test.
13221         (t_last): Add check for v12.
13222         * testsuite/tls_test.h (t12): New function.
13223         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13224
13225 2008-08-13  Ian Lance Taylor  <iant@google.com>
13226
13227         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13228         set tls_segment_ or relro_segment_.
13229         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13230         when appropriate.
13231         * output.h (Output_section::clear_is_relro): New function.
13232         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13233         sections specially even when output_data_ is empty.
13234         (Output_segment::maximum_alignment): When first section is relro,
13235         only force alignment for PT_LOAD segments.
13236         * script.cc (script_data_segment_align): New function.
13237         (script_data_segment_relro_end): New function.
13238         * script-c.h (script_data_segment_align): Declare.
13239         (script_data_segment_relro_end): Declare.
13240         * script-sections.h (class Script_sections): Declare
13241         data_segment_align and data_segment_relro_end.  Add fields
13242         segment_align_index_ and saw_relro_end_.
13243         * script-sections.cc (class Sections_element): Add set_is_relro
13244         virtual function.  Add new bool* parameter to place_orphan_here.
13245         Add get_output_section virtual function.
13246         (class Output_section_definition): Add set_is_relro.  Add new
13247         bool* parameter to place_orphan_here.  Add get_output_section.
13248         Add is_relro_ field.
13249         (Output_section_definition::Output_section_definition): Initialize
13250         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13251         and is_relro_ fields.
13252         (Output_section_definition::place_orphan_here): Add is_relro
13253         parameter.
13254         (Output_section_definition::set_section_addresses): Set relro for
13255         output section.
13256         (Output_section_definition::alternate_constraint): Likewise.
13257         (class Orphan_output_section): Add new bool* parameter to
13258         place_orphan_here.  Add get_output_section.
13259         (Orphan_output_section::place_orphan_here): Add is_relro
13260         parameter.
13261         (Script_sections::Script_sections): Initialize
13262         data_segment_align_index_ and saw_relro_end_.
13263         (Script_sections::data_segment_align): New function.
13264         (Script_sections::data_segment_relro_end): New function.
13265         (Script_sections::place_orphan): Set or clear is_relro.
13266         (Script_sections::set_section_addresses): Force alignment of first
13267         TLS section.
13268         * yyscript.y (exp): Call script_data_segment_align and
13269         script_data_segment_relro_end.
13270         * testsuite/relro_script_test.t: New file.
13271         * testsuite/relro_test.cc (using_script): Declare.
13272         (t1, t2): Test using_script.
13273         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13274         (relro_script_test_SOURCES): Define.
13275         (relro_script_test_DEPENDENCIES): Define.
13276         (relro_script_test_LDFLAGS): Define.
13277         (relro_script_test_LDADD): Define.
13278         (relro_script_test.so): New target.
13279         * testsuite/Makefile.in: Rebuild.
13280
13281 2008-08-06  Cary Coutant <ccoutant@google.com>
13282
13283         * archive.cc (Archive::total_archives, Archive::total_members)
13284         (Archive::total_members_loaded): New variables.
13285         (Archive::setup): Add parameter.  Add option to preread
13286         archive symbols.
13287         (Archive::read_armap): Add counter.
13288         (Archive::get_file_and_offset): New function.
13289         (Archive::get_elf_object_for_member): New function.
13290         (Archive::read_all_symbols): New function.
13291         (Archive::read_symbols): New function.
13292         (Archive::add_symbols): Add counters.
13293         (Archive::include_all_members): Use armap to find members if it's
13294         already built.
13295         (Archive::include_member): Skip reading symbols if already read.
13296         Factored code into Archive::get_file_and_offset and
13297         Archive::get_elf_object_for_member.  Changed call to
13298         Mapfile::report_include_archive_member.
13299         (Archive::print_stats): New function.
13300         * archive.h: Declare Object and Read_symbols_data classes.
13301         (Archive::Archive): Add initializers for new members.
13302         (Archive::setup): Add parameter.
13303         (Archive::print_stats): New function.
13304         (Archive::total_archives, Archive::total_members)
13305         (Archive::total_members_loaded): New variables.
13306         (Archive::get_file_and_offset): New function.
13307         (Archive::get_elf_object_for_member): New function.
13308         (Archive::read_all_symbols): New function.
13309         (Archive::read_symbols): New function.
13310         (Archive::Archive_member): New class.
13311         (Archive::members_): New member.
13312         (Archive::num_members_): New member.
13313         * main.cc: Include archive.h.
13314         (main): Call Archive::print_stats.
13315         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13316         archive parameter; member_name is now the fully-decorated name.
13317         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13318         * options.h: (General_options): Add --preread-archive-symbols option.
13319         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13320         Archive::setup.
13321
13322 2008-08-04  Ian Lance Taylor  <iant@google.com>
13323
13324         * symtab.h (Symbol::use_plt_offset): New function.
13325         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13326         * powerpc.cc (Relocate::relocate): Likewise.
13327         * sparc.cc (Relocate::relocate): Likewise.
13328         * x86_64.cc (Relocate::relocate): Likewise.
13329         * testsuite/weak_plt.sh: New test.
13330         * testsuite/weak_plt_main.cc: New test.
13331         * testsuite/weak_plt_shared.cc: New test.
13332         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13333         (check_PROGRAMS): Add weak_plt.
13334         (check_DATA): Add weak_plt_shared.so.
13335         (weak_plt_main_pic.o, weak_plt): New targets.
13336         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13337         * testsuite/Makefile.in: Rebuild.
13338
13339         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13340         gcctestdir/ld.
13341         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13342         * testsuite/Makefile.in: Rebuild.
13343
13344 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13345
13346         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13347         * Makefile.in: Regenerate.
13348         * po/POTFILES.in: Regenerate.
13349
13350 2008-07-29  Ian Lance Taylor  <iant@google.com>
13351
13352         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13353         symbols before other symbols.
13354         * testsuite/script_test_2.cc (test_addr): Declare.
13355         (test_addr_alias): Declare.
13356         (main): Check that test_addr and test_addr_alias have the right
13357         values.
13358         * testsuite/script_test_2.t: Define test_addr_alias and
13359         test_addr.
13360
13361 2008-07-24  Ian Lance Taylor  <iant@google.com>
13362
13363         PR 5990
13364         * descriptors.cc: New file.
13365         * descriptors.h: New file.
13366         * gold-threads.h (class Hold_optional_lock): New class.
13367         * fileread.cc: Include "descriptors.h".
13368         (File_read::~File_read): Release descriptor rather than closing
13369         it.
13370         (File_read::open) [file]: Call open_descriptor rather than open.
13371         Set is_descriptor_opened_.
13372         (File_read::open) [memory]: Assert that descriptor is not open.
13373         (File_read::reopen_descriptor): New function.
13374         (File_read::release): Release descriptor.
13375         (File_read::do_read): Make non-const.  Reopen descriptor.
13376         (File_read::read): Make non-const.
13377         (File_read::make_view): Reopen descriptor.
13378         (File_read::do_readv): Likewise.
13379         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13380         Update declarations.
13381         * layout.cc: Include "descriptors.h".
13382         (Layout::create_build_id): Use open_descriptor rather than open.
13383         * output.cc: Include "descriptors.h".
13384         (Output_file::open): Use open_descriptor rather than open.
13385         * archive.cc (Archive::const_iterator): Change Archive to be
13386         non-const.
13387         (Archive::begin, Archive::end): Make non-const.
13388         (Archive::count_members): Likewise.
13389         * archive.h (class Archive): Update declarations.
13390         * object.h (Object::read): Make non-const.
13391         * Makefile.am (CCFILES): Add descriptors.cc.
13392         (HFILES): Add descriptors.h.
13393         * Makefile.in: Rebuild.
13394
13395         PR 6716
13396         * gold.h: Always include <clocale>.  Add Solaris workarounds
13397         following code in binutils/sysdep.h.
13398
13399         PR 6048
13400         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13401         this->eh_frame_hdr_ is NULL before using it.
13402
13403         * dynobj.cc (Versions::Versions): Update comment.
13404
13405         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13406         the base version name.
13407
13408         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13409         array size plus one.
13410         (Stringpool_template::set_string_offsets): Subtract one from key
13411         before using it as an array index.
13412         (Stringpool_template::get_offset_with_length): Likewise.
13413         (Stringpool_template::write_to_buffer): Likewise.
13414         * stringpool.h (Stringpool_template::get_offset_from_key):
13415         Likewise.
13416
13417 2008-07-23  Ian Lance Taylor  <iant@google.com>
13418
13419         PR 6658
13420         * object.h (Merged_symbol_value::value): Do our best to handle a
13421         negative addend.
13422
13423         PR 6647
13424         * script.cc (Version_script_info::get_versions): Don't add empty
13425         version tag to return value.
13426         (Version_script_info::get_symbol_version_helper): Change return
13427         type to bool.  Add pversion parameter.  Change all callers.
13428         (script_register_vers_node): Don't require a non-NULL tag.
13429         * script.h (class Version_script_info): Update declarations.
13430         (Version_script_info::get_symbol_version): Change return type to
13431         bool.  Add version parameter.  Change all callers.
13432         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13433         handling.  Handle an empty version from a version script.
13434         (Symbol_table::define_special_symbol): Likewise.
13435         * testsuite/ver_test_10.script: New file.
13436         * testsuite/ver_test_10.sh: New file.
13437         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13438         (check_DATA): Add ver_test_10.syms.
13439         (ver_test_10.syms, ver_test_10.so): New target.
13440         * testsuite/Makefile.in: Rebuild.
13441
13442 2008-07-23  Simon Baldwin  <simonb@google.com>
13443
13444         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13445         to zero for undefined symbols from dynamic libraries.
13446
13447 2008-07-23  Ian Lance Taylor  <iant@google.com>
13448
13449         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13450         Change all callers.
13451         * symtab.h (class Symbol_table): Update declaration.
13452         * testsuite/ver_test_9.cc: New file.
13453         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13454         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13455         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13456         (ver_test_9.so, ver_test_9.o): New targets.
13457         * testsuite/Makefile.in: Rebuild.
13458
13459 2008-07-22  Ian Lance Taylor  <iant@google.com>
13460
13461         * options.h (class General_options): Define --check-sections.
13462         * layout.cc (Layout::set_segment_offsets): Handle
13463         --check-sections.
13464
13465         * options.h (class General_options): Define -n/--nmagic and
13466         -N/--omagic.
13467         * options.cc (General_options::finalize): For -n/--nmagic or
13468         -N/--omagic, set -static.
13469         * layout.cc (Layout::attach_allocated_section_to_segment): If
13470         -N/--omagic, don't put read-only and read-write sections in
13471         different segments.
13472         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13473         finding a read-only segment.
13474         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13475         don't set the minimum segment alignment to the common page size,
13476         and don't set the file offset to the address modulo the page size.
13477         * script-sections.cc (Script_sections::create_segments): If
13478         -n/--omagic, don't put read-only and read-write sections in
13479         different segments.
13480
13481         * cref.cc: New file.
13482         * cref.h: New file.
13483         * options.h (class General_options): Add --print-symbol-counts.
13484         * main.cc (main): Issue defined symbol report if requested.
13485         * archive.cc (Archive::interpret_header): Make into a const member
13486         function.
13487         (Archive::add_symbols): Call Input_objects::archive_start and
13488         archive_stop.
13489         (Archive::const_iterator): Define new class.
13490         (Archive::begin, Archive::end): New functions.
13491         (Archive::include_all_members): Rewrite to use iterator.
13492         (Archive::count_members): New function.
13493         * archive.h (class Archive): Update declarations.
13494         (Archive::filename): New function.
13495         * object.cc: Include "cref.h".
13496         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13497         (Sized_relobj::do_get_global_symbol_counts): New function.
13498         (Input_objects::add_object): Add object to cross-referencer.
13499         (Input_objects::archive_start): New function.
13500         (Input_objects::archive_stop): New function.
13501         (Input_objects::print_symbol_counts): New function.
13502         * object.h: Declare Cref and Archive.
13503         (Object::get_global_symbol_counts): New function.
13504         (Object::do_get_global_symbol_counts): New pure virtual function.
13505         (class Sized_relobj): Add defined_count_ field.  Update
13506         declarations.
13507         (class Input_objects): Add cref_ field.  Update constructor.
13508         Update declarations.
13509         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13510         defined_count_.
13511         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13512         symbol counts.
13513         (Sized_dynobj::do_get_global_symbol_counts): New function.
13514         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13515         defined_count_.  Update declarations.  Define Symbols typedef.
13516         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13517         parameter.  Change all callers.
13518         (Symbol_table::add_from_dynobj): Add sympointers and defined
13519         parameters.  Change all callers.
13520         * symtab.h (class Symbol_table): Update declarations.
13521         * Makefile.am (CCFILES): Add cref.cc.
13522         (HFILES): Add cref.h.
13523         * Makefile.in: Rebuild.
13524
13525 2008-07-22  Simon Baldwin  <simonb@google.com>
13526
13527         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13528         to zero when writing undefined symbols.
13529
13530 2008-07-22  Ian Lance Taylor  <iant@google.com>
13531
13532         * output.cc (Output_section::add_input_section): Don't try to
13533         merge empty merge sections.
13534
13535 2008-07-21  Craig Silverstein  <csilvers@google.com>
13536
13537         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13538         Include symbol version in error message.
13539
13540 2008-07-20  Chris Demetriou  <cgd@google.com>
13541
13542         * configure.ac (gold_cv_c_random_seed): New configured variable.
13543         (RANDOM_SEED_CFLAGS): New substituted variable.
13544         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13545         * configure: Rebuild.
13546         * Makefile.in: Likewise.
13547         * testsuite/Makefile.in: Likewise.
13548
13549 2008-07-18  Ian Lance Taylor  <iant@google.com>
13550
13551         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13552         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13553         * testsuite/ver_test_main.cc (main): Call t4.
13554         (t4, t4_2a): Define.
13555         * testsuite/ver_test_2.cc (t4_2): Define.
13556         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13557         * testsuite/ver_test_4.cc (t4_2a): Define.
13558         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13559         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13560
13561 2008-07-17  Ian Lance Taylor  <iant@google.com>
13562
13563         * dynobj.cc (Versions::add_def): If we give an error about a
13564         missing version, go ahead and create the version anyhow.
13565
13566 2008-07-10  Ian Lance Taylor  <iant@google.com>
13567
13568         Handle output sections with more than 0x7fffffff bytes.
13569         * object.h (class Relobj): Change map_to_output_ to
13570         output_sections_, and just keep a section pointer.  Change all
13571         uses.  Move comdat group support to Sized_relobj.
13572         (Relobj::is_section_specially_mapped): Remove.
13573         (Relobj::output_section): Remove poff parameter.  Change all
13574         callers.
13575         (Relobj::output_section_offset): New function.
13576         (Relobj::set_section_offset): Rewrite.
13577         (Relobj::map_to_output): Remove.
13578         (Relobj::output_sections): New function.
13579         (Relobj::do_output_section_offset): New pure virtual function.
13580         (Relobj::do_set_section_offset): Likewise.
13581         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13582         group support from Relobj.  Update declarations.
13583         (Sized_relobj::get_output_section_offset): New function.
13584         (Sized_relobj::do_output_section_offset): New function.
13585         (Sized_relobj::do_set_section_offset): New function.
13586         * object.cc (Relobj::output_section_address): Remove.
13587         (Sized_relobj::Sized_relobj): Initialize new fields.
13588         (Sized_relobj::include_section_group): Cast find_kept_object to
13589         Sized_relobj.
13590         (Sized_relobj::include_linkonce_section): Likewise.
13591         (Sized_relobj::do_layout): Use separate arrays for output section
13592         and output offset.
13593         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13594         output_sections.
13595         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13596         output_sections and section_offsets.
13597         (Sized_relobj::write_local_symbols): Likewise.
13598         (map_to_kept_section): Compute output address directly.
13599         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13600         output_sections and section_offsets.
13601         (Sized_relobj::write_sections): Likewise.
13602         (Sized_relobj::relocate_sections): Likewise.
13603         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13604         * output.h (class Output_reloc): Update declarations.  Change
13605         u2_.relobj to Sized_relobj*.
13606         (class Output_data_reloc): Change add functions to use
13607         Sized_relobj*.
13608         * output.cc (Output_reloc::Output_reloc): Change relobj to
13609         Sized_relobj*.
13610         (Output_reloc::local_section_offset): Change return type to
13611         Elf_Addr.  Use get_output_section_offset.
13612         (Output_reloc::get_address): Likewise.
13613         (Output_section::is_input_address_mapped): Don't call
13614         is_section_specially_mapped.
13615         (Output_section::output_offset): Likewise.
13616         (Output_section::output_address): Likewise.
13617         (Output_section::starting_output_address): Likewise.
13618         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13619         parameter to Sized_relobj*.
13620         (Copy_relocs::need_copy_reloc): Likewise.
13621         (Copy_relocs::save): Likewise.
13622         * copy-relocs.h (class Copy_relocs): Update declarations.
13623         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13624         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13625         * target-reloc.h (relocate_for_relocatable): Change
13626         offset_in_output_section type to Elf_Addr.  Change code that uses
13627         it as well.
13628         * layout.cc (Layout::layout): Always set *off.
13629         * mapfile.cc (Mapfile::print_input_section): Use
13630         output_section_offset.
13631         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13632         Sized_relobj*.
13633         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13634         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13635         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13636
13637 2008-07-03  Ian Lance Taylor  <iant@google.com>
13638
13639         * layout.cc (Layout::include_section): Do not discard unrecognized
13640         SHT_STRTAB sections.
13641
13642 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13643
13644         * script.cc (Lex::can_continue_name): Make '?' allowable in
13645         version-script names.
13646         * testsuite/version_script.map: Change glob pattern to use '?'
13647
13648 2008-06-30  Manish Singh  <yosh@gimp.org>
13649
13650         PR 6585
13651         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13652         Correct typo.
13653
13654 2008-06-30  Ian Lance Taylor  <iant@google.com>
13655
13656         PR 6660
13657         PR 6682
13658         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13659         versions]: Don't try to read the value in the contents, since we
13660         don't use it.  Use the template endianness when writing.
13661
13662 2008-06-25  Cary Coutant  <ccoutant@google.com>
13663
13664         * fileread.cc (File_read::make_view): Assert on zero-length view.
13665         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13666         symbol table when there are no symbols to read.
13667
13668 2008-06-23  Craig Silverstein  <csilvers@google.com>
13669
13670         * version.cc (version_string): Bump to 1.7
13671
13672 2008-06-18  Craig Silverstein  <csilvers@google.com>
13673
13674         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13675         constant 0xFFFF to type Valtype.
13676         (Powerpc_relocate_functions::rel16_ha): Likewise.
13677
13678 2008-06-17  Ian Lance Taylor  <iant@google.com>
13679
13680         * output.h (Output_section::Input_section): Initialize p2align_ to
13681         zero for Output_section_data constructors.
13682         (Output_section::Input_section::addralign): If not an input
13683         section, return the alignment of the Output_section_data.
13684         * testsuite/copy_test.cc: New file.
13685         * testsuite/copy_test_1.cc: New file.
13686         * testsuite/copy_test_2.cc: New file.
13687         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13688         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13689         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13690         (copy_test_1_pic.o, copy_test_1.so): New targets.
13691         (copy_test_2_pic.o, copy_test_2.so): New targets.
13692         * testsuite/Makefile.in: Rebuild.
13693
13694         * script-sections.cc (Script_sections::place_orphan): Initialize
13695         local variable exact.
13696
13697 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13698
13699         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13700
13701 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13702             David S. Miller  <davem@davemloft.net>
13703
13704         * powerpc.cc: New file.
13705         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13706         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13707         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13708         * Makefile.in: Rebuild.
13709
13710 2008-06-09  Ian Lance Taylor  <iant@google.com>
13711
13712         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13713         <exception>.
13714         (throwing, orig_terminate): New static variables.
13715         (terminate_handler): New static function.
13716         (t2): Set terminate handler.
13717
13718 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13719
13720         PR 6584
13721         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13722         alignment.
13723
13724 2008-05-30  Cary Coutant  <ccoutant@google.com>
13725
13726         * archive.cc (Archive::include_all_members) Correct to step
13727         over symbol table and extended name table in thin archives.
13728
13729 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13730
13731         PR 6407
13732         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13733         calculation.
13734
13735 2008-05-28  Caleb Howe  <cshowe@google.com>
13736
13737         * reduced_debug_output.cc: New file.
13738         * reduced_debug_output.h: New file.
13739         * options.h (class General_options): Add --strip-debug-non-line.
13740         * options.cc (General_options::finalize): Add strip_debug_non_line
13741         to the strip heirarchy.
13742         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13743         fields.
13744         * layout.cc: Include "reduced_debug_output.h".
13745         (Layout::Layout): Initialize new fields.
13746         (line_only_debug_sections): New static array.
13747         (is_lines_only_debug_sections): New static inline function.
13748         (Layout::include_section): Handle --strip-debug-non-line.
13749         (Layout::make_output_section): If --strip-debug-non-line, build
13750         new output sections for .debug_abbrev and .debug_info.
13751         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13752         gold.  Warn about possible overflow.
13753         (read_signed_LEB_128): Likewise.
13754         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13755         (read_signed_LEB_128): Declare.
13756         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13757         (HFILES): Add reduced_debug_output.h.
13758         * Makefile.in: Rebuild.
13759
13760 2008-05-21  Ian Lance Taylor  <iant@google.com>
13761
13762         * mapfile.cc: New file.
13763         * mapfile.h: New file.
13764         * options.h (class General_options): Add -M/--print-map and -Map.
13765         * options.cc (General_options::finalize): Make -M equivalent to
13766         -Map -.
13767         * main.cc: Include <cstdio> and "mapfile.h".
13768         (main): Open mapfile if requested.
13769         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13770         constructor.  Change caller.
13771         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13772         (queue_middle_tasks): Likewise.
13773         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13774         declarations.
13775         * archive.cc: Include "mapfile.h".
13776         (Archive::add_symbols): Add mapfile parameter.  Change all
13777         callers.  Pass mapfile, symbol, and reason to include_member.
13778         (Archive::include_all_members): Add mapfile parameter.  Change all
13779         callers.
13780         (Archive::include_member): Add mapfile, sym, and why parameters.
13781         Change all callers.  Report inclusion to map file.
13782         * archive.h: Include "fileread.h".
13783         (class Archive): Update declarations.
13784         (Archive::file): New const method.
13785         (class Add_archive_symbols): Add mapfile_ field.  Update
13786         constructor.  Change all callers.
13787         * readsyms.h (class Read_symbols): Likewise.
13788         (class Finish_group): Likewise.
13789         (class Read_script): Likewise.
13790         * common.cc: Include "mapfile.h".
13791         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13792         all callers.
13793         (Symbol_table::do_allocate_commons): Likewise.
13794         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13795         symbol allocation to mapfile.
13796         * common.h (class Allocate_commons_task): Add mapfile_ field.
13797         Update constructor.  Change all callers.
13798         * symtab.h (class Symbol_table): Update declarations.
13799         * layout.cc: Include "mapfile.h".
13800         (Layout_task_runner::run): Print information to mapfile.
13801         (Layout::create_gold_note): Change Output_data_fixed_space to
13802         Output_data_zero_fill.
13803         (Layout::create_build_id): Likewise.
13804         (Layout::print_to_mapfile): New function.
13805         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13806         constructor.  Change caller.
13807         (class Layout): Declare print_to_mapfile.
13808         * output.cc (Output_section::Input_section::print_to_mapfile): New
13809         function.
13810         (Output_section::add_input_section): If producing a map, always
13811         add to input_sections_ list.
13812         (Output_section::do_print_to_mapfile): New function.
13813         (Output_segment::print_sections_to_mapfile): New function.
13814         (Output_segment::print_section_list_to_mapfile): New function.
13815         * output.h: Include "mapfile.h".
13816         (Output_data::print_to_mapfile): New function.
13817         (Output_data::do_print_to_mapfile): New virtual function.
13818         (Output_segment_headers::do_print_to_mapfile): New function.
13819         (Output_file_header::do_print_to_mapfile): New function.
13820         (Output_data_const::do_print_to_mapfile): New function.
13821         (class Output_data_const_buffer): Add map_name_ field.  Update
13822         constructor.  Change all callers.  Add do_print_to_mapfile
13823         function.
13824         (class Output_data_fixed_space): Likewise.
13825         (class Output_data_space): Likewise.
13826         (class Output_data_zero_fill): New class.
13827         (Output_data_strtab::do_print_to_mapfile): New function.
13828         (Output_data_reloc_base::do_print_to_mapfile): New function.
13829         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13830         (Output_data_group::do_print_to_mapfile): New function.
13831         (Output_data_got::do_print_to_mapfile): New function.
13832         (Output_data_dynamic::do_print_to_mapfile): New function.
13833         (Output_symtab_xindex::do_print_to_mapfile): New function.
13834         (class Output_section): Declare do_print_to_mapflie.  Declare
13835         print_to_mapfile in Input_section.
13836         (class Output_segment): Declare new functions.
13837         * object.h (Sized_relobj::symbol_count): New function.
13838         * script-sections.cc
13839         (Output_section_element_dot_assignment::set_section_addresses):
13840         Change Output_data_fixed_space to Output_data_zero_fill.
13841         (Output_data_expression::do_print_to_mapfile): New function.
13842         * script.cc (read_input_script): Add mapfile parameter.  Change
13843         all callers.
13844         * script.h (read_input_script): Update declaration.
13845         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13846         (Eh_frame::do_print_to_mapfile): New function.
13847         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13848         (Output_merge_string::do_print_to_mapfile): New function.
13849         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13850         function.
13851         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13852         function.
13853         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13854         function.
13855         * Makefile.am (CCFILES): Add mapfile.cc.
13856         (HFILES): Add mapfile.h.
13857         * Makefile.in: Rebuild.
13858
13859 2008-05-19  Ian Lance Taylor  <iant@google.com>
13860
13861         * options.h (class General_options): Add -z relro.
13862         * layout.cc (Layout::Layout): Initialize relro_segment_.
13863         (Layout::add_output_section_data): Return the output section.
13864         (Layout::make_output_section): Rcognize relro sections and mark
13865         them appropriately.
13866         (Layout::attach_allocated_section_to_segment): Put relro sections
13867         in a PT_GNU_RELRO segment.
13868         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13869         section as relro.
13870         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13871         PT_TLS segments.
13872         (Layout::linkonce_mapping): Map d.rel.ro.local to
13873         .data.rel.ro.local.
13874         (Layout::output_section_name): Us .data.rel.ro.local for any
13875         section which begins with that.
13876         * layout.h (class Layout): Update add_output_section_data
13877         declaration.  Add relro_segment_ field.
13878         * output.cc (Output_section::Output_section): Initialize is_relro_
13879         and is_relro_local_ fields.
13880         (Output_segment::add_output_section): Group relro sections.
13881         (Output_segment::is_first_section_relro): New function.
13882         (Output_segment::maximum_alignment): If there is a relro section,
13883         align the segment to the common page size.
13884         (Output_segment::set_section_addresses): Track whether we are
13885         looking at relro sections.  If the last section is a relro
13886         section, align to the common page size.
13887         (Output_segment::set_section_list_addresses): Add in_relro
13888         parameter.  Change all callers.  Align to the page size when
13889         moving from relro to non-relro section.
13890         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13891         segment.
13892         * output.h (class Output_section): Add is_relro_ and
13893         is_relro_local_ fields.
13894         (Output_section::is_relro): New function.
13895         (Output_section::set_is_relro): New function.
13896         (Output_section::is_relro_local): New function.
13897         (Output_section::set_is_relro_local): New function.
13898         (class Output_segment): Update declarations.
13899         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13900         * sparc.cc (Target_sparc::got_section): Likewise.
13901         * x86_64.cc (Target_x86_64::got_section): Likewise.
13902         * testsuite/relro_test_main.cc: New file.
13903         * testsuite/relro_test.cc: New file.
13904         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13905         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13906         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13907         (relro_test.so, relro_test_pic.o): New targets.
13908         * testsuite/Makefile.in: Rebuild.
13909
13910 2008-05-16  Ian Lance Taylor  <iant@google.com>
13911
13912         * output.cc (Output_segment::add_output_section): Remove front
13913         parameter.
13914         * output.h (class Output_segment): Remove
13915         add_initial_output_section and overloaded add_output_section.
13916         Update declaration of remaining add_output_section.
13917         * layout.cc (Layout::create_interp): Call add_output_section
13918         rather than add_initial_output_section.
13919         (Layout::finish_dynamic_section): Likewise.
13920
13921         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13922         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13923         know the dynamic type.
13924         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13925         field.  Initialize it in constructor.
13926         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13927         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13928         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13929         reloc.
13930
13931         * output.cc (Output_reloc::get_address): Change return type to
13932         Elf_Addr.
13933         * output.h (class Output_reloc): Update get_address declaration.
13934         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13935         for section addresses.
13936
13937 2008-05-09  Ian Lance Taylor  <iant@google.com>
13938
13939         PR 6493
13940         * gold.cc (gold_nomem): Use return value of write.
13941
13942 2008-05-08  Ian Lance Taylor  <iant@google.com>
13943
13944         * symtab.c (Symbol::init_base_output_data): Add version
13945         parameter.  Change all callers.
13946         (Symbol::init_base_output_segment): Likewise.
13947         (Symbol::init_base_constant): Likewise.
13948         (Symbol::init_base_undefined): Likewise.
13949         (Sized_symbol::init_output_data): Likewise.
13950         (Sized_symbol::init_output_segment): Likewise.
13951         (Sized_symbol::init_constant): Likewise.
13952         (Sized_symbol::init_undefined): Likewise.
13953         (Symbol_table::do_define_in_output_data): If the new symbol has a
13954         version, mark it as the default.
13955         (Symbol_table::do_define_in_output_segment): Likewise.
13956         (Symbol_table::do_define_as_constant): Likewise.
13957         * symtab.h (class Symbol): Update declarations.
13958         (class Sized_symbol): Likewise.
13959         * resolve.cc (Symbol::override_version): New function.
13960         (Symbol::override_base): Call override_version.
13961         (Symbol::override_base_with_special): Likewise.
13962         * testsuite/ver_script_8.script: New file.
13963         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13964         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13965         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13966         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13967
13968 2008-05-06  Ian Lance Taylor  <iant@google.com>
13969
13970         PR 6049
13971         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13972         functions.
13973         (class General_options): Remove existing --undefined, and add
13974         --no-undefined instead.  Add new --undefined as synonym for -u.
13975         * archive.cc (Archive::add_symbols): Check whether symbol was
13976         named with -u.
13977         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13978         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13979         all uses.  Add IS_UNDEFINED.  Update declarations to split
13980         different versions of init_base.  Declare init_base_undefined.
13981         (Symbol::is_defined): Handle IS_UNDEFINED.
13982         (Symbol::is_undefined): Likewise.
13983         (Symbol::is_weak_undefined): Call is_undefined.
13984         (Symbol::is_absolute): Handle IS_CONSTANT.
13985         (class Sized_symbol): Update declarations to split different
13986         versions of init.  Declare init_undefined.
13987         (class Symbol_table): Declare new functions.
13988         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13989         Change all callers.
13990         (Symbol::init_base_output_data): Likewise.
13991         (Symbol::init_base_output_segment): Likewise.
13992         (Symbol::init_base_constant): Likewise.
13993         (Symbol::init_base_undefined): New function.
13994         (Sized_symbol::init_object): Rename from init.  Change all
13995         callers.
13996         (Sized_symbol::init_output_data): Likewise.
13997         (Sized_symbol::init_output_segment): Likewise.
13998         (Sized_symbol::init_constant): Likewise.
13999         (Sized_symbol::init_undefined): New function.
14000         (Symbol_table::add_undefined_symbols_from_command_line): New
14001         function.
14002         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14003         function.
14004         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14005         (Symbol::output_section): Likewise.
14006         (Symbol::set_output_section): Likewise.
14007         (Symbol_table::sized_finalize_symbol): Likewise.
14008         (Symbol_table::sized_write_globals): Likewise.
14009         * resolve.cc (Symbol_table::should_override): Likewise.
14010         (Symbol::override_base_with_special): Likewise.
14011
14012         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14013         symbol, change it to have default visibility.
14014         * testsuite/protected_1.cc: New file.
14015         * testsuite/protected_2.cc: New file.
14016         * testsuite/protected_3.cc: New file.
14017         * testsuite/protected_main_1.cc: New file.
14018         * testsuite/protected_main_2.cc: New file.
14019         * testsuite/protected_main_3.cc: New file.
14020         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14021         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14022         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14023         (protected_1.so): New target.
14024         (protected_1_pic.o, protected_2_pic.o): New targets.
14025         (protected_3_pic.o): New target.
14026         (check_PROGRAMS): Add protected_2.
14027         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14028         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14029         * testsuite/Makefile.in: Rebuild.
14030
14031         * options.h (DEFINE_var): Add set_user_set_##varname__.
14032         (DEFINE_bool_alias): New macro.
14033         (class General_options): Define -Bstatic using DEFINE_bool_alias
14034         rather than DEFINE_special.  Add --undefined as an alias for -z
14035         defs.
14036         * options.cc (General_options::parse_Bstatic): Remove.
14037
14038         * options.h (class General_options): Add --fatal-warnings.
14039         * main.cc (main): Implement --fatal-warnings.
14040         * errors.h (Errors::warning_count): New function.
14041
14042         * options.h (class General_options): Add -Bsymbolic-functions.
14043         * symtab.h (Symbol::is_preemptible): Check for
14044         -Bsymbolic-functions.
14045
14046 2008-05-05  Ian Lance Taylor  <iant@google.com>
14047
14048         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14049         as noVARNAME rather than no-VARNAME.
14050         (class General_options): Add option -z combreloc.
14051         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14052         get_address.
14053         (Output_reloc::sort_before) [SHT_REL]: New function.
14054         (Output_reloc::sort_before) [SHT_RELA]: New function.
14055         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14056         Sort_relocs_comparison.
14057         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14058         parameter.  Change all callers.
14059         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14060         sort_relocs parameter.  Change all callers.
14061         * output.cc (Output_reloc::get_address): New function, broken out
14062         of write_rel.
14063         (Output_reloc::write_rel): Call it.
14064         (Output_reloc::compare): New function.
14065         (Output_data_reloc_base::do_write): Optionally sort relocs.
14066
14067         * configure.ac: If targ_extra_obj is set, link it in.
14068         * configure.tgt: Initialize all variables.
14069         (x86_64*): Set targ_extra_obj and targ_extra_size.
14070         * configure: Rebuild.
14071
14072         * object.cc (Sized_relobj::include_section_group): Adjust section
14073         indexes read from group data.  Build vector to pass to
14074         layout_group.
14075         * layout.cc (Layout::layout_group): Add flags and shndxes
14076         parameters.  Remove contents parameter.  Change caller.  Update
14077         explicit instantiations.
14078         * layout.h (class Layout): Update layout_group declaration.
14079         * output.cc (Output_data_group::Output_data_group): Add flags and
14080         input_shndxes parameters.  Remove contents parameter.  Change
14081         caller.
14082         (Output_data_group::do_write): Change input_sections_ to
14083         input_shndxes_.
14084         * output.h (class Output_data_group): Update constructor
14085         declaration.  Rename input_sections_ to input_shndxes_.
14086         * testsuite/many_sections_test.cc: Add template.
14087
14088 2008-04-30  Cary Coutant  <ccoutant@google.com>
14089
14090         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14091
14092         * layout.cc (Layout::include_section): Refactored check for debug
14093         info section.
14094         (Layout::add_comdat): Add new parameters.  Change type
14095         of signature parameter.  Add object and shndx to signatures table.
14096         (Layout::find_kept_object): New function.
14097         * layout.h: Include <cstring>.
14098         (Layout::is_debug_info_section): New function.
14099         (Layout::add_comdat): Add new parameters.
14100         (Layout::find_kept_object): New function.
14101         (Layout::Kept_section): New struct.
14102         (Layout::Signatures): Change type of map range.
14103         * object.cc (Relobj::output_section_address): New function.
14104         (Sized_relobj::include_section_group): Add new parameters.  Change
14105         calls to Layout::add_comdat.  Change to build table of kept comdat
14106         groups and table mapping discarded sections to kept sections.
14107         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14108         (Sized_relobj::do_layout): Change calls to include_section_group and
14109         include_linkonce_section.
14110         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14111         value to zero when section is discarded.
14112         (Sized_relobj::map_to_kept_section): New function.
14113         * object.h (Relobj::output_section_address): New function.
14114         (Relobj::Comdat_group): New type.
14115         (Relobj::find_comdat_group): New function.
14116         (Relobj::Comdat_group_table): New type.
14117         (Relobj::Kept_comdat_section): New type.
14118         (Relobj::Kept_comdat_section_table): New type.
14119         (Relobj::add_comdat_group): New function.
14120         (Relobj::set_kept_comdat_section): New function.
14121         (Relobj::get_kept_comdat_section): New function.
14122         (Relobj::comdat_groups_): New field.
14123         (Relobj::kept_comdat_sections_): New field.
14124         (Symbol_value::input_value): Update comment.
14125         (Sized_relobj::map_to_kept_section) New function.
14126         (Sized_relobj::include_linkonce_section): Add new parameter.
14127         * target-reloc.h (Comdat_behavior): New type.
14128         (get_comdat_behavior): New function.
14129         (relocate_section): Add code to map a discarded section to the
14130         corresponding kept section when applying a relocation.
14131
14132 2008-04-30  Craig Silverstein  <csilvers@google.com>
14133
14134         * dwarf_reader.cc (next_generation_count): New static var.
14135         (Addr2line_cache_entry): New struct.
14136         (addr2line_cache): New static var.
14137         (Dwarf_line_info::one_addr2line): Added caching.
14138         (Dwarf_line_info::clear_addr2line_cache): New function.
14139         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14140         cache-size parameter.
14141         (Dwarf_line_info::one_addr2line_cache): New function.
14142         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14143         new cache-size argument to one_addr2line(), and clear cache.
14144
14145 2008-04-28  Cary Coutant  <ccoutant@google.com>
14146
14147         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14148         R_386_PC8 relocations.
14149
14150 2008-04-23  Ian Lance Taylor  <iant@google.com>
14151
14152         * object.cc (Sized_relobj::include_section_group): Check for
14153         invalid section group.
14154
14155         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14156         header size.
14157
14158         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14159         than read for file header.
14160         * archive.cc (Archive::include_member): Likewise.
14161
14162 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14163
14164         * aclocal.m4: Regenerate.
14165         * configure: Regenerate.
14166
14167 2008-04-19  Ian Lance Taylor  <iant@google.com>
14168
14169         * version.cc (version_string): Bump to 1.6.
14170
14171         * testsuite/Makefile.am (many_sections_r_test): New target.
14172         (many_sections_r_test_SOURCES): Remove.
14173         (many_sections_r_test_DEPENDENCIES): Remove.
14174         (many_sections_r_test_LDFLAGS): Remove.
14175         (many_sections_r_test_LDADD): Remove.
14176
14177         * object.cc (Sized_relobj::do_add_symbols): Always pass
14178         local_symbol_count_ to add_from_relobj.
14179
14180         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14181         every thousand variables.
14182         * testsuite/Makefile.in: Rebuild.
14183
14184         * object.cc (Xindex::initialize_symtab_xindex): New function.
14185         (Xindex::read_symtab_xindex): New function.
14186         (Xindex::sym_xindex_to_shndx): New function.
14187         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14188         available.
14189         (Sized_relobj::do_initialize_xindex): New function.
14190         (Sized_relobj::do_read_symbols): Adjust section links.
14191         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14192         parameter.  Change all callers.
14193         (Sized_relobj::include_section_group): Adjust section links and
14194         symbol section indexes.
14195         (Sized_relobj::do_layout): Adjust section links.
14196         (Sized_relobj::do_count_local_symbols): Adjust section links and
14197         symbol section indexes.
14198         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14199         ordinary and special symbols.
14200         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14201         dynsym_xindex parameters.  Change all callers.  Adjust section
14202         links.  Use SHN_XINDEX when needed.
14203         (Sized_relobj::get_symbol_location_info): Adjust section links.
14204         Don't get fooled by special symbols.
14205         * object.h (class Xindex): Define.
14206         (class Object): Add xindex_ parameter.  Declare virtual functoin
14207         do_initialize_xindex.
14208         (Object::adjust_sym_shndx): New function.
14209         (Object::set_xindex): New protected function.
14210         (class Symbol_value): Add is_ordinary_shndx_ field.
14211         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14212         (Symbol_value::value): Assert ordinary section.
14213         (Symbol_value::initialize_input_to_output_map): Likewise.
14214         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14215         Change all callers.
14216         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14217         all callers.
14218         (class Sized_relobj): Update declarations.
14219         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14220         parameter.  Change all callers.
14221         (Sized_relobj::adjust_shndx): New function.
14222         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14223         field.
14224         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14225         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14226         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14227         (Sized_dynobj::read_dynsym_section): Adjust section links.
14228         (Sized_dynobj::read_dynamic): Likewise.
14229         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14230         section links.
14231         (Sized_dynobj::do_initialize_xindex): New function.
14232         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14233         do_initialize_xindex.
14234         (Sized_dynobj::adjust_shndx): New function.
14235         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14236         dynsym_xindex_ fields.
14237         (Layout::finalize): Add a call to set_section_indexes before
14238         creating the symtab sections.
14239         (Layout::set_section_indexes): Don't do anything if the section
14240         already has a section index.
14241         (Layout::create_symtab_sections): Add shnum parameter.  Change
14242         caller.  Create .symtab_shndx section if needed.
14243         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14244         caller.
14245         (Layout::allocated_output_section_count): New function.
14246         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14247         needed.
14248         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14249         fields.  Update declarations.
14250         (Layout::symtab_xindex): New function.
14251         (Layout::dynsym_xindex): New function.
14252         (class Write_symbols_task): Add layout_ field.
14253         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14254         Change caller.
14255         * output.cc (Output_section_headers::Output_section_headers): Add
14256         shstrtab_section parameter.  Change all callers.
14257         (Output_section_headers::do_sized_write): Store overflow values
14258         for section count and section string table section index in
14259         section header zero.
14260         (Output_file_header::do_sized_write): Check for overflow of
14261         section count and section string table section index.
14262         (Output_symtab_xindex::do_write): New function.
14263         (Output_symtab_xindex::endian_do_write): New function.
14264         * output.h (class Output_section_headers): Add shstrtab_section_.
14265         Update declarations.
14266         (class Output_symtab_xindex): Define.
14267         (Output_section::has_out_shndx): New function.
14268         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14269         field.
14270         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14271         Change all callers.
14272         (Sized_symbol::init): Likewise.
14273         (Symbol::output_section): Check for ordinary symbol.
14274         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14275         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14276         callers.
14277         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14278         Change all callers.  Simplify handling of symbols from sections
14279         not included in the link.
14280         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14281         distinction.
14282         (Weak_alias_sorter::operator()): Assert that symbols are
14283         ordinary.
14284         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14285         distinction.
14286         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14287         parameters.  Change all callers.
14288         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14289         symbol distinction.  Use SHN_XINDEX when needed.
14290         (Symbol_table::write_section_symbol): Add symtab_xindex
14291         parameter.  Change all callers.
14292         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14293         SHN_XINDEX when needed.
14294         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14295         declarations.
14296         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14297         (Symbol::is_defined): Check is_ordinary.
14298         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14299         (Symbol::is_absolute, Symbol::is_common): Likewise.
14300         (class Sized_symbol): Update declarations.
14301         (class Symbol_table): Update declarations.
14302         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14303         parameters.  Change all callers.
14304         (Sized_symbol::override): Likewise.
14305         (Symbol_table::override): Likewise.
14306         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14307         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14308         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14309         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14310         to be in an ordinary section.
14311         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14312         object and is_ordinary parameters.  Change all callers.
14313         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14314         Change all callers.  Don't add undefined or non-ordinary symbols
14315         to reloc_map_.
14316         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14317         Change all callers.
14318         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14319         declarations.
14320         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14321         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14322         (Sized_relobj::relocate_sections): Likewise.
14323         * target-reloc.h (scan_relocs): Adjust section symbol index.
14324         (scan_relocatable_relocs): Likewise.
14325         * i386.cc (Scan::local): Check for ordinary symbols.
14326         * sparc.cc (Scan::local): Likewise.
14327         * x86_64.cc (Scan::local): Likewise.
14328         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14329         to symbol_section_and_value.
14330         * testsuite/many_sections_test.cc: New file.
14331         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14332         (check_PROGRAMS): Add many_sections_test.
14333         (many_sections_test_SOURCES): Define.
14334         (many_sections_test_DEPENDENCIES): Define.
14335         (many_sections_test_LDFLAGS): Define.
14336         (BUILT_SOURCES): Add many_sections_define.h.
14337         (many_sections_define.h): New target.
14338         (BUILT_SOURCES): Add many_sections_check.h.
14339         (many_sections_check.h): New target.
14340         (check_PROGRAMS): Add many_sections_r_test.
14341         (many_sections_r_test_SOURCES): Define.
14342         (many_sections_r_test_DEPENDENCIES): Define.
14343         (many_sections_r_test_LDFLAGS): Define.
14344         (many_sections_r_test_LDADD): Define.
14345         (many_sections_r_test.o): New target.
14346         * testsuite/Makefile.in: Rebuild.
14347
14348 2008-04-17  Cary Coutant  <ccoutant@google.com>
14349
14350         * errors.cc (Errors::info): New function.
14351         (gold_info): New function.
14352         * errors.h (Errors::info): New function.
14353         * gold.h (gold_info): New function.
14354         * object.cc (Input_objects::add_object): Print trace output.
14355         * options.cc (options::parse_set): New function.
14356         (General_options::parse_wrap): Deleted.
14357         (General_options::General_options): Deleted initializer.
14358         * options.h (options::String_set): New typedef.
14359         (options::parse_set): New function.
14360         (DEFINE_set): New macro.
14361         (General_options::wrap): Changed to use DEFINE_set. Changed
14362         callers of any_wrap_symbols and is_wrap_symbol.
14363         (General_options::trace, General_options::trace_symbol):
14364         New options.
14365         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14366         (General_options::wrap_symbols_): Deleted.
14367         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14368
14369 2008-04-17  David S. Miller  <davem@davemloft.net>
14370
14371         * options.cc (General_options::parse_V): New function.
14372         * options.h: Add entries for -V and -Qy.
14373
14374 2008-04-17  Ian Lance Taylor  <iant@google.com>
14375
14376         * common.cc (Symbol_table::allocate_commons): Remove options
14377         parameter.  Change caller.
14378         (Symbol_table::do_allocate_commons): Remove options parameter.
14379         Change caller.  Just call do_allocate_commons_list twice.
14380         (Symbol_table::do_allocate_commons_list): New function, broken out
14381         of do_allocate_commons.
14382         * common.h (class Allocate_commons_task): Remove options_ field.
14383         Update constructor.
14384         * symtab.cc (Symbol_table::Symbol_table): Initialize
14385         tls_commons_.
14386         (Symbol_table::add_from_object): Put TLS common symbols on
14387         tls_commons_ list.
14388         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14389         which are IN_OUTPUT_DATA.
14390         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14391         allocate_commons and do_allocate_commons declarations.  Declare
14392         do_allocate_commons_list.
14393         * gold.cc (queue_middle_tasks): Update creation of
14394         Allocate_commons_task to not pass options.
14395         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14396         (TLS_TEST_C_FLAGS): New variable.
14397         (tls_test_c_pic.o): New target.
14398         (tls_test_shared.so): Link in tls_test_c_pic.o.
14399         (tls_test_c_pic_ie.o): New target.
14400         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14401         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14402         (tls_test_c.o): New target.
14403         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14404         (tls_pic_test_LDADD): Likewise.
14405         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14406         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14407         (tls_test_c_gnu2.o): New target.
14408         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14409         tls_test_c_gnu2.o.
14410         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14411         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14412         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14413         * testsuite/tls_test.cc: Include "config.h".
14414         (t_last): Call t11_last.
14415         * testsuite/tls_test.h (t11, t11_last): Declare.
14416         * testsuite/tls_test_c.c: New file.
14417         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14418         * configure.ac: Check for OpenMP support.
14419         * configure, config.in, Makefile.in: Rebuild.
14420         * testsuite/Makefile.in: Rebuild.
14421
14422 2008-04-16  Cary Coutant  <ccoutant@google.com>
14423
14424         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14425         (Target_i386::tls_base_symbol_defined_): New field.
14426         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14427         (Target_i386::Scan::global): Likewise.
14428         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14429         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14430         (Target_x86_64::tls_base_symbol_defined_): New field.
14431         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14432         (Target_x86_64::Scan::global): Likewise.
14433
14434 2008-04-16  Cary Coutant  <ccoutant@google.com>
14435
14436         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14437         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14438         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14439         building shared libraries.
14440         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14441         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14442         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14443         * testsuite/Makefile.in: Rebuild.
14444         * testsuite/weak_undef.h: New file.
14445         * testsuite/weak_undef_file1.cc: Add extra test cases.
14446         * testsuite/weak_undef_file2.cc: Likewise.
14447         * testsuite/weak_undef_test.cc: Likewise.
14448
14449 2008-04-16  David S. Miller  <davem@davemloft.net>
14450
14451         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14452         Add issued_non_pic_error_ field.  Declare check_non_pic.
14453         (Target_sparc::Scan::check_non_pic): New function.
14454         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14455         (Target_sparc::Scan::global): Likewise.
14456
14457         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14458         * configure: Rebuild.
14459
14460         * options.h (DEFINE_enable): New macro.
14461         (new_dtags): New enable option.
14462         (initfirst, interpose, loadfltr, nodefaultlib,
14463         nodelete, nodlopen, nodump): New -z options.
14464         * layout.cc (Layout:finish_dynamic_section): If new
14465         dtags enabled, emit DT_RUNPATH.  Also, emit a
14466         DT_FLAGS_1 containing any specified -z flags.
14467
14468 2008-04-16  Ian Lance Taylor  <iant@google.com>
14469
14470         * copy-relocs.cc: New file.
14471         * copy-relocs.h: New file.
14472         * reloc.cc: Remove Copy_relocs code.
14473         * reloc.h: Likewise.
14474         * reloc-types.h (struct Reloc_types) [both versions]: Add
14475         get_reloc_addend_noerror.
14476         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14477         variants of add_global which take an addend which must be zero.
14478         * i386.cc: Include "copy-relocs.h".
14479         (class Target_i386): Change type of copy_relocs_ to variable,
14480         update initializer.
14481         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14482         Change all callers.
14483         (Target_i386::do_finalize_sections): Change handling of
14484         copy_relocs_.
14485         * sparc.cc: Include "copy-relocs.h".
14486         (class Target_sparc): Change type of copy_relocs_ to variable,
14487         update initializer.
14488         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14489         Change all callers.
14490         (Target_sparc::do_finalize_sections): Change handling of
14491         copy_relocs_.
14492         * x86_64.cc: Include "copy-relocs.h".
14493         (class Target_x86_64): Change type of copy_relocs_ to variable,
14494         update initializer.
14495         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14496         class.  Change all callers.
14497         (Target_x86_64::do_finalize_sections): Change handling of
14498         copy_relocs_.
14499         * Makefile.am (CCFILES): Add copy-relocs.cc.
14500         (HFILES): Add copy-relocs.h.
14501
14502         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14503
14504         * testsuite/script_test_4.sh: Permit leading zeroes.
14505
14506 2008-04-15  Ian Lance Taylor  <iant@google.com>
14507
14508         * script-sections.cc (Script_sections::create_segments): Use
14509         header_size_adjustment even when there is enough room for the
14510         headers.
14511         * testsuite/script_test_4.sh: New file.
14512         * testsuite/script_test_4.t: New file.
14513         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14514         (check_DATA): Add script_test_4.stdout.
14515         (MOSTLYCLEANFILES): Likewise.
14516         (script_test_4): New target.
14517         (script_test_4.stdout): New target.
14518         * testsuite/Makefile.in: Rebuild.
14519
14520         * sparc.cc: Add definitions for Output_data_plt_sparc class
14521         constants.
14522
14523 2008-04-14  David S. Miller  <davem@davemloft.net>
14524
14525         * sparc.cc: New file.
14526         * Makefile.am (TARGETSOURCES): Add sparc.cc
14527         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14528         * configure.tgt: Document targ_extra_size and
14529         targ_extra_big_endian.  Add entries for sparc-* and
14530         sparc64-*.
14531         * configure.ac: Handle targ_extra_size and
14532         targ_extra_big_endian.
14533         * Makefile.in: Rebuild.
14534         * configure: Likewise.
14535         * po/POTFILES.in: Likewise.
14536         * po/gold.pot: Likewise.
14537
14538 2008-04-14  Ian Lance Taylor  <iant@google.com>
14539
14540         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14541         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14542         in the name/type/flags to section mapping.  Don't call
14543         allocate_output_section.
14544         (Layout::choose_output_section): Change parameter from adjust_name
14545         to is_input_section.  Don't permit input sections after sections
14546         are attached to segments.  Don't call allocate_output_section.
14547         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14548         not write_enable_output_section.
14549         (Layout::make_output_section): Don't push to
14550         unattached_section_list_ nor call attach_to_segment.  Call
14551         attach_section_to_segment if sections are attached.
14552         (Layout::attach_sections_to_segments): New function.
14553         (Layout::attach_section_to_segment): New function.
14554         (Layout::attach_allocated_section_to_segment): Rename from
14555         attach_to_segment.  Remove flags parameter.
14556         (Layout::allocate_output_section): Remove function.
14557         (Layout::write_enable_output_section): Remove function.
14558         * layout.h (class Layout): Update for above changes.  Add new
14559         field sections_are_attached_.
14560         * output.h (Output_section::update_flags_for_input_section): New
14561         function.
14562         * output.cc (Output_section::add_input_section): Call
14563         update_flags_for_input_section.
14564         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14565
14566 2008-04-11  Cary Coutant  <ccoutant@google.com>
14567
14568         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14569         thought unnecessary.
14570         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14571
14572 2008-04-11  Ian Lance Taylor  <iant@google.com>
14573
14574         * output.h (class Output_section_data): Remove inline definition
14575         of set_addralign.
14576         * output.cc (Output_section_data::set_addralign): New function.
14577
14578 2008-04-11  Cary Coutant  <ccoutant@google.com>
14579
14580         Add support for TLS descriptors for i386 and x86_64.
14581         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14582         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14583         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14584         GOT_TYPE_TLS_DESC.
14585         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14586         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14587         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14588         relocations.
14589         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14590         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14591         Fix problem with initial-exec relocations.
14592         (Target_i386::Relocate::relocate_tls): Likewise.
14593         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14594         relaxation.
14595         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14596         support for section-plus-offset dynamic table entries.
14597         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14598         (Output_data_dynamic::Dynamic_entry): Add support for
14599         section-plus-offset dynamic table entries.
14600         (Output_data_dynamic::Classification): Likewise.
14601         (Output_data_dynamic::classification_): Renamed offset_.
14602         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14603         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14604         (Target_x86_64::make_plt_section): New function.
14605         (Target_x86_64::reserve_tlsdesc_entries): New function.
14606         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14607         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14608         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14609         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14610         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14611         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14612         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14613         add extra PLT entry for TLS descriptors.
14614         (Output_data_plt_x86_64::got_): New field.
14615         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14616         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14617         fields.
14618         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14619         descriptors.
14620         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14621         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14622         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14623         R_386_TLS_DESC_CALL relocations.
14624         (Target_x86_64::Scan::global): Likewise.
14625         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14626         for TLS descriptors.
14627         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14628         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14629         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14630         GD-to-IE relaxation.
14631         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14632         and TLS_DESCRIPTORS.
14633         * Makefile.in: Rebuild.
14634         * configure: Rebuild.
14635         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14636         (tls_test_shared2.so): New target.
14637         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14638         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14639         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14640         (tls_shared_gd_to_ie_test_LDADD): New variable.
14641         (tls_shared_gnu2_gd_to_ie_test): New target.
14642         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14643         New targets.
14644         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14645         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14646         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14647         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14648         (tls_shared_gnu2_test): New target.
14649         (tls_test_gnu2_shared.so): New target.
14650         (tls_shared_gnu2_test_SOURCES): New variable.
14651         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14652         (tls_shared_gnu2_test_LDFLAGS): New variable.
14653         (tls_shared_gnu2_test_LDADD): New variable.
14654         * testsuite/Makefile.in: Rebuild.
14655         * testsuite/Makefile.
14656
14657 2008-04-11  Ian Lance Taylor  <iant@google.com>
14658
14659         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14660         justsyms.t.
14661         * testsuite/Makefile.in: Rebuild.
14662
14663         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14664         long.
14665         * testsuite/script_test_2.cc (main): Adjust test.
14666
14667 2008-04-11  David S. Miller  <davem@davemloft.net>
14668             Ian Lance Taylor  <iant@google.com>
14669
14670         * options.h (General_options): Add entries for '-Y' and
14671         '-relax'.
14672         * options.cc (General_options:finalize): If -Y was used, add those
14673         entries to the library path instead of the default "/lib" and
14674         "/usr/lib".
14675
14676 2008-04-11  David S. Miller  <davem@davemloft.net>
14677
14678         * testsuite/justsyms.t: Start at 0x100.
14679         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14680         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14681         long.
14682         * testsuite/script_test_2.cc: Adjust string and section length
14683         checks.
14684
14685 2008-04-09  Ian Lance Taylor  <iant@google.com>
14686
14687         PR gold/5996
14688         * script-sections.cc (Sections_element::allocate_to_segment): Add
14689         orphan parameter.
14690         (Output_section_definition::allocate_to_segment): Likewise.
14691         (Orphan_output_section::allocate_to_segment): Likewise.
14692         (Script_sections::attach_sections_using_phdrs_clause): Don't
14693         propagate non-PT_LOAD segments to orphan sections.
14694         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14695         readelf rather than objdump.
14696         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14697         .interp section and PT_INTERP segment are the same size.
14698         * testsuite/Makefile.in: Rebuild.
14699
14700         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14701         aliases for symbols defined in the same object.
14702         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14703         (weak_alias_test_SOURCES): New variable.
14704         (weak_alias_test_DEPENDENCIES): New variable.
14705         (weak_alias_test_LDFLAGS): New variable.
14706         (weak_alias_test_LDADD): New variable.
14707         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14708         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14709         (weak_alias_test_3.o): New target.
14710         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14711         * testsuite/weak_alias_test_main.cc: New file.
14712         * testsuite/weak_alias_test_1.cc: New file.
14713         * testsuite/weak_alias_test_2.cc: New file.
14714         * testsuite/weak_alias_test_3.cc: New file.
14715
14716 2008-04-08  Ian Lance Taylor  <iant@google.com>
14717
14718         * options.h (class General_options): Add --noinhibit-exec option.
14719         * main.cc (main): Check --noinhibit-exec.
14720
14721         * options.h (class General_options): Define --wrap as a special
14722         option.  Add wrap_symbols_ field.
14723         (General_options::any_wrap_symbols): New function.
14724         (General_options::is_wrap_symbol): New function.
14725         * options.cc (General_options::parse_wrap): New function.
14726         (General_options::General_options): Initialize wrap_symbols_.
14727         * symtab.cc (Symbol_table::wrap_symbol): New function.
14728         (Symbol_table::add_from_object): Handle --wrap.
14729         * symtab.h (class Symbol_table): Declare wrap_symbol.
14730         * target.h (Target::wrap_char): New function.
14731         (Target::Target_info): Add wrap_char field.
14732         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14733         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14734         * testsuite/testfile.cc (Target_test::test_target_info):
14735         Likewise.
14736
14737         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14738         there is one.
14739
14740         * layout.h (class Layout): Add added_eh_frame_data_ field.
14741         * layout.cc (Layout::Layout): Initialize new field.
14742         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14743         output section until we find a section we merged successfully.
14744         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14745         that the size be non-zero.
14746
14747         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14748         qualifier.
14749
14750 2008-04-08  Craig Silverstein  <csilvers@google.com>
14751
14752         * configure.ac: Export new conditional variable HAVE_ZLIB.
14753         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14754         on HAVE_ZLIB.
14755         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14756         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14757
14758 2008-04-07  Ian Lance Taylor  <iant@google.com>
14759
14760         * version.cc (version_string): Set to "1.5".
14761
14762         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14763         Add issued_non_pic_error_ field.  Declare check_non_pic.
14764         (Target_x86_64::Scan::check_non_pic): New function.
14765         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14766         (Target_x86_64::Scan::global): Likewise.
14767
14768         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14769         addend parameter.  Change caller.  Handle merge sections.
14770         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14771         Address to Addend.  Don't add in the result of
14772         local_section_offset, pass down the addend and use the returned
14773         value.
14774         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14775         Update declarations of local_section_offset and symbol_value.
14776         * testsuite/two_file_test_1.cc (t18): New function.
14777         * testsuite/two_file_test_2.cc (f18): New function.
14778         * testsuite/two_file_test_main.cc (main): Call t18.
14779         * testsuite/two_file_test.h (t18, f18): Declare.
14780
14781         * configure.ac: Don't test for objdump, c++filt, or readelf.
14782         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14783         conditionals.
14784         (TEST_READELF): New variable.
14785         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14786         (check_PROGRAMS): Add two_file_strip_test.
14787         (two_file_strip_test): New target.
14788         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14789         (two_file_same_shared_strip_test_SOURCES): New variable.
14790         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14791         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14792         (two_file_same_shared_strip_test_LDADD): New variable.
14793         (two_file_shared_strip.so): New target.
14794         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14795         (ver_test_5.syms, ver_test_7.syms): Likewise.
14796         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14797         (strip_test_3.stdout): Use TEST_OBJDUMP.
14798         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14799
14800 2008-04-04  Cary Coutant  <ccoutant@google.com>
14801
14802         * symtab.h (Symbol::is_weak_undefined): New function.
14803         (Symbol::is_strong_undefined): New function.
14804         (Symbol::is_absolute): New function.
14805         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14806         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14807         absolute symbols.
14808         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14809         (weak_undef_test): New target.
14810         * testsuite/Makefile.in: Rebuild.
14811         * testsuite/weak_undef_file1.cc: New file.
14812         * testsuite/weak_undef_file2.cc: New file.
14813         * testsuite/weak_undef_test.cc: New file.
14814
14815 2008-04-03  Craig Silverstein  <csilvers@google.com>
14816
14817         * compressed_output.h (class Output_compressed_section): Use
14818         unsigned buffer.
14819         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14820         add zlib header.
14821         (zlib_compressed_suffix): Removed.
14822         (Output_compressed_section::set_final_data_size): Use unsigned
14823         buffers.
14824         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14825         Fix linker invocation.
14826         (flagstest_o_specialfile_and_compress_debug_sections):
14827         Likewise.
14828         * testsuite/Makefile.in: Regenerated.
14829
14830 2008-04-02  David S. Miller  <davem@davemloft.net>
14831
14832         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14833         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14834
14835 2008-04-02  Craig Silverstein  <csilvers@google.com>
14836
14837         * TODO: New file.
14838
14839 2008-04-02  Ian Lance Taylor  <iant@google.com>
14840
14841         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14842         parameters.  Update for new key type to views_.  Change all
14843         callers.
14844         (File_read::read): Adjust for byteshift in returned view.
14845         (File_read::add_view): New function, broken out of
14846         find_and_make_view.
14847         (File_read::make_view): New function, broken out of
14848         find_and_make_view.
14849         (File_read::find_or_make_view): Add offset and aligned
14850         parameters.  Rewrite accordingly.  Change all callers.
14851         (File_read::get_view): Add offset and aligned parameters.  Adjust
14852         for byteshift in return value.
14853         (File_read::get_lasting_view): Likewise.
14854         * fileread.h (class File_read): Update declarations.
14855         (class File_read::View): Add byteshift_ field.  Add byteshift to
14856         constructor.  Add byteshift method.
14857         * archive.h (Archive::clear_uncached_views): New function.
14858         (Archive::get_view): Add aligned parameter.  Change all callers.
14859         * object.h (Object::get_view): Add aligned parameter.  Change all
14860         callers.
14861         (Object::get_lasting_view): Likewise.
14862
14863         * fileread.cc (File_read::release): Don't call clear_views if
14864         there are multiple objects.
14865         * fileread.h (File_read::clear_uncached_views): New function.
14866         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14867         on the archive.
14868
14869 2008-03-31  Cary Coutant  <ccoutant@google.com>
14870
14871         Add thin archive support.
14872         * archive.cc (Archive::armagt): New const.
14873         (Archive::setup): Remove task parameter and calls to unlock.
14874         (Archive::unlock_nested_archives): New function.
14875         (Archive::read_header): Add nested_off parameter. Change
14876         all callers.
14877         (Archive::interpret_header): Likewise.
14878         (Archive::include_all_members): Change to handle thin
14879         archives.
14880         (Archive::include_member): Likewise.
14881         * archive.h (Archive::Archive): Add new parameters and
14882         initializers.
14883         (Archive::armagt): New const.
14884         (Archive::setup): Remove task parameter.
14885         (Archive::unlock_nested_archives): New function.
14886         (Archive::read_header): Add nested_off parameter.
14887         (Archive::interpret_header): Likewise.
14888         (Archive::Nested_archive_table): New typedef.
14889         (Archive::is_thin_archive_): New field.
14890         (Archive::nested_archives_): New field.
14891         (Archive::options_): New field.
14892         (Archive::dirpath_): New field.
14893         (Archive::task_): New field.
14894         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14895         for thin archives.  Pass additional parameters to
14896         Archive::Archive.  Unlock the archive file after calling
14897         Archive::setup.
14898
14899 2008-03-29  Ian Lance Taylor  <iant@google.com>
14900
14901         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14902         version symbol to be local.
14903         * testsuite/ver_test_4.sh: New file.
14904         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14905         (check_DATA): Add ver_test_4.syms.
14906         (ver_test_4.syms): New target.
14907         * testsuite/Makefile.in: Rebuild.
14908
14909         * output.cc
14910         (Output_section::Input_section_sort_entry::has_priority): New
14911         function.
14912         (Output_section::Input_section_sort_entry::match_file_name): New
14913         function.
14914         (Output_section::Input_section_sort_entry::match_section_name):
14915         Remove.
14916         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14917         Remove.
14918         (Output_section::Input_section_sort_entry::match_section_file):
14919         Remove.
14920         (Output_section::Input_section_sort_compare::operator()): Rewrite
14921         using new Input_section_sort_entry functions.  Sort crtbegin and
14922         crtend first.  Sort sections with no priority before sections with
14923         a priority.
14924         * testsuite/initpri1.c (d3): Check j != 4.
14925         (cd5): New constructor/destructor function.
14926         (main): Check j != 2.
14927
14928         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14929         new symbol when resolving, don't call set_is_default.
14930         * testsuite/ver_test_7.cc: New file.
14931         * testsuite/ver_test_7.sh: New file.
14932         * testsuite/Makefile.am (ver_test_7.so): New target.
14933         (ver_test_7.o): New target.
14934         (check_SCRIPTS): Add ver_test_7.sh.
14935         (check_DATA): Add ver_test_7.syms.
14936         (ver_test_7.syms): New target.
14937
14938 2008-03-28  Ian Lance Taylor  <iant@google.com>
14939
14940         * layout.cc (Layout::layout): If we see an input section with a
14941         name that needs sorting, set the must_sort flag for the output
14942         section.
14943         (Layout::make_output_section): If the name of the output section
14944         indicates that it might require sorting, set the may_sort flag.
14945         * output.h (Output_section::may_sort_attached_input_sections): New
14946         function.
14947         (Output_section::set_may_sort_attached_input_sections): New
14948         function.
14949         (Output_section::must_sort_attached_input_sections): New
14950         function.
14951         (Output_section::set_must_sort_attached_input_sections): New
14952         function.
14953         (class Output_section): Declare Input_section_sort_entry.  Define
14954         Input_section_sort_compare.  Declare
14955         sort_attached_input_sections.  Add new fields:
14956         may_sort_attached_input_sections_,
14957         must_sort_attached_input_sections_,
14958         attached_input_sections_are_sorted_.
14959         * output.cc (Output_section::Output_section): Initialize new
14960         fields.
14961         (Output_section::add_input_section): Add an entry to
14962         input_sections_ if may_sort or must_sort are true.
14963         (Output_section::set_final_data_size): Call
14964         sort_attached_input_sections if necessary.
14965         (Output_section::Input_section_sort_entry): Define new class.
14966         (Output_section::Input_section_sort_compare::operator()): New
14967         function.
14968         (Output_section::sort_attached_input_sections): New function.
14969         * configure.ac: Check whether the compiler supports constructor
14970         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14971         * testsuite/initpri1.c: New file.
14972         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14973         CONSTRUCTOR_PRIORITY.
14974         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14975         (initpri1_LDFLAGS): New variable.
14976         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14977
14978 2008-03-27  Ian Lance Taylor  <iant@google.com>
14979
14980         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14981         * testsuite/common_test_1.c: New file.
14982         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14983         (common_test_1_SOURCES): New variable.
14984         (common_test_1_DEPENDENCIES): New variable.
14985         (common_test_1_LDFLAGS): New variable.
14986
14987         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14988         and commons_ correctly when NAME/VERSION does not override
14989         NAME/NULL.
14990         * testsuite/ver_test_6.c: New file.
14991         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14992         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14993         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14994
14995 2008-03-26  Ian Lance Taylor  <iant@google.com>
14996
14997         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14998         of an undefined symbol from a version script.
14999         * testsuite/Makefile.am (ver_test_5.so): New target.
15000         (ver_test_5.o): New target.
15001         (check_SCRIPTS): Add ver_test_5.sh.
15002         (check_DATA): Add ver_test_5.syms.
15003         (ver_test_5.syms): New target.
15004         * testsuite/ver_test_5.cc: New file.
15005         * testsuite/ver_test_5.script: New file.
15006         * testsuite/ver_test_5.sh: New file.
15007         * Makefile.in, testsuite/Makefile.in: Rebuild.
15008
15009         PR gold/5986
15010         Fix problems building gold with gcc 4.3.0.
15011         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15012         (gold_error_at_location, gold_warning_at_location): Use it.
15013         * configure.ac: Check whether we can compile and use a template
15014         function with a printf attribute.
15015         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15016         when jumping over bytes.
15017         * object.cc: Instantiate Object::read_section_data.
15018         * debug.h: Include <cstring>
15019         * dwarf_reader.cc: Include <algorithm>
15020         * main.cc: Include <cstring>.
15021         * options.cc: Include <cstring>.
15022         * output.cc: Include <cstring>.
15023         * script.cc: Include <cstring>.
15024         * script.h: Include <string>.
15025         * symtab.cc: Include <cstring> and <algorithm>.
15026         * target-select.cc: Include <cstring>.
15027         * version.cc: Include <string>.
15028         * testsuite/testmain.cc: Include <cstdlib>.
15029         * configure, config.in: Rebuild.
15030
15031 2008-03-25  Ian Lance Taylor  <iant@google.com>
15032
15033         * options.cc: Include "../bfd/bfdver.h".
15034         (options::help): Print bug reporting address.
15035
15036         * version.cc (print_version): Adjust output for current value of
15037         BFD_VERSION_STRING.
15038
15039         * NEWS: New file.
15040
15041         * options.cc (options::help): Print list of supported targets.
15042         * target-select.h: Include <vector>.
15043         (class Target_selector): Make machine_, size_, and is_big_endian_
15044         fields const.  Add bfd_name_ and instantiated_target_ fields.
15045         (Target_selector::Target_selector): Add bfd_name parameter.
15046         (Target_selector::recognize): Make non-virtual, call
15047         do_recognize.
15048         (Target_selector::recognize_by_name): Make non-virtual, call
15049         do_recognize_by_name.
15050         (Target_selector::supported_names): New function.
15051         (Target_selector::bfd_name): New function.
15052         (Target_selector::do_instantiate_target): New pure virtual
15053         function.
15054         (Target_selector::do_recognize): New virtual function.
15055         (Target_selector::do_recognize_by_name): New virtual function.
15056         (Target_selector::instantiate_target): New private function.
15057         (supported_target_names): Declare.
15058         * target-select.cc (Target_selector::Target_selector): Update for
15059         new parameter and fields.
15060         (select_target_by_name): Check that the name matches before
15061         calling recognize_by_name.
15062         (supported_target_names): New function.
15063         * i386.cc (class Target_selector_i386): Update Target_selector
15064         constructor call.  Remove recognize and recognize_by_name.  Add
15065         do_instantiate_target.
15066         * x86_64.cc (class Target_selector_x86_64): Likewise.
15067         * testsuite/testfile.cc (class Target_selector_test): Update for
15068         changes to Target_selector.
15069
15070         * README: Rewrite, with some notes on unsupported features.
15071
15072 2008-03-24  Cary Coutant  <ccoutant@google.com>
15073
15074         * i386.cc (Target_i386::Got_type): New enum declaration.
15075         (Target_i386::Scan::local): Updated callers of Output_data_got
15076         member functions.
15077         (Target_i386::Scan::global): Likewise.
15078         (Target_i386::Relocate::relocate): Likewise.
15079         (Target_i386::Relocate::relocate_tls): Likewise.
15080         * object.h (Got_offset_list): New class.
15081         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15082         (Sized_relobj::local_got_offset): Likewise.
15083         (Sized_relobj::set_local_got_offset): Likewise.
15084         (Sized_relobj::local_has_tls_got_offset): Removed.
15085         (Sized_relobj::local_tls_got_offset): Removed.
15086         (Sized_relobj::set_local_tls_got_offset): Removed.
15087         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15088         * output.cc (Output_data_got::add_global): Added got_type parameter.
15089         (Output_data_got::add_global_with_rel): Likewise.
15090         (Output_data_got::add_global_with_rela): Likewise.
15091         (Output_data_got::add_global_pair_with_rel): New function.
15092         (Output_data_got::add_global_pair_with_rela): New function.
15093         (Output_data_got::add_local): Added got_type parameter.
15094         (Output_data_got::add_local_with_rel): Likewise.
15095         (Output_data_got::add_local_with_rela): Likewise.
15096         (Output_data_got::add_local_pair_with_rel): New function.
15097         (Output_data_got::add_local_pair_with_rela): New function.
15098         (Output_data_got::add_global_tls): Removed.
15099         (Output_data_got::add_global_tls_with_rel): Removed.
15100         (Output_data_got::add_global_tls_with_rela): Removed.
15101         (Output_data_got::add_local_tls): Removed.
15102         (Output_data_got::add_local_tls_with_rel): Removed.
15103         (Output_data_got::add_local_tls_with_rela): Removed.
15104         * output.h (Output_data_got::add_global): Added got_type parameter.
15105         (Output_data_got::add_global_with_rel): Likewise.
15106         (Output_data_got::add_global_with_rela): Likewise.
15107         (Output_data_got::add_global_pair_with_rel): New function.
15108         (Output_data_got::add_global_pair_with_rela): New function.
15109         (Output_data_got::add_local): Added got_type parameter.
15110         (Output_data_got::add_local_with_rel): Likewise.
15111         (Output_data_got::add_local_with_rela): Likewise.
15112         (Output_data_got::add_local_pair_with_rel): New function.
15113         (Output_data_got::add_local_pair_with_rela): New function.
15114         (Output_data_got::add_global_tls): Removed.
15115         (Output_data_got::add_global_tls_with_rel): Removed.
15116         (Output_data_got::add_global_tls_with_rela): Removed.
15117         (Output_data_got::add_local_tls): Removed.
15118         (Output_data_got::add_local_tls_with_rel): Removed.
15119         (Output_data_got::add_local_tls_with_rela): Removed.
15120         * resolve.cc (Symbol::override_base_with_special): Removed
15121         reference to has_got_offset_ field.
15122         * symtab.cc (Symbol::init_fields): Replaced initialization
15123         of got_offset_ with got_offsets_.  Removed initialization
15124         of has_got_offset_
15125         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15126         (Symbol::got_offset): Likewise.
15127         (Symbol::set_got_offset): Likewise.
15128         (Symbol::has_tls_got_offset): Removed.
15129         (Symbol::tls_got_offset): Removed.
15130         (Symbol::set_tls_got_offset): Removed.
15131         (Symbol::got_offset_): Removed.
15132         (Symbol::tls_mod_got_offset_): Removed.
15133         (Symbol::tls_pair_got_offset_): Removed.
15134         (Symbol::got_offsets_): New field.
15135         (Symbol::has_got_offset): Removed.
15136         (Symbol::has_tls_mod_got_offset): Removed.
15137         (Symbol::has_tls_pair_got_offset): Removed.
15138         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15139         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15140         member functions.
15141         (Target_x86_64::Scan::global): Likewise.
15142         (Target_x86_64::Relocate::relocate): Likewise.
15143         (Target_x86_64::Relocate::relocate_tls): Likewise.
15144
15145 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15146
15147         * yyscript.y: Fix spelling error in comment.
15148
15149 2008-03-24  Ian Lance Taylor  <iant@google.com>
15150
15151         * options.h (class General_options): Define build_id option.
15152         * layout.h (class Layout): Declare write_build_id, create_note,
15153         create_build_id.  Add build_id_note_ member.
15154         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15155         "libiberty.h", "md5.h", "sha1.h".
15156         (Layout::Layout): Initialize eh_frame_data_,
15157         eh_frame_hdr_section_, and build_id_note_.
15158         (Layout::finalize): Call create_build_id.
15159         (Layout::create_note): New function, broken out of
15160         Layout::create_gold_note.
15161         (Layout::create_gold_note): Call create_note.
15162         (Layout::create_build_id): New function.
15163         (Layout::write_build_id): New function.
15164         (Close_task_runner::run): Call write_build_id.
15165
15166         * x86_64.cc: Correct license to GPLv3.
15167
15168 2008-03-23  Ian Lance Taylor  <iant@google.com>
15169
15170         * options.cc: Include "demangle.h".
15171         (parse_optional_string): New function.
15172         (parse_long_option): Handle takes_optional_argument.
15173         (parse_short_option): Update dash_z initializer.  Handle
15174         takes_optional_argument.
15175         (General_options::General_options): Initialize do_demangle_.
15176         (General_options::finalize): Set do_demangle_.  Handle demangling
15177         style.
15178         * options.h (parse_optional_string): Declare.
15179         (struct One_option): Add optional_arg field.  Update constructor.
15180         Update call constructor calls.  Add takes_optional_argument
15181         function.
15182         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15183         (DEFINE_optional_string): Define.
15184         (General_options::demangle): Change from DEFINE_bool to
15185         DEFINE_optional_string.
15186         (General_options::no_demangle): New function.
15187         (General_options::do_demangle): New function.
15188         (General_options::set_do_demangle): New function.
15189         (General_options::execstack_status_): Move definition to end of
15190         class definition.
15191         (General_options::static_): Likewise.
15192         (General_options::do_demangle_): New field.
15193         * object.cc (big_endian>::get_symbol_location_info): Call
15194         Options::do_demangle, not Options::demangle.
15195         * symtab.cc (demangle): Likewise.
15196
15197 2008-03-22  Ian Lance Taylor  <iant@google.com>
15198
15199         * gold.h: Include <cstddef> and <sys/types.h>
15200         * options.h: Include <cstring>.
15201
15202 2008-03-21  Ian Lance Taylor  <iant@google.com>
15203
15204         * Added source code to GNU binutils.
15205 \f
15206 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15207
15208 Copying and distribution of this file, with or without modification,
15209 are permitted in any medium without royalty provided the copyright
15210 notice and this notice are preserved.
15211
15212 Local Variables:
15213 mode: change-log
15214 left-margin: 8
15215 fill-column: 74
15216 version-control: never
15217 End: