gold/
[external/binutils.git] / gold / ChangeLog
1 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2
3         * output.cc (Output_segment::set_section_addresses): Take new
4         Target* argument.  If target->isolate_execinstr() and the segment
5         is executable and starts at a target->abi_pagesize() boundary,
6         pad its end out to a target->abi_pagesize() boundary with code fill.
7         * output.h (Output_segment::set_section_addresses): Update decl.
8         * layout.h (Layout::check_output_data_for_reset_values): Take new
9         argument RELAX_OUTPUTS.
10         (Layout): New member relax_output_list_.
11         (Layout::add_relax_output): New method.
12         * layout.cc (Layout::Layout): Update constructor.
13         (Layout::reset_relax_output): New method.
14         (Layout::clean_up_after_relaxation): Call it.
15         (Layout::prepare_for_relaxation): Update caller.
16         (Layout::set_segment_offsets): Update callers of set_section_addresses.
17         Call reset_relax_output before re-processing segments for
18         isolate_execinstr case.
19         (Layout::write_data): Handle relax_output_list_.
20         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
21         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
22
23 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
24
25         PR binutils/15834
26         * object.h: Fix typos.
27
28 2013-08-16  Roland McGrath  <mcgrathr@google.com>
29
30         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
31         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
32
33 2013-08-07  Cary Coutant  <ccoutant@google.com>
34
35         Revert support for v2 DWP files:
36
37         2013-03-01  Cary Coutant  <ccoutant@google.com>
38
39             Add dwp support for v2 DWARF package file format.
40             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
41             tu_length parameter.  Adjust all callers.
42             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
43             * dwp.cc: Include dwarf.h.
44             (Section_bounds): New struct type.
45             (Unit_set): New struct type.
46             (Dwo_file::Dwo_file): Initialize new data member.
47             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
48             Combine and rename to...
49             (Dwo_file::read_unit_index): ...this.
50             (Dwo_file::sized_read_compunit_index)
51             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
52             (Dwo_file::sized_read_unit_index): ...this.
53             (Dwo_file::copy_section): Remove section_name, is_str_offsets
54             parameters; add section_id parameter.
55             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
56             (Dwo_file::add_unit_set): ...this.
57             (Dwo_file::shndx_map_): Remove.
58             (Dwo_file::sect_offsets_): New data member.
59             (Dwp_output_file::Dwp_output_file): Initialize new data members.
60             (Dwp_output_file::add_section): Rename to...
61             (Dwp_output_file::add_contribution): ...this.
62             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
63             (Dwp_output_file::add_tu_set): Likewise.
64             (Dwp_output_file::Contribution): New type.
65             (Dwp_output_file::Section::contributions): New data member.
66             (Dwp_output_file::Cu_or_tu_set): Remove.
67             (Dwp_output_file::Section::Section): New ctor.
68             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
69             (Dwp_output_file::Dwp_index::Section_table): New type.
70             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
71             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
72             parameter.
73             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
74             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
75             (Dwp_output_file::Dwp_index::section_table): New member function.
76             (Dwp_output_file::Dwp_index::section_table_end): New member function.
77             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
78             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
79             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
80             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
81             (Dwp_output_file::Dwp_index::section_table_): New data member.
82             (Dwp_output_file::Dwp_index::section_mask_): New data member.
83             (Dwp_output_file::add_output_section): New member function.
84             (Dwp_output_file::write_new_section): New member function.
85             (Dwp_output_file::write_contributions): New member function.
86             (Dwp_output_file::section_id_map_): New data member.
87             (class Dwo_id_info_reader): Remove.
88             (class Unit_reader): New class.
89             (get_dwarf_section_name): New function.
90             (Dwo_file::read_executable): Adjust initializations of class data.
91             (Dwo_file::read): Add support for v2 package file format.
92             (Dwo_file::read_unit_index): Likewise.
93             (Dwo_file::sized_read_unit_index): Likewise.
94             (Dwo_file::copy_section): Likewise.
95             (Dwo_file::add_unit_set): Likewise.
96             (Dwp_output_file::add_output_section): Likewise.
97             (Dwp_output_file::add_contribution): Likewise.
98             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
99             for empty slot.
100             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
101             file format.
102             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
103             slot.
104             (Dwp_output_file::initialize): Remove unused function.
105             (Dwp_output_file::finalize): Add support for v2 package file format.
106             (Dwp_output_file::write_index): Likewise.
107             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
108             function prototype.
109
110 2013-07-31  Cary Coutant  <ccoutant@google.com>
111
112         * object.cc (Sized_relobj::do_output_section_address): New function.
113         (Sized_relobj): Instantiate explicitly.
114         * object.h (Object::output_section_address): New function.
115         (Object::do_output_section_address): New function.
116         (Sized_relobj::do_output_section_address): New function.
117         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
118
119 2013-07-30  Cary Coutant  <ccoutant@google.com>
120             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
121
122         * parameters.cc (Parameters::entry): Return target-specific entry
123         symbol name.
124         * target.h (Target::entry_symbol_name): New function.
125         (Target_info::entry_symbol_name): New data member.
126
127         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
128         * i386.cc (Target_i386::i386_info): Likewise.
129         (Target_i386_nacl::i386_nacl_info): Likewise.
130         * sparc.cc (Target_sparc::sparc_info): Likewise.
131         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
132         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
133         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
134         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
135
136 2013-07-22  Sterling Augustine  <saugustine@google.com>
137
138         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
139         Convert parameter shndx to local variable. Add parameters symtab
140         and symtab_size.  Scan over section names.  Find relocation
141         section corresponding to current section.  Create and initialize
142         reloc_mapper_ and reloc_type_.
143         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
144         unit_length to off_t.  Initialize member unit_length_.  Fill in field
145         cu_offset_.
146         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
147         Initialize new fields unit_length_ and cu_offset_.
148         (Dwarf_pubnames_table::read_section): Update prototype.
149         (Dwarf_pubnames_table::cu_offset): New member function.
150         (Dwarf_pubnames_table::subsection_size): Likewise.
151         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
152         New fields.
153         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
154         member functions public.
155         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
156         Update comment.  Rework logic.  Move repeated parts to...
157         (Gdb_index_info_reader::read_pubtable): ...here. New function.
158         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
159         pubtypes_table_, and stmt_list_offset.
160         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
161         Gdb_index::find_pubtype_offset,
162         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
163         (Gdb_index::pubnames_read): Update prototype and rework logic.
164         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
165         Forward declare.
166         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
167         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
168         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
169         Gdb_index::map_pubtable_to_dies):
170         Declare functions.
171         (Gdb_index::pubnames_read): Update declaration.
172         (Gdb_index::Pubname_offset_map): New type.
173         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
174         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
175         Gdb_index::stmt_list_offset): Declare.
176         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
177         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
178         Gdb_index::pubtypes_offset_): Remove.
179
180 2013-07-19  Roland McGrath  <mcgrathr@google.com>
181
182         * options.h (General_options): Add -Trodata-segment option.
183         * parameters.cc (Parameters::check_rodata_segment): New function.
184         (Parameters::set_target_once): Call it.
185         * parameters.h (Parameters): Declare it (private member function).
186         * layout.cc (load_seg_unusable_for_headers): New function, broken
187         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
188         then validate rodata segment rather than text segment.
189         (relaxation_loop_body): Call that.
190         (is_text_segment): New function.  Don't admit a non-executable
191         segment if TARGET->isolate_execinstr().
192         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
193
194 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
195
196         PR gold/15070
197         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
198         * nacl.h (Sniff_file::View::View): Request aligned view.
199
200 2013-07-11  Cary Coutant  <ccoutant@google.com>
201
202         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
203         correct BRLT entry size.
204
205 2013-07-03  Alan Modra  <amodra@gmail.com>
206
207         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
208         comment.
209
210 2013-07-01  Cary Coutant  <ccoutant@google.com>
211
212         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
213         reloc_type_.
214         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
215         (Dwarf_ranges_table::lookup_reloc): New function.
216         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
217         reloc_type_.
218         (Dwarf_ranges_table::lookup_reloc): New function.
219         (Dwarf_ranges_table::reloc_type_): New data member.
220
221 2013-06-27  Jing Yu  <jingyu@google.com>
222
223         PR gold/15662
224         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
225         function.
226         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
227         (Target_powerpc::do_relax): Call the above.
228
229 2013-06-27  Cary Coutant  <ccoutant@google.com>
230
231         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
232         on garbage collected .opd section.
233
234 2013-06-27  Alan Modra  <amodra@gmail.com>
235
236         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
237         is non-zero.
238         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
239         (Target_powerpc::do_function_location): Likewise for loc->shndx.
240
241 2013-06-14  Cary Coutant  <ccoutant@google.com>
242
243         * resolve.cc (Symbol::override_base): Don't override st_type
244         from plugin placeholder symbols.
245         (Symbol_table::resolve): Likewise.
246         (Symbol_table::should_override): Don't complain about TLS mismatch
247         if the TO symbol is a plugin placeholder.
248         * testsuite/Makefile.am (plugin_test_tls): New test.
249         * testsuite/Makefile.in: Regenerate.
250         * testsuite/plugin_test_tls.sh: New test script.
251         * testsuite/two_file_test_2_tls.cc: New test source.
252         * testsuite/two_file_test_tls.cc: New test source.
253
254 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
255
256         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
257         the maximum segment alignment is larger than the page size.
258         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
259         correctly aligns the symbols with large alignemnt.
260         * testsuite/Makefile.in: Regenerate.
261         * testsuite/large_symbol_alignment.cc: New file.
262
263 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
264             Sriraman Tallam  <tmsriram@google.com>
265
266         * options.h (sort_section): New option.
267         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
268         Rename from Input_section_sort_section_name_special_ordering_compare.
269         (Input_section_sort_section_name_compare): New struct.
270         * output.cc (Output_section::Input_section_sort_section_name_compare::
271         operator()): New function.
272         (Output_section::sort_attached_input_sections): Use new sort function
273         for .text if --sort-section=name is specified.
274         * layout.cc (Layout::make_output_section):
275         Add sorting by name when --sort-section=name is specified.
276         * testsuite/Makefile.am (text_section_grouping): Test option
277         --sort-section=name.
278         * testsuite/Makefile.in: Regenerate.
279         * testsuite/section_sorting_name.cc: New file.
280         * testsuite/section_sorting_name.sh: New file.
281
282 2013-05-21  Cary Coutant  <ccoutant@google.com>
283
284         * symtab.h (Symbol::is_cxx_vtable): New function.
285         * target-reloc.h (relocate_section): Check for vtable symbol.
286         * testsuite/Makefile.am (missing_key_func.sh): New test case.
287         * testsuite/Makefile.in: Regenerate.
288         * testsuite/missing_key_func.cc: New test source.
289         * testsuite/missing_key_func.sh: New test script.
290
291 2013-05-21  Cary Coutant  <ccoutant@google.com>
292
293         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
294         type of enclosing symbol.
295         (Relocate_info::location): Check symbol type when describing symbol.
296         * object.h (Symbol_location_info): Remove unused line_number;
297         add enclosing_symbol_type.
298         * testsuite/debug_msg.sh: Adjust expected output.
299
300 2013-05-13  Cary Coutant  <ccoutant@google.com>
301
302         * configure.ac: Export DEFAULT_TARGET.
303         * configure: Regenerate.
304         * Makefile.in: Regenerate.
305         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
306         * testsuite/Makefile.in: Regenerate.
307         * testsuite/debug_msg.sh: Delete duplicate tests.
308         Don't check undef_int error message match for powerpc where the
309         source file and line number aren't available.
310
311 2013-05-10  Roland McGrath  <mcgrathr@google.com>
312
313         * options.h (General_options): Add --rosegment-gap option.
314         * options.cc (finalize): --rosegment-gap implies --rosegment.
315         * layout.cc (set_segment_offsets): Let user option override
316         target->rosegment_gap().
317
318 2013-05-10  Roland McGrath  <mcgrathr@google.com>
319
320         * options.h (General_options): Remove leading space from help
321         messages for -nostdlib and --rosegment.
322
323 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
324
325         PR ld/15365
326         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
327
328 2013-05-03  Alan Modra  <amodra@gmail.com>
329
330         * merge.cc (Output_merge_string::do_add_input_section): Correct
331         scan for number of strings.  Rename vars to avoid shadowing.
332         Include missing terminator in input_size_.
333
334 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
335
336         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
337         Restore empty string handling.
338
339 2013-05-01  Cary Coutant  <ccoutant@google.com>
340
341         * stringpool.cc (Stringpool_template::new_key_offset): Fix
342         uninitialized warning.
343
344 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
345
346         * output.cc (Output_section::add_merge_input_section): Allow
347         to merge sections if the alignment is more than character size.
348         * merge.h (Output_merge_string::Output_merge_string): Remove
349         assert.
350         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
351         only not-null strings. Check the alignment of strings.
352         * stringpool.h
353         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
354         alignment as the argument.
355         (Stringpool_template<Stringpool_char>::addralign_): New class member.
356         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
357         Align non-zero length strings according to the addralign_.
358         (Stringpool_template<Stringpool_char>::set_string_offsets):
359         Updating offsets according to the given alignment.
360         * testsuite/Makefile.am (text_section_grouping): Test if string
361         literals are getting merged.
362         * testsuite/Makefile.in: Regenerate.
363         * testsuite/merge_string_literals_1.c: New file.
364         * testsuite/merge_string_literals_2.c: Ditto.
365         * testsuite/merge_string_literals.sh: Ditto.
366
367 2013-04-26  Ian Lance Taylor  <iant@google.com>
368
369         * target-reloc.h (relocate_section): If the reloc offset is out of
370         range, pass VIEW as NULL to relocate.relocate.
371         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
372         * i386.cc (Target_i386::Relocate::relocate): Likewise.
373         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
374         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
375         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
376         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
377
378 2013-04-26  Geoff Pike  <gpike@chromium.org>
379
380         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
381         * layout.cc (Hash_task): New class.
382         (Layout::queue_build_id_tasks): New function.
383         (Layout::write_build_id): Handle single-thread portion of build ID
384         computation.  (In some cases, all of it is single-threaded.)  Replace
385         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
386         functionality in fewer lines of code.
387         * layout.h (Layout::queue_build_id_tasks): New function declaration.
388         * options.h (General_options): make "--build-id" default to tree
389         rather than sha1.  Add two new options related to --build-id=tree:
390         --build-id-chunk-size-for-treehash and
391         --build-id-min-file-size-for-treehash.
392         * Makefile.am: add testing of --build-id=tree and related new options
393         (these tests will be invoked by "make check").
394         * Makefile.in: Regenerate.
395
396 2013-04-25  Alan Modra  <amodra@gmail.com>
397
398         * configure.tgt: Add powerpcle and powerpc64le.
399
400 2013-04-22  Alan Modra  <amodra@gmail.com>
401
402         PR gold/15355
403         * layout.cc (Layout::segment_precedes): Allow more than one
404         segment with the same type and flags.
405
406 2013-04-15  Cary Coutant  <ccoutant@google.com>
407
408         * layout.cc (Layout::set_relocatable_section_offsets): Don't
409         allocate space in file for BSS sections.
410
411 2013-04-15  Cary Coutant  <ccoutant@google.com>
412
413         * script-sections.cc (Orphan_output_section): Reset address
414         to zero after each orphaned section for relocatable links.
415
416 2013-04-15  Cary Coutant  <ccoutant@google.com>
417
418         * symtab.cc (Symbol_table::sized_write_globals): Subtract
419         section starting address for relocatable link.
420         * testsuite/Makefile.am (script_test_11): New test.
421         * testsuite/Makefile.in: Regenerate.
422         * testsuite/script_test_11.c: New source file.
423         * testsuite/script_test_11.t: New linker script.
424
425 2013-04-13  Alan Modra  <amodra@gmail.com>
426
427         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
428         owner when sections are not adjacent and exceed group size.
429         (Target_powerpc::group_sections): Handle corner case.
430         (Target_powerpc::Branch_info::make_stub): Handle case where
431         stub table doesn't exist due to branches in non-exec sections.
432         (Target_powerpc::Relocate::relocate): Likewise.
433
434 2013-04-11  Alan Modra  <amodra@gmail.com>
435
436         PR gold/15354
437         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
438         .branch_lt to match bfd ld.  Adjust comments throughout file.
439
440 2013-04-04  Ian Lance Taylor  <iant@google.com>
441
442         GCC PR c++/56840
443         * object.cc (do_layout_deferred_sections): Handle .eh_frame
444         sections before checking whether they are included in the link.
445
446 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
447
448         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
449         object before calling the plugin claim_file handler.  Pass the elf
450         object of the archive to the plugin. Delete the elf object if the
451         plugin claims the file.
452
453 2013-03-21  Alan Modra  <amodra@gmail.com>
454
455         * layout.cc (Layout::set_segment_offsets): Accept writable .text
456         segment when omagic.
457
458 2013-03-21  Alan Modra  <amodra@gmail.com>
459
460         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
461         comparison warning.
462         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
463         uninitialized" warning.
464
465 2013-03-20  Alan Modra  <amodra@gmail.com>
466
467         * symtab.h (Symbol::clear_version): New function.
468         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
469         is_needed by weak references.  Clear version for symbols defined
470         in as-needed objects that are not needed.
471
472 2013-03-15  Alan Modra  <amodra@gmail.com>
473
474         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
475         static and public.  Add report_err param.  Return false for data refs.
476         (Target_powerpc::rela_dyn_section): New overloaded function.
477         (Target_powerpc::plt_, iplt_): Elucidate.
478         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
479         (Output_data_plt_powerpc::do_write): Don't write .iplt.
480         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
481         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
482         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
483         push_branch and make_plt_entry for ifunc syms when
484         reloc_needs_plt_for_ifunc.
485         (Target_powerpc::Relocate::relocate): Don't use plt entry value
486         for ifunc unless reloc_needs_plt_for_ifunc.
487
488 2013-03-15  Alan Modra  <amodra@gmail.com>
489
490         * gc.h (gc_process_relocs): Don't look through function descriptors.
491         * icf.cc (get_section_contents): Do so here instead.
492
493 2013-03-13  Alan Modra  <amodra@gmail.com>
494
495         * powerpc.cc (is_branch_reloc): Forward declare.
496         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
497         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
498         false for 64-bit, true for 32-bit non-branch relocs.
499         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
500         * testsuite/Makefile.am (icf_test): Use linker map file instead of
501         nm output.
502         (icf_safe_test): Generate linker map file as well as nm output.
503         (icf_safe_so_test): Likewise.
504         * testsuite/Makefile.in: Regenerate.
505         * testsuite/icf_test.sh: Parse linker map file to determine
506         section folding.
507         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
508         * testsuite/icf_safe_so_test.sh: Likewise.
509         (X86_32_or_ARM_specific_safe_fold): Merge into..
510         (arch_specific_safe_fold): ..this.
511         (X86_64_specific_safe_fold): Delete unused function.
512
513 2013-03-12  Alan Modra  <amodra@gmail.com>
514
515         * gc.h (gc_process_relocs): Look through function descriptors
516         to determine shndx, symvalue and addend used by ICF.  Tidy
517         variable duplication.
518
519 2013-03-11  Alan Modra  <amodra@gmail.com>
520
521         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
522         * layout.cc (Layout_task_runner::run): ..to here.
523         * symtab.h (struct Symbol_location): Extract from..
524         (class Symbol_table): ..here.
525         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
526         * target.h (class Target): Add function_location and
527         do_function_location functions.
528         (class Sized_target): Add do_function_location.
529         * object.h (class Sized_relobj_file): Move find_shdr..
530         (class Object): ..to here.
531         * object.cc: Likewise.  Update to suit.  Instantiate.
532         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
533         * powerpc.cc (class Powerpc_dynobj): New.
534         (Target_powerpc::do_function_location): New function.
535         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
536         (Powerpc_dynobj::do_read_symbols): New function.
537         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
538
539 2013-03-08  Ian Lance Taylor  <iant@google.com>
540
541         * options.cc (General_options::string_to_object_format): Accept
542         "default".
543
544 2013-03-08  Alan Modra  <amodra@gmail.com>
545
546         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
547         pointer to Post_fde.
548         (struct Post_fde): Move definition to here..
549         * ehframe.cc (struct Post_fde): ..from here.
550         (Cie::write): Don't alloc Post_fde.
551         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
552
553 2013-03-07  Alan Modra  <amodra@gmail.com>
554
555         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
556         relocation referencing .LC0.
557         * testsuite/discard_locals_test.sh: Remove FIXMEs.
558
559 2013-03-07  Alan Modra  <amodra@gmail.com>
560
561         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
562         always_inline.  Add assembly for powerpc to avoid GOT.
563
564 2013-03-07  Alan Modra  <amodra@gmail.com>
565
566         * testsuite/script_test_10.sh: Don't test .bss section
567         header number.
568
569 2013-03-06  Alan Modra  <amodra@gmail.com>
570
571         * powerpc.cc (class Powerpc_relobj): Move some member functions.
572         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
573         all callers.  Handle folded sections.
574         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
575         to Powerpc_relobj.
576         (Global_symbol_visitor_opd::operator()): Likewise.
577
578 2013-03-04  Alan Modra  <amodra@gmail.com>
579
580         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
581         * testsuite/Makefile.in: Regenerate.
582
583 2013-03-01  Cary Coutant  <ccoutant@google.com>
584
585         Add dwp support for v2 DWARF package file format.
586         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
587         tu_length parameter.  Adjust all callers.
588         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
589         * dwp.cc: Include dwarf.h.
590         (Section_bounds): New struct type.
591         (Unit_set): New struct type.
592         (Dwo_file::Dwo_file): Initialize new data member.
593         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
594         Combine and rename to...
595         (Dwo_file::read_unit_index): ...this.
596         (Dwo_file::sized_read_compunit_index)
597         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
598         (Dwo_file::sized_read_unit_index): ...this.
599         (Dwo_file::copy_section): Remove section_name, is_str_offsets
600         parameters; add section_id parameter.
601         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
602         (Dwo_file::add_unit_set): ...this.
603         (Dwo_file::shndx_map_): Remove.
604         (Dwo_file::sect_offsets_): New data member.
605         (Dwp_output_file::Dwp_output_file): Initialize new data members.
606         (Dwp_output_file::add_section): Rename to...
607         (Dwp_output_file::add_contribution): ...this.
608         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
609         (Dwp_output_file::add_tu_set): Likewise.
610         (Dwp_output_file::Contribution): New type.
611         (Dwp_output_file::Section::contributions): New data member.
612         (Dwp_output_file::Cu_or_tu_set): Remove.
613         (Dwp_output_file::Section::Section): New ctor.
614         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
615         (Dwp_output_file::Dwp_index::Section_table): New type.
616         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
617         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
618         parameter.
619         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
620         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
621         (Dwp_output_file::Dwp_index::section_table): New member function.
622         (Dwp_output_file::Dwp_index::section_table_end): New member function.
623         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
624         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
625         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
626         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
627         (Dwp_output_file::Dwp_index::section_table_): New data member.
628         (Dwp_output_file::Dwp_index::section_mask_): New data member.
629         (Dwp_output_file::add_output_section): New member function.
630         (Dwp_output_file::write_new_section): New member function.
631         (Dwp_output_file::write_contributions): New member function.
632         (Dwp_output_file::section_id_map_): New data member.
633         (class Dwo_id_info_reader): Remove.
634         (class Unit_reader): New class.
635         (get_dwarf_section_name): New function.
636         (Dwo_file::read_executable): Adjust initializations of class data.
637         (Dwo_file::read): Add support for v2 package file format.
638         (Dwo_file::read_unit_index): Likewise.
639         (Dwo_file::sized_read_unit_index): Likewise.
640         (Dwo_file::copy_section): Likewise.
641         (Dwo_file::add_unit_set): Likewise.
642         (Dwp_output_file::add_output_section): Likewise.
643         (Dwp_output_file::add_contribution): Likewise.
644         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
645         for empty slot.
646         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
647         file format.
648         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
649         slot.
650         (Dwp_output_file::initialize): Remove unused function.
651         (Dwp_output_file::finalize): Add support for v2 package file format.
652         (Dwp_output_file::write_index): Likewise.
653         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
654         function prototype.
655
656 2013-03-01  Cary Coutant  <ccoutant@google.com>
657
658         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
659         function into class definition in header file.
660         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
661         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
662         New function.
663         (Dwarf_info_reader::check_buffer): Move here from .cc file.
664
665 2013-02-28  Alan Modra  <amodra@gmail.com>
666
667         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
668         * target.cc (Target::do_plt_fde_location): New function.
669         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
670         accessor function, and constructor param.
671         (struct Post_fde, Post_fdes): Declare.
672         (Cie::write): Add post_fdes param.
673         * ehframe.cc (Fde::write): Use plt_fde_location.
674         (struct Post_fde): Define.
675         (Cie::write): Stash FDEs added post merge mapping.
676         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
677         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
678         (Eh_frame::do_sized_write): Arrange to write post map FDES after
679         other FDEs.
680         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
681         (Target_powerpc::has_glink): New function.
682         (Target_powerpc::do_relax): Add eh_frame info for stubs.
683         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
684         glink_eh_frame_fde_32, default_fde): New data.
685         (Stub_table::eh_frame_added_): New var.
686         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
687         Make const.
688         (Stub_table::add_eh_frame): New function.
689         (Output_data_glink::add_eh_frame): New function.
690         (Target_powerpc::make_glink_section): Call add_eh_frame.
691
692 2013-02-15  Ian Lance Taylor  <iant@google.com>
693
694         * options.h (DEFINE_uint64_alias): Define.
695         (class General_options): Add -Ttext-segment as an alias for
696         -Ttext.
697
698 2013-02-15  Alan Modra  <amodra@gmail.com>
699
700         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
701         (Stub_table::do_write): ..here, two places.
702         (Stub_table::plt_call_size): Use it here too.
703
704 2013-02-11  Ian Lance Taylor  <iant@google.com>
705
706         * descriptors.cc (Descriptors::close_all): New function.
707         * descriptors.h (class Descriptors): Declare close_all.
708         (close_all_descriptors): New inline function.
709         * plugin.cc: Include "descriptors.h".
710         (Plugin_manager::cleanup): Call close_all_descriptors.
711
712 2013-02-06  Alan Modra  <amodra@gmail.com>
713
714         * README: Update coding style link.
715
716 2013-01-28  Cary Coutant  <ccoutant@google.com>
717
718         * dwp.cc (File_list): New typedef.
719         (Dwo_name_info_reader): New class.
720         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
721         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
722         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
723         (Dwo_file::read_executable): New function.
724         (Dwo_file::read): Move common setup code to ...
725         (Dwo_file::make_object): ... here.
726         (dwp_options): Add --exec/-e.
727         (usage): Likewise.
728         (main): Likewise.
729
730 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
731
732         * layout.cc (Layout::layout): Check for option text_reorder.
733         (Layout::make_output_section): Ditto.
734         * options.h (text_reorder): New option.
735         * output.cc (Input_section_sort_compare): Remove special ordering
736         of section names.
737         (Output_section::
738          Input_section_sort_section_name_special_ordering_compare::
739          operator()): New function.
740         (Output_section::sort_attached_input_sections): Use new sort function
741         for .text.
742         * output.h (Input_section_sort_section_name_special_ordering_compare):
743         New struct.
744         * testsuite/Makefile.am (text_section_grouping): Test option
745         --no-text-reorder
746         * testsuite/Makefile.in: Regenerate.
747         * testsuite/text_section_grouping.sh: Check order of functions without
748         default text reordering.
749
750 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
751
752         * options.h (General_options): Change default to true for new_dtags.
753
754 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
755
756         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
757         when enable_new_dtags is false.  Only add DT_RUNPATH when
758         enable_new_dtags is true.
759
760 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
761
762         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
763         used in declaration and definition consistent.
764         (Target_powerpc::symval_for_branch): Ditto.
765
766 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
767
768         * testsuite/plugin_final_layout.cc: Fix comment.
769
770 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
771
772         * layout.cc (Layout::layout): Do not do default sorting for
773         text sections when section ordering is specified.
774         (make_output_section): Ditto.
775         * testsuite/plugin_final_layout.cc: Name the function sections
776         to catch reordering issues.
777
778 2013-01-15  Alan Modra  <amodra@gmail.com>
779
780         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
781         plt-thread-safe.
782
783 2013-01-15  Alan Modra  <amodra@gmail.com>
784
785         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
786         * testsuite/Makefile.in: Regenerate.
787
788 2013-01-14  Alan Modra  <amodra@gmail.com>
789
790         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
791         * testsuite/Makefile.in: Regenerate.
792
793 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
794
795         PR bfd/14430
796         Fix mingw gold build with plugins enabled
797         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
798         * configure.ac: Export DLOPEN_LIBS and add headers check.
799         * plugin.cc: Handle non-dlfcn case.
800         * Makefile.in: Regenerate.
801         * config.in: Regenerate.
802         * configure: Regenerate.
803         * testsuite/Makefile.in: Regenerate.
804
805 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
806
807         * output.h (sort_attached_input_sections): Change to be public.
808         * script-sections.cc
809         (Output_section_definition::set_section_addresses): Sort
810         attached input sections according to section order before linker
811         script assigns section addresses.
812         (Orphan_output_section::set_section_addresses): Sort
813         attached input sections according to section order before linker
814         script assigns section addresses.
815         * Makefile.am (final_layout.sh): Use a simple linker script to
816         check if section ordering still works.
817         * Makefile.in: Regenerate.
818
819 2013-01-09  Ben Cheng  <bccheng@google.com>
820
821         * arm.cc (Target_arm::attributes_accept_div): New function.
822         (Target_arm::attributes_forbid_div): New function.
823         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
824         attribute using the same new functions as what bfd/elf32_arm.c
825         does.
826
827 2013-01-07  Cary Coutant  <ccoutant@google.com>
828
829         PR gold/14993
830         * output.cc (Output_section::add_input_section): For incremental
831         updates, don't track input sections that are allocated from patch
832         space.
833
834 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
835             Ian Lance Taylor  <iant@google.com>
836
837         PR gold/14897
838         * configure.ac (--enable-ld): Removed.
839         (install_as_default): Set to yes only for --enable-gold=default
840         or --disable-ld.
841         * configure: Regenerated.
842
843 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
844
845         * options.h (General_options): Add -fuse-ld= for GCC linker
846         option compatibility.
847
848 2013-01-04  Cary Coutant  <ccoutant@google.com>
849
850         * configure.ac: Fix typo restoring CXXFLAGS.
851         * configure: Regenerate.
852
853 2013-01-04  Cary Coutant  <ccoutant@google.com>
854
855         * testsuite/Makefile.am (CXXLINK_S): New macro.
856         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
857         * testsuite/Makefile.in: Regenerate.
858
859 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
860
861         * version.cc (print_version): Update copyright year to 2013.
862
863 2012-12-20  Ian Lance Taylor  <iant@google.com>
864
865         * layout.cc (Layout::special_ordering_of_input_section): New
866         function.
867         (Layout::layout): If input section requires special ordering, must
868         sort input sections.
869         (Layout::make_output_section): May sort .text input sections.
870         (Layout::is_section_name_prefix_grouped): Remove.
871         * layout.h (class Layout): Declare
872         special_ordering_of_input_section.  Don't declare
873         is_section_name_prefix_grouped.
874         * output.cc (Output_section::add_input_section): Revert last
875         change.
876         (Output_section::Input_section_sort::match_file_name): Don't crash
877         if called on output section data.
878         (Output_section::Input_section_sort_compare): Sort based on
879         special ordering.
880         (Output_section::Input_section_sort_section_order_index_compare):
881         Revert last patch.
882         (Output_section::sort_attached_input_sections): Likewise.
883
884 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
885
886         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
887         * layout.h (Layout::is_section_name_prefix_grouped): New function.
888         * output.cc (Output_section::add_input_section): Check if section
889         name contains special prefix.  Keep input sections to sort such
890         sections.
891         (Output_section::Input_section_sort_section_order_index_compare
892          ::operator()): Group sections according to prefixes.
893         (Output_section::sort_attached_input_sections): Add condition to
894         Input_section_entry constructor call.
895         * testsuite/Makefile.am (text_section_grouping): New test.
896         * testsuite/Makefile.in: Regenerate.
897         * testsuite/text_section_grouping.cc: New file.
898         * testsuite/text_section_grouping.sh: New file.
899
900 2012-12-17  Nick Clifton  <nickc@redhat.com>
901
902         * Makefile.am: Add copyright notice.
903         * NEWS: Likewise.
904         * README: Likewise.
905         * configure.ac: Likewise.
906         * ftruncate.c: Likewise.
907         * Makefile.in: Regenerate.
908
909 2012-12-14  Cary Coutant  <ccoutant@google.com>
910
911         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
912         --no-as-needed flag.
913         (exception_separate_shared_12_test): Likewise.
914         (incremental_copy_test): Likewise.
915         * testsuite/Makefile.in: Regenerate.
916
917 2012-12-14  Cary Coutant  <ccoutant@google.com>
918
919         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
920         (Dwp_output_file::Dwp_index::enter_set): Add assert.
921
922 2012-12-12  Alan Modra  <amodra@gmail.com>
923
924         * powerpc.cc (class Track_tls): New.
925         (class Relocate, class Scan): Inherit Track_tls.
926         (Target_powerpc::Scan::local, global): Track tls optimization
927         and avoid creating plt entry for __tls_get_addr if all uses
928         are optimized away.
929         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
930
931 2012-12-12  Alan Modra  <amodra@gmail.com>
932
933         * options.h (General_options): Add --toc-sort/--no-toc-sort.
934         Replace no_toc_optimize with toc_optimize.
935         * output.h (Output_section::input_sections): Provide non-const variant.
936         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
937         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
938         accessors.
939         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
940         (class Sort_toc_sections): New.
941         (Target_powerpc::do_finalize_sections): Sort toc sections.
942         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
943
944 2012-12-10  Roland McGrath  <mcgrathr@google.com>
945
946         * testsuite/binary_unittest.cc (read_all): New function.
947         (Sized_binary_test): Use it instead of ::read.
948         * fileread.cc (do_read): Don't assume pread always reads the whole
949         amount in a single call.
950
951 2012-12-10  Alan Modra  <amodra@gmail.com>
952
953         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
954         Set EM_PPC64 or EM_PPC here.
955         (Target_selector_powerpc::do_recognize): Delete.
956
957 2012-12-10  Alan Modra  <amodra@gmail.com>
958
959         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
960         stub_table_.
961         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
962
963 2012-12-07  Roland McGrath  <mcgrathr@google.com>
964
965         * testsuite/binary_unittest.cc (Sized_binary_test):
966         Use open_descriptor rather than ::open.
967
968 2012-12-07  Alan Modra  <amodra@gmail.com>
969
970         * powerpc.cc (Stub_table::do_write): Delete redundant Address
971         typedef and invalid_address constant.
972         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
973         instantiate constants.
974
975 2012-12-06  Roland McGrath  <mcgrathr@google.com>
976
977         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
978         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
979         * aclocal.m4: Regenerate.
980         * configure: Regenerate.
981         * Makefile.in: Regenerate.
982         * testsuite/Makefile.in: Regenerate.
983
984 2012-12-07  Alan Modra  <amodra@gmail.com>
985
986         * options.h (General_options): Add no_toc_optimize.
987         * powerpc.cc (ok_lo_toc_insn): New function.
988         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
989
990 2012-12-06  Alan Modra  <amodra@gmail.com>
991
992         * options.h (General_options): Add plt_align, plt_static_chain,
993         plt_thread_safe.  Update stub_group_size help text.
994         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
995         for new plt_thread_safe_ var.
996         (use_plt_offset): Correct comments.
997         (Target_powerpc::do_relax): Look for thread creation symbols to
998         determine default plt_thread_safe value.  Clear plt call stubs
999         as well as branch stubs each iteration.
1000         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1001         insn constants.
1002         (l, hi, ha, write_insn): Move earlier.
1003         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1004         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1005         plt stubs too.
1006         (Stub_table::update_size): Adjust.
1007         (Stub_table::prev_size, set_prev_size): Delete.
1008         (Stub_table::stub_align): Let --plt-align affect result.
1009         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1010         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1011         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1012         (Stub_table::do_write): Support more stub variants.
1013
1014 2012-12-04  Alan Modra  <amodra@gmail.com>
1015
1016         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1017         (Target_powerpc::do_define_standard_symbols): New function.
1018
1019 2012-12-03  Alan Modra  <amodra@gmail.com>
1020
1021         * output.h: Formatting, whitespace.
1022
1023 2012-12-03  Alan Modra  <amodra@gmail.com>
1024
1025         * layout.h (Layout::get_executable_sections): Declare.
1026         * layout.cc (Layout::get_executable_sections): New function.
1027         * arm.cc (Target_arm::group_sections): Use it.
1028         (Arm_output_section::group_sections): Delete now redundant test.
1029         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1030         param to handle relative relocs.
1031         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1032         (Output_data_reloc::add_absolute): Adjust.
1033         (Output_data_reloc::add_relative): New function.
1034         (Output_data::reset_data_size): New function.
1035         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1036         (Output_section::set_addralign): New function.
1037         (Output_section::checkpoint_set_addralign): New function.
1038         (Output_section::clear_section_offsets_need_adjustment): New function.
1039         (Output_section::input_sections): Make public.
1040         * powerpc.cc (class Output_data_brlt_powerpc): New.
1041         (class Stub_table, class Stub_control): New.
1042         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1043         stub_table_, set_stub_table, stub_table): New vectors and accessor
1044         functions.
1045         (Target_powerpc::do_may_relax, do_relax, push_branch,
1046         new_stub_table, stub_tables, brlt_section, group_sections,
1047         add_branch_lookup_table, find_branch_lookup_table,
1048         write_branch_lookup_table, make_brlt_section): New functions.
1049         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1050         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1051         branch_info_): New vars.
1052         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1053         make call stubs here.
1054         (Output_data_glink): Remove all call stub handling from this class.
1055         (Target_powerpc::Scan::local, global): Save interesting branch
1056         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1057         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1058         functions on final link.
1059         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1060         Handle long branch destinations too.
1061         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1062         do_plt_address_for_local): Adjust lookup of plt call stubs.
1063
1064 2012-11-30  Alan Modra  <amodra@gmail.com>
1065
1066         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1067         relocs against protected symbols when building 32-bit shared libs.
1068
1069 2012-11-30  Alan Modra  <amodra@gmail.com>
1070
1071         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1072         param.  Call got_section() to make .got.  Update all callers
1073         and their callers and so on.
1074
1075 2012-11-30  Alan Modra  <amodra@gmail.com>
1076
1077         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1078         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1079         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1080         value if it already exists.
1081
1082 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1083
1084         PR gold/14858
1085         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1086
1087 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1088
1089         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1090         than bfc instruction for data sandboxing.
1091
1092 2012-11-08  Alan Modra  <amodra@gmail.com>
1093
1094         * po/POTFILES.in: Regenerate.
1095
1096 2012-11-05  Alan Modra  <amodra@gmail.com>
1097
1098         * configure.ac: Apply 2012-09-10 change to config.in here.
1099         * configure: Regenerate.
1100
1101 2012-11-05  Alan Modra  <amodra@gmail.com>
1102
1103         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1104         (struct Opd_ent): Use "Address" rather than "Offset".
1105         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1106         (Target_powerpc::got_section): Make public.
1107         (Target_powerpc::scan_relocs): Move code setting symbols..
1108         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1109         Create _SDA_BASE_ only when referenced.
1110
1111 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1112
1113         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1114         from last change.
1115
1116 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1117
1118         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1119         for offset_in_output_section parameter.
1120         (Sized_target::relocate_special_relocatable): Likewise.
1121         * arm.cc (Target_arm::relocate_relocs): Likewise.
1122         (Target_arm::relocate_special_relocatable): Likewise.
1123         * i386.cc (Target_i386::relocate_relocs): Likewise.
1124         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1125         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1126         * target-reloc.h (relocate_relocs): Likewise.
1127         * testsuite/testfile.cc (Target_test): Likewise.
1128         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1129         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1130
1131         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1132         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1133
1134         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1135         parameter, which is unused in the [!F_SETFD] case.
1136
1137         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1138         SYMNDX to off_t before comparing it to this->data_size().
1139         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1140         * incremental.cc (Output_section_incremental_inputs::do_write):
1141         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1142
1143         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1144
1145 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1146
1147         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1148         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1149         in EABI_VER5.
1150
1151 2012-10-29  Cary Coutant  <ccoutant@google.com>
1152
1153         * dwp.cc (usage): Add file and exit status parameters;
1154         add --help and --version options.
1155         (print_version): New function.
1156         (main): Add --help and --version options.
1157
1158 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1159
1160         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1161         final_layout_sequence.txt.
1162         * testsuite/Makefile.in: Regenerated.
1163
1164 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1165
1166         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1167         COMPILE generated by automake.
1168         (LINK1): Likewise.
1169         (CXXCOMPILE1): Likewise.
1170         (CXXLINK1): Likewise.
1171         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1172         (LINK): Likewise.
1173         (CXXCOMPILE): Likewise.
1174         (CXXLINK): Likewise.
1175         * testsuite/Makefile.in: Regenerated.
1176
1177 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1178
1179         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1180         on bad fwrite return.
1181
1182 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1183
1184         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1185         on val.
1186
1187 2012-10-23  Cary Coutant  <ccoutant@google.com>
1188
1189         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1190         * testsuite/Makefile.in: Regenerate.
1191         * testsuite/dwp_test.h: New source file.
1192         * testsuite/dwp_test_1.cc: New source file.
1193         * testsuite/dwp_test_1.s: New source file.
1194         * testsuite/dwp_test_1.sh: New source file.
1195         * testsuite/dwp_test_1b.cc: New source file.
1196         * testsuite/dwp_test_1b.s: New source file.
1197         * testsuite/dwp_test_2.cc: New source file.
1198         * testsuite/dwp_test_2.s: New source file.
1199         * testsuite/dwp_test_2.sh: New source file.
1200         * testsuite/dwp_test_main.cc: New source file.
1201         * testsuite/dwp_test_main.s: New source file.
1202
1203 2012-10-23  Cary Coutant  <ccoutant@google.com>
1204
1205         * dwp.h: New header file.
1206         * dwp.cc: New source file.
1207         * gold.h: Move shared declarations to system.h.
1208         * system.h: New header file.
1209         * Makefile.am: Add dwp.
1210         * Makefile.in: Regenerate.
1211
1212 2012-10-23  Cary Coutant  <ccoutant@google.com>
1213
1214         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1215         Dwarf_info_reader::read_from_pointer.
1216         (Dwarf_pubnames_table::read_header): Likewise.
1217         (Dwarf_pubnames_table::next_name): Likewise.
1218         (Dwarf_die::read_attributes): Likewise.
1219         (Dwarf_die::skip_attributes): Likewise.
1220         (Dwarf_info_reader::read_from_pointer): New function template.
1221         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1222         (Dwarf_pubnames_table): Likewise.
1223         (Dwarf_info_reader::read_from_pointer): New function template.
1224         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1225         Dwarf_pubnames_table ctor.
1226
1227 2012-10-23  Cary Coutant  <ccoutant@google.com>
1228
1229         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1230         abbrev_shndx.
1231         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1232         abbrev_shndx_.
1233         (Dwarf_info_reader::set_abbrev_shndx): New method.
1234         (Dwarf_info_reader::abbrev_shndx_): New data member.
1235
1236 2012-10-23  Cary Coutant  <ccoutant@google.com>
1237
1238         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1239         from object, not parameters.
1240         (Dwarf_info_reader::parse): Likewise.
1241         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1242         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1243         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1244         methods.
1245
1246 2012-10-23  Cary Coutant  <ccoutant@google.com>
1247
1248         * fileread.cc (Input_file::Input_file): New constructor.
1249         * fileread.h (class Input_file): Add new constructor.
1250
1251 2012-10-18  Alan Modra  <amodra@gmail.com>
1252
1253         PR gold/14727
1254         * object.cc (Relobj::is_section_name_included): Also match
1255         .sdata personality section.
1256
1257 2012-10-18  Alan Modra  <amodra@gmail.com>
1258
1259         * target-reloc.h (class Default_comdat_behavior): New, package up..
1260         (get_comdat_behaviour): ..this.
1261         (relocate_section): Add Relocate_comdat_behavior template arg,
1262         adjust code to suit.
1263         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1264         (Target_arm::scan_reloc_section): Likewise.
1265         * i386.cc (Target_i386::relocate_section): Likewise.
1266         * sparc.cc (Target_sparc::relocate_section): Likewise.
1267         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1268         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1269         * powerpc.cc (class Relocate_comdat_behavior): New.
1270         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1271         gold::relocate_section with new template arg.
1272
1273 2012-10-18  Alan Modra  <amodra@gmail.com>
1274
1275         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1276         dynamic relocs for GOT_TPREL got entries, without symbol if
1277         resolving locally.
1278         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1279         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1280         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1281
1282 2012-10-17  Alan Modra  <amodra@gmail.com>
1283
1284         PR gold/14726
1285         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1286
1287 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1288
1289         * layout.cc (Layout::include_section): Keep sections marked
1290         SHF_EXCLUDE when doing relocatable links.
1291
1292 2012-10-16  Alan Modra  <amodra@gmail.com>
1293
1294         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1295         (Target_powerpc::do_finalize_sections): Call it.
1296         (Output_data_save_res): New class and supporting functions.
1297         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1298         normal symbols defined in object files.
1299
1300 2012-10-12  Alan Modra  <amodra@gmail.com>
1301
1302         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1303         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1304         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1305         section if scan_opd_relocs not yet called.
1306         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1307
1308 2012-10-12  Alan Modra  <amodra@gmail.com>
1309
1310         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1311         add_local_ifunc_entry): Revert last change.
1312         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1313
1314 2012-10-05  Alan Modra  <amodra@gmail.com>
1315
1316         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1317         do_plt_address_for_global): New functions.
1318         (Output_data_got_powerpc::do_write): Don't segfault when linking
1319         statically.
1320         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1321         add_local_ifunc_entry): Return true on adding entry..
1322         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1323         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1324         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1325         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1326         set up symbols here.
1327         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1328         syms here.  Do so even when no .iplt.  Don't segfault when linking
1329         statically.
1330         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1331         new variants without reloc param.
1332         (Glink_sym_ent::Glink_sym_ent): Likewise.
1333         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1334         reloc when refs will resolve to plt call stub.
1335         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1336         R_PPC_PLTREL24 to resolve locally.
1337         (Target_powerpc::Scan::global): Correct ifunc handling.
1338         (Target_powerpc::Relocate::relocate): Correct local sym glink
1339         lookup.  Don't destroy "value" when we have a plt call stub,
1340         and when checking plt call validity.
1341         (Target_powerpc::do_dynsym_value): Simplify.
1342
1343 2012-10-05  Alan Modra  <amodra@gmail.com>
1344
1345         * i386.cc (Output_data_plt_i386::address_for_global,
1346         address_for_local): Add plt offset to returned value.  Adjust uses.
1347         * sparc.cc (Output_data_plt_sparc::address_for_global,
1348         address_for_local): Likewise.
1349         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1350         address_for_local): Likewise.
1351         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1352         address_for_local): Likewise.
1353         * target.h (Target::plt_address_for_global, plt_address_for_local):
1354         Update comment.
1355         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1356         (Output_data_got::Got_entry::write): Nor here.
1357         * output.h: Comment fix.
1358
1359 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1360
1361         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1362         global_offset_table_ value for larget got.
1363         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1364
1365 2012-09-29  Alan Modra  <amodra@gmail.com>
1366
1367         * powerpc.cc (Target_powerpc::iplt_): New output section.
1368         (Target_powerpc::iplt_section, make_iplt_section,
1369         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1370         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1371         Target_powerpc::plt_entry_count): Count iplt entries too.
1372         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1373         reloc section in constructor.  New params.
1374         (Target_powerpc::make_plt_section): Create reloc section here instead.
1375         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1376         functions.
1377         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1378         (Output_data_glink::add_entry, find_entry): New functions to
1379         deal with local syms.
1380         (Glink_sym_ent): Add support for local syms.
1381         (Output_data_glink::do_write): Handle ifunc plt entries.
1382         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1383         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1384         (Target_powerpc::Relocate::relocate): Likewise.
1385         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1386
1387 2012-09-25  Alan Modra  <amodra@gmail.com>
1388
1389         * object.h (Sized_relobj_file::adjust_local_symbol,
1390         do_adjust_local_symbol): New functions.
1391         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1392         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1393         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1394         and irregular opd entry spacing.
1395         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1396         (Global_symbol_visitor_opd): New functor.
1397         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1398         on deleted opd entries.
1399
1400 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1401
1402         * tilegx.cc: New file.
1403         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1404         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1405         * configure.tgt: Add entries for tilegx*.
1406         * configure.ac: Likewise.
1407         * Makefile.in: Rebuild.
1408         * configure: Likewise.
1409         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1410         tilegx.
1411
1412 2012-09-13  Alan Modra  <amodra@gmail.com>
1413
1414         * target-reloc.h (scan_relocs): Call scan.local for relocs
1415         against symbols in discarded sections.  Pass is_discarded
1416         param.
1417         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1418         Add is_discarded param.
1419         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1420         is_discarded to flag opd entry as discarded.  Don't emit dyn
1421         relocs on such entries.
1422         (Target_powerpc::Scan::global): Similarly detect and handle
1423         such opd entries.
1424         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1425         opd_ent_.  Update all uses.
1426         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1427         (Target_powerpc::relocate_section): Zero out discarded opd
1428         entry relocs.
1429
1430 2012-09-12  Ian Lance Taylor  <iant@google.com>
1431
1432         PR gold/14570
1433         * output.cc: Rename Output_data_got template parameter from size
1434         to got_size for all functions.  Compile all variants of
1435         Output_data_got.
1436         (Output_data_got::Got_entry::write): Correct use of size for
1437         symbol value.  Use local_is_tls rather than casting to
1438         Sized_relobj_file.
1439         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1440         (class Sized_relobj_file): Add do_local_is_tls.
1441         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1442
1443 2012-09-11  Alan Modra  <amodra@gmail.com>
1444
1445         PR gold/14566
1446         * layout.cc (Layout::set_segment_offsets): When using
1447         common-page-size alignment, ensure we are on a new max-page-size
1448         page.
1449         * output.cc (Output_segment::set_section_addresses): Use
1450         abi_pagesize, not common_pagesize for relro boundary.
1451         (Output_segment::set_offset): Likewise.
1452
1453 2012-09-11  Alan Modra  <amodra@gmail.com>
1454
1455         * output.h (Output_data_got::add_global_tls, add_local_tls,
1456         add_local_tls_pair): New functions.
1457         (Output_data_got::add_local_pair_with_rel): Remove second
1458         reloc param.  Expand comment.
1459         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1460         use_plt_or_tls_offset_, similarly for constructor param.
1461         (Output_data_got::Got_entry::write): Add got_index param.
1462         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1463         add_local_tls_pair): New functions.
1464         (Output_data_got::Got_entry::write): Handle tls symbols
1465         with use_plt_or_tls_offset_ set specially.
1466         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1467         (Output_data_got::do_write): Replace iterator with index, pass
1468         index to entry write function.
1469         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1470         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1471         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1472         call.
1473         * i386.cc (Target_i386::Scan::local): Likewise.
1474         * sparc.cc (Target_sparc::Scan::local): Likewise.
1475         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1476         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1477         do_tls_offset_for_global): New functions.
1478         (Target_powerpc::Scan::local): Correct TLS relocations and got
1479         entry values.
1480         (Target_powerpc::Scan::global): Don't emit unnecessary
1481         dynamic relocations on TLS GOT entries.
1482
1483 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1484
1485         * config.in: Disable sanity check for kfreebsd.
1486
1487 2012-09-10  Sterling Augustine  <saugustine@google.com>
1488
1489         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1490         (Gdb_index::pubtypes_read): New parameter.
1491         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1492         to calls.
1493         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1494         pubtypes_object_.
1495
1496 2012-09-09  Alan Modra  <amodra@gmail.com>
1497
1498         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1499         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1500         * gc.h (gc_process_relocs): Call target gc_add_reference.
1501         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1502         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1503         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1504         unnecessary cast.
1505         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1506         to cater for when we don't need code offset.  Update use.
1507         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1508         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1509         set_opd_valid): New functions.
1510         (Target_powerpc::do_gc_add_reference): New function.
1511         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1512         stashed refs.
1513         (Target_powerpc::do_gc_mark_symbol): New function.
1514
1515 2012-09-06  Cary Coutant  <ccoutant@google.com>
1516
1517         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1518         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1519         (Dwarf_die::skip_attributes): Likewise.
1520         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1521         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1522         (main): Call it.
1523         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1524
1525 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1526
1527         * testsuite/script_test_3.t: Add .got.plt output section
1528         statement.
1529         * testsuite/script_test_4.t: Likewise.
1530
1531 2012-09-05  Alan Modra  <amodra@gmail.com>
1532
1533         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1534         update all uses and lose "enum" when using type.
1535
1536 2012-09-05  Alan Modra  <amodra@gmail.com>
1537
1538         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1539         * configure: Regenerate.
1540         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1541         (plugin_final_layout.stdout): Likewise.
1542         (memory_test): Set page sizes to 0x1000.
1543         * testsuite/Makefile.in: Regenerate.
1544         * testsuite/discard_locals_test.sh: Add FIXME comment.
1545         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1546         * testsuite/pr14265.t: Add .got output section statement.
1547         * testsuite/script_test_2.t: Likewise.
1548         * testsuite/script_test_3.t: Likewise.
1549         * testsuite/script_test_4.t: Likewise.
1550         * testsuite/script_test_5.t: Likewise.
1551         * testsuite/script_test_6.t: Likewise.
1552         * testsuite/script_test_7.t: Likewise.
1553         * testsuite/script_test_9.t: Likewise.
1554
1555 2012-09-05  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1558         (Powerpc_relocate_functions::Status): New typedef.
1559         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1560         (Target_powerpc::Scan::local): Handle REL64.
1561         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1562         for REL32 and REL64.
1563         (Target_powerpc::symval_for_branch): New function, extracted from..
1564         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1565         checks.  Report overflow errors.
1566
1567 2012-09-05  Alan Modra  <amodra@gmail.com>
1568
1569         * object.h (Sized_relobj_file::emit_relocs): Delete.
1570         (Sized_relobj_file::emit_relocs_reltype): Delete.
1571         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1572         relocate_relocs for --emit-relocs.
1573         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1574         * output.h: Update comment.
1575         (Output_segment::first_section): New function.
1576         (Output_segment::first_section_load_address): Use first_section.
1577         * output.cc (Output_segment::first_section): New function extracted..
1578         (Output_segment::first_section_load_address): ..from here.  Delete.
1579         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1580         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1581         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1582         adjust call to target.h function.
1583         * i386.cc (Target_i386): Likewise.
1584         * sparc.cc (Target_sparc): Likewise.
1585         * x86_64.cc (Target_x86_64): Likewise.
1586         * powerpc.cc (Target_powerpc): Likewise.
1587         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1588         first tls section has section symbol for optimised local dynamic
1589         output relocs.
1590         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1591         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1592         optimised tls code.
1593         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1594         Rename to relocate_relocs.  Update error message.
1595
1596 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1597
1598         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1599         --just-symbols.
1600
1601 2012-08-31  Alan Modra  <amodra@gmail.com>
1602
1603         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1604         (Powerpc_relobj::toc_base_offset): New stub function.
1605         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1606         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1607         (Target_powerpc::Relocate::enum skip_tls): New.
1608         (Target_powerpc::call_tls_get_addr_): New var.
1609         (Target_powerpc::is_branch_reloc): Move to file scope.
1610         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1611         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1612         New functions.
1613         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1614         (powerpc_info): Correct common_pagesize for ppc64.
1615         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1616         (Powerpc_relocate_functions): Add overflow check enums and functions.
1617         Add non-shift version of rela, rela_ua.  Delete all rel public
1618         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1619         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1620         addr16_ha3, addr14 functions.
1621         (Output_data_got_powerpc::add_constant_pair): New function.
1622         (Output_data_got_powerpc::got_base_offset): Likewise.
1623         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1624         (instruction constants): Sort, add some more.
1625         (Output_data_glink::do_write): Add and use Address typedef.  Use
1626         object->toc_base_offset() stub for 64-bit.
1627         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1628         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1629         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1630         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1631         Always treat .opd relocs as against locally defined symbol.
1632         Correct condition for RELATIVE relocs.
1633         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1634         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1635         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1636         calculations.  Handle TLS relocs, and more.  Add overflow
1637         checking and adjust for Powerpc_relocate_functions changes.
1638         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1639         Reinstate --emit-relocs code with FIXME.
1640
1641 2012-08-30  Alan Modra  <amodra@gmail.com>
1642
1643         * layout.cc (Layout::set_segment_offsets): Set p_align to
1644         abi_pagesize, not common_pagesize.
1645         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1646         to determine whether file header can go in segment.
1647
1648 2012-08-30  Alan Modra  <amodra@gmail.com>
1649
1650         * output.h (Output_reloc::Output_reloc <output section>): Add
1651         is_relative param.  Adjust calls.
1652         (Output_reloc::add_output_section_relative): New functions.
1653         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1654         is_relative.
1655         (Output_reloc::symbol_value): Handle SECTION_CODE.
1656
1657 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1658
1659         * gold.cc (queue_middle_tasks): Call layout again when unique
1660         segments for sections is desired.
1661         * layout.cc (Layout::Layout): Initialize new members.
1662         (Layout::get_output_section_flags): New function.
1663         (Layout::choose_output_section): Call get_output_section_flags.
1664         (Layout::layout): Make output section for mapping to a unique segment.
1665         (Layout::insert_section_segment_map): New function.
1666         (Layout::attach_allocated_section_to_segment): Make unique segment for
1667         output sections marked so.
1668         (Layout::segment_precedes): Check for unique segments when sorting.
1669         * layout.h (Layout::Unique_segment_info): New struct.
1670         (Layout::Section_segment_map): New typedef.
1671         (Layout::insert_section_segment_map): New function.
1672         (Layout::get_output_section_flags): New function.
1673         (Layout::is_unique_segment_for_sections_specified): New function.
1674         (Layout::set_unique_segment_for_sections_specified): New function.
1675         (Layout::unique_segment_for_sections_specified_): New member.
1676         (Layout::section_segment_map_): New member.
1677         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1678         Rename is_gc_pass_one to is_pass_one.
1679         Rename is_gc_pass_two to is_pass_two.
1680         Rename is_gc_or_icf to is_two_pass.
1681         Check for which pass based on whether symbols data is present.
1682         Make it two pass when unique segments for sections is desired.
1683         * output.cc (Output_section::Output_section): Initialize new
1684         members.
1685         * output.h (Output_section::is_unique_segment): New function.
1686         (Output_section::set_is_unique_segment): New function.
1687         (Output_section::is_unique_segment_): New member.
1688         (Output_section::extra_segment_flags): New function.
1689         (Output_section::set_extra_segment_flags): New function.
1690         (Output_section::extra_segment_flags_): New member.
1691         (Output_section::segment_alignment): New function.
1692         (Output_section::set_segment_alignment): New function.
1693         (Output_section::segment_alignment_): New member.
1694         (Output_segment::Output_segment): Initialize is_unique_segment_.
1695         (Output_segment::is_unique_segment): New function.
1696         (Output_segment::set_is_unique_segment): New function.
1697         (Output_segment::is_unique_segment_): New member.
1698         * plugin.cc (allow_unique_segment_for_sections): New function.
1699         (unique_segment_for_sections): New function.
1700         (Plugin::load): Add new functions to transfer vector.
1701         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1702         * Makefile.in: Regenerate.
1703         * testsuite/plugin_final_layout.sh: Check if unique segment
1704         functionality works.
1705         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1706         are available.
1707         (allow_unique_segment_for_sections): New global.
1708         (unique_segment_for_sections): New global.
1709         (claim_file_hook): Call allow_unique_segment_for_sections.
1710         (all_symbols_read_hook): Call unique_segment_for_sections.
1711
1712 2012-08-22  Cary Coutant  <ccoutant@google.com>
1713
1714         * layout.cc (Layout::include_section): Don't assert on GROUP
1715         sections with --emit-relocs.
1716
1717 2012-08-21  Cary Coutant  <ccoutant@google.com>
1718
1719         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1720         if --export-dynamic-symbol names an undef symbol.
1721
1722 2012-08-18  Alan Modra  <amodra@gmail.com>
1723
1724         * powerpc.cc: Formatting and white space.
1725         (Powerpc_relobj): Rename got2_section_ to special_.
1726         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1727         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1728         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1729         (Target_powerpc): Add Address typedef and invalid_address.  Use
1730         throughout.
1731         (Target_powerpc::is_branch_reloc): New function.
1732         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1733         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1734         for dst_mask, value and addend.
1735         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1736         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1737         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1738         uint16_t for 24-bit offset.  Use get_output_section_offset and
1739         check return.
1740         (Target_powerpc::Scan::local): Handle more relocs.
1741         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1742         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1743         Plug in toc restoring insn after plt calls.  Translate branches
1744         to function descriptor symbols to corresponding entry point.
1745         (Target_powerpc::relocate_for_relocatable): Check return from
1746         get_output_section_offset.
1747         * symtab.h: Comment typo.
1748
1749 2012-08-14  Ian Lance Taylor  <iant@google.com>
1750
1751         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1752         unsupported_relocal_local to call unsupported_reloc_global.
1753
1754 2012-08-14  Nick Clifton  <nickc@redhat.com>
1755
1756         PR ld/14265
1757         * script-sections.cc (Sections_element::output_section_name): Add
1758         keep return parameter.
1759         (Output_section_element::match_name): Add keep return parameter.
1760         Return the value of the keep_ member.
1761         * script-sections.h (class Output_section): Update
1762         output_section_name prototype.
1763         * layout.cc (Layout::keep_input_section): New public member
1764         function.
1765         (Layout::choose_output_section): Pass keep parameter to
1766         output_section_name.
1767         * layout.h (class Layout): Add keep_input_section.
1768         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1769         sections.
1770         * testsuite/Makefile.am: Add a test.
1771         * testsuite/Makefile.in: Regenerate.
1772         * testsuite/pr14265.c: Source file for the test.
1773         * testsuite/pr14265.t: Linker script for the test.
1774         * testsuite/pr14265.sh: Shell script for the test.
1775
1776 2012-08-14  Alan Modra  <amodra@gmail.com>
1777
1778         * target.h (Target::output_section_name): New function.
1779         (Target::do_output_section_name): New function.
1780         * layout.cc (Layout::choose_output_section): Call the above.
1781         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1782
1783 2012-08-14  Alan Modra  <amodra@gmail.com>
1784
1785         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1786         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1787         for replace_constant call.
1788         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1789         (Output_data_glink::do_print_to_mapfile): New function.
1790         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1791         (Target_powerpc::Relocate::relocate): Likewise.
1792
1793 2012-08-14  Alan Modra  <amodra@gmail.com>
1794
1795         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1796         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1797         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1798         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1799         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1800         here.
1801         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1802         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1803         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1804         here.
1805         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1806         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1807
1808 2012-08-12  Alan Modra  <amodra@gmail.com>
1809
1810         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1811         (glink insn constants): Use uint32_t.
1812         (Output_data_glink::add_entry): Use insert, not [] operator.
1813
1814 2012-08-11  Alan Modra  <amodra@gmail.com>
1815
1816         * object.h (Sized_relobj_file::find_shdr): New function.
1817         (Sized_relobj_file::find_special_sections): New function.
1818         * object.cc (Sized_relobj_file::find_shdr): New function.
1819         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1820         (Sized_relobj_file::find_special_sections): New function, split out..
1821         (Sized_relobj_file::do_read_symbols): ..from here.
1822         * output.h (Output_data_got::replace_constant): New function.
1823         (Output_data_got::num_entries): New function.
1824         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1825         (Output_data_got::got_offset): Protected rather than private.
1826         (Output_data_got::replace_got_entry): New function.
1827         * output.cc (Output_data_got::replace_got_entry): New function.
1828         * powerpc.cc (class Powerpc_relobj): New.
1829         (class Powerpc_relocate_functions): Delete all psymval variants or
1830         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1831         Implement _ha functions using corresponding _hi function.
1832         (Powerpc_relobj::find_special_sections): New function.
1833         (Target_powerpc::do_make_elf_object): New function.
1834         (class Output_data_got_powerpc): New.
1835         (class Output_data_glink): New.
1836         (class Powerpc_scan_relocatable_reloc): New.
1837         Many more changes througout file.
1838
1839 2012-08-09  Nick Clifton  <nickc@redhat.com>
1840
1841         * po/vi.po: Updated Vietnamese translation.
1842
1843 2012-08-07  Ian Lance Taylor  <iant@google.com>
1844
1845         * layout.cc (Layout::add_target_dynamic_tags): If
1846         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1847         plt_rel.
1848
1849 2012-07-30  Nick Clifton  <nickc@redhat.com>
1850
1851         * po/gold.pot: Updated template.
1852         * po/es.po: Updated Spanish translation.
1853
1854 2012-07-18  Cary Coutant  <ccoutant@google.com>
1855
1856         PR gold/14344
1857         * configure.ac: Add check for -gpubnames support.
1858         * configure: Regenerate.
1859         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1860         support; force -gno-pubnames.
1861         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1862         support.
1863         (gdb_index_test_4): New test.
1864         * testsuite/Makefile.in: Regenerate.
1865         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1866         * testsuite/gdb_index_test_2.sh: Likewise.
1867         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1868         * testsuite/gdb_index_test_4.sh: New script.
1869         * testsuite/gdb_index_test_comm.sh: New script with common code;
1870         don't look for space after colon.
1871
1872 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1873
1874         * gold.cc (queue_middle_tasks): Update function order only after
1875         deferred objects due to plugins are processed.
1876
1877 2012-07-11  Ian Lance Taylor  <iant@google.com>
1878
1879         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1880         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1881         (Target_arm::scan_reloc_for_stub): Likewise.
1882         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1883         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1884         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1885         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1886         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1887
1888 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1889             Ian Lance Taylor  <iant@google.com>
1890
1891         PR gold/14309
1892         * configure.ac: Test whether std::tr1::hash<off_t> works.
1893         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1894         needed.
1895         * output.h (class Output_fill): Add virtual destructor.
1896         * configure, config.in: Rebuild.
1897
1898 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1899
1900         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1901
1902 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1903
1904         * plugin.cc (Plugin::load): Handle position independent executables.
1905
1906 2012-06-06  Cary Coutant  <ccoutant@google.com>
1907
1908         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1909         add .debug_macro.
1910         (lines_only_debug_sections): Likewise.
1911         (gdb_fast_lookup_sections): New static array.
1912         (is_gdb_debug_section): Rename formal parameter.
1913         (is_lines_only_debug_section): Likewise.
1914         (is_gdb_fast_lookup_section): New function.
1915         (Layout::include_section): Check for ".zdebug_" prefix; pass
1916         section name suffix to is_gdb_debug_section, et al.; check for
1917         fast-lookup sections when building .gdb_index.
1918         * options.h (--strip-debug-gdb): Update GDB version number.
1919
1920 2012-06-06  Cary Coutant  <ccoutant@google.com>
1921
1922         * configure.ac: Add check for fallocate.
1923         * configure: Regenerate.
1924         * config.in: Regenerate.
1925
1926         * options.h (class General_options): Add --mmap-output-file and
1927         --posix-fallocate options.
1928         * output.cc: (posix_fallocate): Remove; replace with...
1929         (gold_fallocate): New function.
1930         (Output_file::map_no_anonymous): Call gold_fallocate.
1931         (Output_file::map): Check --mmap-output-file option.
1932
1933 2012-06-05  Jing Yu  <jingyu@google.com>
1934
1935         * gold.h (textdomain): Add do {} to empty while(0).
1936         (bindtextdomain): Likewise.
1937
1938 2012-06-04  Cary Coutant  <ccoutant@google.com>
1939
1940         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1941         has_dynsym_index.
1942
1943 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1944
1945         * symtab.cc (Symbol_table::define_special_symbol):
1946         Initialize *poldsym to prevent uninitialized variable errors.
1947
1948 2012-05-23  Cary Coutant  <ccoutant@google.com>
1949
1950         * layout.cc (Layout::section_name_mapping): Add rules to handle
1951         exact match on .data.rel.ro.local or .data.rel.ro.
1952         (Layout::output_section_name): Check for exact matches.
1953
1954 2012-05-23  Cary Coutant  <ccoutant@google.com>
1955
1956         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1957         more carefully.
1958
1959 2012-05-22  Cary Coutant  <ccoutant@google.com>
1960
1961         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1962         object before exporting symbol.
1963
1964 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1965
1966         * testsuite/tls_test.cc: Include "config.h" first.
1967         * testsuite/tls_test_c.c: Likewise.
1968
1969 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1970             Nick Clifton  <nickc@redhat.com>
1971
1972         PR 14072
1973         * configure.in: Add check that sysdep.h has been included before
1974         any system header files.
1975         * configure: Regenerate.
1976         * config.in: Regenerate.
1977
1978 2012-05-14  Cary Coutant  <ccoutant@google.com>
1979
1980         * layout.cc (Layout::make_output_section): Mark .tdata section
1981         as RELRO.
1982         * testsuite/relro_test.cc: Add a TLS variable.
1983
1984 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1985
1986         PR gold/14091
1987         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1988         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1989         R_X86_64_64.
1990
1991 2012-05-08  Cary Coutant  <ccoutant@google.com>
1992
1993         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1994         (lines_only_debug_sections): Likewise.
1995
1996 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1997
1998         * nacl.cc: New file.
1999         * nacl.h: New file.
2000         * Makefile.am (CCFILES, HFILES): Add them.
2001         * Makefile.in: Regenerate.
2002         * i386.cc (Output_data_plt_i386_nacl): New class.
2003         (Output_data_plt_i386_nacl_exec): New class.
2004         (Output_data_plt_i386_nacl_dyn): New class.
2005         (Target_i386_nacl): New class.
2006         (Target_selector_i386_nacl): New class.
2007         (target_selector_i386): Use it instead of Target_selector_i386.
2008         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2009         (Target_x86_64_nacl): New class.
2010         (Target_selector_x86_64_nacl): New class.
2011         (target_selector_x86_64, target_selector_x32): Use it instead of
2012         Target_selector_x86_64.
2013         * arm.cc (Output_data_plt_arm_nacl): New class.
2014         (Target_arm_nacl): New class.
2015         (Target_selector_arm_nacl): New class.
2016         (target_selector_arm, target_selector_armbe): Use it instead of
2017         Target_selector_arm.
2018
2019         * target-select.cc (select_target): Take new Input_file* and off_t
2020         arguments, pass them on to recognize method of selector.
2021         * object.cc (make_elf_sized_object): Update caller.
2022         * parameters.cc (parameters_force_valid_target): Likewise.
2023         * incremental.cc (make_sized_incremental_binary): Likewise.
2024         * target-select.h: Update decl.
2025         (Target_selector::recognize): Take new Input_file* argument,
2026         pass it on to do_recognize.
2027         (Target_selector::do_recognize): Take new Input_file* argument.
2028         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2029         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2030         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2031         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2032
2033         * target.h (Target::Target_info): New members isolate_execinstr
2034         and rosegment_gap.
2035         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2036         * arm.cc (Target_arm::arm_info): Update initializer.
2037         * i386.cc (Target_i386::i386_info): Likewise.
2038         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2039         * sparc.cc (Target_sparc::sparc_info): Likewise.
2040         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2041         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2042         * layout.cc (Layout::attach_allocated_section_to_segment):
2043         Take new const Target* argument.  If target->isolate_execinstr(), act
2044         like --rosegment.
2045         (Layout::find_first_load_seg): Take new const Target* argument;
2046         if target->isolate_execinstr(), reject PF_X segments.
2047         (Layout::relaxation_loop_body): Update caller.
2048         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2049         reset file offset to zero when we hit LOAD_SEG, and then do a second
2050         loop over the segments before LOAD_SEG to reassign offsets after
2051         addresses have been determined.  Handle target->rosegment_gap().
2052         (Layout::attach_section_to_segment): Take new const Target* argument;
2053         pass it to attach_allocated_section_to_segment.
2054         (Layout::make_output_section): Update caller.
2055         (Layout::attach_sections_to_segments): Take new const Target* argument;
2056         pass it to attach_section_to_segment.
2057         * gold.cc (queue_middle_tasks): Update caller.
2058         * layout.h (Layout): Update method decls with new arguments.
2059
2060         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2061         Target_info pointer to use.
2062         (Target_arm::do_make_data_plt): New virtual method.
2063         (Target_arm::make_data_plt): New method that calls it.
2064         (Target_arm::make_plt_entry): Use it.
2065         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2066         for the section alignment.
2067         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2068         method.
2069         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2070         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2071         method.
2072         (Output_data_plt_arm::get_plt_entry_size): Call it.
2073         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2074         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2075         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2076         method.
2077         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2078         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2079         method instead of sizeof(plt_entry).
2080         (Output_data_plt_arm::add_entry): Likewise.
2081         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2082         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2083         than static method.
2084         (Target_arm::plt_entry_size): Likewise.
2085         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2086         Move to ...
2087         (Output_data_plt_arm_standard): ... here, new class.
2088         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2089         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2090         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2091
2092         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2093         Take additional argument for the PLT entry size.
2094         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2095         Use get_plt_entry_size method rather than plt_entry_size variable.
2096         (Output_data_plt_x86_64::reserve_slot): Likewise.
2097         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2098         (Output_data_plt_x86_64::add_entry): Likewise.
2099         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2100         (Output_data_plt_x86_64::address_for_global): Likewise.
2101         (Output_data_plt_x86_64::address_for_local): Likewise.
2102         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2103         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2104         Make method non-static.
2105         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2106         method.
2107         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2108         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2109         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2110         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2111         virtual method.
2112         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2113         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2114         virtual method.
2115         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2116         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2117         virtual method.
2118         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2119         (Output_data_plt_x86_64::plt_entry_size)
2120         (Output_data_plt_x86_64::first_plt_entry)
2121         (Output_data_plt_x86_64::plt_entry)
2122         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2123         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2124         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2125         (Output_data_plt_x86_64_standard): ... here, new class.
2126         (Target_x86_64::Target_x86_64): Take optional argument for the
2127         Target_info pointer to use.
2128         (Target_x86_64::do_make_data_plt): New virtual method.
2129         (Target_x86_64::make_data_plt): New method to call it.
2130         (Target_x86_64::init_got_plt_for_update): Use that.
2131         Call this->plt_->add_eh_frame method here.
2132         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2133         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2134         rather than static method.
2135         (Target_x86_64::plt_entry_size): Likewise.
2136         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2137         rather than plt_entry_size variable.  Move guts of PLT filling to...
2138         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2139         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2140         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2141
2142         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2143         additional argument for the section alignment.
2144         Don't do add_eh_frame_for_plt here.
2145         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2146         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2147         variable.
2148         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2149         method.
2150         (Output_data_plt_i386::get_plt_entry_size): Call it.
2151         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2152         (Output_data_plt_i386::add_eh_frame): New method to call it.
2153         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2154         method.
2155         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2156         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2157         method.
2158         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2159         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2160         method instead of plt_entry_size.
2161         (Output_data_plt_i386::plt_entry_size)
2162         (Output_data_plt_i386::plt_eh_frame_fde_size)
2163         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2164         (Output_data_plt_i386_standard): ... here, new class.
2165         (Output_data_plt_i386_exec): New class.
2166         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2167         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2168         (Output_data_plt_i386::exec_plt_entry): Move to ...
2169         (Output_data_plt_i386_exec::plt_entry): ... here.
2170         (Output_data_plt_i386_dyn): New class.
2171         (Output_data_plt_i386::first_plt_entry): Move to ...
2172         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2173         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2174         (Output_data_plt_i386_dyn::plt_entry): ... here.
2175         (Target_i386::Target_i386): Take optional argument for the Target_info
2176         pointer to use.
2177         (Target_i386::do_make_data_plt): New virtual method.
2178         (Target_i386::make_data_plt): New method to call it.
2179         (Target_i386::make_plt_section): Use that.
2180         Call this->plt_->add_eh_frame method here.
2181         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2182         rather than plt_entry_size variable.
2183         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2184         (Output_data_plt_i386::address_for_local): Likewise.
2185         (Output_data_plt_i386::do_write): Likewise.
2186         Move guts of PLT filling to...
2187         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2188         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2189         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2190         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2191
2192 2012-05-01  Cary Coutant  <ccoutant@google.com>
2193
2194         * dwarf_reader.cc (Dwarf_die::read_attributes)
2195         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2196         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2197         * reduced_debug_output.cc
2198         (Output_reduced_debug_info_section::get_die_end): Remove
2199         DW_FORM_GNU_ref_index.  Add default case.
2200
2201 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2202
2203         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2204         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2205         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2206         DW_AT_high_pc as offset from DW_AT_low_pc.
2207
2208         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2209         * testsuite/Makefile.in: Regenerate.
2210         * testsuite/gdb_index_test_3.c: New test source file.
2211         * testsuite/gdb_index_test_3.sh: New test source file.
2212
2213 2012-04-25  Ian Lance Taylor  <iant@google.com>
2214
2215         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2216         pointer.
2217         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2218         as a class, not a struct.
2219         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2220         (Target_arm::apply_cortex_a8_workaround): Likewise.
2221         * gc.h: Declare Reloc_types as a struct, not a class.
2222         * object.h: Declare Symbols_data as a struct.
2223         * reloc.h: Declare Read_relocs_data as a struct.
2224         * target.h: Declare Relocate_info as a struct.
2225
2226 2012-04-24  David S. Miller  <davem@davemloft.net>
2227
2228         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2229         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2230         and R_SPARC_WPLT30.
2231
2232 2012-04-24  Cary Coutant  <ccoutant@google.com>
2233
2234         * incremental-dump.cc (find_input_containing_global): Replace
2235         magic number with symbolic constant.
2236         (dump_incremental_inputs): Update version number.
2237         * incremental.cc (Output_section_incremental_inputs): Update version
2238         number; import symbolic constants from Incremental_inputs_reader.
2239         (Incremental_inputs::create_data_sections): Align relocations
2240         section correctly for 64-bit targets.
2241         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2242         constants; add padding.
2243         (Output_section_incremental_inputs::write_header): Add assert for
2244         header_size.
2245         (Output_section_incremental_inputs::write_input_files): Add assert
2246         for input_entry_size.
2247         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2248         add assert for object_info_size, input_section_entry_size,
2249         global_sym_entry_size.
2250         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2251         for data structure sizes; use them.
2252         (Incremental_input_entry_reader): Import symbolic constants from
2253         Incremental_inputs_reader; use them.
2254
2255 2012-04-23  David S. Miller  <davem@davemloft.net>
2256
2257         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2258         and elf_flags_set_.
2259         (Target_sparc::Target_sparc): Initialize new fields.
2260         (Target_sparc::do_make_elf_object): New function.
2261         (Target_sparc::do_adjust_elf_header): New function.
2262
2263 2012-04-23  Cary Coutant  <ccoutant@google.com>
2264
2265         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2266         CU range table of gdb index.
2267
2268 2012-04-20  David S. Miller  <davem@davemloft.net>
2269
2270         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2271         instead of false.
2272
2273 2012-04-16  David S. Miller  <davem@davemloft.net>
2274
2275         * sparc.cc (Target_sparc::got_address): New function.
2276         (Sparc_relocate_functions::gdop_hix22): New function.
2277         (Sparc_relocate_functions::gdop_lox10): New function.
2278         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2279         relocs.
2280         (Target_sparc::Scan::local): Likewise if the global symbol is not
2281         preemptible and is not IFUNC.
2282         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2283         transformations for local and non-preemptible non-IFUNC global
2284         symbols.
2285
2286         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2287         writing out 64-bit part of ranges.
2288
2289         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2290         -fpic and -fpie respectively.
2291         * Makefile.in: Regenerate.
2292
2293         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2294         (Target_sparc::Target_sparc): Initialize new field.
2295         (Target_sparc::do_plt_section_for_global): New function.
2296         (Target_sparc::do_plt_section_for_local): New function.
2297         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2298         (Target_sparc::make_plt_section): New function, broken out of
2299         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2300         (Target_sparc::make_plt_entry): Call make_plt_section.
2301         (Target_sparc::make_local_ifunc_plt_entry): New function.
2302         (Target_sparc::rela_ifunc_section): New function.
2303         (Target_sparc::plt_section): Remove const.
2304         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2305         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2306         and ifunc_count_ fields.
2307         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2308         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2309         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2310         (Output_data_plt_sparc::rela_ifunc): New function.
2311         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2312         (Output_data_plt_sparc::has_ifunc_section): New function.
2313         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2314         (Output_data_plt_sparc::address_for_global): New function.
2315         (Output_data_plt_sparc::address_for_local): New function.
2316         (Output_data_plt_sparc::plt_index_to_offset): New function.
2317         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2318         and entry_count.
2319         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2320         entry_count.
2321         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2322         R_SPARC_JMP_IREL to switch.
2323         (Target_sparc::Scan::check_non_pic): Likewise.
2324         (Target_sparc::Scan::local): Handle IFUNC symbols.
2325         (Target_sparc::Scan::local): Likewise.
2326         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2327         and plt_address_for_local.
2328         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2329         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2330
2331         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2332         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2333         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2334         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2335         global relocs too.
2336         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2337         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2338         calls.
2339         * sparc.cc (Target_sparc::Scan::global): Likewise.
2340         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2341
2342 2012-04-16  Cary Coutant  <ccoutant@google.com>
2343
2344         * archive.cc (Library_base::should_include_member): Check for
2345         --export-dynamic-symbol.
2346         * options.h (class General_options): Add --export-dynamic-symbol.
2347         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2348         --export-dynamic-symbol.
2349         (Symbol_table::gc_mark_undef_symbols): Likewise.
2350         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2351
2352 2012-04-12  David S. Miller  <davem@davemloft.net>
2353
2354         * sparc.cc (Reloc::wdisp10): New relocation method.
2355         (Reloc::h34): Likewise.
2356         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2357         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2358         R_SPARC_WDISP10.
2359         (Target_sparc::Scan::local): Likewise.
2360         (Target_sparc::Scan::global): Likewise.
2361         (Target_sparc::Relocate::relocate): Likewise.
2362
2363 2012-04-09  Cary Coutant  <ccoutant@google.com>
2364
2365         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2366         low_pc == 0.
2367
2368 2012-04-06  Ian Lance Taylor  <iant@google.com>
2369
2370         * timer.cc: #include <unistd.h>.
2371
2372 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2373
2374         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2375         * config.in: Regenerate.
2376         * configure: Regenerate.
2377
2378 2012-04-05  Nick Clifton  <nickc@redhat.com>
2379
2380         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2381         (AM_LC_MESSAGES): Add.
2382         * aclocal.m4: Regenerate.
2383         * config.in: Regenerate.
2384         * configure: Regenerate.
2385
2386 2012-03-21  Cary Coutant  <ccoutant@google.com>
2387
2388         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2389         * Makefile.in: Regenerate.
2390         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2391         (Sized_elf_reloc_mapper::symbol_section): New function.
2392         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2393         (make_elf_reloc_mapper): New function.
2394         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2395         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2396         (Dwarf_abbrev_table::do_get_abbrev): New function.
2397         (Dwarf_ranges_table::read_ranges_table): New function.
2398         (Dwarf_ranges_table::read_range_list): New function.
2399         (Dwarf_pubnames_table::read_section): New function.
2400         (Dwarf_pubnames_table::read_header): New function.
2401         (Dwarf_pubnames_table::next_name): New function.
2402         (Dwarf_die::Dwarf_die): New function.
2403         (Dwarf_die::read_attributes): New function.
2404         (Dwarf_die::skip_attributes): New function.
2405         (Dwarf_die::set_name): New function.
2406         (Dwarf_die::set_linkage_name): New function.
2407         (Dwarf_die::attribute): New function.
2408         (Dwarf_die::string_attribute): New function.
2409         (Dwarf_die::int_attribute): New function.
2410         (Dwarf_die::uint_attribute): New function.
2411         (Dwarf_die::ref_attribute): New function.
2412         (Dwarf_die::child_offset): New function.
2413         (Dwarf_die::sibling_offset): New function.
2414         (Dwarf_info_reader::check_buffer): New function.
2415         (Dwarf_info_reader::parse): New function.
2416         (Dwarf_info_reader::do_parse): New function.
2417         (Dwarf_info_reader::do_read_string_table): New function.
2418         (Dwarf_info_reader::lookup_reloc): New function.
2419         (Dwarf_info_reader::get_string): New function.
2420         (Dwarf_info_reader::visit_compilation_unit): New function.
2421         (Dwarf_info_reader::visit_type_unit): New function.
2422         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2423         Sized_elf_reloc_mapper.
2424         (Sized_dwarf_line_info::symbol_section): Remove function.
2425         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2426         (Sized_dwarf_line_info::read_line_mappings): Remove object
2427         parameter, adjust callers.
2428         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2429         * dwarf_reader.h: Include <sys/types.h>.
2430         (class Track_relocs): Remove forward declaration.
2431         (class Elf_reloc_mapper): New class.
2432         (class Sized_elf_reloc_mapper): New class.
2433         (class Dwarf_abbrev_table): New class.
2434         (class Dwarf_range_list): New class.
2435         (class Dwarf_ranges_table): New class.
2436         (class Dwarf_pubnames_table): New class.
2437         (class Dwarf_die): New class.
2438         (class Dwarf_info_reader): New class.
2439         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2440         (Sized_dwarf_line_info::symbol_section): Remove member function.
2441         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2442         base class.
2443         * gdb-index.cc: New source file.
2444         * gdb-index.h: New source file.
2445         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2446         and .debug_types sections, call Layout::add_to_gdb_index.
2447         (Sized_relobj_incr::do_section_name): Implement.
2448         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2449         return type; Implement.
2450         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2451         return type.
2452         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2453         parameter list and return type.
2454         (Sized_incr_dynobj::do_section_contents): Likewise.
2455         * layout.cc: Include gdb-index.h.
2456         (Layout::Layout): Initialize gdb_index_data_.
2457         (Layout::init_fixed_output_section): Check for .gdb_index section.
2458         (Layout::add_to_gdb_index): New function. Instantiate.
2459         * layout.h: Add forward declaration for class Gdb_index.
2460         (Layout::add_to_gdb_index): New member function.
2461         (Layout::gdb_index_data_): New data member.
2462         * main.cc: Include gdb-index.h.
2463         (main): Print statistics for gdb index.
2464         * object.cc (Object::section_contents): Move code into
2465         do_section_contents.
2466         (need_decompressed_section): Check for sections needed when building
2467         gdb index.
2468         (build_compressed_section_map): Likewise.
2469         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2470         gdb index.
2471         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2472         sections; call Layout::add_to_gdb_index.
2473         (Sized_relobj_file::do_decompressed_section_contents): Call
2474         do_section_contents directly.
2475         * object.h (Object::do_section_contents): Adjust parameter list and
2476         return type.
2477         (Object::do_decompressed_section_contents): Call do_section_contents
2478         directly.
2479         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2480         return type.
2481         * options.h (class General_options): Add --gdb-index option.
2482         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2483         list and return type.
2484         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2485         * reloc.h (Track_relocs::checkpoint): New function.
2486         (Track_relocs::reset): New function.
2487
2488         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2489         New test cases.
2490         * testsuite/Makefile.in: Regenerate.
2491         * testsuite/gdb_index_test.cc: New test source file.
2492         * testsuite/gdb_index_test_1.sh: New test source file.
2493         * testsuite/gdb_index_test_2.sh: New test source file.
2494
2495 2012-03-19  Doug Kwan  <dougkwan@google.com>
2496
2497         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2498         (Target_arm::do_finalize_sections): Remove code which defines
2499         __exidx_start and __exidx_end.  Make symbol table parameter
2500         anonymous as it is not used.
2501         * gold.cc (queue_middle_tasks): Call target hook to define any
2502         target-specific symbols.
2503         * target.h (Target::define_standard_symbols): New method.
2504         (Target::do_define_standard_symbols): Same.
2505         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2506         * testsuite/Makefile.in: Regenerate.
2507         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2508         and __exidx_end.
2509         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2510         relocations are generated for __exidx_start and __exidx_end.
2511
2512 2012-03-16  Doug Kwan  <dougkwan@google.com>
2513
2514         * testsuite/Makefile.am: Disable test initpri3b.
2515         * testsuite/Makefile.in: Regenerate.
2516
2517 2012-03-15  Doug Kwan  <dougkwan@google.com>
2518
2519         * arm.cc (Target_arm::got_section): Make .got section read-only
2520         if -z now is given.
2521
2522 2012-03-15  Ian Lance Taylor  <iant@google.com>
2523
2524         PR gold/13850
2525         * layout.cc (Layout::make_output_section): Correctly mark
2526         SHT_INIT_ARRAY, et. al., as relro.
2527
2528 2012-03-14  Doug Kwan  <dougkwan@google.com>
2529
2530         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2531         dynamic relocations for protected symbols in shared objects.
2532
2533 2012-03-13  Ian Lance Taylor  <iant@google.com>
2534
2535         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2536         keep the larger alignment.
2537
2538 2012-03-12  Cary Coutant  <ccoutant@google.com>
2539
2540         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2541         handling of DW_LNE_define_file.
2542
2543 2012-03-12  Cary Coutant  <ccoutant@google.com>
2544
2545         * reduced_debug_output.cc
2546         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2547         codes to switch.
2548
2549 2012-02-29  Cary Coutant  <ccoutant@google.com>
2550
2551         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2552
2553 2012-02-29  Cary Coutant  <ccoutant@google.com>
2554
2555         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2556         Call Object::decompressed_section_contents.
2557         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2558         New dtor.
2559         (Sized_dwarf_line_info::buffer_start_): New data member.
2560         * merge.cc (Output_merge_data::do_add_input_section): Call
2561         Object::decompressed_section_contents.
2562         (Output_merge_string::do_add_input_section): Likewise.
2563         * object.cc (need_decompressed_section): New function.
2564         (build_compressed_section_map): Decompress sections needed later.
2565         (Sized_relobj_file::do_decompressed_section_contents): New function.
2566         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2567         * object.h (Object::decompressed_section_contents): New function.
2568         (Object::discard_decompressed_sections): New function.
2569         (Object::do_decompressed_section_contents): New function.
2570         (Object::do_discard_decompressed_sections): New function.
2571         (Compressed_section_info): New type.
2572         (Compressed_section_map): Include decompressed section contents.
2573         (Sized_relobj_file::do_decompressed_section_contents): New function.
2574         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2575
2576 2012-02-16  Cary Coutant  <ccoutant@google.com>
2577
2578         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2579         * testsuite/Makefile.in: Regenerate.
2580
2581 2012-02-14  Cary Coutant  <ccoutant@google.com>
2582
2583         * options.cc (General_options::finalize): Disallow -pie and -static.
2584
2585 2012-02-03  Doug Kwan  <dougkwan@google.com>
2586
2587         * arm.cc (Arm_relocate_functions::abs8,
2588         Arm_relocate_functions::abs16): Use
2589         Bits::has_signed_unsigned_overflow32.
2590         (Arm_relocate_functions::thm_abs8): Correct range of
2591         overflow check.
2592         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2593         in assertions.
2594
2595 2012-02-02  Doug Kwan  <dougkwan@google.com>
2596
2597         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2598         position independent outputs, not just shared objects.
2599
2600 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2601
2602         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2603         * configure: Regenerated.
2604
2605 2012-01-27  Ian Lance Taylor  <iant@google.com>
2606
2607         * reloc.h (Bits): New class with static functions, copied from
2608         namespace utils in arm.cc.
2609         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2610         instead.
2611
2612 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2613
2614         * incremental.cc (write_info_blocks): Correct relocation offset.
2615
2616 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2617
2618         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2619         (Relocate::tls_gd_to_le): Likewise.
2620
2621 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2622
2623         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2624
2625 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2626
2627         * configure.ac: Check if -mcmodel=medium works.
2628         * configure: Regenerated.
2629
2630 2012-01-24  Cary Coutant  <ccoutant@google.com>
2631
2632         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2633         definition and ...
2634         (read_unsigned_LEB_128_x): ... this new function.
2635         (read_signed_LEB_128): Replaced with inline definition and ...
2636         (read_signed_LEB_128_x): ... this new function.
2637         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2638         (read_unsigned_LEB_128): Add inline definition.
2639         (read_signed_LEB_128_x): New function.
2640         (read_signed_LEB_128): Add inline definition.
2641         * testsuite/Makefile.am (leb128_unittest): New unit test.
2642         * testsuite/Makefile.in: Regenerate.
2643         * testsuite/leb128_unittest.cc: New unit test.
2644
2645 2012-01-23  Ian Lance Taylor  <iant@google.com>
2646
2647         PR gold/13617
2648         * i386.cc (Target_i386::do_code_fill): When using a jmp
2649         instruction, pad with nop instructions.
2650         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2651
2652 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2653
2654         * x86_64.cc (gc_process_relocs): Add typename on types used in
2655         template.
2656         (scan_relocs): Likewise.
2657         (relocate_section): Likewise.
2658         (apply_relocation): Likewise.
2659
2660 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2661
2662         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2663         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2664         under x32.
2665
2666 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2667
2668         * x86_64.cc: Initial support for x32.
2669
2670 2012-01-03  Cary Coutant  <ccoutant@google.com>
2671
2672         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2673         Use abstract base class for GOT.
2674         * gold/output.h (class Output_data_got_base): New abstract base class.
2675         (class Output_data_got): Derive from new base class, adjust ctors.
2676         (Output_data_got::reserve_slot): Make virtual; rename to
2677         do_reserve_slot; Adjust callers.
2678         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2679         pointer to abstract base class.
2680         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2681
2682 2011-12-18  Ian Lance Taylor  <iant@google.com>
2683
2684         * object.h (Relobj::local_symbol_value): New function.
2685         (Relobj::local_plt_offset): New function.
2686         (Relobj::local_has_got_offset): New function.
2687         (Relobj::local_got_offset): New function.
2688         (Relobj::set_local_got_offset): New function.
2689         (Relobj::do_local_symbol_value): New pure virtual function.
2690         (Relobj::do_local_plt_offset): Likewise.
2691         (Relobj::do_local_has_got_offset): Likewise.
2692         (Relobj::do_local_got_offset): Likewise.
2693         (Relobj::do_set_local_got_offset): Likewise.
2694         (Sized_relobj::do_local_has_got_offset): Rename from
2695         local_has_got_offset.
2696         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2697         (Sized_relobj::do_set_local_got_offset): Rename from
2698         set_local_got_offset.
2699         (Sized_relobj_file::do_local_plt_offset): Rename from
2700         local_plt_offset.
2701         (Sized_relobj_file::do_local_symbol_value): New function.
2702         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2703         local_plt_offset.
2704         * output.cc (Output_data_got::Got_entry::write): Change object to
2705         Relobj.  Use local_symbol_value.
2706         (Output_data_got::add_global_with_rel): Change rel_dyn to
2707         Output_data_reloc_generic*.  Use add_global_generic.
2708         (Output_data_got::add_global_with_rela): Remove.  Change all
2709         callers to use add_global_with_rel.
2710         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2711         Output_data_reloc_generic*.  Use add_global_generic.
2712         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2713         callers to use add_global_pair_with_rel.
2714         (Output_data_got::add_local): Change object to Relobj*.
2715         (Output_data_got::add_local_plt): Likewise.
2716         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2717         change rel_dyn to Output_data_reloc_generic*.  Use
2718         add_local_generic.
2719         (Output_data_got::add_local_with_rela): Remove.  Change all
2720         callers to use all_local_with_rel.
2721         (Output_data_got::add_local_pair_with_rel): Change object to
2722         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2723         add_output_section_generic.
2724         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2725         callers to use add_local_pair_with_rel.
2726         (Output_data_got::reserve_local): Change object to Relobj*.
2727         * output.h: (class Output_data_reloc_generic): Add pure virtual
2728         declarations for add_global_generic, add_local_generic,
2729         add_output_section_generic.
2730         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2731         functions for Output_data_reloc_generic.  Update declarations for
2732         changes listed in output.cc.
2733         (class Output_data_got): Change template parameter to got_size.
2734         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2735         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2736         function.
2737         (Sized_relobj_incr::do_local_plt_offset): New function.
2738         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2739         add_global_generic.
2740
2741 2011-12-17  Cary Coutant  <ccoutant@google.com>
2742
2743         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2744         * resolve.cc (Symbol_table::resolve): Likewise.
2745         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2746         arrays.
2747         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2748
2749 2011-12-16  Ian Lance Taylor  <iant@google.com>
2750
2751         * output.h (Output_data_reloc_generic::add): Only call
2752         add_dynamic_reloc if this is a dynamic reloc section.
2753
2754 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2755
2756         PR gold/13505
2757         * target-reloc.h (apply_relocation): Replace <64, false> with
2758         <size, big_endian>.
2759
2760 2011-11-25  Nick Clifton  <nickc@redhat.com>
2761
2762         * po/it.po: New Italian translation.
2763
2764 2011-11-17  Sterling Augustine  <saugustine@google.com>
2765
2766         * script.cc (script_include_directive): Implement.
2767         (read_script_file): New local variables name and search_path. Update
2768         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2769         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2770         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2771
2772 2011-11-11  Sterling Augustine  <saugustine@google.com>
2773
2774         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2775         (file_or_sections_cmd): Likewise.
2776
2777 2011-11-11  Doug Kwan  <dougkwan@google.com>
2778
2779         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2780         if --just-symbols is given.
2781
2782 2011-11-10  Doug Kwan  <dougkwan@google.com>
2783
2784         PR gold/13362
2785         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2786         when processing data relocs.
2787         * reloc.h (Relocate_functions::rel_unaligned): New method.
2788         (Relocate_functions::pcrel_unaligned): Ditto.
2789         (Relocate_functions::rel32_unaligned): Ditto.
2790         (Relocate_functions::pcrel32_unaligned): Ditto.
2791
2792 2011-11-09  Doug Kwan  <dougkwan@google.com>
2793
2794         PR gold/13362
2795         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2796         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2797         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2798         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2799         (Relocate_functions::rel_unaligned): New.
2800         (Relocate_functions::rel32_unaligned): New.
2801         * target-reloc.h (relocate_for_relocatable): Add code to handle
2802         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2803         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2804         arm_unaligned_reloc_r): New targets.
2805         * testsuite/Makefile.in: Regenerate.
2806         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2807         linking.
2808
2809 2011-11-02  Ian Lance Taylor  <iant@google.com>
2810
2811         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2812         NATIVE_LINKER.
2813         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2814         * options.cc (General_options::finalize): Use library search path
2815         from configure script if specified.  If not native and no sysroot,
2816         only search TOOLLIBDIR.
2817         * options.h (Search_directory::Search_directory): Change name to
2818         const std::string&.
2819         (General_options::add_to_library_path_with_sysroot): Change arg to
2820         const std::string&.
2821         * configure, Makefile.in, config.in: Rebuild.
2822
2823 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2824
2825         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2826         we are working around the ARM1176 Erratum.
2827         * options.h (General_options::fix_arm1176): Add option.
2828         * testsuite/Makefile.am: Add testcases, and keep current ones
2829         working.
2830         * testsuite/Makefile.in: Regenerate.
2831         * testsuite/arm_fix_1176.s: New file.
2832         * testsuite/arm_fix_1176.sh: Likewise.
2833
2834 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2835
2836         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2837         may_use_blx_.
2838         (Target_arm::may_use_blx): Remove method.
2839         (Target_arm::set_may_use_blx): Likewise.
2840         (Target_arm::may_use_v4t_interworking): New method.
2841         (Target_arm::may_use_v5t_interworking): Likewise.
2842         (Target_arm::may_use_blx_): Remove member variable.
2843         (Arm_relocate_functions::arm_branch_common): Check for v5T
2844         interworking.
2845         (Arm_relocate_functions::thumb_branch_common): Likewise.
2846         (Reloc_stub::stub_type_for_reloc): Likewise.
2847         (Target_arm::do_finalize_sections): Correct interworking checks.
2848         * testsuite/Makefile.am: Add new tests.
2849         * testsuite/Makefile.in: Regenerate.
2850         * testsuite/arm_farcall_arm_arm.s: New test.
2851         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2852         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2853         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2854         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2855         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2856         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2857         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2858
2859 2011-10-31  Cary Coutant  <ccoutant@google.com>
2860
2861         PR gold/13023
2862         * expression.cc (Expression::eval_with_dot): Add
2863         is_section_dot_assignment parameter.
2864         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2865         absolute and assigning to dot within a section.
2866         * script-sections.cc
2867         (Output_section_element_assignment::set_section_addresses): Pass
2868         dot_section to set_if_absolute.
2869         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2870         as is_section_dot_assignment flag to eval_with_dot.
2871         (Output_section_element_dot_assignment::set_section_addresses):
2872         Likewise.
2873         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2874         parameter.  Also set value if relative to dot_section; set the
2875         symbol's output_section.
2876         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2877         parameter.  Adjust all callers.
2878         (Expression::eval_maybe_dot): Likewise.
2879         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2880         Adjust all callers.
2881         * testsuite/script_test_2.t: Test assignment of an absolute value
2882         to dot within an output section element.
2883
2884 2011-10-31  Cary Coutant  <ccoutant@google.com>
2885
2886         * options.h (class General_options): Add --[no-]gnu-unique options.
2887         * symtab.cc (Symbol_table::sized_write_globals): Convert
2888         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2889
2890 2011-10-31  Cary Coutant  <ccoutant@google.com>
2891
2892         PR gold/13359
2893         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2894         unnecessary assertion.
2895         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2896
2897 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2898
2899         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2900         gc_mark_symbol.
2901         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2902         gc_mark_symbol.
2903         Change to just keep the section associated with symbol.
2904         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2905         they are externally visible and --export-dynamic is turned on.
2906         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2907
2908 2011-10-19  Ian Lance Taylor  <iant@google.com>
2909
2910         PR gold/13163
2911         * script-sections.cc
2912         (Output_section_element_dot_assignment::needs_output_section): New
2913         function.
2914
2915 2011-10-19  Ian Lance Taylor  <iant@google.com>
2916
2917         PR gold/13204
2918         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2919         --section-start option was seen.
2920         * options.h (General_options::any_section_start): New function.
2921
2922 2011-10-18  David S. Miller  <davem@davemloft.net>
2923
2924         PR binutils/13301
2925         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2926         member to track relocation locations that have moved during TLS
2927         reloc optimizations.
2928         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2929         (Target_sparc::Relocate::relocate): Adjust view down by 4
2930         bytes if it matches reloc_adjust_addr_.
2931         (Target_sparc::Relocate::relocate_tls): Always move the
2932         __tls_get_addr call delay slot instruction forward 4 bytes when
2933         performing relaxation.
2934
2935 2011-10-18  Cary Coutant  <ccoutant@google.com>
2936
2937         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2938         (Output_file::map_no_anonymous): Check for non-zero
2939         return code from posix_fallocate.
2940
2941 2011-10-17  Cary Coutant  <ccoutant@google.com>
2942
2943         PR gold/13245
2944         * plugin.cc (is_visible_from_outside): Check for symbols
2945         referenced from dynamic objects.
2946         * resolve.cc (Symbol_table::resolve): Don't count references
2947         from dynamic objects as references from real ELF files.
2948         * testsuite/plugin_test_2.sh: Adjust expected result.
2949
2950 2011-10-17  Cary Coutant  <ccoutant@google.com>
2951
2952         * gold.cc: Include timer.h.
2953         (queue_middle_tasks): Stamp time.
2954         (queue_final_tasks): Likewise.
2955         * main.cc (main): Store timer in parameters.  Print timers
2956         for each pass.
2957         * parameters.cc (Parameters::Parameters): Initialize timer_.
2958         (Parameters::set_timer): New function.
2959         (set_parameters_timer): New function.
2960         * parameters.h (Parameters::set_timer): New function.
2961         (Parameters::timer): New function.
2962         (Parameters::timer_): New data member.
2963         (set_parameters_timer): New function.
2964         * timer.cc (Timer::stamp): New function.
2965         (Timer::get_pass_time): New function.
2966         * timer.h (Timer::stamp): New function.
2967         (Timer::get_pass_time): New function.
2968         (Timer::pass_times_): New data member.
2969
2970 2011-10-17  Cary Coutant  <ccoutant@google.com>
2971
2972         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2973         task for members of lib groups.
2974
2975 2011-10-17  Cary Coutant  <ccoutant@google.com>
2976
2977         PR gold/13288
2978         * fileread.cc (File_read::find_view): Add assert.
2979         (File_read::make_view): Move bounds check (replace with assert)...
2980         (File_read::find_or_make_view): ... to here.
2981
2982 2011-10-12  Cary Coutant  <ccoutant@google.com>
2983
2984         * output.cc (Output_file::open_base_file): Handle case where
2985         ::read returns less than requested size.
2986
2987 2011-10-10  Cary Coutant  <ccoutant@google.com>
2988
2989         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2990         Initialize defined_count_.
2991         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2992         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2993         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2994         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2995         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2996         * incremental.h (Sized_relobj_incr::defined_count_): New data
2997         member.
2998         (Sized_incr_dynobj::defined_count_): New data member.
2999         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3000         Return zeroes instead of internal error.
3001
3002 2011-10-10  Cary Coutant  <ccoutant@google.com>
3003
3004         PR gold/13249
3005         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3006         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3007         * output.h (class Output_reloc): Add use_plt_offset flag.
3008         (Output_reloc::type_): Adjust size of bit field.
3009         (Output_reloc::use_plt_offset_): New bit field.
3010         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3011         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3012         flag.  Adjust all callers.
3013         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3014         creating RELATIVE relocations.
3015
3016 2011-10-10  Nick Clifton  <nickc@redhat.com>
3017
3018         * po/es.po: Updated Spanish translation.
3019         * po/fi.po: Updated Finnish translation.
3020
3021 2011-10-03   Diego Novillo  <dnovillo@google.com>
3022
3023         * options.cc (parse_uint): Fix dereference of RETVAL.
3024
3025 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3026
3027         * layout.h (section_order_map_): New member.
3028         (get_section_order_map): New member function.
3029         * output.cc (Output_section::add_input_section): Check for patterns
3030         only when --section-ordering-file is specified.
3031         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3032         output_sections have been formed.
3033         * layout.cc (Layout_Layout): Initialize section_order_map_.
3034         * plugin.cc (update_section_order): Store order in order_map. Do not
3035         update the order.
3036         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3037         * testsuite/Makefile.in: Regenerate.
3038         * testsuite/plugin_section_order.c: New file.
3039         * testsuite/plugin_final_layout.cc: New file.
3040         * testsuite/plugin_final_layout.sh: New file.
3041
3042 2011-09-29  Cary Coutant  <ccoutant@google.com>
3043
3044         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3045         Check for NULL.
3046         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3047         symbols during incremental update.
3048         (Symbol_table::add_from_dynobj): Likewise.
3049
3050 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3051             Ian Lance Taylor  <iant@google.com>
3052
3053         * symtab.cc (Symbol_table::define_special_symbol): Always
3054         canonicalize version string.
3055
3056 2011-09-26  Cary Coutant  <ccoutant@google.com>
3057
3058         * gold.cc (queue_initial_tasks): Move option checks ...
3059         * options.cc (General_options::finalize): ... to here. Disable
3060         some options; make others fatal.
3061
3062 2011-09-26  Cary Coutant  <ccoutant@google.com>
3063
3064         gcc PR lto/47247
3065         * plugin.cc (get_symbols_v2): New function.
3066         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3067         (is_referenced_from_outside): New function.
3068         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3069         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3070         (get_symbols): Pass version parameter.
3071         (get_symbols_v2): New function.
3072         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3073         parameter.
3074         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3075         (onload): Add LDPT_GET_SYMBOLS_V2.
3076         (all_symbols_read_hook): Use get_symbols_v2; check for
3077         LDPR_PREVAILING_DEF_IRONLY_EXP.
3078         * testsuite/plugin_test_3.sh: Update expected results.
3079
3080 2011-09-23  Simon Baldwin  <simonb@google.com>
3081
3082         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3083         configuration options.
3084         * configure: Regenerate.
3085         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3086         * Makefile.in: Regenerate.
3087         * testsuite/Makefile.in: Regenerate.
3088
3089 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3090
3091         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3092
3093 2011-09-19  Cary Coutant  <ccoutant@google.com>
3094
3095         * incremental.cc (can_incremental_update): Fix typo in comment.
3096         * incremental.h (can_incremental_update): Likewise.
3097
3098 2011-09-18  Cary Coutant  <ccoutant@google.com>
3099
3100         * incremental.cc (can_incremental_update): New function.
3101         * incremental.h (can_incremental_update): New function.
3102         * layout.cc (Layout::init_fixed_output_section): Call it.
3103         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3104         * object.cc (Sized_relobj_file::do_layout): Call
3105         can_incremental_update.
3106
3107 2011-09-13  Cary Coutant  <ccoutant@google.com>
3108
3109         * configure.ac: Check for glibc support for gnu_indirect_function
3110         support with static linking, setting automake conditional
3111         IFUNC_STATIC.
3112         * Makefile.in: Regenerate.
3113         * configure: Regenerate.
3114
3115         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3116         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3117         for IFUNC_STATIC.
3118         * testsuite/Makefile.in: Regenerate.
3119
3120 2011-09-13  Cary Coutant  <ccoutant@google.com>
3121
3122         * incremental.cc (Sized_relobj_incr::do_layout): Call
3123         report_comdat_group for kept comdat sections.
3124         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3125         * testsuite/Makefile.in: Regenerate.
3126         * testsuite/incr_comdat_test_1.cc: New source file.
3127         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3128         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3129         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3130
3131 2011-09-13  Ian Lance Taylor  <iant@google.com>
3132
3133         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3134         variable external_symbols_offset.
3135
3136 2011-09-12  Ian Lance Taylor  <iant@google.com>
3137
3138         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3139         triggered if object has no symbols.
3140
3141 2011-09-09  David S. Miller  <davem@davemloft.net>
3142
3143         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3144         (Output_fill_debug_line::do_write): Likewise.
3145
3146 2011-08-29  Cary Coutant  <ccoutant@google.com>
3147
3148         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3149         casts to match formatting specs.
3150         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3151
3152 2011-08-26  Cary Coutant  <ccoutant@google.com>
3153
3154         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3155         remaining hole size when allocating.
3156         (Layout::make_output_section): Set fill methods for debug sections.
3157         * layout.h (Free_list::Free_list_node): Move from private to
3158         public.
3159         (Free_list::set_min_hole_size): New function.
3160         (Free_list::begin, Free_list::end): New functions.
3161         (Free_list::min_hole_): New data member.
3162         * output.cc: Include dwarf.h.
3163         (Output_fill_debug_info::do_minimum_hole_size): New function.
3164         (Output_fill_debug_info::do_write): New function.
3165         (Output_fill_debug_line::do_minimum_hole_size): New function.
3166         (Output_fill_debug_line::do_write): New function.
3167         (Output_section::Output_section): Initialize new data member.
3168         (Output_section::set_final_data_size): Ensure patch space is larger
3169         than minimum hole size.
3170         (Output_section::do_write): Fill holes in debug sections.
3171         * output.h (Output_fill): New class.
3172         (Output_fill_debug_info): New class.
3173         (Output_fill_debug_line): New class.
3174         (Output_section::set_free_space_fill): New function.
3175         (Output_section::free_space_fill_): New data member.
3176         * testsuite/Makefile.am (incremental_test_3): Add
3177         --incremental-patch option.
3178         (incremental_test_4): Likewise.
3179         (incremental_test_5): Likewise.
3180         (incremental_test_6): Likewise.
3181         (incremental_copy_test): Likewise.
3182         (incremental_common_test_1): Likewise.
3183         * testsuite/Makefile.in: Regenerate.
3184
3185 2011-08-26  Nick Clifton  <nickc@redhat.com>
3186
3187         * po/es.po: Updated Spanish translation.
3188
3189 2011-08-01  Cary Coutant  <ccoutant@google.com>
3190
3191         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3192         * gold/testsuite/Makefile.in: Regenerate.
3193         * gold/testsuite/justsyms_exec.c: New source file.
3194         * gold/testsuite/justsyms_lib.c: New source file.
3195
3196 2011-08-01  Cary Coutant  <ccoutant@google.com>
3197
3198         * layout.cc (Layout::set_segment_offsets): Don't realign text
3199         segment if -Ttext was specified.
3200         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3201         file type.
3202         * object.h (Sized_relobj_file::e_type): New function.
3203         (Sized_relobj_file::e_type_): New data member.
3204         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3205         base address for ET_EXEC files.
3206         * target.cc (Target::do_make_elf_object_implementation): Allow
3207         ET_EXEC files with --just-symbols option.
3208
3209 2011-07-28  Cary Coutant  <ccoutant@google.com>
3210
3211         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3212         Add thread_number parameter.
3213         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3214         * workqueue-threads.cc
3215         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3216         current thread if its thread number is greater than desired thread
3217         count.
3218         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3219         Add thread_number parameter.
3220         (Workqueue::should_cancel_thread): Likewise.
3221         (Workqueue::find_runnable_or_wait): Pass thread_number to
3222         should_cancel_thread.
3223         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3224         parameter.
3225
3226 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3227
3228         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3229         only after checking if it cannot be forced local.
3230         * symtab.h (is_externally_visible): Check if the symbol is not forced
3231         local.
3232
3233 2011-07-15  Ian Lance Taylor  <iant@google.com>
3234
3235         * options.h (class General_options): Add --print-output-format.
3236         Move -EL next to -EB, for  better --help output.
3237         * target-select.cc: Include <cstdio>, "options.h", and
3238         "parameters.h".
3239         (Target_selector::do_target_bfd_name): New function.
3240         (print_output_format): New function.
3241         * target-select.h (class Target_selector): Update declarations.
3242         (Target_selector::target_bfd_name): New function.
3243         (print_output_format): Declare.
3244         * main.cc: Include "target-select.h".
3245         (main): Handle --print-output-format.
3246         * gold.cc: Include "target-select.h".
3247         (queue_initial_tasks): Handle --print-output-format when there are
3248         no input files.
3249         * parameters.cc (parameters_force_valid_target): Give a better
3250         error message if -EB/-EL does not match target.
3251         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3252         function.
3253
3254 2011-07-15  Ian Lance Taylor  <iant@google.com>
3255
3256         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3257         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3258         (Output_data_plt_i386::do_write): Write address of .dynamic
3259         section to first entry in .got.plt section.
3260         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3261         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3262         Initialize layout_.
3263         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3264         section to first entry in .got.plt section.
3265         * layout.h (Layout::dynamic_section): New function.
3266
3267 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3268
3269         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3270         to claim_file call.
3271         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3272         input_section_position_, and input_section_glob_.
3273         (read_layout_from_file): Call function section_ordering_specified.
3274         * layout.h (is_section_ordering_specified): New function.
3275         (section_ordering_specified): New function.
3276         (section_ordering_specified_): New boolean member.
3277         * main.cc(main): Call load_plugins after layout object is defined.
3278         * output.cc (Output_section::add_input_section): Use
3279         function section_ordering_specified to check if section ordering is
3280         needed.
3281         * output.cc (Output_section::add_relaxed_input_section): Use
3282         function section_ordering_specified to check if section ordering is
3283         needed.
3284         (Output_section::update_section_layout): New function.
3285         (Output_section::sort_attached_input_sections): Check if input section
3286         must be reordered.
3287         * output.h (Output_section::update_section_layout): New function.
3288         * plugin.cc (get_section_count): New function.
3289         (get_section_type): New function.
3290         (get_section_name): New function.
3291         (get_section_contents): New function.
3292         (update_section_order): New function.
3293         (allow_section_ordering): New function.
3294         (Plugin::load): Add the new interfaces to the transfer vector.
3295         (Plugin_manager::load_plugins): New parameter.
3296         (Plugin_manager::all_symbols_read): New parameter.
3297         (Plugin_manager::claim_file): New parameter. Save the elf object for
3298         unclaimed objects.
3299         (Plugin_manager::get_elf_object): New function.
3300         (Plugin_manager::get_view): Change to directly use the bool to check
3301         if get_view is called from claim_file_hook.
3302         * plugin.h (input_objects): New function
3303         (Plugin__manager::load_plugins): New parameter.
3304         (Plugin_manager::claim_file): New parameter.
3305         (Plugin_manager::get_elf_object): New function.
3306         (Plugin_manager::in_claim_file_handler): New function.
3307         (Plugin_manager::in_claim_file_handler_): New member.
3308         (layout): New function.
3309         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3310         handler with an extra parameter. Make the elf object before calling
3311         claim_file handler.
3312         * testsuite/plugin_test.c (get_section_count): New function pointer.
3313         (get_section_type): New function pointer.
3314         (get_section_name): New function pointer.
3315         (get_section_contents): New function pointer.
3316         (update_section_order): New function pointer.
3317         (allow_section_ordering): New function pointer.
3318         (onload): Check if the new interfaces exist.
3319
3320 2011-07-13  Ian Lance Taylor  <iant@google.com>
3321
3322         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3323         relro section.
3324         * x86_64.cc (Target_x86_64::got_section): Likewise.
3325         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3326         (relro_now_test_SOURCES): New variable.
3327         (relro_now_test_DEPENDENCIES): New variable.
3328         (relro_now_test_LDFLAGS): New variable.
3329         (relro_now_test_LDADD): New variable.
3330         (relro_now_test.so): New target.
3331         * testsuite/Makefile.in: Rebuild.
3332
3333 2011-07-12  Ian Lance Taylor  <iant@google.com>
3334
3335         PR gold/12980
3336         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3337         GLOB_DAT relocation rather than a RELATIVE relocation for a
3338         protected symbol when creating a shared library.
3339         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3340         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3341         * testsuite/protected_main_1.cc (main): Test that protected
3342         function has same address.
3343
3344 2011-07-11  Ian Lance Taylor  <iant@google.com>
3345
3346         PR gold/12979
3347         * options.h (class General_options): Add -Bgroup.
3348         * options.cc (General_options::finalize): If -Bgroup is set,
3349         default to --unresolved-symbols=report-all.
3350         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3351         * target-reloc.h (issue_undefined_symbol_error): Handle
3352         --unresolved-symbols=report-all.
3353
3354 2011-07-08  Ian Lance Taylor  <iant@google.com>
3355
3356         PR gold/11985
3357         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3358         if linker script discards key sections.
3359         (Layout::create_dynamic_symtab): Likewise.
3360         (Layout::assign_local_dynsym_offsets): Likewise.
3361         (Layout::sized_create_version_sections): Likewise.
3362         (Layout::create_interp): Likewise.
3363         (Layout::finish_dynamic_section): Likewise.
3364         (Layout::set_dynamic_symbol_size): Likewise.
3365
3366 2011-07-08  Ian Lance Taylor  <iant@google.com>
3367
3368         PR gold/12386
3369         * options.h (class General_options): Add --unresolved-symbols.
3370         * target-reloc.h (issue_undefined_symbol_error): Check
3371         --unresolved-symbols.  Add comments.
3372
3373 2011-07-08  Ian Lance Taylor  <iant@google.com>
3374
3375         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3376         expression more complex.
3377
3378 2011-07-08  Ian Lance Taylor  <iant@google.com>
3379
3380         PR gold/11317
3381         * target-reloc.h (issue_undefined_symbol_error): New inline
3382         function, broken out of relocate_section.
3383         (relocate_section): Call issue_undefined_symbol_error.
3384         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3385         there is no TLS segment if we are about to issue an undefined
3386         symbol error.
3387         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3388
3389 2011-07-08  Ian Lance Taylor  <iant@google.com>
3390
3391         PR gold/12279
3392         * resolve.cc (Symbol_table::should_override): Add fromtype
3393         parameter.  Change all callers.  Give error when linking together
3394         TLS and non-TLS symbol.
3395         (Symbol_table::should_override_with_special): Add fromtype
3396         parameter.  Change all callers.
3397         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3398         there is no TLS segment if we have reported some errors.
3399         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3400
3401 2011-07-08  Ian Lance Taylor  <iant@google.com>
3402
3403         PR gold/12372
3404         * target.h (Target::plt_address_for_global): New function.
3405         (Target::plt_address_for_local): New function.
3406         (Target::plt_section_for_global): Remove.
3407         (Target::plt_section_for_local): Remove.
3408         (Target::do_plt_address_for_global): New virtual function.
3409         (Target::do_plt_address_for_local): New virtual function.
3410         (Target::do_plt_section_for_global): Remove.
3411         (Target::do_plt_section_for_local): Remove.
3412         (Target::register_global_plt_entry): Add Symbol_table and Layout
3413         parameters.
3414         * output.cc (Output_data_got::Got_entry::write): Use
3415         plt_address_for_global and plt_address_for_local.
3416         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3417         address of output section.
3418         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3419         got_irelative_, and irelative_count_ fields.  Update
3420         declarations.
3421         (Output_data_plt_i386::has_irelative_section): New function.
3422         (Output_data_plt_i386::entry_count): Add irelative_count_.
3423         (Output_data_plt_i386::set_final_data_size): Likewise.
3424         (class Target_i386): Add got_irelative_ and rel_irelative_
3425         fields.  Update declarations.
3426         (Target_i386::Target_i386): Initialize new fields.
3427         (Target_i386::do_plt_address_for_global): New function replacing
3428         do_plt_section_for_global.
3429         (Target_i386::do_plt_address_for_local): New function replacing
3430         do_plt_section_for_local.
3431         (Target_i386::got_section): Create got_irelative_.
3432         (Target_i386::rel_irelative_section): New function.
3433         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3434         fields.  Don't define __rel_iplt_{start,end}.
3435         (Output_data_plt_i386::add_entry): Add symtab and layout
3436         parameters.  Change all callers.  Use different PLT and GOT for
3437         IFUNC symbols.
3438         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3439         layout parameters.  Change all callers.  Use different PLT and
3440         GOT.
3441         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3442         (Output_data_plt_i386::rel_irelative): New function.
3443         (Output_data_plt_i386::address_for_global): New function.
3444         (Output_data_plt_i386::address_for_local): New function.
3445         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3446         IRELATIVE GOT when changing IFUNC GOT entries.
3447         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3448         reloc.
3449         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3450         if we didn't create an IRELATIVE GOT.
3451         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3452         plt_address_for_local.
3453         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3454         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3455         got_irelative_, and irelative_count_ fields.  Update
3456         declarations.
3457         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3458         Initialize new fields.  Remove symtab parameter.  Change all
3459         callers.
3460         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3461         irelative_count_.
3462         (Output_data_plt_x86_64::has_irelative_section): New function.
3463         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3464         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3465         fields.  Update declarations.
3466         (Target_x86_64::Target_x86_64): Initialize new fields.
3467         (Target_x86_64::do_plt_address_for_global): New function replacing
3468         do_plt_section_for_global.
3469         (Target_x86_64::do_plt_address_for_local): New function replacing
3470         do_plt_section_for_local.
3471         (Target_x86_64::got_section): Create got_irelative_.
3472         (Target_x86_64::rela_irelative_section): New function.
3473         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3474         all callers.  Don't create __rel_iplt_{start,end}.
3475         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3476         parameters.  Change all callers.  Use different PLT and GOT for
3477         IFUNC symbols.
3478         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3479         layout parameters.  Change all callers.  Use different PLT and
3480         GOT.
3481         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3482         parameters.  Change all callers.  Use different PLT and GOT for
3483         IFUNC symbols.
3484         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3485         (Output_data_plt_x86_64::rela_irelative): New function.
3486         (Output_data_plt_x86_64::address_for_global): New function.
3487         (Output_data_plt_x86_64::address_for_local): New function.
3488         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3489         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3490         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3491         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3492         parameters.
3493         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3494         reloc.
3495         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3496         symbols if we didn't create an IRELATIVE GOT.
3497         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3498         plt_address_for_local.
3499         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3500         * testsuite/ifuncvar1.c: New test file.
3501         * testsuite/ifuncvar2.c: New test file.
3502         * testsuite/ifuncvar3.c: New test file.
3503         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3504         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3505         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3506         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3507         * testsuite/Makefile.in: Rebuild.
3508
3509 2011-07-07  Cary Coutant  <ccoutant@google.com>
3510
3511         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3512         (two_file_test_1_ndebug.o): Likewise.
3513         (two_file_test_1b_ndebug.o): Likewise.
3514         (two_file_test_2_ndebug.o): Likewise.
3515         (two_file_test_main_ndebug.o): Likewise.
3516         (incremental_test_2): Link with no-debug versions.
3517
3518 2011-07-06  Cary Coutant  <ccoutant@google.com>
3519
3520         * gold/incremental.cc
3521         (Output_section_incremental_inputs::write_info_blocks): Check for
3522         hidden and internal symbols.
3523
3524 2011-07-06  Cary Coutant  <ccoutant@google.com>
3525
3526         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3527         Check disposition for startup file.
3528         (Incremental_inputs::report_command_line): Ignore
3529         --incremental-startup-unchanged option.
3530         * options.cc (General_options::parse_incremental_startup_unchanged):
3531         New function.
3532         (General_options::General_options): Initialize new data member.
3533         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3534         (General_options): Add --incremental-startup-unchanged option.
3535         (General_options::incremental_startup_disposition): New function.
3536         (General_options::incremental_startup_disposition_): New data member.
3537
3538 2011-07-06  Cary Coutant  <ccoutant@google.com>
3539
3540         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3541         input file index to Script_info ctor.
3542         (Sized_incremental_binary::do_file_has_changed): Find the
3543         command-line argument for files named in scripts.
3544         * incremental.h (Script_info::Script_info): New ctor
3545         with input file index.
3546         (Script_info::input_file_index): New function.
3547         (Script_info::input_file_index_): New data member.
3548         (Incremental_binary::get_library): Add const.
3549         (Incremental_binary::get_script_info): Add const.
3550         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3551         * testsuite/Makefile.am (incremental_test_5): New test case.
3552         (incremental_test_6): New test case.
3553         * testsuite/Makefile.in: Regenerate.
3554
3555 2011-07-06  Cary Coutant  <ccoutant@google.com>
3556
3557         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3558         debug output when command lines differ.
3559
3560 2011-07-06  Cary Coutant  <ccoutant@google.com>
3561
3562         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3563         --incremental-patch option.
3564         * layout.cc (Free_list::allocate): Extend allocation beyond original
3565         end if enabled.
3566         (Layout::make_output_section): Mark sections that should get
3567         patch space.
3568         * options.cc (parse_percent): New function.
3569         * options.h (parse_percent): New function.
3570         (DEFINE_percent): New macro.
3571         (General_options): Add --incremental-patch option.
3572         * output.cc (Output_section::Output_section): Initialize new data
3573         members.
3574         (Output_section::add_input_section): Print section name when out
3575         of patch space.
3576         (Output_section::add_output_section_data): Likewise.
3577         (Output_section::set_final_data_size): Add patch space when
3578         doing --incremental-full.
3579         (Output_section::do_reset_address_and_file_offset): Remove patch
3580         space.
3581         (Output_segment::set_section_list_addresses): Print debug output
3582         only if --incremental-update.
3583         * output.h (Output_section::set_is_patch_space_allowed): New function.
3584         (Output_section::is_patch_space_allowed_): New data member.
3585         (Output_section::patch_space_): New data member.
3586         * parameters.cc (Parameters::incremental_full): New function.
3587         * parameters.h (Parameters::incremental_full): New function
3588         * testsuite/Makefile.am (incremental_test_2): Add test for
3589         --incremental-patch option.
3590         * testsuite/Makefile.in: Regenerate.
3591         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3592         (t18): Remove function body.
3593
3594 2011-07-05  Doug Kwan  <dougkwan@google.com>
3595
3596         PR gold/12771
3597         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3598         Arm_Address type for relocation result.
3599         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3600         overflow check.
3601         (Arm_relocate_functions::abs32): Use unaligned access.
3602         (Arm_relocate_functions::rel32): Ditto.
3603         (Arm_relocate_functions::prel31): Ditto.
3604         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3605         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3606         static data relocations.
3607         * testsuite/Makefile.in: Regnerate.
3608         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3609
3610 2011-07-05  Ian Lance Taylor  <iant@google.com>
3611
3612         PR gold/12392
3613         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3614         symbols if necessary.
3615         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3616
3617 2011-07-05  Ian Lance Taylor  <iant@google.com>
3618
3619         PR gold/12952
3620         * resolve.cc (Symbol::override_base_with_special): Simply override
3621         version with special symbol version, ignoring previous version.
3622
3623 2011-07-05  Ian Lance Taylor  <iant@google.com>
3624
3625         * object.cc (Sized_relobj_file::include_section_group): Add
3626         information to comment about signature location.
3627
3628 2011-07-02  Ian Lance Taylor  <iant@google.com>
3629
3630         PR gold/12957
3631         * options.h (class General_options): Add -f and -F.
3632         * options.cc (General_options::finalize): Fatal error if -f/-F
3633         are used without -shared.
3634         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3635
3636 2011-07-02  Ian Lance Taylor  <iant@google.com>
3637
3638         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3639
3640 2011-07-01  Ian Lance Taylor  <iant@google.com>
3641
3642         PR gold/12525
3643         PR gold/12952
3644         * resolve.cc (Symbol::override_base_with_special): Don't override
3645         the version if the overriding symbol has a different name.
3646         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3647         all callers.  If we give an error about an undefined version,
3648         define the base version if necessary.
3649         * dynobj.h (class Versions): Update declaration.
3650         * testsuite/weak_alias_test_5.cc: New file.
3651         * testsuite/weak_alias_test.script: New file.
3652         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3653         and versioned_alias have the right value, and call t2.
3654         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3655         weak_alias_test_5.so.
3656         (weak_alias_test_LDADD): Likewise.
3657         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3658         * testsuite/Makefile.in: Rebuild.
3659
3660 2011-07-01  Ian Lance Taylor  <iant@google.com>
3661
3662         PR gold/12525
3663         * options.h (class General_options): Support -z notext.
3664         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3665         -Wl,-z,notext.
3666         (two_file_shared_nonpic.so): Likewise.
3667         (two_file_shared_mixed.so): Likewise.
3668         (two_file_shared_mixed_1.so): Likewise.
3669         (weak_undef_lib_nonpic.so): Likewise.
3670         (alt/weak_undef_lib_nonpic.so): Likewise.
3671         (tls_test_shared_nonpic.so): Likewise.
3672         * testsuite/Makefile.in: Rebuild.
3673
3674 2011-07-01  Ian Lance Taylor  <iant@google.com>
3675
3676         PR gold/12525
3677         * configure.ac: Test whether static linking works, setting
3678         the automake conditional HAVE_STATIC.
3679         * testsuite/Makefile.am: Disable tests using -static if
3680         HAVE_STATIC is not true.
3681         * configure, testsuite/Makefile.in: Rebuild.
3682
3683 2011-07-01  Ian Lance Taylor  <iant@google.com>
3684
3685         PR gold/12525
3686         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3687         Assert if we see DW_EH_PE_indirect.
3688         * target.h (Target::ehframe_datarel_base): New function.
3689         (Target::do_ehframe_datarel_base): New target function.
3690         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3691         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3692         function.
3693
3694 2011-07-01  Ian Lance Taylor  <iant@google.com>
3695
3696         PR gold/12571
3697         * options.h (class General_options): Add
3698         --ld-generated-unwind-info.
3699         * ehframe.cc (Fde::write): Add address parameter.  Change all
3700         callers.  If associated with PLT, fill in address and size.
3701         (Cie::set_output_offset): Only add merge mapping if there is an
3702         object.
3703         (Cie::write): Add address parameter.  Change all callers.
3704         (Eh_frame::add_ehframe_for_plt): New function.
3705         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3706         input_offset_ fields into union u_, with new plt field.
3707         (Fde::Fde): Adjust for new union field.
3708         (Fde::Fde) [Output_data version]: New constructor.
3709         (Fde::add_mapping): Only add merge mapping if there is an object.
3710         (class Cie): Update declarations.
3711         (class Eh_frame): Declare add_ehframe_for_plt.
3712         * layout.cc (Layout::layout_eh_frame): Break out code into
3713         make_eh_frame_section, and call it.
3714         (Layout::make_eh_frame_section): New function.
3715         (Layout::add_eh_frame_for_plt): New function.
3716         * layout.h (class Layout): Update declarations.
3717         * merge.cc (Merge_map::add_mapping): Add assertion.
3718         * i386.cc: Include "dwarf.h".
3719         (class Output_data_plt_i386): Make first_plt_entry,
3720         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3721         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3722         and plt_eh_frame_fde.
3723         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3724         boundary.  Call add_eh_frame_for_plt if appropriate.
3725         * x86_64.cc: Include "dwarf.h".
3726         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3727         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3728         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3729         and plt_eh_frame_fde.
3730         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3731         appropriate.
3732
3733 2011-06-29  Ian Lance Taylor  <iant@google.com>
3734
3735         PR gold/12629
3736         * object.cc (Sized_relobj_file::layout_section): Change shdr
3737         parameter to be const.
3738         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3739         out of do_layout.
3740         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3741         appropriate.  Call layout_eh_frame_section.
3742         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3743         sections.
3744         * object.h (class Sized_relobj_file): Update declarations.
3745
3746 2011-06-29  Ian Lance Taylor  <iant@google.com>
3747
3748         PR gold/12652
3749         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3750         modifier.
3751         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3752
3753 2011-06-29  Ian Lance Taylor  <iant@google.com>
3754
3755         PR gold/12675
3756         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3757         SHT_X86_64_UNWIND.
3758         * layout.cc (Layout::layout_eh_frame): Likewise.
3759
3760 2011-06-29  Ian Lance Taylor  <iant@google.com>
3761
3762         PR gold/12695
3763         * layout.cc (Layout::symtab_section_shndx): New function.
3764         * layout.h (class Layout): Declare symtab_section_shndx.
3765         * output.cc (Output_section::write_header): Call it.
3766
3767 2011-06-29  Ian Lance Taylor  <iant@google.com>
3768
3769         PR gold/12818
3770         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3771         symbols which are not used in a relocation.
3772
3773 2011-06-28  Ian Lance Taylor  <iant@google.com>
3774
3775         PR gold/12898
3776         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3777         script create indistinguishable segments.
3778         (Layout::set_segment_offsets): Use stable_sort when sorting
3779         segments.  Pass this to Compare_segments constructor.
3780         * layout.h (class Layout): Make segment_precedes non-static.
3781         (class Compare_segments): Change from struct to class.  Add
3782         layout_ field.  Add constructor.
3783         * script-sections.cc
3784         (Script_sections::attach_sections_using_phdrs_clause): Rename
3785         local orphan to is_orphan.  Don't report failure to put empty
3786         section in segment.  On attachment failure, report name of
3787         section, and attach to first PT_LOAD segment.
3788
3789 2011-06-28  Ian Lance Taylor  <iant@google.com>
3790
3791         PR gold/12934
3792         * target-select.cc (Target_selector::Target_selector): Add
3793         emulation parameter.  Change all callers.
3794         (select_target_by_bfd_name): Rename from select_target_by_name.
3795         Change all callers.
3796         (select_target_by_emulation): New function.
3797         (supported_emulation_names): New function.
3798         * target-select.h (class Target_selector): Add emulation_ field.
3799         Update declarations.
3800         (Target_selector::recognize_by_bfd_name): Rename from
3801         recognize_by_name.  Change all callers.
3802         (Target_selector::supported_bfd_names): Rename from
3803         supported_names.  Change all callers.
3804         (Target_selector::recognize_by_emulation): New function.
3805         (Target_selector::supported_emulations): New function.
3806         (Target_selector::emulation): New function.
3807         (Target_selector::do_recognize_by_bfd_name): Rename from
3808         do_recognize_by_name.  Change all callers.
3809         (Target_selector::do_supported_bfd_names): Rename from
3810         do_supported_names.  Change all callers.
3811         (Target_selector::do_recognize_by_emulation): New function.
3812         (Target_selector::do_supported_emulations): New function.
3813         (select_target_by_bfd_name): Change name in declaration.
3814         (select_target_by_emulation): Declare.
3815         (supported_emulation_names): Declare.
3816         * parameters.cc (parameters_force_valid_target): Try to find
3817         target based on emulation from -m option.
3818         * options.h (class General_options): Change doc string for -m.
3819         * options.cc (help): Print emulations.
3820         (General_options::parse_V): Likewise.
3821         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3822         Add emulation parameter.  Change all callers.
3823
3824 2011-06-28  Ian Lance Taylor  <iant@google.com>
3825
3826         * target.h (class Target): Add osabi_ field.
3827         (Target::osabi): New function.
3828         (Target::set_osabi): New function.
3829         (Target::Target): Initialize osabi_.
3830         (Target::do_adjust_elf_header): Make pure virtual.
3831         (Sized_target::do_adjust_elf_header): Declare.
3832         * target.cc (Sized_target::do_adjust_elf_header): New function.
3833         (class Sized_target): Instantiate all versions.
3834         * freebsd.h (class Target_freebsd): Remove.
3835         (Target_selector_freebsd::do_recognize): Call set_osabi on
3836         Target.
3837         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3838         (Target_selector_freebsd::set_osabi): Remove.
3839         * i386.cc (class Target_i386): Inherit from Sized_target rather
3840         than Target_freebsd.
3841         * x86_64.cc (class Target_x86_64): Likewise.
3842
3843 2011-06-28  Ian Lance Taylor  <iant@google.com>
3844
3845         * target.h (Target::can_check_for_function_pointers): Rewrite.
3846         Make non-virtual.
3847         (Target::can_icf_inline_merge_sections): Likewise.
3848         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3849         (Target::Target_info): Add can_icf_inline_merge_sections field.
3850         (Target::do_can_check_for_function_pointers): New virtual
3851         function.
3852         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3853         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3854         from can_check_for_function_pointers, move in file.
3855         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3856         section_may_have_icf_unsafe_poineters, move in file.
3857         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3858         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3859         Rename from can_check_for_function_pointers, move in file.
3860         (Target_i386::can_icf_inline_merge_sections): Remove.
3861         (Target_i386::i386_info): Initialize
3862         can_icf_inline_merge_sections.
3863         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3864         Initialize can_icf_inline_merge_sections.
3865         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3866         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3867         Rename from can_check_for_function_pointers, move in file.
3868         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3869         (Target_x86_64::x86_64_info): Initialize
3870         can_icf_inline_merge_sections.
3871         * testsuite/testfile.cc (Target_test::test_target_info):
3872         Likewise.
3873         * icf.cc (get_section_contents): Correct formatting.
3874
3875 2011-06-27  Ian Lance Taylor  <iant@google.com>
3876
3877         * symtab.cc (Symbol::versioned_name): New function.
3878         (Symbol_table::add_to_final_symtab): Use versioned_name when
3879         appropriate.
3880         (Symbol_table::sized_write_symbol): Likewise.
3881         * symtab.h (class Symbol): Declare versioned_name.
3882         * stringpool.h (class Stringpool_template): Add variant of add
3883         which takes a std::basic_string.
3884         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3885         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3886         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3887         (ver_test_12.o): New target.
3888         * testsuite/Makefile.in: Rebuild.
3889
3890 2011-06-27  Doug Kwan  <dougkwan@google.com>
3891
3892         * arm.cc (Arm_relocate_functions::thm_jump8,
3893         Arm_relocate_functions::thm_jump11): Use a wider signed
3894         type to compute offset.
3895         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3896         arm_thm_jump8.
3897         * testsuite/Makefile.in: Regenerate.
3898         * testsuite/arm_branch_in_range.sh: Check test results of
3899         arm_thm_jump11 and arm_thm_jump8.
3900         * testsuite/arm_thm_jump11.s: New test source file.
3901         * testsuite/arm_thm_jump11.t: New linker script.
3902         * testsuite/arm_thm_jump8.s: New test source file.
3903         * testsuite/arm_thm_jump8.t: New linker script.
3904
3905 2011-06-24  Ian Lance Taylor  <iant@google.com>
3906
3907         * layout.cc: Include "object.h".
3908         (ctors_sections_in_init_array): New static variable.
3909         (Layout::is_ctors_in_init_array): New function.
3910         (Layout::layout): Add entry to ctors_sections_in_init_array if
3911         appropriate.
3912         * layout.h (class Layout): Declare is_ctors_in_init_array.
3913         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3914         is_ctors_reverse_view is set.
3915         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3916         all callers.  Set is_ctors_reverse_view field of View_size.
3917         (Sized_relobj_file::reverse_words): New function.
3918         * object.h (Sized_relobj_file::View_size): Add
3919         is_ctors_reverse_view field.
3920         (class Sized_relobj_file): Update declarations.
3921         * testsuite/initpri3.c: New test.
3922         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3923         initpri3b.
3924         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3925         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3926         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3927         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3928         * testsuite/Makefile.in: Rebuild.
3929
3930 2011-06-24  Cary Coutant  <ccoutant@google.com>
3931
3932         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3933         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3934         (debug_msg_cdebug.err): New targets.
3935         * testsuite/Makefile.in: Regenerate.
3936         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3937         Fix checks for link with shared library.
3938
3939 2011-06-24  Doug Kwan  <dougkwan@google.com>
3940
3941         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3942         skip empty text sections.
3943         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3944
3945 2011-06-22  Ian Lance Taylor  <iant@google.com>
3946
3947         PR gold/12910
3948         * options.h (class General_options): Add --ctors-in-init-array.
3949         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3950         friends as SHT_PROGBITS for merging sections.
3951         (Layout::layout): Remove special handling of .init_array and
3952         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3953         and .dtors if ctors_in_init_array.
3954         (Layout::make_output_section): Force correct section types for
3955         .init_array and friends.  Don't sort if doing relocatable link,
3956         Don't sort .ctors and .dtors if ctors_in_init_array.
3957         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3958         (Layout::output_section_name): Add relobj parameter.  Change all
3959         callers.  Handle .ctors. and .dtors. in code rather than table.
3960         Handle .ctors and .dtors if ctors_in_init_array.
3961         (Layout::match_file_name): New function, moved from output.cc.
3962         * layout.h (class Layout): Update declarations.
3963         * output.cc: Include "layout.h".
3964         (Input_section_sort_entry::get_priority): New function.
3965         (Input_section_sort_entry::match_file_name): Just call
3966         Layout::match_file_name.
3967         (Output_section::Input_section_sort_init_fini_compare::operator()):
3968         Handle .ctors and .dtors.  Sort by explicit priority rather than
3969         by name.
3970         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3971         * testsuite/initpri2.c: New test.
3972         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3973         (check_PROGRAMS): Add initpri2.
3974         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3975         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3976         * configure, testsuite/Makefile.in: Rebuild.
3977
3978 2011-06-19  Ian Lance Taylor  <iant@google.com>
3979
3980         PR gold/12880
3981         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3982         .interp section to a PT_INTERP segment even if we have seen a
3983         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3984         clause in a linker script.
3985         (Layout::finalize): Don't create a .interp section if we've
3986         already create a PT_INTERP segment.
3987         (Layout::create_interp): Always call choose_output_section (revert
3988         patch of 2011-06-17).  Don't create PT_INTERP segment.
3989         * script-sections.cc
3990         (Script_sections::create_note_and_tls_segments): Add a .interp
3991         section to a PT_INTERP segment even if we have seen a
3992         --dynamic-linker option.
3993
3994 2011-06-18  Ian Lance Taylor  <iant@google.com>
3995
3996         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3997         merely because a non-PT_LOAD segment has a dynamic reloc.
3998
3999 2011-06-18  Ian Lance Taylor  <iant@google.com>
4000
4001         * layout.cc (Layout::finish_dynamic_section): Don't create
4002         DT_FLAGS entry if not needed.
4003
4004 2011-06-18  Ian Lance Taylor  <iant@google.com>
4005
4006         PR gold/12745
4007         * layout.cc (Layout::layout_eh_frame): Correct handling of
4008         writable .eh_frame section.
4009
4010 2011-06-17  Ian Lance Taylor  <iant@google.com>
4011
4012         PR gold/12893
4013         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4014         symbol is redefined with the exact same object and value.
4015
4016 2011-06-17  Ian Lance Taylor  <iant@google.com>
4017
4018         PR gold/12880
4019         * layout.h (class Layout): Add interp_segment_ field.
4020         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4021         (Layout::attach_allocated_section_to_segment): If making shared
4022         library, put .interp section in PT_INTERP segment.
4023         (Layout::finalize): Also call create_interp if -dynamic-linker
4024         option was used.
4025         (Layout::create_interp): Assert that there is no PT_INTERP
4026         segment.  If not using a SECTIONS clause, use make_output_section.
4027         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4028         * script-sections.cc
4029         (Script_sections::create_note_and_tls_segments): If making shared
4030         library, put .interp section in PT_INTERP segment.
4031
4032 2011-06-17  Ian Lance Taylor  <iant@google.com>
4033
4034         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4035         when making a shared library.
4036
4037 2011-06-17  Ian Lance Taylor  <iant@google.com>
4038
4039         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4040         parameter.  Change all callers.  Don't issue warning about PC32
4041         against locally defined symbol.
4042
4043 2011-06-16  Ian Lance Taylor  <iant@google.com>
4044
4045         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4046         occurs in same object.
4047
4048 2011-06-14  Alan Modra  <amodra@gmail.com>
4049
4050         * po/POTFILES.in: Regenerate.
4051
4052 2011-06-09  Ian Lance Taylor  <iant@google.com>
4053
4054         * script-sections.cc
4055         (Orphan_output_section::set_section_addresses): For a relocatable
4056         link set address to 0.
4057
4058 2011-06-09  Cary Coutant  <ccoutant@google.com>
4059
4060         PR gold/12804
4061         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4062         used with --compress-debug-sections.
4063         * gold/object.cc (Sized_relobj_file::do_layout): Report
4064         uncompressed size of compressed input sections.
4065
4066 2011-06-08  Cary Coutant  <ccoutant@google.com>
4067
4068         PR gold/12804
4069         * testsuite/two_file_test_2_v1.cc: Change initialization of
4070         v2 to keep it in .data.
4071
4072 2011-06-07  Cary Coutant  <ccoutant@google.com>
4073
4074         * common.cc (Symbol_table::do_allocate_commons_list): Call
4075         gold_fallback.
4076         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4077         (Errors::fallback): New function.
4078         (gold_fallback): New function.
4079         * errors.h (Errors::fallback): New function.
4080         * gold.cc (gold_exit): Change status parameter to enum; adjust
4081         all callers.
4082         (queue_initial_tasks): Call gold_fallback.
4083         * gold.h: Include cstdlib.
4084         (Exit_status): New enum type.
4085         (gold_exit): Change status parameter to enum.
4086         (gold_fallback): New function.
4087         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4088         (Layout::create_symtab_sections): Likewise.
4089         (Layout::create_shdrs): Likewise.
4090         * main.cc (main): Adjust call to gold_exit.
4091         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4092         (Output_data_got::add_got_entry_pair): Likewise.
4093         (Output_section::add_input_section): Likewise.
4094         (Output_section::add_output_section_data): Likewise.
4095         (Output_segment::set_section_list_addresses): Likewise.
4096         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4097
4098 2011-06-07  Cary Coutant  <ccoutant@google.com>
4099
4100         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4101         for incremental links.
4102         * output.cc (Output_segment::set_section_list_addresses): Remove
4103         FIXME and test for TLS or BSS.
4104
4105 2011-06-07  Cary Coutant  <ccoutant@google.com>
4106
4107         * testsuite/Makefile.am: Add incremental_copy_test,
4108         incremental_common_test_1.
4109         * testsuite/Makefile.in: Regenerate.
4110         * testsuite/common_test_1_v1.c: New source file.
4111         * testsuite/common_test_1_v2.c: New source file.
4112         * testsuite/copy_test_v1.cc: New source file.
4113
4114 2011-06-07  Cary Coutant  <ccoutant@google.com>
4115
4116         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4117         update, allocate common from bss section's free list.
4118         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4119         linker-defined symbols.
4120         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4121         Skip GOT and PLT entries that are no longer referenced.
4122         (Output_section_incremental_inputs::write_info_blocks): Mark
4123         linker-defined symbols.
4124         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4125         * output.cc (Output_section::allocate): New function.
4126         * output.h (Output_section::allocate): New function.
4127         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4128         linker-defined symbols.
4129         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4130         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4131         (Symbol::init_base_output_data): Likewise.
4132         (Symbol::init_base_output_segment): Likewise.
4133         (Symbol::init_base_constant): Likewise.
4134         (Sized_symbol::init_output_data): Likewise.
4135         (Sized_symbol::init_output_segment): Likewise.
4136         (Sized_symbol::init_constant): Likewise.
4137         (Symbol_table::do_define_in_output_data): Likewise.
4138         (Symbol_table::do_define_in_output_segment): Likewise.
4139         (Symbol_table::do_define_as_constant): Likewise.
4140         * symtab.h (Symbol::is_predefined): New function.
4141         (Symbol::init_base_output_data): Add is_predefined parameter.
4142         (Symbol::init_base_output_segment): Likewise.
4143         (Symbol::init_base_constant): Likewise.
4144         (Symbol::is_predefined_): New data member.
4145         (Sized_symbol::init_output_data): Add is_predefined parameter.
4146         (Sized_symbol::init_output_segment): Likewise.
4147         (Sized_symbol::init_constant): Likewise.
4148         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4149
4150 2011-06-07  Cary Coutant  <ccoutant@google.com>
4151
4152         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4153         instead of emit_copy_reloc.
4154         (Copy_relocs::emit_copy_reloc): Refactor.
4155         (Copy_relocs::make_copy_reloc): New function.
4156         (Copy_relocs::add_copy_reloc): Remove.
4157         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4158         section.
4159         (Copy_relocs::make_copy_reloc): New function.
4160         (Copy_relocs::add_copy_reloc): Remove.
4161         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4162         unchanged input files.
4163         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4164         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4165         Reserve BSS space for COPY relocations.
4166         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4167         (Output_section_incremental_inputs::write_info_blocks): Record
4168         whether a symbol is copied from a shared object.
4169         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4170         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4171         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4172         (Incremental_input_entry_reader::get_output_symbol_index): Add
4173         is_copy parameter.
4174         (Incremental_binary::emit_copy_relocs): New function.
4175         (Incremental_binary::do_emit_copy_relocs): New function.
4176         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4177         new data member.
4178         (Sized_incremental_binary::add_copy_reloc): New function.
4179         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4180         (Sized_incremental_binary::Copy_reloc): New struct.
4181         (Sized_incremental_binary::Copy_relocs): New typedef.
4182         (Sized_incremental_binary::copy_relocs_): New data member.
4183         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4184         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4185         * target.h (Sized_target::emit_copy_reloc): New function.
4186         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4187
4188 2011-06-02  Cary Coutant  <ccoutant@google.com>
4189
4190         PR gold/12163
4191         * gold/archive.cc (Archive::Archive): Initialize new data member.
4192         (Archive::include_all_members): Return if archive has already been
4193         included.
4194         * gold/archive.h (Archive::include_all_members_): New data member.
4195
4196 2011-06-02  Nick Clifton  <nickc@redhat.com>
4197
4198         * dynobj.h: Fix spelling mistake in comment.
4199         * output.cc: Likewise.
4200
4201 2011-05-31  Doug Kwan  <dougkwan@google.com>
4202             Asier Llano
4203
4204         PR gold/12826
4205         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4206         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4207         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4208         redundant arm_exidx_test.so.
4209         * testsuite/Makefile.in: Regenerate.
4210         (check_SCRIPTS): Add pr12826.sh
4211         (check_DATA): Add pr12826.stdout
4212         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4213         * testsuite/pr12826.sh: New file.
4214         * testsuite/pr12826_1.s: Ditto.
4215         * testsuite/pr12826_1.s: Ditto.
4216
4217 2011-05-30  Ian Lance Taylor  <iant@google.com>
4218
4219         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4220         sections.
4221
4222 2011-05-29  Ian Lance Taylor  <iant@google.com>
4223
4224         PR gold/12804
4225         * testsuite/Makefile.am: Use different file name for two_file_test
4226         temporary file for each incremental test.
4227         * testsuite/Makefile.in: Rebuild.
4228
4229 2011-05-29  Ian Lance Taylor  <iant@google.com>
4230
4231         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4232         binary input file is empty.
4233
4234 2011-05-27  Ian Lance Taylor  <iant@google.com>
4235
4236         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4237         (ver_test_9.so): Likewise.
4238         * testsuite/Makefile.in: Rebuild.
4239
4240 2011-05-26 Cary Coutant  <ccoutant@google.com>
4241
4242         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4243         * incremental.cc (Incremental_inputs::report_input_section): Fix
4244         comment, indentation.
4245         (Incremental_inputs::report_comdat_group): New function.
4246         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4247         of data for incremental input file entry.
4248         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4249         group count, COMDAT group signatures.
4250         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4251         an unchanged input file.
4252         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4253         Initialize new data member.
4254         (Incremental_object_entry::add_comdat_group): New function.
4255         (Incremental_object_entry::get_comdat_group_count): New function.
4256         (Incremental_object_entry::get_comdat_signature_key): New function.
4257         (Incremental_object_entry::groups_): New data member.
4258         (Incremental_inputs::report_comdat_group): New function.
4259         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4260         data for incremental input file entry.
4261         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4262         (Incremental_input_entry_reader::get_input_section): Adjust size of
4263         data for incremental input file entry.
4264         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4265         (Incremental_input_entry_reader::get_comdat_group_signature): New
4266         function.
4267         * object.cc (Sized_relobj::include_section_group): Report kept
4268         COMDAT groups for incremental links.
4269
4270 2011-05-24  David Meyer  <pdox@google.com>
4271
4272         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4273         with name parameter.  Add found_name parameter.
4274         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4275         * dirsearch.h (class Dirsearch): Update declaration.
4276
4277 2011-05-24  Ian Lance Taylor  <iant@google.com>
4278
4279         * archive.cc (Library_base::should_include_member): Pull in object
4280         from archive if it defines the entry symbol.
4281         * parameters.cc (Parameters::entry): New function.
4282         * parameters.h (class Parameters): Declare entry.
4283         * output.h (class Output_file_header): Remove entry_ field.
4284         * output.cc (Output_file_header::Output_file_header): Remove entry
4285         parameter.  Change all callers.
4286         (Output_file_header::entry): Use parameters->entry.
4287         * gold.cc (queue_middle_tasks): Likewise.
4288         * plugin.cc (Plugin_hook::run): Likewise.
4289
4290 2011-05-24 Cary Coutant  <ccoutant@google.com>
4291
4292         * gold.cc (queue_initial_tasks): Pass incremental base filename
4293         to Output_file::open_base_file; don't print error message.
4294         * incremental-dump.cc (main): Adjust call to
4295         Output_file::open_for_modification.
4296         * incremental-dump.cc (main): Likewise.
4297         * incremental.cc (Incremental_inputs::report_command_line):
4298         Ignore --incremental-base option when comparing command lines.
4299         Ignore parameter when given as separate argument.
4300         * options.h (class General_options): Add --incremental-base.
4301         * output.cc (Output_file::Output_file):
4302         (Output_file::open_base_file): Add base_name and writable parameters;
4303         read base file into new file; print error message here.
4304         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4305         callers.
4306         * output.h (Output_file::open_for_modification): Rename to...
4307         (Output_file::open_base_file): ...this; add base_name and
4308         writable parameters; adjust all callers.
4309         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4310         callers.
4311         * testsuite/Makefile.am (incremental_test_4): Test
4312         --incremental-base.
4313         * testsuite/Makefile.in: Regenerate.
4314
4315 2011-05-24 Cary Coutant  <ccoutant@google.com>
4316
4317         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4318         incremental_test_4.
4319         * testsuite/Makefile.in: Regenerate.
4320         * testsuite/two_file_test_1_v1.cc: New test source file.
4321         * testsuite/two_file_test_1b_v1.cc: New test source file.
4322         * testsuite/two_file_test_2_v1.cc: New test source file.
4323
4324 2011-05-24 Cary Coutant  <ccoutant@google.com>
4325
4326         * dynobj.h (Dynobj::do_dynobj): New function.
4327         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4328         flag and soname for shared objects.
4329         * incremental.cc (Incremental_inputs::report_object): Make
4330         either Incremental_object_entry or Incremental_dynobj_entry; add
4331         soname to string table.
4332         (Incremental_inputs::report_input_section): Add assertion.
4333         (Output_section_incremental_inputs::set_final_data_size): Adjust
4334         type of input file entry for shared libraries; adjust size of
4335         shared library info entry.
4336         (Output_section_incremental_inputs::write_input_files): Write
4337         as_needed flag for shared libraries.
4338         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4339         of input file entry for shared libraries; write soname.
4340         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4341         soname from incremental info.
4342         * incremental.h (enum Incremental_input_flags): Add
4343         INCREMENTAL_INPUT_AS_NEEDED.
4344         (Incremental_input_entry::Incremental_input_entry): Initialize new
4345         data member.
4346         (Incremental_input_entry::set_as_needed): New function.
4347         (Incremental_input_entry::as_needed): New function.
4348         (Incremental_input_entry::do_dynobj_entry): New function.
4349         (Incremental_input_entry::as_needed_): New data member.
4350         (Incremental_object_entry::Incremental_object_entry): Don't check
4351         for shared library.
4352         (Incremental_object_entry::do_type): Likewise.
4353         (class Incremental_dynobj_entry): New class.
4354         (Incremental_input_entry_reader::as_needed): New function.
4355         (Incremental_input_entry_reader::get_soname): New function.
4356         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4357         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4358         size of shared library info entry.
4359         * layout.cc (Layout::finish_dynamic_section): Don't test for
4360         incremental link when adding DT_NEEDED entries.
4361         * object.h (Object::Object): Initialize new data member.
4362         (Object::dynobj): New function.
4363         (Object::set_as_needed): New function.
4364         (Object::as_needed): New function.
4365         (Object::do_dynobj): New function.
4366         (Object::as_needed_): New data member.
4367
4368 2011-05-24 Cary Coutant  <ccoutant@google.com>
4369
4370         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4371         info; adjust display of GOT entries.
4372         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4373         vector of input objects; remove file_status_.
4374         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4375         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4376         got_plt reader; call target hooks to reserve GOT entries.
4377         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4378         of input file info header and GOT info entry.
4379         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4380         relocation info.
4381         (Got_plt_view_info::got_descriptor): Remove.
4382         (Got_plt_view_info::sym_index): New data member.
4383         (Got_plt_view_info::input_index): New data member.
4384         (Local_got_offset_visitor::visit): Write input file index.
4385         (Global_got_offset_visitor::visit): Write 0 for input file index.
4386         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4387         with sym_index and input_index.
4388         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4389         incremental info GOT entry; replace got_descriptor with input_index.
4390         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4391         map from input file index to object.
4392         (Sized_relobj_incr::do_layout): Replace direct data member reference
4393         with accessor function.
4394         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4395         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4396         Adjust size of input file info header.
4397         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4398         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4399         (Incremental_input_entry_reader::get_input_section): Adjust size of
4400         input file info header.
4401         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4402         of incremental info GOT entry.
4403         (Incremental_got_plt_reader::get_got_desc): Remove.
4404         (Incremental_got_plt_reader::get_got_symndx): New function.
4405         (Incremental_got_plt_reader::get_got_input_index): New function.
4406         (Sized_incremental_binary::Sized_incremental_binary): Remove
4407         file_status_; add input_objects_.
4408         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4409         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4410         (Sized_incremental_binary::file_is_unchanged): Remove.
4411         (Sized_incremental_binary::set_input_object): New function.
4412         (Sized_incremental_binary::input_object): New function.
4413         (Sized_incremental_binary::file_status_): Remove.
4414         (Sized_incremental_binary::input_objects_): New data member.
4415         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4416         references.
4417         (Sized_relobj_incr::invalid_address): Move to base class.
4418         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4419         class.
4420         (Sized_relobj_incr::do_output_section_offset): Likewise.
4421         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4422         (Sized_relobj_incr::section_offsets_): Likewise.
4423         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4424         function.
4425         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4426         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4427         with accessor function.
4428         (Sized_relobj_file::do_layout): Likewise.
4429         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4430         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4431         (Sized_relobj_file::compute_final_local_value): Replace refs to
4432         section_offsets_ with accessor function.
4433         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4434         * object.h (Relobj::Relobj): Initialize new data members.
4435         (Relobj::add_dyn_reloc): New function.
4436         (Relobj::first_dyn_reloc): New function.
4437         (Relobj::dyn_reloc_count): New function.
4438         (Relobj::first_dyn_reloc_): New data member.
4439         (Relobj::dyn_reloc_count_): New data member.
4440         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4441         references.
4442         (Sized_relobj::Address): New typedef.
4443         (Sized_relobj::invalid_address): Move here from child class.
4444         (Sized_relobj::Sized_relobj): Initialize new data members.
4445         (Sized_relobj::sized_relobj): New function.
4446         (Sized_relobj::is_output_section_offset_invalid): Move here from
4447         child class.
4448         (Sized_relobj::get_output_section_offset): Likewise.
4449         (Sized_relobj::local_has_got_offset): Likewise.
4450         (Sized_relobj::local_got_offset): Likewise.
4451         (Sized_relobj::set_local_got_offset): Likewise.
4452         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4453         (Sized_relobj::clear_got_offsets): New function.
4454         (Sized_relobj::section_offsets): Move here from child class.
4455         (Sized_relobj::do_output_section_offset): Likewise.
4456         (Sized_relobj::do_set_section_offset): Likewise.
4457         (Sized_relobj::Local_got_offsets): Likewise.
4458         (Sized_relobj::local_got_offsets_): Likewise.
4459         (Sized_relobj::section_offsets_): Likewise.
4460         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4461         references.
4462         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4463         class.
4464         (Sized_relobj_file::sized_relobj): New function
4465         (Sized_relobj_file::local_has_got_offset): Move to base class.
4466         (Sized_relobj_file::local_got_offset): Likewise.
4467         (Sized_relobj_file::set_local_got_offset): Likewise.
4468         (Sized_relobj_file::get_output_section_offset): Likewise.
4469         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4470         (Sized_relobj_file::do_output_section_offset): Likewise.
4471         (Sized_relobj_file::do_set_section_offset): Likewise.
4472         (Sized_relobj_file::Local_got_offsets): Likewise.
4473         (Sized_relobj_file::local_got_offsets_): Likewise.
4474         (Sized_relobj_file::section_offsets_): Likewise.
4475         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4476         (all constructors).
4477         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4478         (Output_reloc::get_symbol_index): Likewise.
4479         (Output_reloc::local_section_offset): Likewise.
4480         (Output_reloc::get_address): Likewise.
4481         (Output_reloc::symbol_value): Likewise.
4482         (Output_data_got::reserve_slot): Move to class definition.
4483         (Output_data_got::reserve_local): New function.
4484         (Output_data_got::reserve_slot_for_global): Remove.
4485         (Output_data_got::reserve_global): New function.
4486         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4487         (all constructors, two instantiations).
4488         (Output_reloc::get_relobj): New function (two instantiations).
4489         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4490         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4491         (Output_data_reloc::add_global): Adjust type of relobj.
4492         (Output_data_reloc::add_global_relative): Likewise.
4493         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4494         (Output_data_reloc::add_local): Likewise.
4495         (Output_data_reloc::add_local_relative): Likewise.
4496         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4497         (Output_data_reloc::add_local_section): Likewise.
4498         (Output_data_reloc::add_output_section): Likewise.
4499         (Output_data_reloc::add_absolute): Likewise.
4500         (Output_data_reloc::add_target_specific): Likewise.
4501         (Output_data_got::reserve_slot): Move definition here.
4502         (Output_data_got::reserve_local): New function.
4503         (Output_data_got::reserve_global): New function.
4504         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4505         section_offsets_ with accessor function.
4506         (Sized_relobj_file::write_sections): Likewise.
4507         (Sized_relobj_file::do_relocate_sections): Likewise.
4508         * target.h (Sized_target::reserve_local_got_entry): New function.
4509         (Sized_target::reserve_global_got_entry): New function.
4510         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4511         (Target_x86_64::reserve_global_got_entry): New function.
4512         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4513
4514 2011-05-23 Cary Coutant  <ccoutant@google.com>
4515
4516         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4517         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4518         bit when checking got_type.
4519         * incremental.cc (Sized_incremental_binary::setup_readers):
4520         Store symbol table and string table locations; initialize bit vector
4521         of file status flags.
4522         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4523         unchanged files.
4524         (Sized_incremental_binary::do_process_got_plt): New function.
4525         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4526         (Output_section_incremental_inputs::set_final_data_size): Record
4527         file index for each input file.
4528         (Output_section_incremental_inputs::write_got_plt): Store file index
4529         instead of input entry offset for each GOT entry.
4530         * incremental.h
4531         (Incremental_input_entry::Incremental_input_entry): Initialize new
4532         data member.
4533         (Incremental_input_entry::set_offset): Store file index.
4534         (Incremental_input_entry::get_file_index): New function.
4535         (Incremental_input_entry::file_index_): New data member.
4536         (Incremental_binary::process_got_plt): New function.
4537         (Incremental_binary::do_process_got_plt): New function.
4538         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4539         data members.
4540         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4541         (Sized_incremental_binary::set_file_is_unchanged): New function.
4542         (Sized_incremental_binary::file_is_unchanged): New function.
4543         (Sized_incremental_binary::do_process_got_plt): New function.
4544         (Sized_incremental_binary::file_status_): New data member.
4545         (Sized_incremental_binary::main_symtab_loc_): New data member.
4546         (Sized_incremental_binary::main_strtab_loc_): New data member.
4547         * output.cc (Output_data_got::Got_entry::write): Add case
4548         RESERVED_CODE.
4549         (Output_data_got::add_global): Call add_got_entry.
4550         (Output_data_got::add_global_plt): Likewise.
4551         (Output_data_got::add_global_with_rel): Likewise.
4552         (Output_data_got::add_global_with_rela): Likewise.
4553         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4554         (Output_data_got::add_global_pair_with_rela): Likewise.
4555         (Output_data_got::add_local): Call add_got_entry.
4556         (Output_data_got::add_local_plt): Likewise.
4557         (Output_data_got::add_local_with_rel): Likewise.
4558         (Output_data_got::add_local_with_rela): Likewise.
4559         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4560         (Output_data_got::add_local_pair_with_rela): Likewise.
4561         (Output_data_got::reserve_slot): New function.
4562         (Output_data_got::reserve_slot_for_global): New function.
4563         (Output_data_got::add_got_entry): New function.
4564         (Output_data_got::add_got_entry_pair): New function.
4565         (Output_section::add_output_section_data): Edit FIXME.
4566         * output.h
4567         (Output_section_data_build::Output_section_data_build): New
4568         constructor with size parameter.
4569         (Output_data_space::Output_data_space): Likewise.
4570         (Output_data_got::Output_data_got): Initialize new data member; new
4571         constructor with size parameter.
4572         (Output_data_got::add_constant): Call add_got_entry.
4573         (Output_data_got::reserve_slot): New function.
4574         (Output_data_got::reserve_slot_for_global): New function.
4575         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4576         (Output_data_got::add_got_entry): New function.
4577         (Output_data_got::add_got_entry_pair): New function.
4578         (Output_data_got::free_list_): New data member.
4579         * target.h (Sized_target::init_got_plt_for_update): New function.
4580         (Sized_target::register_global_plt_entry): New function.
4581         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4582         Initialize new data member; call init; add constructor with PLT count.
4583         (Output_data_plt_x86_64::init): New function.
4584         (Output_data_plt_x86_64::add_relocation): New function.
4585         (Output_data_plt_x86_64::reserve_slot): New function.
4586         (Output_data_plt_x86_64::free_list_): New data member.
4587         (Target_x86_64::init_got_plt_for_update): New function.
4588         (Target_x86_64::register_global_plt_entry): New function.
4589         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4590         incremental updates.
4591         (Output_data_plt_x86_64::add_relocation): New function.
4592         * testsuite/object_unittest.cc (Object_test): Set default options.
4593
4594 2011-05-16  Ian Lance Taylor  <iant@google.com>
4595
4596         * options.h (class General_options): Make -i a synonym for -r.
4597
4598 2011-05-16  Ian Lance Taylor  <iant@google.com>
4599
4600         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4601
4602 2011-05-10 Cary Coutant  <ccoutant@google.com>
4603
4604         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4605         strip_all (-s).
4606
4607 2011-05-06  Ian Lance Taylor  <iant@google.com>
4608
4609         * layout.cc (Layout::layout): If the output section flags change,
4610         update the ordering.
4611
4612 2011-04-25 Cary Coutant  <ccoutant@google.com>
4613
4614         * incremental-dump.cc (dump_incremental_inputs): Print local
4615         symbol info for each input file.
4616         * incremental.cc
4617         (Output_section_incremental_inputs::set_final_data_size): Add local
4618         symbol info to input file entries in incremental info.
4619         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4620         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4621         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4622         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4623         implementation.
4624         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4625         (Sized_incr_relobj::do_relocate): Write the local symbols.
4626         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4627         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4628         Adjust size of input file header.
4629         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4630         (Incremental_inputs_reader::get_local_symbol_count): New function.
4631         (Incremental_inputs_reader::get_input_section): Adjust size of input
4632         file header.
4633         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4634         (Sized_incr_relobj::This): New typedef.
4635         (Sized_incr_relobj::sym_size): New const data member.
4636         (Sized_incr_relobj::Local_symbol): New struct.
4637         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4638         (Sized_incr_relobj::do_local_symbol_offset): New function.
4639         (Sized_incr_relobj::local_symbol_count_): New data member.
4640         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4641         (Sized_incr_relobj::local_symbol_index_): New data member.
4642         (Sized_incr_relobj::local_symbol_offset_): New data member.
4643         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4644         (Sized_incr_relobj::local_symbols_): New data member.
4645         * object.h (Relobj::output_local_symbol_count): New function.
4646         (Relobj::local_symbol_offset): New function.
4647         (Relobj::do_output_local_symbol_count): New function.
4648         (Relobj::do_local_symbol_offset): New function.
4649         (Sized_relobj::do_output_local_symbol_count): New function.
4650         (Sized_relobj::do_local_symbol_offset): New function.
4651
4652 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4653
4654         * descriptors.cc (set_close_on_exec): New function.
4655         (Descriptors::open): Use set_close_on_exec.
4656         * output.cc (S_ISLNK): Define if not defined.
4657
4658 2011-04-22 Cary Coutant  <ccoutant@google.com>
4659
4660         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4661         global symbol map.
4662         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4663         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4664         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4665         relocations.
4666         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4667         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4668         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4669         * incremental.h
4670         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4671         function.
4672         (Incremental_binary::apply_incremental_relocs): New function.
4673         (Incremental_binary::do_apply_incremental_relocs): New function.
4674         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4675         data member.
4676         (Sized_incremental_binary::add_global_symbol): New function.
4677         (Sized_incremental_binary::global_symbol): New function.
4678         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4679         (Sized_incremental_binary::symbol_map_): New data member.
4680         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4681         * target.h (Sized_target::apply_relocation): New function.
4682         * target-reloc.h (apply_relocation): New function.
4683         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4684
4685 2011-04-22  Doug Kwan  <dougkwan@google.com>
4686
4687         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4688         flag of a SHT_ARM_EXIDX section.
4689         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4690         * testsuite/Makefile.in: Regenerate.
4691         * testsuite/arm_exidx_test.s: New file.
4692         * testsuite/arm_exidx_test.sh: Same.
4693
4694 2011-04-20 Cary Coutant  <ccoutant@google.com>
4695
4696         PR gold/12689
4697         * archive.h (Incremental_archive_entry::Archive_member):
4698         Initialize arg_serial_ (second constructor).
4699
4700 2011-04-17  Ian Lance Taylor  <iant@google.com>
4701
4702         * object.cc (Relocate_info::location): Simplify location string.
4703         * errors.cc (Errors::error_at_location): Don't print program
4704         name.
4705         (Errors::warning_at_location): Likewise.
4706         (Errors::undefined_symbol): Likewise.
4707         * testsuite/debug_msg.sh: Update accordingly.
4708
4709 2011-04-14 Cary Coutant  <ccoutant@google.com>
4710
4711         * gold/layout.cc (Layout::symtab_section_offset): New function.
4712         * gold/layout.h (Layout::symtab_section_offset): New function.
4713         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4714
4715 2011-04-12  Ian Lance Taylor  <iant@google.com>
4716
4717         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4718         with MREMAP_MAYMOVE.
4719         * output.h (class Output_file): Add map_is_allocated_ field.
4720         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4721         not available, provide stubs.  If mremap is not available, #define
4722         it to gold_mremap.
4723         (MREMAP_MAYMOVE): Define if not defined.
4724         (Output_file::Output_file): Initialize map_is_allocated_.
4725         (Output_file::resize): Check map_is_allocated_.
4726         (Output_file::map_anonymous): If mmap fails, use malloc.
4727         (Output_file::unmap): Don't do anything for an anonymous map.
4728         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4729         is not available, provide stubs.
4730         (File_read::View::~View): Use free rather than delete[].
4731         (File_read::make_view): Use malloc rather than new[].  If mmap
4732         fails, use malloc.
4733         (File_read::find_or_make_view): Use malloc rather than new[].
4734         * gold.h: Remove HAVE_REMAP code.
4735         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4736         exists.  Rename mremap to gold_mremap.  If mmap is not available
4737         don't do anything.
4738         * configure, config.in: Rebuild.
4739
4740 2011-04-11  Ian Lance Taylor  <iant@google.com>
4741
4742         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4743         initialize local variable v.
4744
4745 2011-04-11  Cary Coutant  <ccoutant@google.com>
4746
4747         * archive.cc (Archive::include_member): Adjust call to
4748         report_object.
4749         (Add_archive_symbols::run): Track argument serial numbers.
4750         (Lib_group::include_member): Likewise.
4751         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4752         * archive.h (Incremental_archive_entry::Archive_member):
4753         Initialize arg_serial_.
4754         (Archive_member::arg_serial_): New data member.
4755         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4756         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4757         incremental link.
4758         (Sized_dynobj::do_for_all_local_got_entries): New function.
4759         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4760         function.
4761         * fileread.cc (get_mtime): New function.
4762         * fileread.h (get_mtime): New function.
4763         * gold.cc (queue_initial_tasks): Check for incremental update.
4764         (process_incremental_input): New function.
4765         (queue_middle_tasks): Don't force valid target for incremental
4766         update.
4767         * incremental-dump.cc (find_input_containing_global): Adjust
4768         size of symbol info entry.
4769         (dump_incremental_inputs): Dump argument serial number and
4770         in_system_directory flag; bias shndx by 1; print symbol names
4771         when dumping per-file symbol lists; use new symbol info readers.
4772         * incremental.cc
4773         (Output_section_incremental_inputs:update_data_size): New function.
4774         (Sized_incremental_binary::setup_readers): Setup input readers
4775         for each input file; build maps for files added from libraries
4776         and scripts.
4777         (Sized_incremental_binary::check_input_args): New function.
4778         (Sized_incremental_binary::do_check_inputs): Build map of argument
4779         serial numbers to input arguments.
4780         (Sized_incremental_binary::do_file_has_changed): Rename
4781         do_file_is_unchanged to this; compare file modification times.
4782         (Sized_incremental_binary::do_init_layout): New function.
4783         (Sized_incremental_binary::do_reserve_layout): New function.
4784         (Sized_incremental_binary::do_get_input_reader): Remove.
4785         (Sized_incremental_binary::get_symtab_view): New function.
4786         (Incremental_checker::can_incrementally_link_output_file): Remove.
4787         (Incremental_inputs::report_command_line): Exclude --debug options.
4788         (Incremental_inputs::report_archive_begin): Add parameter; track
4789         argument serial numbers; don't put input file entry for archive
4790         before archive members.
4791         (Incremental_inputs::report_archive_end): Put input file entry
4792         for archive after archive members.
4793         (Incremental_inputs::report_object): Add parameter; track argument
4794         serial numbers and in_system_directory flag.
4795         (Incremental_inputs::report_script): Add parameter; track argument
4796         serial numbers.
4797         (Output_section_incremental_inputs::set_final_data_size): Adjust
4798         size of symbol info entry; check for forwarding symbols.
4799         (Output_section_incremental_inputs::write_input_files): Write
4800         in_system_directory flag and argument serial number.
4801         (Output_section_incremental_inputs::write_info_blocks): Map section
4802         indices between incremental info and original input file; store
4803         input section index for each symbol.
4804         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4805         change operator() to visit().
4806         (class Global_got_offset_visitor): Likewise.
4807         (class Global_symbol_visitor_got_plt):
4808         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4809         classes.
4810         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4811         (Sized_incr_relobj::do_read_symbols): New function.
4812         (Sized_incr_relobj::do_layout): New function.
4813         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4814         (Sized_incr_relobj::do_add_symbols): New function.
4815         (Sized_incr_relobj::do_should_include_member): New function.
4816         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4817         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4818         (Sized_incr_relobj::do_section_size): New function.
4819         (Sized_incr_relobj::do_section_name): New function.
4820         (Sized_incr_relobj::do_section_contents): New function.
4821         (Sized_incr_relobj::do_section_flags): New function.
4822         (Sized_incr_relobj::do_section_entsize): New function.
4823         (Sized_incr_relobj::do_section_address): New function.
4824         (Sized_incr_relobj::do_section_type): New function.
4825         (Sized_incr_relobj::do_section_link): New function.
4826         (Sized_incr_relobj::do_section_info): New function.
4827         (Sized_incr_relobj::do_section_addralign): New function.
4828         (Sized_incr_relobj::do_initialize_xindex): New function.
4829         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4830         (Sized_incr_relobj::do_read_relocs): New function.
4831         (Sized_incr_relobj::do_gc_process_relocs): New function.
4832         (Sized_incr_relobj::do_scan_relocs): New function.
4833         (Sized_incr_relobj::do_count_local_symbols): New function.
4834         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4835         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4836         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4837         (Sized_incr_relobj::do_relocate): New function.
4838         (Sized_incr_relobj::do_set_section_offset): New function.
4839         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4840         (Sized_incr_dynobj::do_read_symbols): New function.
4841         (Sized_incr_dynobj::do_layout): New function.
4842         (Sized_incr_dynobj::do_add_symbols): New function.
4843         (Sized_incr_dynobj::do_should_include_member): New function.
4844         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4845         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4846         (Sized_incr_dynobj::do_section_size): New function.
4847         (Sized_incr_dynobj::do_section_name): New function.
4848         (Sized_incr_dynobj::do_section_contents): New function.
4849         (Sized_incr_dynobj::do_section_flags): New function.
4850         (Sized_incr_dynobj::do_section_entsize): New function.
4851         (Sized_incr_dynobj::do_section_address): New function.
4852         (Sized_incr_dynobj::do_section_type): New function.
4853         (Sized_incr_dynobj::do_section_link): New function.
4854         (Sized_incr_dynobj::do_section_info): New function.
4855         (Sized_incr_dynobj::do_section_addralign): New function.
4856         (Sized_incr_dynobj::do_initialize_xindex): New function.
4857         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4858         (make_sized_incremental_object): New function.
4859         (Incremental_library::copy_unused_symbols): New function.
4860         (Incremental_library::do_for_all_unused_symbols): New function.
4861         * incremental.h (enum Incremental_input_flags): New type.
4862         (class Incremental_checker): Remove.
4863         (Incremental_input_entry::Incremental_input_entry): Add argument
4864         serial number.
4865         (Incremental_input_entry::arg_serial): New function.
4866         (Incremental_input_entry::set_is_in_system_directory): New function.
4867         (Incremental_input_entry::is_in_system_directory): New function.
4868         (Incremental_input_entry::arg_serial_): New data member.
4869         (Incremental_input_entry::is_in_system_directory_): New data member.
4870         (class Script_info): Move here from script.h.
4871         (Script_info::Script_info): Add filename parameter.
4872         (Script_info::filename): New function.
4873         (Script_info::filename_): New data member.
4874         (Incremental_script_entry::Incremental_script_entry): Add argument
4875         serial number.
4876         (Incremental_object_entry::Incremental_object_entry): Likewise.
4877         (Incremental_object_entry::add_input_section): Build list of input
4878         sections with map to original shndx.
4879         (Incremental_object_entry::get_input_section_index): New function.
4880         (Incremental_object_entry::shndx_): New data member.
4881         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4882         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4883         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4884         serial number.
4885         (Incremental_inputs::report_archive_begin): Likewise.
4886         (Incremental_inputs::report_object): Likewise.
4887         (Incremental_inputs::report_script): Likewise.
4888         (class Incremental_global_symbol_reader): New class.
4889         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4890         and store flags and input file type.
4891         (Incremental_input_entry_reader::arg_serial): New function.
4892         (Incremental_input_entry_reader::type): Extract type from flags.
4893         (Incremental_input_entry_reader::is_in_system_directory): New function.
4894         (Incremental_input_entry_reader::get_input_section_count): Call
4895         accessor function for type.
4896         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4897         function for type; adjust size of global symbol entry.
4898         (Incremental_input_entry_reader::get_global_symbol_count): Call
4899         accessor function for type.
4900         (Incremental_input_entry_reader::get_object_count): Likewise.
4901         (Incremental_input_entry_reader::get_object_offset): Likewise.
4902         (Incremental_input_entry_reader::get_member_count): Likewise.
4903         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4904         (Incremental_input_entry_reader::get_member_offset): Likewise.
4905         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4906         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4907         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4908         (Incremental_input_entry_reader::get_global_symbol_reader): New
4909         function.
4910         (Incremental_input_entry_reader::get_output_symbol_index): New
4911         function.
4912         (Incremental_input_entry_reader::type_): Remove.
4913         (Incremental_input_entry_reader::flags_): New data member.
4914         (Incremental_inputs_reader::input_file_offset): New function.
4915         (Incremental_inputs_reader::input_file_index): New function.
4916         (Incremental_inputs_reader::input_file): Call input_file_offset.
4917         (Incremental_inputs_reader::input_file_at_offset): New function.
4918         (Incremental_relocs_reader::get_r_type): Reformat.
4919         (Incremental_relocs_reader::get_r_shndx): Reformat.
4920         (Incremental_relocs_reader::get_r_offset): Reformat.
4921         (Incremental_relocs_reader::data): New function.
4922         (Incremental_binary::Incremental_binary): Initialize new data members.
4923         (Incremental_binary::check_inputs): Add cmdline parameter.
4924         (Incremental_binary::file_is_unchanged): Remove.
4925         (Input_reader::arg_serial): New function.
4926         (Input_reader::get_unused_symbol_count): New function.
4927         (Input_reader::get_unused_symbol): New function.
4928         (Input_reader::do_arg_serial): New function.
4929         (Input_reader::do_get_unused_symbol_count): New function.
4930         (Input_reader::do_get_unused_symbol): New function.
4931         (Incremental_binary::input_file_count): New function.
4932         (Incremental_binary::get_input_reader): Change signature to use
4933         index instead of filename.
4934         (Incremental_binary::file_has_changed): New function.
4935         (Incremental_binary::get_input_argument): New function.
4936         (Incremental_binary::get_library): New function.
4937         (Incremental_binary::get_script_info): New function.
4938         (Incremental_binary::init_layout): New function.
4939         (Incremental_binary::reserve_layout): New function.
4940         (Incremental_binary::output_file): New function.
4941         (Incremental_binary::do_check_inputs): New function.
4942         (Incremental_binary::do_file_is_unchanged): Remove.
4943         (Incremental_binary::do_file_has_changed): New function.
4944         (Incremental_binary::do_init_layout): New function.
4945         (Incremental_binary::do_reserve_layout): New function.
4946         (Incremental_binary::do_input_file_count): New function.
4947         (Incremental_binary::do_get_input_reader): Change signature.
4948         (Incremental_binary::input_args_map_): New data member.
4949         (Incremental_binary::library_map_): New data member.
4950         (Incremental_binary::script_map_): New data member.
4951         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4952         new data members.
4953         (Sized_incremental_binary::output_section): New function.
4954         (Sized_incremental_binary::inputs_reader): Add const.
4955         (Sized_incremental_binary::symtab_reader): Add const.
4956         (Sized_incremental_binary::relocs_reader): Add const.
4957         (Sized_incremental_binary::got_plt_reader): Add const.
4958         (Sized_incremental_binary::get_symtab_view): New function.
4959         (Sized_incremental_binary::Inputs_reader): New typedef.
4960         (Sized_incremental_binary::Input_entry_reader): New typedef.
4961         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4962         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4963         (Sized_incremental_binary::do_file_has_changed): New function.
4964         (Sized_incremental_binary::do_init_layout): New function.
4965         (Sized_incremental_binary::do_reserve_layout): New function.
4966         (Sized_input_reader::Inputs_reader): Remove.
4967         (Sized_input_reader::Input_entry_reader): Remove.
4968         (Sized_input_reader::do_arg_serial): New function.
4969         (Sized_input_reader::do_get_unused_symbol_count): New function.
4970         (Sized_input_reader::do_get_unused_symbol): New function.
4971         (Sized_incremental_binary::do_input_file_count): New function.
4972         (Sized_incremental_binary::do_get_input_reader): Change signature;
4973         use index instead of filename.
4974         (Sized_incremental_binary::section_map_): New data member.
4975         (Sized_incremental_binary::input_entry_readers_): New data member.
4976         (class Sized_incr_relobj): New class.
4977         (class Sized_incr_dynobj): New class.
4978         (make_sized_incremental_object): New function.
4979         (class Incremental_library): New class.
4980         * layout.cc (Free_list::num_lists): New static data member.
4981         (Free_list::num_nodes): New static data member.
4982         (Free_list::num_removes): New static data member.
4983         (Free_list::num_remove_visits): New static data member.
4984         (Free_list::num_allocates): New static data member.
4985         (Free_list::num_allocate_visits): New static data member.
4986         (Free_list::init): New function.
4987         (Free_list::remove): New function.
4988         (Free_list::allocate): New function.
4989         (Free_list::dump): New function.
4990         (Free_list::print_stats): New function.
4991         (Layout_task_runner::run): Resize output file for incremental updates.
4992         (Layout::Layout): Initialize new data members.
4993         (Layout::set_incremental_base): New function.
4994         (Layout::init_fixed_output_section): New function.
4995         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4996         incremental updates.
4997         (Layout::create_gold_note): Do not create gold note section for
4998         incremental updates.
4999         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5000         for incremental updates.
5001         (Layout::set_section_offsets): For incremental updates, allocate space
5002         from free list.
5003         (Layout::create_symtab_sections): Layout with offsets relative to
5004         start of section; for incremental updates, allocate space from free
5005         list.
5006         (Layout::create_shdrs): For incremental updates, allocate space from
5007         free list.
5008         (Layout::finish_dynamic_section): For incremental updates, do not
5009         check --as-needed (fixed in subsequent patch).
5010         * layout.h (class Free_list): New class.
5011         (Layout::set_incremental_base): New function.
5012         (Layout::incremental_base): New function.
5013         (Layout::init_fixed_output_section): New function.
5014         (Layout::allocate): New function.
5015         (Layout::incremental_base_): New data member.
5016         (Layout::free_list_): New data member.
5017         * main.cc (main): Print Free_list statistics.
5018         * object.cc (Relobj::finalize_incremental_relocs): Add
5019         clear_counts parameter; clear counts only when clear_counts is set.
5020         (Sized_relobj::Sized_relobj): Initialize new base class.
5021         (Sized_relobj::do_layout): Don't report special sections.
5022         (Sized_relobj::do_for_all_local_got_entries): New function.
5023         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5024         symtab_off to all symbol table offsets.
5025         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5026         * object.h (class Got_offset_list): Move to top of file.
5027         (Object::Object): Allow case where input_file == NULL.
5028         (Object::~Object): Likewise.
5029         (Object::input_file): Assert that input_file != NULL.
5030         (Object::lock): Allow case where input_file == NULL.
5031         (Object::unlock): Likewise.
5032         (Object::is_locked): Likewise.
5033         (Object::token): Likewise.
5034         (Object::release): Likewise.
5035         (Object::is_incremental): New function.
5036         (Object::get_mtime): New function.
5037         (Object::for_all_local_got_entries): New function.
5038         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5039         (Object::set_is_in_system_directory): New function.
5040         (Object::is_in_system_directory): New function.
5041         (Object::do_is_incremental): New function.
5042         (Object::do_get_mtime): New function.
5043         (Object::do_for_all_local_got_entries): New function.
5044         (Object::is_in_system_directory_): New data member.
5045         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5046         (class Sized_relobj_base): New class.
5047         (class Sized_relobj): Derive from Sized_relobj_base.
5048         (class Sized_relobj::Symbols): Redeclare from base class.
5049         (class Sized_relobj::local_got_offset_list): Remove.
5050         (class Sized_relobj::Output_sections): Redeclare from base class.
5051         (class Sized_relobj::do_for_all_local_got_entries): New function.
5052         (class Sized_relobj::write_local_symbols): Add offset parameter.
5053         (class Sized_relobj::local_symbol_offset_): Update comment.
5054         (class Sized_relobj::local_dynsym_offset_): Update comment.
5055         * options.cc (Input_arguments::add_file): Remove const.
5056         * options.h (Input_file_argument::Input_file_argument):
5057         Initialize arg_serial_ (all constructors).
5058         (Input_file_argument::set_arg_serial): New function.
5059         (Input_file_argument::arg_serial): New function.
5060         (Input_file_argument::arg_serial_): New data member.
5061         (Input_arguments::Input_arguments): Initialize file_count_.
5062         (Input_arguments::add_file): Remove const.
5063         (Input_arguments::number_of_input_files): New function.
5064         (Input_arguments::file_count_): New data member.
5065         (Command_line::number_of_input_files): Call
5066         Input_arguments::number_of_input_files.
5067         * output.cc (Output_segment_headers::Output_segment_headers):
5068         Set current size.
5069         (Output_section::Input_section::current_data_size): New function.
5070         (Output_section::Output_section): Initialize new data members.
5071         (Output_section::add_input_section): Don't do merge sections for
5072         an incremental link; allocate space from free list for an
5073         incremental update.
5074         (Output_section::add_output_section_data): Allocate space from
5075         free list for an incremental update.
5076         (Output_section::update_data_size): New function.
5077         (Output_section::set_fixed_layout): New function.
5078         (Output_section::reserve): New function.
5079         (Output_segment::set_section_addresses): Remove const.
5080         (Output_segment::set_section_list_addresses): Remove const; allocate
5081         space from free list for an incremental update.
5082         (Output_segment::set_offset): Adjust size of RELRO segment for an
5083         incremental update.
5084         * output.h (Output_data::current_data_size): Move here from
5085         child classes.
5086         (Output_data::pre_finalize_data_size): New function.
5087         (Output_data::update_data_size): New function.
5088         (Output_section_headers::update_data_size): new function.
5089         (Output_section_data_build::current_data_size): Move to Output_data.
5090         (Output_data_strtab::update_data_size): New function.
5091         (Output_section::current_data_size): Move to Output_data.
5092         (Output_section::set_fixed_layout): New function.
5093         (Output_section::has_fixed_layout): New function.
5094         (Output_section::reserve): New function.
5095         (Output_section::update_data_size): New function.
5096         (Output_section::has_fixed_layout_): New data member.
5097         (Output_section::free_list_): New data member.
5098         (Output_segment::set_section_addresses): Remove const.
5099         (Output_segment::set_section_list_addresses): Remove const.
5100         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5101         New function.
5102         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5103         New function.
5104         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5105         parameter when calling Add_symbols constructor; store argument
5106         serial number for members of a lib group.
5107         (Add_symbols::locks): Allow case where token == NULL.
5108         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5109         (Read_member::~Read_member): New function.
5110         (Read_member::is_runnable): New function.
5111         (Read_member::locks): New function.
5112         (Read_member::run): New function.
5113         (Check_script::~Check_script): New function.
5114         (Check_script::is_runnable): New function.
5115         (Check_script::locks): New function.
5116         (Check_script::run): New function.
5117         (Check_library::~Check_library): New function.
5118         (Check_library::is_runnable): New function.
5119         (Check_library::locks): New function.
5120         (Check_library::run): New function.
5121         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5122         (Add_symbols::library_): New data member.
5123         (class Read_member): New class.
5124         (class Check_script): New class.
5125         (class Check_library): New class.
5126         * reloc.cc (Read_relocs::is_runnable): Allow case where
5127         token == NULL.
5128         (Read_relocs::locks): Likewise.
5129         (Scan_relocs::locks): Likewise.
5130         (Relocate_task::locks): Likewise.
5131         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5132         to clear counters.
5133         (Sized_relobj::incremental_relocs_scan): Fix comment.
5134         (Sized_relobj::do_relocate): Pass output file offset to
5135         write_local_symbols.
5136         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5137         from class declaration.
5138         * script.cc (read_input_script): Allocate Script_info; pass
5139         argument serial number to report_script.
5140         * script.h (class Script_info): Move to incremental.h.
5141         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5142         * symtab.h (Symbol_table::add_from_incrobj): New function.
5143         (Symbol_table::set_file_offset): New function.
5144
5145 2011-04-05  Cary Coutant  <ccoutant@google.com>
5146
5147         * incremental-dump.cc (dump_incremental_inputs): Change signature
5148         to take a Sized_incremental_binary; change caller.  Use readers
5149         in Sized_incremental_binary.
5150         * incremental.cc
5151         (Sized_incremental_binary::find_incremental_inputs_sections):
5152         Rename do_find_incremental_inputs_sections to this.
5153         (Sized_incremental_binary::setup_readers): New function.
5154         (Sized_incremental_binary::do_check_inputs): Check
5155         has_incremental_info_ flag; move setup code to setup_readers;
5156         use input readers.
5157         (Sized_incremental_binary::do_file_is_unchanged): New function.
5158         (Sized_incremental_binary::do_get_input_reader): New function.
5159         * incremental.h (class Incremental_binary): Move to end of file.
5160         (Incremental_binary::file_is_unchanged): New function.
5161         (Incremental_binary::do_file_is_unchanged): New function.
5162         (Incremental_binary::Input_reader): New class.
5163         (Incremental_binary::get_input_reader): New function.
5164         (class Sized_incremental_binary): Move to end of file.
5165         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5166         input section reader classes.
5167         (Sized_incremental_binary::has_incremental_info): New function.
5168         (Sized_incremental_binary::inputs_reader): New function.
5169         (Sized_incremental_binary::symtab_reader): New function.
5170         (Sized_incremental_binary::relocs_reader): New function.
5171         (Sized_incremental_binary::got_plt_reader): New function.
5172         (Sized_incremental_binary::do_file_is_unchanged): New function.
5173         (Sized_incremental_binary::Sized_input_reader): New class.
5174         (Sized_incremental_binary::get_input_reader): New function.
5175         (Sized_incremental_binary::find_incremental_inputs_sections):
5176         Rename do_find_incremental_inputs_sections to this.
5177         (Sized_incremental_binary::setup_readers): New function.
5178         (Sized_incremental_binary::has_incremental_info_): New data member.
5179         (Sized_incremental_binary::inputs_reader_): New data member.
5180         (Sized_incremental_binary::symtab_reader_): New data member.
5181         (Sized_incremental_binary::relocs_reader_): New data member.
5182         (Sized_incremental_binary::got_plt_reader_): New data member.
5183         (Sized_incremental_binary::current_input_file_): New data member.
5184
5185 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5186
5187         PR gold/12640
5188         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5189         violation.
5190
5191 2011-03-30  Cary Coutant  <ccoutant@google.com>
5192
5193         * archive.cc (Archive::include_member): Adjust call to report_object.
5194         (Add_archive_symbols::run): Add script_info to call to
5195         report_archive_begin.
5196         (Lib_group::include_member): Adjust call to report_object.
5197         (Add_lib_group_symbols::run): Adjust call to report_object.
5198         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5199         blocks.  Add object count for script input files.
5200         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5201         script_info parameter; change all callers.
5202         (Incremental_inputs::report_object): Add script_info parameter;
5203         change all callers.
5204         (Incremental_inputs::report_script): Store backpointer to
5205         incremental info entry.
5206         (Output_section_incremental_inputs::set_final_data_size): Record
5207         additional information for scripts.
5208         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5209         * incremental.h (Incremental_script_entry::add_object): New function.
5210         (Incremental_script_entry::get_object_count): New function.
5211         (Incremental_script_entry::get_object): New function.
5212         (Incremental_script_entry::objects_): New data member; adjust
5213         constructor.
5214         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5215         (Incremental_inputs::report_object): Add script_info parameter.
5216         (Incremental_inputs_reader::get_object_count): New function.
5217         (Incremental_inputs_reader::get_object_offset): New function.
5218         * options.cc (Input_arguments::add_file): Return reference to
5219         new input argument.
5220         * options.h (Input_argument::set_script_info): New function.
5221         (Input_argument::script_info): New function.
5222         (Input_argument::script_info_): New data member; adjust all
5223         constructors.
5224         (Input_file_group::add_file): Return reference to new input argument.
5225         (Input_file_lib::add_file): Likewise.
5226         (Input_arguments::add_file): Likewise.
5227         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5228         * script.cc (Parser_closure::Parser_closure): Add script_info
5229         parameter; adjust all callers.
5230         (Parser_closure::script_info): New function.
5231         (Parser_closure::script_info_): New data member.
5232         (read_input_script): Report scripts earlier to incremental info.
5233         (script_add_file): Set script_info in Input_argument.
5234         (script_add_library): Likewise.
5235         * script.h (Script_options::Script_info): Rewrite class.
5236
5237 2011-03-29  Cary Coutant  <ccoutant@google.com>
5238
5239         * archive.cc (Library_base::should_include_member): Move
5240         method here from class Archive.
5241         (Archive::Archive): Initialize base class.
5242         (Archive::should_include_member): Move to base class.
5243         (Archive::do_for_all_unused_symbols): New function.
5244         (Add_archive_symbols::run): Remove redundant access to
5245         incremental_inputs.
5246         (Lib_group::Lib_group): Initialize base class.
5247         (Lib_group::do_filename): New function.
5248         (Lib_group::include_member): Pass pointer to Lib_group to
5249         report_object.
5250         (Lib_group::do_for_all_unused_symbols): New function.
5251         (Add_lib_group_symbols::run): Report archive information for
5252         incremental links.
5253         * archive.h (class Library_base): New base class.
5254         (class Archive): Derive from Library_base.
5255         (Archive::filename): Move to base class.
5256         (Archive::set_incremental_info): Likewise.
5257         (Archive::incremental_info): Likewise.
5258         (Archive::Should_include): Likewise.
5259         (Archive::should_include_member): Likewise.
5260         (Archive::Armap_entry): Remove.
5261         (Archive::Unused_symbol_iterator): Remove.
5262         (Archive::unused_symbols_begin): Remove.
5263         (Archive::unused_symbols_end): Remove.
5264         (Archive::do_filename): New function.
5265         (Archive::do_get_mtime): New function.
5266         (Archive::do_for_all_unused_symbols): New function.
5267         (Archive::task_): Move to base class.
5268         (Archive::incremental_info_): Likewise.
5269         (class Lib_group): Derive from Library_base.
5270         (Lib_group::do_filename): New function.
5271         (Lib_group::do_get_mtime): New function.
5272         (Lib_group::do_for_all_unused_symbols): New function.
5273         (Lib_group::task_): Move to base class.
5274         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5275         function.
5276         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5277         function.
5278         * incremental.cc (Incremental_inputs::report_archive_begin):
5279         Use Library_base; call library's get_mtime; add incremental inputs
5280         entry before members.
5281         (class Unused_symbol_visitor): New class.
5282         (Incremental_inputs::report_archive_end): Use Library_base; use
5283         visitor class to record unused symbols; don't add incremental inputs
5284         entry after members.
5285         (Incremental_inputs::report_object): Use Library_base.
5286         * incremental.h
5287         (Incremental_archive_entry::Incremental_archive_entry): Remove
5288         unused Archive parameter.
5289         (Incremental_inputs::report_archive_begin): Use Library_base.
5290         (Incremental_inputs::report_archive_end): Likewise.
5291         (Incremental_inputs::report_object): Likewise.
5292         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5293         function.
5294         * object.h (Object::for_all_global_symbols): New function.
5295         (Object::do_for_all_global_symbols): New function.
5296         (Sized_relobj::do_for_all_global_symbols): New function.
5297         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5298         function.
5299         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5300         function.
5301
5302 2011-03-27  Ian Lance Taylor  <iant@google.com>
5303
5304         * archive.cc (Archive::interpret_header): Return -1 if something
5305         goes wrong.  Change callers accordingly.
5306
5307 2011-03-25  Cary Coutant  <ccoutant@google.com>
5308
5309         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5310         * testsuite/Makefile.in: Regenerate.
5311
5312 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5313
5314         * plugin.cc (get_view): New.
5315         (Plugin::load): Pass get_view to the plugin.
5316         (Plugin_manager::get_view): New.
5317
5318 2011-03-21  Ian Lance Taylor  <iant@google.com>
5319
5320         * testsuite/final_layout.sh: Rewrite to not use dc.
5321         * testsuite/relro_test.sh: Fail if dc is not present.
5322
5323 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5324
5325         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5326         Change == to -eq.
5327         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5328         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5329         Change == to -eq.
5330         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5331         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5332
5333 2011-03-14  Ian Lance Taylor  <iant@google.com>
5334
5335         * script-sections.cc (Sort_output_sections::script_compare):
5336         Rename from is_before, change return type.
5337         (Sort_output_sections::operator()): Adjust accordingly.
5338
5339 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5340
5341         PR gold/12572
5342         * testsuite/odr_violation2.cc: Add comment to make all error line
5343         numbers double digits.
5344         * testsuite/debug_msg.sh: Adjust expected errors.
5345
5346 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5347
5348         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5349         but mark earlier ones as non-canonical
5350         (offset_to_iterator): Update search target and example
5351         (do_addr2line): Return extra lines in a vector*
5352         (format_file_lineno): Extract from do_addr2line
5353         (one_addr2line): Add vector* out-param
5354         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5355         when a lineno entry appeared last for its instruction
5356         (Dwarf_line_info): Add vector* out-param
5357         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5358         * symtab.cc (Odr_violation_compare): Include the lineno in the
5359         comparison again.
5360         (linenos_from_loc): New. Combine the canonical line for an
5361         address with its other lines.
5362         (True_if_intersect): New. Helper functor to make
5363         std::set_intersection a query.
5364         (detect_odr_violations): Compare sets of lines instead of just
5365         one line for each function. This became less deterministic, but
5366         has fewer false positives.
5367         * symtab.h: Declarations.
5368         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5369         mix an optimized and non-optimized object in the same binary
5370         (odr_violation2.so): Same.
5371         * testsuite/Makefile.in: Regenerate from Makefile.am.
5372         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5373         * testsuite/debug_msg.sh: Update line numbers and add
5374         assertions.
5375         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5376         non-optimized context.
5377         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5378         isn't inlined, and use OdrDerived in an optimized context.
5379         * testsuite/odr_header1.h: Defines OdrDerived, where
5380         optimization will change the
5381         first-instruction-in-the-destructor's file and line number.
5382         * testsuite/odr_header2.h: Defines OdrBase.
5383
5384 2011-03-09  Ian Lance Taylor  <iant@google.com>
5385
5386         * fileread.cc (File_read::clear_views): Don't delete the whole
5387         file view.
5388
5389 2011-03-08  Ian Lance Taylor  <iant@google.com>
5390
5391         PR gold/12525
5392         * fileread.cc: #include <climits>.
5393         (GOLD_IOV_MAX): Define.
5394         (File_read::read_multiple): Limit number of entries by iov_max.
5395         * fileread.h (class File_read): Always set max_readv_entries to
5396         128.
5397
5398 2011-03-07  Ian Lance Taylor  <iant@google.com>
5399
5400         PR gold/12525
5401         * options.h (class General_options): Add -dy and -dn.
5402
5403 2011-03-02  Cary Coutant  <ccoutant@google.com>
5404
5405         * testsuite/script_test_9.t: Add TLS segment.
5406
5407 2011-03-02  Simon Baldwin  <simonb@google.com>
5408
5409         * configure.ac: Add check for gnu_indirect_function support in
5410         the toolchain building binutils.
5411         * configure: Rebuild.
5412
5413 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5414
5415         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5416         plugin only symbols.
5417         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5418         in plugin files as not needed in the symbol table.
5419
5420 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5421
5422         * output.cc (Output_section::add_input_section): Delay fill
5423         generation for section ordering.
5424
5425 2011-02-09  Ian Lance Taylor  <iant@google.com>
5426
5427         PR gold/12316
5428         * object.h (class Sized_relobj): Remove clear_local_symbols.
5429         * reloc.cc (Sized_relobj::do_relocate): Don't call
5430         clear_local_symbols.
5431
5432 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5433
5434         * plugin.cc (is_visible_from_outside): Return true for symbols
5435         in the -u option.
5436
5437 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5438
5439         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5440         filename.
5441
5442 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5443
5444         * icf.h (is_section_foldable_candidate): Change type of parameter
5445         to std::string.
5446         * icf.cc (Icf::find_identical_sections): Change type of local variable
5447         section_name to be std::string.
5448         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5449
5450 2011-01-25  Ian Lance Taylor  <iant@google.com>
5451
5452         * script.cc (script_add_extern): Rewrite to use
5453         add_symbol_reference.
5454
5455 2011-01-25  Doug Kwan  <dougkwan@google.com>
5456
5457         * icf.cc (get_section_contents): Always lock section's object.
5458
5459 2011-01-24  Ian Lance Taylor  <iant@google.com>
5460
5461         * options.h (class General_options): Accept
5462         --no-detect-odr-violations.
5463
5464 2011-01-24  Ian Lance Taylor  <iant@google.com>
5465
5466         * version.cc (version_string): Bump to 1.11.
5467
5468 2011-01-24  Ian Lance Taylor  <iant@google.com>
5469
5470         * plugin.cc (class Plugin_rescan): Define new class.
5471         (Plugin_manager::claim_file): Set any_claimed_.
5472         (Plugin_manager::save_archive): New function.
5473         (Plugin_manager::save_input_group): New function.
5474         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5475         necessary.
5476         (Plugin_manager::new_undefined_symbol): New function.
5477         (Plugin_manager::rescan): New function.
5478         (Plugin_manager::rescannable_defines): New function.
5479         (Plugin_manager::add_input_file): Set any_added_.
5480         * plugin.h (class Plugin_manager): define new fields rescannable_,
5481         undefined_symbols_, any_claimed_, and any_added_.  Declare
5482         Plugin_rescan as friend.  Declare new functions.
5483         (Plugin_manager::Rescannable): Define type.
5484         (Plugin_manager::Rescannable_list): Define type.
5485         (Plugin_manager::Undefined_symbol_list): Define type.
5486         (Plugin_manager::Plugin_manager): Initialize new fields.
5487         * archive.cc (Archive::defines_symbol): New function.
5488         (Add_archive_symbols::run): Pass archive to plugins if any.
5489         * archive.h (class Archive): Declare defines_symbol.
5490         * readsyms.cc (Input_group::~Input_group): New function.
5491         (Finish_group::run): Pass input_group to plugins if any.
5492         * readsyms.h (class Input_group): Declare destructor.
5493         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5494         any.
5495
5496 2011-01-10  Ian Lance Taylor  <iant@google.com>
5497
5498         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5499         section as relro.
5500         (Layout::set_segment_offsets): Reset increase_relro before calling
5501         set_section_addresses a second time.
5502
5503 2011-01-04  Cary Coutant  <ccoutant@google.com>
5504
5505         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5506         sections before NOBITS sections.
5507
5508 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5509
5510         * version.cc (print_version): Update copyright to 2011.
5511
5512 2010-12-23  Cary Coutant  <ccoutant@google.com>
5513
5514         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5515         of OS to this->add.  Add OD parameter to second form of the function.
5516
5517 2010-12-20  Ian Lance Taylor  <iant@google.com>
5518
5519         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5520         second of two consecutive entries with same offset.
5521
5522 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5523
5524         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5525         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5526         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5527         to avoid unneeded links against $(LDADD).
5528         * testsuite/Makefile.in: Regenerate.
5529
5530 2010-12-15  Ian Lance Taylor  <iant@google.com>
5531
5532         PR gold/12324
5533         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5534         for R_X86_64_32 and R_X86_64_PC32.
5535         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5536         ver_matching_def_pic.o.
5537         (ver_matching_def_pic.o): New target.
5538
5539 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5540
5541         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5542         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5543         Move definition before File_read::View member definitions.
5544         (File_read::View::~View): Initialize and hold lock before
5545         updating current_mapped_bytes.
5546
5547 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5548
5549         * dwarf_reader.cc: Remove outdated comment.
5550         * gold-threads.cc: Fix typo in error message.
5551         * archive.cc: Fix typos in comments.
5552         * archive.h: Likewise.
5553         * arm-reloc-property.cc: Likewise.
5554         * arm-reloc-property.h: Likewise.
5555         * arm-reloc.def: Likewise.
5556         * arm.cc: Likewise.
5557         * attributes.h: Likewise.
5558         * cref.cc: Likewise.
5559         * ehframe.cc: Likewise.
5560         * fileread.h: Likewise.
5561         * gold.h: Likewise.
5562         * i386.cc: Likewise.
5563         * icf.cc: Likewise.
5564         * incremental.h: Likewise.
5565         * int_encoding.cc: Likewise.
5566         * layout.h: Likewise.
5567         * main.cc: Likewise.
5568         * merge.h: Likewise.
5569         * object.cc: Likewise.
5570         * object.h: Likewise.
5571         * options.cc: Likewise.
5572         * readsyms.cc: Likewise.
5573         * reduced_debug_output.cc: Likewise.
5574         * reloc.cc: Likewise.
5575         * script-sections.cc: Likewise.
5576         * sparc.cc: Likewise.
5577         * symtab.h: Likewise.
5578         * target-reloc.h: Likewise.
5579         * target.cc: Likewise.
5580         * target.h: Likewise.
5581         * timer.cc: Likewise.
5582         * timer.h: Likewise.
5583         * x86_64.cc: Likewise.
5584
5585 2010-12-09  Cary Coutant  <ccoutant@google.com>
5586
5587         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5588         stack.
5589         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5590         parameter; change all callers.
5591         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5592         * options.h (warn_execstack): New option.
5593
5594 2010-12-07  Doug Kwan  <dougkwan@google.com>
5595
5596         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5597         like function call relocations.
5598
5599 2010-12-07  Ian Lance Taylor  <iant@google.com>
5600
5601         * archive.cc (Archive::get_elf_object_for_member): Permit
5602         punconfigured to be NULL.
5603         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5604         (Archive::include_member): Pass NULL to get_elf_object_for_member
5605         if we searched for the archive and this is the first included
5606         object.
5607
5608 2010-12-01  Ian Lance Taylor  <iant@google.com>
5609
5610         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5611         track_relocs_type_ field.
5612         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5613         Set track_relocs_type_.
5614         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5615         contents when using RELA relocs.
5616         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5617         reloc_map_.
5618         * reloc.cc (Track_relocs::next_addend): New function.
5619         * reloc.h (class Track_relocs): Declare next_addend.
5620
5621 2010-12-01  Ian Lance Taylor  <iant@google.com>
5622
5623         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5624         virtual destructor.
5625
5626 2010-12-01  Ian Lance Taylor  <iant@google.com>
5627
5628         * README: Update compilers known to work and fail.
5629
5630 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5631
5632         * configure.in: For --enable-gold, handle value `default' instead of
5633         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5634         not the default.
5635         * configure: Regenerate.
5636
5637 2010-11-18  Doug Kwan  <dougkwan@google.com>
5638
5639         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5640         and right_alignment to be zero.  Store result alignment only if it is
5641         greater than existing alignment.
5642
5643 2010-11-16  Cary Coutant  <ccoutant@google.com>
5644
5645         PR gold/12220
5646         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5647         Check for ".zdebug_line".
5648
5649 2010-11-16  Doug Kwan  <dougkwan@google.com>
5650             Cary Coutant  <ccoutant@google.com>
5651
5652         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5653         by reference; adjust all callers.
5654         * output.cc (Output_segment::set_section_addresses): Adjust references
5655         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5656         list is empty.
5657         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5658         end at page boundary.
5659
5660 2010-11-16  Cary Coutant  <ccoutant@google.com>
5661
5662         PR gold/12220
5663         * layout.cc (Layout::choose_output_section): Transform names of
5664         compressed sections even when using a script with a SECTIONS clause.
5665         (Layout::output_section_name): Remove code to transform
5666         compressed debug section names.
5667         * output.cc (Output_section::add_input_section): Use uncompressed
5668         section size when tracking input sections.
5669
5670 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5671
5672         * symtab.h (Symbol::NON_PIC_REF): Remove.
5673         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5674         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5675         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5676         (Symbol::use_plt_offset): Take a flags argument and pass it
5677         directly to needs_dynamic_reloc.  Restrict check for undefined
5678         weak symbols to function calls.
5679         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5680         (Target_arm::Scan::global): Use it.
5681         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5682         (Target_arm::Relocate::relocate): Likewise.
5683         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5684         parameter with an r_type parameter.  Use get_reference_flags
5685         to get the flags.
5686         (Target_arm::Relocate::relocate): Update accordingly.
5687         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5688         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5689         (Target_i386::Scan::global): Likewise.
5690         (Target_i386::Relocate::relocate): Likewise.
5691         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5692         parameter with an r_type parameter.  Use get_reference_flags
5693         to get the flags.
5694         (Target_i386::Relocate::relocate): Update accordingly.
5695         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5696         (Target_powerpc::Scan::global): Use it.
5697         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5698         (Target_powerpc::Relocate::relocate): Likewise.
5699         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5700         (Target_sparc::Scan::global): Use it.
5701         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5702         (Target_sparc::Relocate::relocate): Likewise.
5703         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5704         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5705         (Target_x86_64::Scan::global): Likewise.
5706         (Target_x86_64::Relocate::relocate): Likewise.
5707
5708 2010-11-08  Doug Kwan  <dougkwan@google.com>
5709             Cary Coutant  <ccoutant@google.com>
5710
5711         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5712         (Arm_exidx_merge_section::section_contents_): New data member.
5713         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5714         (Arm_input_section::~Arm_input_section): De-allocate memory.
5715         (Arm_input_section::original_contents_): New data member.
5716         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5717         in parameters instead of calling Object::section_contents without
5718         locking.
5719         (Arm_output_section::group_section): New parameter TASK.  Pass it
5720         to callees that need locking objects.
5721         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5722         to lock EXIDX input sections.  Fix a formatting issue.  Call
5723         Arm_exidx_merged_section::build_contents to create merged section
5724         contents.
5725         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5726         to lock object of stub table owner.
5727         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5728         TEXT_SIZE to initialize data member TEXT_SIZE_.
5729         (Arm_exidx_input_section::addralign): Fix typo in comment.
5730         (Arm_exidx_input_section::text_size): New method.
5731         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5732         that require locking objects.  Lock objects before scanning for stubs
5733         and updating local symbols.
5734         (Arm_input_section<big_endian>::init): Copy contents of original
5735         input section.
5736         (Arm_input_section<big_endian>::do_write): Use saved contents of
5737         original input section instead of calling Object::section_contents
5738         without locking.
5739         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5740         size without calling Object::section_size().
5741         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5742         for size.  Allocate a buffer for merged EXIDX entries.
5743         (Arm_exidx_merged_section::build_contents): New method.
5744         (Arm_exidx_merged_section::do_write): Move merge section contents
5745         building code to Arm_exidx_merged_section::build_contetns.  Write
5746         out contetns in buffer instead of building it on the fly.
5747         (Arm_relobj::make_exidx_input_section): Also pass text section size
5748         to Arm_exidx_input_section constructor.
5749         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5750         (Arm_dynobj::do_read_symbols): Fix memory leak.
5751         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5752         * target.h: (class Task): Add forward declaration.
5753         (Target::relax): Add new parameter TASK and pass it to
5754         Target::do_relax().
5755         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5756
5757 2010-11-05  Cary Coutant  <ccoutant@google.com>
5758
5759         PR gold/10708
5760         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5761         object when reading from the file.
5762         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5763         second layout pass.
5764         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5765         when reading section contents.
5766         (get_section_contents): Likewise.
5767         (icf::find_identical_sections): Likewise.
5768         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5769         object when reading from the file.
5770         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5771         the object when doing deferred section layout.
5772
5773 2010-11-03  Nick Clifton  <nickc@redhat.com>
5774
5775         PR gold/12001
5776         * script.h (class Symbol_assignment: name): New member.  Returns
5777         the name of the symbol.
5778         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5779         Returns true if the given symbol name is on the list of
5780         assignments wating to be processed.
5781         * archive.cc (should_incldue_member): If the symbol is undefined,
5782         check to see if it is on the list of symbols pending assignment.
5783
5784 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5785
5786         * script-sections.cc (Script_sections::find_memory_region): Check
5787         for a NULL output section pointer.
5788
5789 2010-10-29  Doug Kwan  <dougkwan@google.com>
5790
5791         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5792         Output_section::add_relaxed_input_section.
5793         * output.cc (Output_section::add_relaxed_input_section): Add new
5794         arguments LAYOUT and NAME.  Set section order index.
5795         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5796         Copy section order index.
5797         * output.h (Output_section::add_relaxed_input_section): Add new
5798         arguments LAYOUT and NAME.
5799
5800 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5801
5802         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5803         NATIVE_OR_CROSS_LINKER.
5804         * testsuite/Makefile.in: Regenerate.
5805
5806 2010-10-20  Doug Kwan  <dougkwan@google.com>
5807
5808         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5809         without SHF_LINK_ORDER flags.
5810         * layout.cc (Layout::choose_output_section): Do not filter
5811         SHF_LINK_ORDER flag in a relocatable link.
5812
5813 2010-10-17  Cary Coutant  <ccoutant@google.com>
5814
5815         * output.h (Output_segment::set_section_addresses): Change function
5816         signature.  Update all callers.
5817         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5818         sections.
5819         (Output_segment::set_section_addresses): Align after last TLS
5820         section.  Add padding before last relro section instead of after.
5821
5822 2010-10-17  Doug Kwan  <dougkwan@google.com>
5823
5824         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5825         GOT output section to be writable.
5826
5827 2010-10-14  Cary Coutant  <ccoutant@google.com>
5828
5829         * debug.h (DEBUG_INCREMENTAL): New flag.
5830         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5831         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5832         mode.
5833         * incremental.cc (report_command_line): Ignore all forms of
5834         --incremental.
5835         * layout.cc (Layout::Layout): Check parameters for incremental link
5836         mode.
5837         * options.cc (General_options::parse_incremental): New function.
5838         (General_options::parse_no_incremental): New function.
5839         (General_options::parse_incremental_full): New function.
5840         (General_options::parse_incremental_update): New function.
5841         (General_options::incremental_mode_): New data member.
5842         (General_options::finalize): Check incremental_mode_.
5843         * options.h (General_options): Update help text for --incremental.
5844         Add --no-incremental, --incremental-full, --incremental-update.
5845         (General_options::Incremental_mode): New enum type.
5846         (General_options::incremental_mode): New function.
5847         (General_options::incremental_mode_): New data member.
5848         * parameters.cc (Parameters::incremental_mode_): New data member.
5849         (Parameters::set_options): Set incremental_mode_.
5850         (Parameters::set_incremental_full): New function.
5851         (Parameters::incremental): New function.
5852         (Parameters::incremental_update): New function.
5853         (set_parameters_incremental_full): New function.
5854         * parameters.h (Parameters::set_incremental_full): New function.
5855         (Parameters::incremental): New function.
5856         (Parameters::incremental_update): New function.
5857         (Parameters::incremental_mode_): New data member.
5858         (set_parameters_incremental_full): New function.
5859         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5860         incremental link mode.
5861         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5862         (Sized_relobj::do_relocate_sections): Likewise.
5863         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5864         option.
5865         * testsuite/Makefile.in: Regenerate.
5866         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5867
5868 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5869
5870         * script-sections.h (class Script_sections): Make
5871         Sections_elements typedef public.
5872         * script-sections.cc (class Sort_output_sections): Add elements_
5873         field.  Add constructor which sets it; change all callers.
5874         (Sort_output_sections::is_before): New function.
5875         (Sort_output_sections::operator()): Call is_before.
5876         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5877         conditional.
5878         * testsuite/script_test_10.sh: New test. Test script section
5879         order.
5880         * testsuite/script_test_10.t: Likewise.
5881         * testsuite/script_test_10.s: Likewise.
5882         * testsuite/Makefile.am: Wrap the cross linker tests and the
5883         common tests into NATIVE_OR_CROSS_LINKER.
5884         (check_SCRIPTS): Add script_test_10.sh.
5885         (check_DATA): Add script_test_10.stdout.
5886         (script_test_10.o, script_test_10): New targets.
5887         (script_test_10.stdout): New target.
5888         * configure, testsuite/Makefile.in: Regenerate.
5889
5890 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5891
5892         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5893         error for the deprecated relocations.
5894         (Target_arm::Scan::global): Likewise.
5895         (Target_arm::Relocate::relocate): Likewise.
5896
5897 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5898
5899         * fileread.cc (Input_file::find_file): Initialize *found_name
5900         and *namep when using the fallback search for case 4.
5901
5902 2010-10-11  Cary Coutant  <ccoutant@google.com>
5903
5904         * options.h (class General_options): Redefine -z lazy as an alias for
5905         the negation of -z now.
5906
5907 2010-10-11  Ian Lance Taylor  <iant@google.com>
5908
5909         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5910         binding.
5911
5912 2010-10-06  Nick Clifton  <nickc@redhat.com>
5913
5914         * script-sections.cc(class Memory_region): Remove
5915         current_lma_offset_ field.  Rename current_vma_offset_ to
5916         current_offset_.  Add last_section_ field.
5917         (Memory_region::get_current_vma_address): Rename to
5918         get_current_address.
5919         (Memory_region::get_current_lma_address): Delete.
5920         (Memory_region::increment_vma_offset): Rename to
5921         increment_offset.
5922         (Memory_region::increment_lma_offset): Delete.
5923         (Memory_region::attributes_compatible): New method.  Returns
5924         true if the provided section is compatible with the region.
5925         (Memory_region::get_last_section): New method.  Returns the last
5926         section to use the region.
5927         (Memory_region::set_last_section): New method.  Stores the last
5928         section to use the region.
5929         (Script_sections::block_in_region): New method.  Returns true if
5930         a block of memory is contained within a region.
5931         (Script_sections::find_memory_region): New method.  Locates a
5932         memory region to be used to set a VMA or LMA address.
5933         (Output_section_definition::set_section_addresses): Add code to
5934         check for addresses set by memory regions.
5935         (Output_segment::set_section_addresses): Remove memory region
5936         walking code.
5937         (Script_sections::create_segment): Add a warning if a header
5938         segment is created outside of any region.
5939         * script-sections.h (class Script_sections): Add prototypes for
5940         find_memory_region and block_in_region methods.
5941         * testsuite/memory_test.s: Use .long instead of .word.
5942         * testsuite/memory_test.t: Add some more output sections.
5943         * testsuite/memory_test.sh: Update expected output.
5944
5945 2010-10-02  Doug Kwan  <dougkwan@google.com>
5946
5947         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5948         defintion to symtab.h
5949         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5950         declaration to defintion.
5951
5952 2010-10-01  Nick Clifton  <nickc@redhat.com>
5953
5954         * expression.cc (eval): Replace dummy argument with NULL.
5955         (eval_maybe_dot): Check for a NULL result section pointer.
5956         (Symbol_expression::value): Likewise.
5957         (Dot_expression::value): Likewise.
5958         (BINARY_EXPRESSION): Likewise.
5959         (Max_expression::value): Likewise.
5960         (Min_expression::value): Likewise.
5961         (Absolute_expression::value): Likewise.
5962         (Addr_expression::value_from_output_section): Likewise.
5963         (Loaddddr_expression::value_from_output_section): Likewise.
5964         (Segment_start_expression::value): Likewise.
5965         * script-sections.cc
5966         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5967         argument with NULL.
5968         (Sections_elememt_dot_assignment::set_section_addresses):
5969         Likewise.
5970         (Output_data_expression::do_write_to_buffer): Likewise.
5971         (Output_section_definition::finalize_symbols): Likewise.
5972         (Output_section_definition::set_section_addresses): Likewise.
5973
5974 2010-09-30  Doug Kwan  <dougkwan@google.com>
5975
5976         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5977
5978 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5979
5980         * target.h (Target::can_icf_inline_merge_sections): New virtual
5981         function.
5982         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5983         virtual function.
5984         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5985         virtual function.
5986         * icf.cc (get_section_contents): Inline merge sections only when
5987         target allows it.
5988
5989 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5990
5991         * configure: Regenerate.
5992
5993 2010-09-17  Ian Lance Taylor  <iant@google.com>
5994
5995         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5996         * testsuite/Makefile.am (memory_test.o): New target.
5997         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5998         memory_test.t.
5999         * testsuite/Makefile.in: Rebuild.
6000
6001 2010-09-17  Doug Kwan  <dougkwan@google.com>
6002
6003         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6004         defintion if relocation uses GOT entries of the symbol.
6005         * testsuite/icf_safe_test.sh: Fix test.
6006         * testsuite/icf_safe_so_test.sh: Fix test.
6007
6008 2010-09-16  Cary Coutant  <ccoutant@google.com>
6009
6010         * script_sections.cc (class Memory_region): Remove "NULL" from
6011         vector initializations.
6012
6013 2010-09-15  Cary Coutant  <ccoutant@google.com>
6014
6015         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6016         Resolve forwarding symbols.
6017
6018 2010-09-15  Doug Kwan  <dougkwan@google.com>
6019
6020         * gold/testsuite/script_test_3.t: Add ARM special sections.
6021         * gold/testsuite/script_test_4.t: Same.
6022         * gold/testsuite/script_test_5.t: Same.
6023         * gold/testsuite/script_test_6.t: Same.
6024         * gold/testsuite/script_test_7.t: Same.
6025         * gold/testsuite/script_test_7.t: Same.
6026         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6027
6028 2010-09-14  Cary Coutant  <ccoutant@google.com>
6029
6030         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6031         (Target_x86_64::Relocate::relocate_tls): Replace check for
6032         saw_tls_block_reloc_ with test for executable section.
6033
6034 2010-09-12  Cary Coutant  <ccoutant@google.com>
6035
6036         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6037         position-independent executables to shared libraries need dynamic
6038         relocations.
6039         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6040         position-independent executables.
6041         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6042         * testsuite/Makefile.in: Regenerate.
6043
6044 2010-09-10  Nick Clifton  <nickc@redhat.com>
6045
6046         PR gold/11997
6047         * testsuite/memory_test.t: Discard any sections that are not
6048         needed.
6049
6050 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6051
6052         PR gold/11996
6053         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6054         "This::" to work around a bug in gcc 4.2.
6055
6056         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6057
6058 2010-09-09  Rafael Espindola  <espindola@google.com>
6059
6060         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6061         sections with different PF_X flags in the same segment.
6062         (Layout::find_first_load_seg): Search all segments to find the first
6063         one.
6064         * options.h (rosegment): New.
6065
6066 2010-09-08  Rafael Espindola  <espindola@google.com>
6067
6068         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6069
6070 2010-09-08  Doug Kwan  <dougkwan@google.com>
6071
6072         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6073         (Arm_relobj::do_relocate_sections): Add new parameter for output
6074         file to match the parent.
6075         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6076         of local symbols instead of input values.  Update code to track
6077         changes in gold::relocate_section.
6078         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6079         (Sized_relobj::compute_final_local_value_internal): New methods.
6080         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6081         body into private version of Sized_relobj::compute_final_local_value.
6082         Call the inline method.
6083         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6084         merged symbol value if there is one.
6085         (Symbol_value::has_output_value): New method defintiion.
6086         (Sized_relobj::Compute_final_local_value_status): New enum type.
6087         (Sized_relobj::compute_final_local_value): New methods.
6088         (Sized_relobj::compute_final_local_value_internal): New methods.
6089         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6090         and arm_cortex_a8.sh.
6091         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6092         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6093         New tests.
6094         * Makefile.in: Regenerate.
6095         * testsuite/arm_bl_out_of_range.s: Update test.
6096         * testsuite/thumb_bl_out_of_range.s: Ditto.
6097         * testsuite/thumb_blx_out_of_range.s: Ditto.
6098         * testsuite/arm_branch_out_of_range.sh: New file.
6099         * testsuite/arm_cortex_a8.sh: Ditto.
6100         * testsuite/arm_cortex_a8_b.s: Ditto.
6101         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6102         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6103         * testsuite/arm_cortex_a8_bl.s: Ditto.
6104         * testsuite/arm_cortex_a8_blx.s: Ditto.
6105         * testsuite/arm_cortex_a8_local.s: Ditto.
6106         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6107         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6108
6109 2010-09-08  Rafael Espindola  <espindola@google.com>
6110
6111         * Makefile.am (memory_test.stdout): Run readelf with -W.
6112         * Makefile.in: Regenerate.
6113         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6114         64 bit output.
6115
6116 2010-09-08  Rafael Espindola  <espindola@google.com>
6117
6118         * script-sections.cc (Script_sections::add_memory_region): Convert
6119         field precision to int.
6120         * script.cc (script_set_section_region, script_set_section_region):
6121         Convert field precision to int.
6122
6123 2010-09-08  Rafael Espindola  <espindola@google.com>
6124
6125         * arm.cc (do_finalize_sections): Create the __exidx_start and
6126         __exdix_end symbols even when the section is missing.
6127
6128 2010-09-08  Nick Clifton  <nickc@redhat.com>
6129
6130         * README: Remove claim that MEMORY is not supported.
6131         * expression.cc (script_exp_function_origin)
6132         (script_exp_function_length): Move from here to ...
6133         * script.cc: ... here.
6134         (script_set_section_region, script_add_memory)
6135         (script_parse_memory_attr, script_include_directive): New
6136         functions.
6137         * script-sections.cc
6138         (class Memory_region): New class.
6139         (class Output_section_definition): Add set_memory_region,
6140         set_section_vma, set_section_lma and get_section_name methods.
6141         (class Script_Sections): Add add_memory_region,
6142         find_memory_region, find_memory_region_origin,
6143         find_memory_region_length and set_memory_region methods.
6144         Have set_section_addresses method walk the list of set memory
6145         regions.
6146         Extend the print methos to display memory regions.
6147         * script-sections.h: Add prototypes for new methods.
6148         Add enum for MEMORY region attributes.
6149         * yyscript.y: Add support for parsing MEMORY regions.
6150         * script-c.h: Add prototypes for new functions.
6151         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6152         * testsuite/Makefile.in: Regenerate.
6153         * testsuite/memory_test.sh: New script.
6154         * testsuite/memory_test.s: New assembler source file.
6155         * testsuite/memory_test.t: New linker script.
6156
6157 2010-08-27  Doug Kwan  <dougkwan@google.com>
6158
6159         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6160         reference override an existing dynamic weak reference.
6161         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6162         * testsuite/Makefile.in: Regenerate.
6163         * testsuite/dyn_weak_ref.sh: New file.
6164         * testsuite/dyn_weak_ref_1.c: Ditto.
6165         * testsuite/dyn_weak_ref_2.c: Ditto.
6166
6167 2010-08-27  Ian Lance Taylor  <iant@google.com>
6168
6169         * incremental.h (class Incremental_input_entry): Add virtual
6170         destructor.
6171
6172 2010-08-27  Ian Lance Taylor  <iant@google.com>
6173
6174         * testsuite/start_lib_test_3.c: Mark t3 as used.
6175
6176 2010-08-27  Nick Clifton  <nickc@redhat.com>
6177
6178         * options.cc (version_script): Fix small typo in previous
6179         whitespace tidyup.
6180
6181 2010-08-25  Nick Clifton  <nickc@redhat.com>
6182
6183         * archive.cc: Formatting fixes: Remove whitespace between
6184         typename and following asterisk.  Remove whitespace between
6185         function name and opening parenthesis.
6186         * archive.h: Likewise.
6187         * arm.cc: Likewise.
6188         * attributes.cc: Likewise.
6189         * attributes.h: Likewise.
6190         * common.cc: Likewise.
6191         * copy-relocs.cc: Likewise.
6192         * dirsearch.h: Likewise.
6193         * dynobj.cc: Likewise.
6194         * ehframe.cc: Likewise.
6195         * ehframe.h: Likewise.
6196         * expression.cc: Likewise.
6197         * fileread.cc: Likewise.
6198         * fileread.h: Likewise.
6199         * gc.h: Likewise.
6200         * gold-threads.cc: Likewise.
6201         * gold.cc: Likewise.
6202         * i386.cc: Likewise.
6203         * icf.h: Likewise.
6204         * incremental-dump.cc: Likewise.
6205         * incremental.cc: Likewise.
6206         * layout.cc: Likewise.
6207         * layout.h: Likewise.
6208         * main.cc: Likewise.
6209         * merge.cc: Likewise.
6210         * merge.h: Likewise.
6211         * object.cc: Likewise.
6212         * object.h: Likewise.
6213         * options.cc: Likewise.
6214         * options.h: Likewise.
6215         * output.cc: Likewise.
6216         * output.h: Likewise.
6217         * plugin.cc: Likewise.
6218         * plugin.h: Likewise.
6219         * powerpc.cc: Likewise.
6220         * reloc.cc: Likewise.
6221         * script-c.h: Likewise.
6222         * script-sections.cc: Likewise.
6223         * script.cc: Likewise.
6224         * stringpool.cc: Likewise.
6225         * symtab.cc: Likewise.
6226         * symtab.h: Likewise.
6227         * target.cc: Likewise.
6228         * timer.cc: Likewise.
6229         * timer.h: Likewise.
6230         * version.cc: Likewise.
6231         * x86_64.cc: Likewise.
6232
6233 2010-08-24  Nick Clifton  <nickc@redhat.com>
6234
6235         PR 11899
6236         * layout.cc (segment_precedes): Sort segments by their physical
6237         addresses, if they have been set.
6238
6239 2010-08-23  Cary Coutant  <ccoutant@google.com>
6240
6241         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6242         symbols data.
6243         (Lib_group::include_member): Unlock object after deleting its
6244         symbols data.
6245         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6246         the bug fixed here.
6247
6248 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6249             Cary Coutant  <ccoutant@google.com>
6250
6251         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6252         constructor, and set_blocker.
6253         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6254         readsyms_blocker_.
6255         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6256         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6257         * testsuite/Makefile.am (start_lib_test): New test case.
6258         * testsuite/Makefile.in: Regenerate.
6259         * testsuite/start_lib_test_main.c: New file.
6260         * testsuite/start_lib_test_1.c: New file.
6261         * testsuite/start_lib_test_2.c: New file.
6262         * testsuite/start_lib_test_3.c: New file.
6263
6264 2010-08-19  Ian Lance Taylor  <iant@google.com>
6265
6266         * Makefile.in: Rebuild with automake 1.11.1.
6267         * aclocal.m4: Likewise.
6268         * testsuite/Makefile.in: Likewise.
6269
6270 2010-08-19  Ian Lance Taylor  <iant@google.com>
6271
6272         PR 10893
6273         * i386.cc (class Output_data_plt_i386): Update declarations.
6274         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6275         local_ifuncs_ fields.
6276         (Target_i386::do_plt_section_for_global): New function.
6277         (Target_i386::do_plt_section_for_local): New function.
6278         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6279         parameter; change all callers.  Initialize global_ifuncs_ and
6280         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6281         __rel_iplt_end.
6282         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6283         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6284         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6285         symbols.
6286         (Target_i386::make_plt_section): New function, broken out of
6287         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6288         (Target_i386::make_plt_entry): Call make_plt_section.
6289         (Target_i386::make_local_ifunc_plt_entry): New function.
6290         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6291         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6292         R_386_IRELATIVE to switch.
6293         (Target_i386::Scan::global): Likewise.
6294         (Target_i386::Relocate::relocate): Likewise.
6295         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6296         switch.
6297         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6298         (Target_x86_64::do_plt_section_for_global): New function.
6299         (Target_x86_64::do_plt_section_for_local): New function.
6300         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6301         parameter; change all callers.  If doing a static link define
6302         __rela_iplt_start and __rela_iplt_end.
6303         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6304         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6305         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6306         to point to .plt.
6307         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6308         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6309         switch.
6310         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6311         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6312         R_X86_64_IRELATIVE to switch.
6313         (Target_x86_64::Scan::global): Likewise.
6314         (Target_x86_64::Relocate::relocate): Likewise.
6315         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6316         switch.
6317         * target.h (class Target): Add plt_section_for_global and
6318         plt_section_for_local functions.  Add do_plt_section_for_global
6319         and do_plt_section_for_local virtual functions.
6320         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6321         clarifying comments.
6322         (Symbol::use_plt_offset): Handle IFUNC symbol.
6323         * object.cc (Sized_relobj::Sized_relobj): Initialize
6324         local_plt_offsets_.
6325         (Sized_relobj::local_has_plt_offset): New function.
6326         (Sized_relobj::local_plt_offset): New function.
6327         (Sized_relobj::set_local_plt_offset): New function.
6328         (Sized_relobj::do_count): Handle IFUNC symbol.
6329         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6330         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6331         is_ifunc_symbol functions.
6332         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6333         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6334         local_plt_offsets_ field.
6335         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6336         * output.h (class Output_section_data): Add non-const
6337         output_section function.
6338         (class Output_data_got): Update declarations.
6339         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6340         Add use_plt_offset parameter to global and local constructors.
6341         Change all callers.  Change local_sym_index_ field to 31 bits.
6342         Change GSYM_CODE and CONSTANT_CODE accordingly.
6343         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6344         doing a static link don't set sh_link field.
6345         (Output_data_got::Got_entry::write): Use PLT offset if
6346         appropriate.
6347         (Output_data_got::add_global_plt): New function.
6348         (Output_data_got::add_local_plt): New function.
6349         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6350         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6351         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6352         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6353         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6354         IFUNC conditional.
6355         * testsuite/ifunc-sel.h: New file.
6356         * testsuite/ifuncmain1.c: New file.
6357         * testsuite/ifuncmain1vis.c: New file.
6358         * testsuite/ifuncmod1.c: New file.
6359         * testsuite/ifuncdep2.c: New file.
6360         * testsuite/ifuncmain2.c: New file.
6361         * testsuite/ifuncmain3.c: New file.
6362         * testsuite/ifuncmod3.c: New file.
6363         * testsuite/ifuncmain4.c: New file.
6364         * testsuite/ifuncmain5.c: New file.
6365         * testsuite/ifuncmod5.c: New file.
6366         * testsuite/ifuncmain6pie.c: New file.
6367         * testsuite/ifuncmod6.c: New file.
6368         * testsuite/ifuncmain7.c: New file.
6369         * configure, testsuite/Makefile.in: Rebuild.
6370
6371 2010-08-18  Ian Lance Taylor  <iant@google.com>
6372
6373         * incremental.cc
6374         (Output_section_incremental_inputs::write_input_files): Add cast
6375         to avoid signed/unsigned comparison warning.
6376         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6377
6378 2010-08-12  Cary Coutant  <ccoutant@google.com>
6379
6380         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6381
6382 2010-08-13  Ian Lance Taylor  <iant@google.com>
6383
6384         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6385
6386 2010-08-12  Cary Coutant  <ccoutant@google.com>
6387             Doug Kwan  <dougkwan@google.com>
6388
6389         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6390         defintion overrides non-weak undef, remember that the original undef
6391         is not weak.
6392         * symtab.cc (Symbol_table::sized_write_global): For undef without
6393         an original weak binding, set binding to global in output.
6394         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6395         * testsuite/Makefile.in: Regenerate.
6396         * testsuite/strong_ref_weak_def.sh: New file.
6397         * testsuite/strong_ref_weak_def_1.c: Ditto.
6398         * testsuite/strong_ref_weak_def_2.c: Ditto.
6399
6400 2010-08-12  Cary Coutant  <ccoutant@google.com>
6401
6402         * testsuite/incremental_test.sh: Rewrite.
6403         * testsuite/incremental_test_1.c: Rewrite.
6404         * testsuite/incremental_test_2.c: Rewrite.
6405
6406 2010-08-12  Cary Coutant  <ccoutant@google.com>
6407
6408         * arm.cc (Target_arm::got_size): Add const.
6409         (Target_arm::got_entry_count): New function.
6410         (Target_arm::plt_entry_count): New function.
6411         (Target_arm::first_plt_entry_offset): New function.
6412         (Target_arm::plt_entry_size): New function.
6413         (Output_data_plt_arm::entry_count): New function.
6414         (Output_data_plt_arm::first_plt_entry_offset): New function.
6415         (Output_data_plt_arm::get_plt_entry_size): New function.
6416         * i386.cc (Target_i386::got_size): Add const.
6417         (Target_i386::got_entry_count): New function.
6418         (Target_i386::plt_entry_count): New function.
6419         (Target_i386::first_plt_entry_offset): New function.
6420         (Target_i386::plt_entry_size): New function.
6421         (Output_data_plt_i386::entry_count): New function.
6422         (Output_data_plt_i386::first_plt_entry_offset): New function.
6423         (Output_data_plt_i386::get_plt_entry_size): New function.
6424         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6425         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6426         * incremental.cc: Include target.h.
6427         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6428         parameter.  Adjust all callers.  Find incremental_got_plt section.
6429         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6430         section.
6431         (Output_section_incremental_inputs::set_final_data_size): Calculate
6432         size of incremental_got_plt section.
6433         (Output_section_incremental_inputs::do_write): Write the
6434         incremental_got_plt section.
6435         (Got_plt_view_info): New struct.
6436         (Local_got_offset_visitor): New class.
6437         (Global_got_offset_visitor): New class.
6438         (Global_symbol_visitor_got_plt): New class.
6439         (Output_section_incremental_inputs::write_got_plt): New function.
6440         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6441         Add parameter.  Adjust all callers.
6442         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6443         (Incremental_inputs::got_plt_section): New function.
6444         (Incremental_inputs::got_plt_section_): New data member.
6445         (Incremental_got_plt_reader): New class.
6446         * layout.cc (Layout::create_incremental_info_sections): Add the
6447         incremental_got_plt section.
6448         * object.h (Got_offset_list::get_list): New function.
6449         (Got offset_list::for_all_got_offsets): New function.
6450         (Sized_relobj::local_got_offset_list): New function.
6451         * powerpc.cc (Target_powerpc::got_size): Add const.
6452         (Target_powerpc::got_entry_count): New function.
6453         (Target_powerpc::plt_entry_count): New function.
6454         (Target_powerpc::first_plt_entry_offset): New function.
6455         (Target_powerpc::plt_entry_size): New function.
6456         (Output_data_plt_powerpc::entry_count): New function.
6457         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6458         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6459         * sparc.cc (Target_sparc::got_size): Add const.
6460         (Target_sparc::got_entry_count): New function.
6461         (Target_sparc::plt_entry_count): New function.
6462         (Target_sparc::first_plt_entry_offset): New function.
6463         (Target_sparc::plt_entry_size): New function.
6464         (Output_data_plt_sparc::entry_count): New function.
6465         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6466         (Output_data_plt_sparc::get_plt_entry_size): New function.
6467         * symtab.h (Symbol::got_offset_list): New function.
6468         (Symbol_table::for_all_symbols): New function.
6469         * target.h (Sized_target::got_entry_count): New function.
6470         (Sized_target::plt_entry_count): New function.
6471         (Sized_target::plt_entry_size): New function.
6472         * x86_64.cc (Target_x86_64::got_size): Add const.
6473         (Target_x86_64::got_entry_count): New function.
6474         (Target_x86_64::plt_entry_count): New function.
6475         (Target_x86_64::first_plt_entry_offset): New function.
6476         (Target_x86_64::plt_entry_size): New function.
6477         (Output_data_plt_x86_64::entry_count): New function.
6478         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6479         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6480
6481 2010-08-12  Cary Coutant  <ccoutant@google.com>
6482
6483         * archive.cc: Include incremental.h.
6484         (Archive::Archive): Initialize incremental_info_.
6485         (Archive::include_member): Record archive members in incremental info.
6486         (Add_archive_symbols::run): Record begin and end of an archive in
6487         incremental info.
6488         (Lib_group::include_member): Record objects in incremental info.
6489         * archive.h (Incremental_archive_entry): Forward declaration.
6490         (Archive::set_incremental_info): New member function.
6491         (Archive::incremental_info): New member function.
6492         (Archive::Unused_symbol_iterator): New class.
6493         (Archive::unused_symbols_begin): New member function.
6494         (Archive::unused_symbols_end): New member function.
6495         (Archive::incremental_info_): New data member.
6496         * incremental-dump.cc (find_input_containing_global): New function.
6497         (dump_incremental_inputs): Dump new incremental info sections.
6498         * incremental.cc: Include symtab.h.
6499         (Output_section_incremental_inputs): New class.
6500         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6501         new incremental info sections.
6502         (Sized_incremental_binary::do_check_inputs): Likewise.
6503         (Incremental_inputs::report_archive): Remove.
6504         (Incremental_inputs::report_archive_begin): New function.
6505         (Incremental_inputs::report_archive_end): New function.
6506         (Incremental_inputs::report_object): New function.
6507         (Incremental_inputs::finalize_inputs): Remove.
6508         (Incremental_inputs::report_input_section): New function.
6509         (Incremental_inputs::report_script): Rewrite.
6510         (Incremental_inputs::finalize): Do nothing but finalize string table.
6511         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6512         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6513         (Incremental_inputs::create_data_sections): New function.
6514         (Incremental_inputs::relocs_entsize): New function.
6515         (Output_section_incremental_inputs::set_final_data_size): New function.
6516         (Output_section_incremental_inputs::do_write): New function.
6517         (Output_section_incremental_inputs::write_header): New function.
6518         (Output_section_incremental_inputs::write_input_files): New function.
6519         (Output_section_incremental_inputs::write_info_blocks): New function.
6520         (Output_section_incremental_inputs::write_symtab): New function.
6521         * incremental.h (Incremental_script_entry): Forward declaration.
6522         (Incremental_object_entry): Forward declaration.
6523         (Incremental_archive_entry): Forward declaration.
6524         (Incremental_inputs): Forward declaration.
6525         (Incremental_inputs_header_data): Remove.
6526         (Incremental_inputs_header): Remove.
6527         (Incremental_inputs_header_write): Remove.
6528         (Incremental_inputs_entry_data): Remove.
6529         (Incremental_inputs_entry): Remove.
6530         (Incremental_inputs_entry_write): Remove.
6531         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6532         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6533         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6534         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6535         Likewise.
6536         (Incremental_input_entry): New class.
6537         (Incremental_script_entry): New class.
6538         (Incremental_object_entry): New class.
6539         (Incremental_archive_entry): New class.
6540         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6541         (Incremental_inputs::report_inputs): Remove.
6542         (Incremental_inputs::report_archive): Remove.
6543         (Incremental_inputs::report_archive_begin): New function.
6544         (Incremental_inputs::report_archive_end): New function.
6545         (Incremental_inputs::report_object): Change prototype.
6546         (Incremental_inputs::report_input_section): New function.
6547         (Incremental_inputs::report_script): Change prototype.
6548         (Incremental_inputs::get_reloc_count): New function.
6549         (Incremental_inputs::set_reloc_count): New function.
6550         (Incremental_inputs::create_data_sections): New function.
6551         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6552         (Incremental_inputs::inputs_section): New function.
6553         (Incremental_inputs::symtab_section): New function.
6554         (Incremental_inputs::relocs_section): New function.
6555         (Incremental_inputs::get_stringpool): Add const.
6556         (Incremental_inputs::command_line): Add const.
6557         (Incremental_inputs::inputs): Remove.
6558         (Incremental_inputs::command_line_key): New function.
6559         (Incremental_inputs::input_file_count): New function.
6560         (Incremental_inputs::input_files): New function.
6561         (Incremental_inputs::relocs_entsize): New function.
6562         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6563         (Incremental_inputs::finalize_inputs): Remove.
6564         (Incremental_inputs::Input_info): Remove.
6565         (Incremental_inputs::lock_): Remove.
6566         (Incremental_inputs::inputs_): Change type.
6567         (Incremental_inputs::inputs_map_): Remove.
6568         (Incremental_inputs::current_object_entry_): New data member.
6569         (Incremental_inputs::inputs_section_): New data member.
6570         (Incremental_inputs::symtab_section_): New data member.
6571         (Incremental_inputs::relocs_section_): New data member.
6572         (Incremental_inputs::reloc_count_): New data member.
6573         (Incremental_inputs_reader): New class.
6574         (Incremental_symtab_reader): New class.
6575         (Incremental_relocs_reader): New class.
6576         * layout.cc (Layout::finalize): Move finalization of incremental info
6577         and creation of incremental info sections to follow finalization of
6578         symbol table.  Set offsets for postprocessing sections.
6579         (Layout::create_incremental_info_sections): Call
6580         Incremental_inputs::create_data_sections.  Add incremental symtab
6581         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6582         sections to layout after input sections.
6583         * layout.h (struct Timespec): Forward declaration.
6584         (Layout::incremental_inputs): Add const.
6585         (Layout::create_incremental_info_sections): Add parameter.
6586         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6587         * object.cc: Include incremental.h.
6588         (Relobj::finalize_incremental_relocs): New function.
6589         (Sized_relobj::do_layout): Record input sections in incremental info.
6590         * object.h (Object::output_section): New function.
6591         (Object::output_section_offset): Moved from Relobj.
6592         (Object::get_incremental_reloc_base): New function.
6593         (Object::get_incremental_reloc_count): New function.
6594         (Object::do_output_section): New function.
6595         (Object::do_output_section_offset): Moved from Relobj.
6596         (Object::do_get_incremental_reloc_base): New function.
6597         (Object::do_get_incremental_reloc_count): New function.
6598         (Object::Object): Initialize new data members.
6599         (Relobj::output_section): Renamed do_output_section and moved to
6600         protected.
6601         (Relobj::output_section_offset): Moved to Object.
6602         (Relobj::do_get_incremental_reloc_base): New function.
6603         (Relobj::do_get_incremental_reloc_count): New function.
6604         (Relobj::allocate_incremental_reloc_counts): New function.
6605         (Relobj::count_incremental_reloc): New function.
6606         (Relobj::finalize_incremental_relocs): New function.
6607         (Relobj::next_incremental_reloc_index): New function.
6608         (Relobj::reloc_counts_): New data member.
6609         (Relobj::reloc_bases_): New data member.
6610         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6611         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6612         (Sized_relobj::incremental_relocs_scan): New function.
6613         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6614         (Sized_relobj::incremental_relocs_write): New function.
6615         (Sized_relobj::incremental_relocs_write_reltype): New function.
6616         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6617         incremental link.
6618         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6619         archives and object files elsewhere.
6620         (Add_symbols::run): Report object files here.
6621         (Finish_group::run): Report end of archive at end of group.
6622         * reloc.cc: Include layout.h, incremental.h.
6623         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6624         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6625         (Sized_relobj::incremental_relocs_scan): New function.
6626         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6627         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6628         (Sized_relobj::incremental_relocs_write): New function.
6629         (Sized_relobj::incremental_relocs_write_reltype): New function.
6630         * script.cc (read_input_script): Rewrite test for incremental link.
6631         Change call to Incremental_inputs::report_script.
6632         * symtab.h (Symbol_table::first_global_index): New function.
6633         (Symbol_table::output_count): New function.
6634
6635 2010-08-12  Doug Kwan  <dougkwan@google.com>
6636
6637         * arm.cc (Target_arm::merge_object_attributes): Check command line
6638         options --no-wchar-size-warning and --no-enum-size-warning.
6639         * options.h (General_options): Add ld-compatible options
6640         --no-enum-size-warning and --no-wchar-size-warning.
6641
6642 2010-08-04  Ian Lance Taylor  <iant@google.com>
6643
6644         * x86_64.cc (Target_x86_64::Scan::local): Use
6645         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6646         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6647         (Target_x86_64::Scan::global): Likewise.
6648         (Target_x86_64::Relocate::relocate): Likewise.
6649         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6650         Likewise.
6651
6652 2010-08-03  Cary Coutant  <ccoutant@google.com>
6653
6654         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6655         to reserve space in merged_strings vector. Keep total input size
6656         for stats.
6657         (Output_merge_string::do_print_merge_stats): Print total input size.
6658         * merge.h (Output_merge_string): Add input_size_ field.
6659         * stringpool.cc (Stringpool_template::string_length): Move
6660         implementations out of Stringpool_template class and place in
6661         stringpool.h.
6662         * stringpool.h (string_length): Move out of Stringpool_template.
6663
6664 2010-08-03  Ian Lance Taylor  <iant@google.com>
6665
6666         PR 11712
6667         * layout.cc (relaxation_loop_body): If address of load segment is
6668         set, adjust address to include headers if possible.
6669
6670 2010-08-03  Ian Lance Taylor  <iant@google.com>
6671
6672         * version.cc (version_string): Bump to 1.10.
6673
6674 2010-08-03  Ian Lance Taylor  <iant@google.com>
6675
6676         PR 11805
6677         * layout.h (enum Output_section_order): Define.
6678         (class Layout): Update declarations.
6679         * layout.cc (Layout::get_output_section): Add order parameter.
6680         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6681         is_first_non_relro parameters.  Change all callers.
6682         (Layout::choose_output_section): Likewise.
6683         (Layout::add_output_section_data): Likewise.
6684         (Layout::make_output_section): Likewise.  Set order.
6685         (Layout::default_section_order): New function.
6686         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6687         * output.cc (Output_section::Output_section): Initialize order_.
6688         Don't initialize deleted fields.
6689         (Output_segment::Output_segment): Don't initialize deleted
6690         fields.
6691         (Output_segment::add_output_section_to_load): New function
6692         replacing add_output_section.  Change all callers to call this or
6693         add_output_section_to_nonload.
6694         (Output_segment::add_output_section_to_nonload): New function.
6695         (Output_segment::remove_output_section): Rewrite.
6696         (Output_segment::add_initial_output_data): Likewise.
6697         (Output_segment::has_any_data_sections): Likewise.
6698         (Output_segment::is_first_section_relro): Likewise.
6699         (Output_segment::maximum_alignment): Likewise.
6700         (Output_segment::has_dynamic_reloc): New function replacing
6701         dynamic_reloc_count.  Change all callers.
6702         (Output_segment::has_dynamic_reloc_list): New function replacing
6703         dynamic_reloc_count_list.  Change all callers.
6704         (Output_segment::set_section_addresses): Rewrite.
6705         (Output_segment::set_offset): Rewrite.
6706         (Output_segment::find_first_and_last_list): Remove.
6707         (Output_segment::set_tls_offsets): Rewrite.
6708         (Output_segment::first_section_load_address): Likewise.
6709         (Output_segment::output_section_count): Likewise.
6710         (Output_segment::section_with_lowest_load_address): Likewise.
6711         (Output_segment::write_section_headers): Likewise.
6712         (Output_segment::print_sections_to_map): Likewise.
6713         * output.h (class Output_data): Remove dynamic_reloc_count_
6714         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6715         (Output_data::add_dynamic_reloc): Rewrite.
6716         (Output_data::has_dynamic_reloc): New function.
6717         (Output_data::dynamic_reloc_count): Remove.
6718         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6719         is_last_relro_, is_first_non_relro_, is_interp_,
6720         is_dynamic_linker_section_ fields.  Add order and set_order
6721         functions.  Remove is_relro_local, set_is_relro_local,
6722         is_last_relro, set_is_last_relro, is_first_non_relro,
6723         set_is_first_non_relro functions, is_interp, set_is_interp,
6724         is_dynamic_linker_section, and set_is_dynamic_linker_section
6725         functions.
6726         (class Output_segment): Change Output_data_list from std::list to
6727         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6728         output_bss_ fields.  Update declarations.
6729
6730 2010-08-02  Ian Lance Taylor  <iant@google.com>
6731
6732         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6733         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6734         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6735
6736 2010-08-02  Ian Lance Taylor  <iant@google.com>
6737
6738         PR 11855
6739         * script.cc (Script_options::Script_options): Initialize
6740         symbol_definitions_ and symbol_references_.
6741         (Script_options::add_symbol_assignment): Update
6742         symbol_definitions_ and symbol_references_.
6743         (Script_options::add_symbol_reference): New function.
6744         (script_symbol): New function.
6745         * script.h (class Script_options): Add symbol_definitions_ and
6746         symbol_references_ fields.
6747         (Script_options::referenced_const_iterator): New type.
6748         (Script_options::referenced_begin): New function.
6749         (Script_options::referenced_end): New function.
6750         (Script_options::is_referenced): New function.
6751         (Script_options::any_unreferenced): New function.
6752         * script-c.h (script_symbol): Declare.
6753         * yyscript.y (exp): Call script_symbol.
6754         * symtab.cc: Include "script.h".
6755         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6756         Change all callers.  Check symbols referenced by scripts.
6757         (Symbol_table::add_undefined_symbols_from_command_line): Add
6758         layout parameter.  Change all callers.
6759         (Symbol_table::do_add_undefined_symbols_from_command_line):
6760         Likewise.  Break out loop body.  Check symbols referenced by
6761         scripts.
6762         (Symbol_table::add_undefined_symbol_from_command_line): New
6763         function broken out of
6764         do_add_undefined_symbols_from_command_line.
6765         * symtab.h (class Symbol_table): Update declarations.
6766         * archive.cc: Include "layout.h".
6767         (Archive::should_include_member): Add layout parameter.  Change
6768         all callers.  Check for symbol mentioned in expression.
6769         * archive.h (class Archive): Update declaration.
6770         * object.cc (Sized_relobj::do_should_include_member): Add layout
6771         parameter.
6772         * object.h (Object::should_include_member): Add layout parameter.
6773         Change all callers.
6774         (Object::do_should_include_member): Add layout parameter.
6775         (class Sized_relobj): Update declaration.
6776         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6777         parameter.
6778         * dynobj.h (class Sized_dynobj): Update declaration.
6779         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6780         layout parameter.
6781         * plugin.h (class Sized_pluginobj): Update declaration.
6782
6783 2010-08-02  Ian Lance Taylor  <iant@google.com>
6784
6785         PR 11866
6786         * output.cc (Output_segment::set_offset): Search for the first and
6787         last sections rather than assuming that the list is in order.
6788         (Output_segment::find_first_and_last_list): New function.
6789         * output.h (class Output_segment): Update declarations.
6790         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6791         (relro_strip_test_SOURCES): New variable.
6792         (relro_strip_test_DEPENDENCIES): New variable.
6793         (relro_strip_test_LDFLAGS): New variable.
6794         (relro_strip_test_LDADD): New variable.
6795         (relro_strip_test.so): New target.
6796
6797 2010-08-02  Ian Lance Taylor  <iant@google.com>
6798
6799         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6800         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6801         (Target_i386::got_tlsdesc_section): New function.
6802         (Target_i386::got_section): Create space for GOT entries for
6803         TLSDESC relocations.
6804         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6805         R_386_TLS_GOTDESC.
6806         (Target_i386::Scan::global): Likewise.
6807         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6808         using TLSDESC GOT.
6809         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6810         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6811         (Target_x86_64::got_tlsdesc_section): New function.
6812         (Target_x86_64::got_section): Create space for GOT entries for
6813         TLSDESC relocations.
6814         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6815         R_386_TLS_GOTDESC.
6816         (Target_x86_64::Scan::global): Likewise.
6817         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6818         using TLSDESC GOT.
6819
6820 2010-08-02  Ian Lance Taylor  <iant@google.com>
6821
6822         * testsuite/final_layout.sh: Use dc to convert from hex to
6823         decimal.
6824
6825 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6826
6827         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6828         paramter to the call to gold::gc_process_relocs.
6829         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6830         paramter to the call to gold::gc_process_relocs.
6831         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6832         parameter to the call to gold::gc_process_relocs.
6833         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6834         template parameter to the call to gold::gc_process_relocs.
6835         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6836         paramter to the call to gold::gc_process_relocs.
6837         * gc.h (get_embedded_addend_size): New function.
6838         (gc_process_relocs): Save the size of the reloc for use by ICF.
6839         * icf.cc (get_section_contents): Get the addend from the text section
6840         for SHT_REL relocation sections.
6841         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6842         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6843         * int_encoding.h (read_from_pointer): New overloaded function.
6844         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6845         * testsuite/icf_sht_rel_addend_test.sh: New file.
6846         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6847         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6848
6849 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6850
6851         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6852         * Makefile.in: Regenerate.
6853         * testsuite/Makefile.in: Regenerate.
6854
6855 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6856
6857         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6858         * gold/testsuite/debug_msg.cc: Likewise.
6859         * gold/testsuite/odr_violation1.cc
6860         * gold/testsuite/odr_violation2.cc
6861
6862 2010-07-21  Cary Coutant  <ccoutant@google.com>
6863
6864         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6865         string, and length fields.
6866         (Output_merge_string::Merged_strings_list): New type.
6867         (Output_merge_string::Merged_strings_lists): New typedef.
6868         (Output_merge_string): Replace merged_strings_ with
6869         merged_strings_lists_.
6870         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6871         Merged_strings_list per input object and section.  Don't store pointer
6872         to the string.  Don't store length with each merged string entry.
6873         (Output_merge_string::finalize_merged_data): Loop over list of merged
6874         strings lists.  Recompute length of each merged string.
6875
6876 2010-07-15  Cary Coutant  <ccoutant@google.com>
6877
6878         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6879         here.
6880
6881 2010-07-14  Ian Lance Taylor  <iant@google.com>
6882
6883         * descriptors.cc (Descriptors::open): Report correct name in error
6884         message.
6885
6886 2010-07-13  Doug Kwan  <dougkwan@google.com>
6887
6888         * arm.cc (Arm_input_section::Arm_input_section): For a
6889         SHT_ARM_EXIDX section, always keeps the input sections.
6890         (Arm_input_section::set_exidx_section_link): New method.
6891         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6892         has_errors_ to false.
6893         (Arm_exidx_input_section::has_errors,
6894         Arm_exidx_input_section::set_has_errors): New methods.
6895         (Arm_exidx_input_section::has_errors_): New data member.
6896         (Arm_relobj::get_exidx_shndx_list): New method.
6897         (Arm_output_section::append_text_sections_to_list): Do not skip
6898         section without SHF_EXECINSTR.
6899         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6900         errors.
6901         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6902         section header.  Make error messages more verbose.  Check for
6903         a non-executable section linked to an EXIDX section.
6904         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6905         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6906         check that there is no deferred EXIDX section if we exit early.
6907         Instead of not making an EXIDX section in case of an error, make one
6908         and set the has_errors flag of it.
6909         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6910         in a relocatable link.
6911         (Target_arm::do_relax): Look for the EXIDX output section instead of
6912         assuming that it is called .ARM.exidx.
6913         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6914         section list.  Do not check for SHF_EXECINSTR section flags but
6915         skip any input section with errors.
6916         * output.cc (Output_section::Output_section): Initialize
6917         always_keeps_input_sections_ to false.
6918         (Output_section::add_input_section): Check for
6919         always_keeps_input_sections_.
6920         *  output.h (Output_section::always_keeps_input_sections,
6921         Output_section::set_always_keeps_input_sections): New methods.
6922         (Output_section::always_keeps_input_sections): New data member.
6923
6924 2010-07-13  Rafael Espindola  <espindola@google.com>
6925
6926         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6927         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6928
6929 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6930             Ian Lance Taylor  <iant@google.com>
6931
6932         * output.h (Output_section_lookup_maps::add_merge_section):
6933         Correct check of whether value was inserted.
6934         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6935         (Output_section_lookup_maps::add_relaxed_input_section):
6936         Likewise.
6937         * arm.cc (Target_arm::got_section): Remove used local os.
6938         * i386.cc (Target_i386::got_section): Likewise.
6939         * x86_64.cc (Target_x86_64::got_section): Likewise.
6940         * sparc.cc (Target_sparc::got_section): Likewise.
6941         (Target_sparc::relocate): Remove unused local have_got_offset.
6942         * powerpc.cc (Target_powerpc::relocate): Likewise.
6943
6944 2010-07-13  Ian Lance Taylor  <iant@google.com>
6945
6946         * compressed_output.cc (zlib_decompress): Fix signature in
6947         !HAVE_ZLIB_H case.
6948
6949         * archive.cc (Archive::include_member): Unlock an external member
6950         of a thin archive.  Don't bother to delete an object we know is
6951         NULL.
6952
6953 2010-07-12  Cary Coutant  <ccoutant@google.com>
6954
6955         * compressed_output.cc (zlib_decompress): New function.
6956         (get_uncompressed_size): New function.
6957         (decompress_input_section): New function.
6958         * compressed_output.h (get_uncompressed_size): New function.
6959         (decompress_input_section): New function.
6960         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6961         Handle compressed debug sections.
6962         * layout.cc (is_compressed_debug_section): New function.
6963         (Layout::output_section_name): Map compressed section names to
6964         canonical names.
6965         * layout.h (is_compressed_debug_section): New function.
6966         (is_debug_info_section): Recognize compressed debug sections.
6967         * merge.cc: Include compressed_output.h.
6968         (Output_merge_data::do_add_input_section): Handle compressed
6969         debug sections.
6970         (Output_merge_string::do_add_input_section): Handle compressed
6971         debug sections.
6972         * object.cc: Include compressed_output.h.
6973         (Sized_relobj::Sized_relobj): Initialize new data members.
6974         (build_compressed_section_map): New function.
6975         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6976         * object.h (Object::section_is_compressed): New method.
6977         (Object::do_section_is_compressed): New method.
6978         (Sized_relobj::Compressed_section_map): New type.
6979         (Sized_relobj::do_section_is_compressed): New method.
6980         (Sized_relobj::compressed_sections_): New data member.
6981         * output.cc (Output_section::add_input_section): Handle compressed
6982         debug sections.
6983         * reloc.cc: Include compressed_output.h.
6984         (Sized_relobj::write_sections): Handle compressed debug sections.
6985
6986 2010-07-08  Cary Coutant  <ccoutant@google.com>
6987
6988         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6989         weak when resolving to a dynamic def.
6990         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6991         for weak undef/dynamic def cases. Adjust callers.
6992         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6993         undef_binding_weak_.
6994         (Symbol_table::sized_write_globals): Adjust symbol binding.
6995         (Symbol_table::sized_write_symbol): Add binding parameter.
6996         * symtab.h (Symbol::set_undef_binding): New method.
6997         (Symbol::is_undef_binding_weak): New method.
6998         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6999         (Symbol_table::should_override): Add new parameter.
7000         (Symbol_table::sized_write_symbol): Add new parameter.
7001
7002         * testsuite/weak_undef_file1.cc: Add new test case.
7003         * testsuite/weak_undef_file2.cc: Fix header comment.
7004         * testsuite/weak_undef_test.cc: Add new test case.
7005
7006 2010-06-29  Doug Kwan  <dougkwan@google.com>
7007
7008         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7009         Initialize USE_SYMBOL_.
7010         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7011         definition.
7012         (Arm_reloc_property::uses_symbol_): New data member declaration.
7013         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7014         uses symbol value and symbol is undefined but not weakly undefined.
7015
7016 2010-06-28  Rafael Espindola  <espindola@google.com>
7017
7018         * plugin.cc (Plugin::load): Use dlerror.
7019
7020 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7021
7022         * symtab.cc (detect_odr_violations): When reporting an ODR
7023         violation, report an object where the symbol is defined.
7024
7025 2010-06-25  Doug Kwan  <dougkwan@google.com>
7026
7027         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7028         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7029         definition.
7030         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7031         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7032         target hook to detect function points.
7033         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7034         * icf.h (Icf::check_section_for_function_pointers): Change type of
7035         parameter SECTION_NAME to const reference to std::string.  Use
7036         target hook to determine if section may have unsafe pointers.
7037         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7038         method definition.
7039
7040 2010-06-21  Rafael Espindola  <espindola@google.com>
7041
7042         * fileread.cc (Input_file::find_fie): New
7043         (Input_file::open): Use Input_file::find_fie.
7044         * fileread.h (Input_file::find_fie): New
7045         * plugin.cc (set_extra_library_path): New.
7046         (Plugin::load): Add set_extra_library_path to the transfer vector.
7047         (Plugin_manager::set_extra_library_path): New.
7048         (Plugin_manager::add_input_file): Use the extra search path if set.
7049         (set_extra_library_path(): New.
7050         * plugin.h (Plugin_manager): Add set_extra_library_path and
7051         extra_search_path_.
7052
7053 2010-06-19  Cary Coutant  <ccoutant@google.com>
7054
7055         * layout.cc (gdb_sections): Add .debug_types.
7056         (lines_only_debug_sections): Likewise.
7057
7058 2010-06-18  Rafael Espindola  <espindola@google.com>
7059
7060         * plugin.cc (add_input_file,add_input_library)
7061         (Plugin_manager::add_input_file): Make filename arguments const.
7062         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7063         const.
7064
7065 2010-06-16  Doug Kwan  <dougkwan@google.com>
7066
7067         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7068         .ARM.attributes section if we have not merged any input
7069         attributes sections.
7070
7071 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7072
7073         * arm.cc: Allow combining objects with no EABI version
7074         information.
7075
7076 2010-06-15  Rafael Espindola  <espindola@google.com>
7077
7078         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7079
7080 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7081
7082         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7083         (struct iovec): Correct !HAVE_READV definition.
7084
7085 2010-06-10  Cary Coutant  <ccoutant@google.com>
7086
7087         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7088         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7089         reloc sections.
7090         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7091
7092         PR 11683
7093         * symtab.h (Symbol::is_placeholder): New member function.
7094         * target-reloc.h (relocate_section): Check for placeholder symbols.
7095
7096         * testsuite/Makefile.am (plugin_test_8): New test.
7097         (plugin_test_9): New test.
7098         * testsuite/Makefile.in: Regenerate.
7099
7100 2010-06-09  Nick Clifton  <nickc@redhat.com>
7101
7102         * yyscript.y (input_list_element): Allow strings prefixed with
7103         the '-' character.  Treat these as libraries.
7104         * script.cc (script_add_library): New function.  Adds a library
7105         specified by "-l<name>" found in an input script.
7106         * script-c.h: Add prototype for script_add_library.
7107
7108 2010-06-07  Doug Kwan  <dougkwan@google.com>
7109
7110         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7111         Restrict stub-group size to be within long conditional branch
7112         range when working around cortex-A8 erratum.
7113
7114 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7115
7116         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7117         #ifdef typo.
7118
7119 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7120
7121         PR gold/11658
7122         * output.cc
7123         (Output_section::Input_section_sort_entry::compare_section_ordering):
7124         Change to return non-zero correctly.
7125         (Output_section::Input_section_sort_section_order_index_compare
7126         ::operator()): Change to fix ambiguity in comparisons.
7127
7128 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7129
7130         * gold.h (is_wildcard_string): New function.
7131         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7132         (Layout::layout_eh_frame): Ditto.
7133         (Layout::find_section_order_index): New method.
7134         (Layout::read_layout_from_file): New method.
7135         * layout.h (Layout::find_section_order_index): New method.
7136         (Layout::read_layout_from_file): New method.
7137         (Layout::input_section_position_): New private member.
7138         (Layout::input_section_glob_): New private member.
7139         * main.cc (main): Call read_layout_from_file here.
7140         * options.h (--section-ordering-file): New option.
7141         * output.cc (Output_section::input_section_order_specified_): New
7142         member.
7143         (Output_section::Output_section): Initialize new member.
7144         (Output_section::add_input_section): Add new parameter.
7145         Keep input sections when --section-ordering-file is used.
7146         (Output_section::set_final_data_size): Sort input sections when
7147         section ordering file is specified.
7148         (Output_section::Input_section_sort_entry): Add new parameter.
7149         Check sorting type.
7150         (Output_section::Input_section_sort_entry::compare_section_ordering):
7151         New method.
7152         (Output_section::Input_section_sort_compare::operator()): Change to
7153         consider section_order_index.
7154         (Output_section::Input_section_sort_init_fini_compare::operator()):
7155         Change to consider section_order_index.
7156         (Output_section::Input_section_sort_section_order_index_compare
7157         ::operator()): New method.
7158         (Output_section::sort_attached_input_sections): Change to sort
7159         according to section order when specified.
7160         (Output_section::add_input_section<32, true>): Add new parameter.
7161         (Output_section::add_input_section<64, true>): Add new parameter.
7162         (Output_section::add_input_section<32, false>): Add new parameter.
7163         (Output_section::add_input_section<64, false>): Add new parameter.
7164         * output.h (Output_section::add_input_section): Add new parameter.
7165         (Output_section::input_section_order_specified): New
7166         method.
7167         (Output_section::set_input_section_order_specified): New method.
7168         (Input_section::Input_section): Initialize section_order_index_.
7169         (Input_section::section_order_index): New method.
7170         (Input_section::set_section_order_index): New method.
7171         (Input_section::section_order_index_): New member.
7172         (Input_section::Input_section_sort_section_order_index_compare): New
7173         struct.
7174         (Output_section::input_section_order_specified_): New member.
7175         * script-sections.cc (is_wildcard_string): Delete and move modified
7176         method to gold.h.
7177         (Output_section_element_input::Output_section_element_input): Modify
7178         call to is_wildcard_string.
7179         (Output_section_element_input::Input_section_pattern
7180         ::Input_section_pattern): Ditto.
7181         (Output_section_element_input::Output_section_element_input): Ditto.
7182         * testsuite/Makefile.am (final_layout): New test case.
7183         * testsuite/Makefile.in: Regenerate.
7184         * testsuite/final_layout.cc: New file.
7185         * testsuite/final_layout.sh: New file.
7186
7187 2010-06-01  Rafael Espindola  <espindola@google.com>
7188
7189         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7190
7191 2010-06-01  Rafael Espindola  <espindola@google.com>
7192
7193         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7194         visibility of symbols.
7195
7196 2010-05-27  Doug Kwan  <dougkwan@google.com>
7197
7198         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7199         from start of output section instead of address for a local symbol
7200         in a merged or relaxed section when doing a relocatable link.
7201
7202 2010-05-26  Rafael Espindola  <espindola@google.com>
7203
7204         PR 11604
7205         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7206         adding sections the garbage collector removed.
7207         * gold/testsuite/Makefile.am: Add test.
7208         * gold/testsuite/Makefile.in: Regenerate.
7209         * gold/testsuite/plugin_test_7.sh: New.
7210         * gold/testsuite/plugin_test_7_1.c: New.
7211         * gold/testsuite/plugin_test_7_2.c: New.
7212
7213 2010-05-26  Rafael Espindola  <espindola@google.com>
7214
7215         * script-sections.cc (Output_section_definition::set_section_addresses):
7216         Check for --section-start.
7217
7218 2010-05-26  Doug Kwan  <dougkwan@google.com>
7219
7220         * arm.cc (Arm_scan_relocatable_relocs): New class.
7221         (Target_arm::relocate_special_relocatable): New method.
7222         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7223         (Arm_relocate_functions::thumb_branch_common): Same.
7224         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7225         instead of Default_scan_relocatable_relocs.
7226         * target-reloc.h (relocate_for_relocatable): Let target handle
7227         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7228         * target.h (Sized_target::relocate_special_relocatable): New method.
7229
7230 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7231
7232         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7233
7234 2010-05-23  Doug Kwan  <dougkwan@google.com>
7235
7236         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7237         instead of a cast.
7238         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7239         with a direct branch, not a conditional branch, to a stub.
7240         * merge.cc (Output_merge_base::record_input_section): New method
7241         defintion.
7242         (Output_merge_data::do_add_input_section): Record input section if
7243         keeps-input-sections flag is set.
7244         (Output_merge_string::do_add_input_section): Ditto.
7245         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7246         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7247         INPUT_SECTIONS_.
7248         (Output_merge_base::keeps_input_sections,
7249         Output_merge_base::set_keeps_input_sections,
7250         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7251         method definitions.
7252         (Output_merge_base::Input_sections): New type declaration.
7253         (Output_merge_base::input_sections_begin,
7254         Output_merge_base::input_sections_end,
7255         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7256         (Output_merge_base::bool keeps_input_sections_,
7257         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7258         Output_merge_base::input_sections_): New data members.
7259         (Output_merge_data::do_set_keeps_input_sections): New method
7260         defintion.
7261         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7262         * output.cc (Output_section::Input_section::relobj): Move method
7263         defintion from class declaration to here and handle merge sections.
7264         (Output_section::Input_section::shndx): Ditto.
7265         (Output_section::Output_section): Remove initializations of removed
7266         data members and initialize new data member LOOKUP_MAPS_.
7267         (Output_section::add_input_section): Set keeps-input-sections flag
7268         for a newly created merge output section as appropriate.  Adjust code
7269         to use Output_section_lookup_maps class.
7270         (Output_section::add_relaxed_input_section): Adjst code for lookup
7271         maps code refactoring.
7272         (Output_section::add_merge_input_section): Add a new parameter
7273         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7274         class.  If adding input section to a newly created merge output
7275         section fails, remove the new merge section.
7276         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7277         Adjust code for use of the Output_section_lookup_maps class.
7278         (Output_section::find_merge_section): Ditto.
7279         (Output_section::build_lookup_maps): New method defintion.
7280         (Output_section::find_relaxed_input_section): Adjust code to use
7281         Output_section_lookup_maps class.
7282         (Output_section::get_input_sections): Export merge sections.  Adjust
7283         code to use Output_section_lookup_maps class.
7284         (Output_section:::add_script_input_section): Adjust code to use
7285         Output_section_lookup_maps class.  Update lookup maps for merge
7286         sections also.
7287         (Output_section::discard_states): Use Output_section_lookup_maps.
7288         (Output_section::restore_states): Same.
7289         * output.h (Merge_section_properties): Move class defintion out of
7290         Output_section.
7291         (Output_section_lookup_maps): New class.
7292         (Output_section::Input_section::is_merge_section): New method
7293         defintion.
7294         (Output_section::Input_section::relobj): Move defintion out of class
7295         defintion.  Declare method only.
7296         (Output_section::Input_section::shndx): Ditto.
7297         (Output_section::Input_section::output_merge_base): New method defintion.
7298         (Output_section::Input_section::u2_.pomb): New union field.
7299         (Output_section::Merge_section_by_properties_map,
7300         Output_section::Output_section_data_by_input_section_map,
7301         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7302         Remove types.
7303         (Output_section::add_merge_input_section): Add new parameter
7304         KEEPS_INPUT_SECTIONS.
7305         (Output_section::build_lookup_maps): New method declaration.
7306         (Output_section::merge_section_map_,
7307         Output_section::merge_section_by_properties_map_,
7308         Output_section::relaxed_input_section_map_,
7309         Output_section::is_relaxed_input_section_map_valid_): Remove data
7310         members.
7311         (Output_section::lookup_maps_): New data member.
7312
7313 2010-05-21  Doug Kwan  <dougkwan@google.com>
7314
7315         PR gold/11619
7316         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7317         avoid a compilation error.
7318
7319 2010-05-19  Rafael Espindola  <espindola@google.com>
7320
7321         * script-sections.cc (Output_section_definition::allocate_to_segment):
7322         Update the phdrs_list even when the output section is NULL.
7323         * testsuite/Makefile.am: Add test.
7324         * testsuite/Makefile.in: Regenerate.
7325         * testsuite/script_test_9.cc: New.
7326         * testsuite/script_test_9.sh: New.
7327         * testsuite/script_test_9.t: New.
7328
7329 2010-05-19  Doug Kwan  <dougkwan@google.com>
7330
7331         * arm.cc (Arm_input_section::original_size): New method.
7332         (Arm_input_section::do_addralign): Add a cast.
7333         (Arm_input_section::do_output_offset): Remove static cast.
7334         (Arm_input_section::original_addralign,
7335          Arm_input_section::original_size_): Change type to uint32_t.
7336         (Arm_input_section::init): Add safe casts for section alignment
7337         and size.
7338         (Arm_input_section::set_final_data_size): Do not set address and
7339         offset of stub table.
7340         (Arm_output_section::fix_exidx_coverage): Change use of of
7341         Output_section::Simple_input_section to that of
7342         Output_section::Input_section.
7343         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7344         except for the first pass.
7345         * output.cc (Output_section::get_input_sections): Change type of
7346         input_sections to std::list<Input_section>.
7347         (Output_section::add_script_input_section): Rename from
7348         Output_section::add_simple_input_section.  Change type of SIS
7349         parameter from Simple_input_section to Input_section.
7350         * output.h (Output_section::Simple_input_section): Remove class.
7351         (Output_section::Input_section): Change class visibility to public.
7352         (Output_section::Input_section::addralign): Use stored alignments
7353         for special input sections if set.
7354         (Output_section::Input_section::set_addralign): New method.
7355         (Output_section::get_input_sections): Change parameter type from
7356         list of Simple_input_section to list of Input_section.
7357         (Output_section::add_script_input_section): Rename from
7358         Output_section::add_simple_input_section. Change first parameter's
7359         type from Simple_input_section to Input_section and remove the
7360         second and third parameters.
7361         * script-sections.cc (Input_section::Input_section_list): Change
7362         type to list of Output_section::Input_section/
7363         (Input_section_info::Input_section_info): Change parameter type of
7364         INPUT_SECTION to Output_section::Input_section.
7365         (Input_section_info::input_section): Change return type.
7366         (Input_section_info::input_section_): Change type to
7367         Output_section::Input_section.
7368         (Output_section_element_input::set_section_addresses): Adjust code
7369         to use Output_section::Input_section instead of
7370         Output_section::Simple_input_section.  Adjust code for renaming
7371         of Output_section::add_simple_input_section.
7372         (Orphan_output_section::set_section_addresses): Ditto.
7373
7374 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7375
7376         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7377         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7378
7379 2010-05-18  Rafael Espindola  <espindola@google.com>
7380
7381         * options.cc (General_options::finalize): Handle -nostdlib.
7382         * options.h (nostdlib): New option.
7383         * script.cc (script_add_search_dir): Handle -nostdlib.
7384
7385 2010-05-12  Doug Kwan  <dougkwan@google.com>
7386
7387         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7388         attributes section only if there no attributes section after merging.
7389         (Target_arm::merge_object_attributes): Move value of
7390         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7391         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7392         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7393         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7394         and arm_attr_merge_7.stdout.
7395         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7396         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7397         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7398         arm_attr_merge_7b.o): New rules.
7399         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7400         arm_attr_merge_7
7401         * testsuite/Makefile.in: Regenerate.
7402         * testsuite/arm_attr_merge.sh: New file.
7403         * testsuite/arm_attr_merge_[67][ab].s: Same.
7404
7405 2010-05-05  Nick Clifton  <nickc@redhat.com>
7406
7407         * po/es.po: Updated Spanish translation.
7408
7409 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7410
7411         * Makefile.am (install-exec-local): Properly install gold as
7412         default cross linker.
7413         * Makefile.in: Regenerated.
7414
7415 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7416             Nick Clifton  <nickc@redhat.com>
7417
7418         * configure.ac (install_as_default): Define and set to false
7419         unless --enable-gold or --enable-gold=both/gold has been
7420         specified.
7421         * configure: Regenerate.
7422
7423         * Makefile.am (install-exec-local): Install the executable as
7424         'ld.gold'.  If install_as_default is true then also install it as
7425         'ld'.
7426         * Makefile.in: Regenerated.
7427
7428 2010-04-24  Ian Lance Taylor  <iant@google.com>
7429
7430         * layout.cc (Layout::layout_reloc): In relocatable link don't
7431         combine reloc sections for grouped sections.
7432
7433 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7434
7435         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7436         sections that are not ordinary to icf.
7437         * icf.cc (get_section_contents): Handle relocation pointing to section
7438         with no object or shndx information.
7439         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7440         * testsuite/Makefile.in: Regenerate.
7441         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7442         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7443
7444 2010-04-22  Ian Lance Taylor  <iant@google.com>
7445
7446         * expression.cc (Expression::Expression_eval_info): Add
7447         result_alignment_pointer field.
7448         (Expression::eval_with_dot): Add result_alignment_pointer
7449         parameter.  Change all callers.
7450         (Expression::eval_maybe_dot): Likewise.
7451         (class Binary_expression): Add alignment_pointer parameter to
7452         left_value and right_value.  Change all callers.
7453         (BINARY_EXPRESSION): Set result alignment.
7454         (class Trinary_expression): Add alignment_pointer parameter to
7455         arg2_value and arg3_value.  Change all callers.
7456         (Trinary_cond::value): Set result alignment.
7457         (Max_expression::value, Min_expression::value): Likewise.
7458         (Align_expression::value): Likewise.
7459         * script-sections.cc (class Sections_element): Add dot_alignment
7460         parameter to set_section_addresses virtual function.  Update
7461         instantiations.
7462         (class Output_section_element): Likewise.
7463         (Script_sections::create_segments): Add dot_alignment parameter.
7464         Change all callers.
7465         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7466         (Script_sections::set_phdrs_clause_addresses): Likewise.
7467         * script-sections.h: Update declarations.
7468         * script.h: Update declarations.
7469         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7470         min_p_align.
7471         * testsuite/script_test_3.t: Set large alignment.
7472         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7473         segment has expected alignment.
7474
7475 2010-04-22  Nick Clifton  <nickc@redhat.com>
7476
7477         * po/gold.pot: Updated by the Translation project.
7478         * po/vi.po: Updated Vietnamese translation.
7479
7480 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7481
7482         * testsuite/Makefile.am (check_PROGRAMS): Add
7483         icf_virtual_function_folding_test.
7484         * testsuite/Makefile.in: Regenerated.
7485
7486 2010-04-15  Andrew Haley  <aph@redhat.com>
7487
7488         * options.h (merge_exidx_entries): New option.
7489         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7490         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7491         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7492         (Target_arm::merge_exidx_entries): New function.
7493         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7494         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7495         to Arm_exidx_fixup constructor.
7496         Add new arg, merge_exidx_entries.
7497         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7498         Arm_output_section::fix_exidx_coverage.
7499
7500 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7501
7502         * icf.cc (get_section_contents): Check for preemptible functions.
7503         Ignore addend when appropriate.
7504         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7505         section folded.
7506         (add_from_relobj): Check for section folded.
7507         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7508         * symtab.h (should_add_dynsym_entry): Add new parameter.
7509         * target-reloc.h (scan_relocs): Check for section folded.
7510         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7511         Check reloc types for function pointers in shared objects.
7512         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7513         case.
7514         (icf_preemptible_functions_test): New test case.
7515         (icf_string_merge_test): New test case.
7516         * testsuite.Makefile.in: Regenerate.
7517         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7518         bar_glob.  Refactor code.
7519         * testsuite/icf_preemptible_functions_test.cc: New file.
7520         * testsuite/icf_preemptible_functions_test.sh: New file.
7521         * testsuite/icf_string_merge_test.cc: New file.
7522         * testsuite/icf_string_merge_test.sh: New file.
7523         * testsuite/icf_virtual_function_folding_test.cc: New file.
7524         * testsuite/icf_virtual_function_folding_test.sh: New file.
7525
7526 2010-04-14  Doug Kwan  <dougkwan@google.com>
7527
7528         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7529         for local symbol recounting if we remove a section due to ICF.
7530         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7531         there are no regular objects in input.
7532
7533 2010-04-13  Doug Kwan  <dougkwan@google.com>
7534
7535         * arm.cc (Arm_input_section::set_final_data_size): Compute
7536         accurate final data size instead of using current data size.
7537
7538 2010-04-09  Doug Kwan  <dougkwan@google.com>
7539
7540         * layout.cc (Layout::choose_output_section): Handle script section
7541         types.
7542         (Layout::make_output_section_for_script): Add section type parameter.
7543         Handle script section types.
7544         * layout.h (Layout::make_output_section_for_script): Add section
7545         type parameter.
7546         * output.cc (Output_section::Output_section): Initialize data member
7547         is_noload_.
7548         (Output_section::do_reset_address_and_file_offset): Do not set address
7549         to 0 if section is a NOLOAD section.
7550         * output.h (Output_section::is_noload): New method.
7551         (Output_section::set_is_noload): Ditto.
7552         (Output_section::is_noload_): New data member.
7553         * script-c.h (Script_section_type): New enum type.
7554         (struct Parser_output_section_header): Add new file section_type.
7555         * script-sections.cc (Sections_element::output_section_name): Add
7556         parameter for returning script section type.
7557         (Output_section_definition::output_section_name): Ditto.
7558         (Output_section_definition::section_type)P; New method.
7559         (Output_section_definiton::script_section_type_name): Ditto.
7560         (Output_section_definition::script_section_type_): New data member.
7561         (Output_section_definition::Output_section_definition): Initialize
7562         data member Output_section_definition::script_section_type_.
7563         (Output_section_definition::create_sections): Pass script section type
7564         to Layout::make_output_section_for_script.
7565         (Output_section_definition::output_section_name): Return script
7566         section type to caller.
7567         (Output_section_definition::set_section_address): Do not advance
7568         dot value and load address if section type is NOLOAD.  Set address
7569         of NOLOAD sections regardless of section flags.
7570         (Output_section_definition::print): Print section type if it is
7571         not SCRIPT_SECTION_TYPE_NONE.
7572         (Output_section_definition::section_type): New method.
7573         (Output_section_definition::script_section_type_name): Ditto.
7574         (Script_sections::output_section_name): Add new parameter
7575         PSECTION_TYPE for returning script section type.  Pass it to
7576         section elements.  Handle discard sections.
7577         (Sort_output_sections::operator()): Handle NOLOAD sections.
7578         * script-sections.h (Script_sections::Section_type): New enum type.
7579         (Script_sections::output_section_name): Add a new parameter for
7580         returning script section type.
7581         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7582         INFO and NOLOAD.
7583         * yyscript.y (union): Add new field SECTION_TYPE.
7584         (COPY, DSECT, INFO, NOLOAD): New tokens.
7585         (opt_address_and_section_type): Change type to output_section_header.
7586         (section_type): New non-terminal
7587         (section_header): Handle section type.
7588         (opt_address_and_section_type): Return section type value.
7589
7590 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7591
7592         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7593         * testsuite/plugin_common_test_2.c (foo): Likewise.
7594
7595 2010-04-08  Doug Kwan  <dougkwan@google.com>
7596
7597         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7598         Output_merge_data.
7599         * output.cc (Output_section::add_merge_input_section): Simplify
7600         code and return status of Output_merge_base::add_input_section.
7601         Update merge section map only if Output_merge_base::add_input_section
7602         returns true.
7603
7604 2010-04-07  Doug Kwan  <dougkwan@google.com>
7605
7606         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7607         if section is marked as containing instructions but has no mapping
7608         symbols.
7609         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7610         correct section index.
7611         (Arm_relobj::find_linked_text_section): Ditto.
7612
7613 2010-04-07  Cary Coutant  <ccoutant@google.com>
7614
7615         * archive.cc (include_member): Destroy Read_symbols_data object before
7616         releasing file.
7617         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7618         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7619         (Read_symbols_data::~Read_symbols_data) New destructor.
7620         (Section_relocs::Section_relocs) New constructor.
7621         (Section_relocs::~Section_relocs) New destructor.
7622         (Read_relocs_data::Read_relocs_data) New constructor.
7623         (Read_relocs_data::~Read_relocs_data) New destructor.
7624         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7625         pointers to NULL after deleting.
7626
7627 2010-04-07  Doug Kwan  <dougkwan@google.com>
7628
7629         * arm.cc: Replace "endianity" with "endianness" in comments.
7630         (Arm_exidx_cantunwind): Ditto.
7631         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7632         (Arm_relobj::merge_flags_and_attributes): New method.
7633         (Arm_relobj::merge_flags_and_attributes_): New data member.
7634         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7635         (Arm_relobj::scan_sections_for_stubs): Ditto.
7636         (Arm_relobj::do_read_symbols): Check to see if we really want to
7637         merge processor-specific flags and attributes.  Exit early if
7638         an object is empty except for section names and the undefined symbol.
7639         (Target_arm::do_finalize_sections): Move check for ELF format to
7640         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7641         attributes from a regular object only when we have determined that
7642         it is aapropriate.  Do not create an .ARM.attributes section in
7643         output if there is no regular input object.
7644         (Target_arm::merge_processor_specific_flags): Check
7645         --warn-mismatch before printing any error.
7646         (Target_arm::merge_object_attributes): Ditto.
7647         * gold.cc (queue_middle_tasks): Handle the case in which there is
7648         no regular object in input.
7649         * options.cc (General_options::parse_EB): New method.
7650         (General_options::parse_EL): Same.
7651         (General_options::General_options): Initialize endianness_.
7652         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7653         New options.
7654         (General_options::Endianness): New enum.
7655         (General_options::endianness): New method.
7656         (General_options::endianness_): New data member.
7657         * parameters.cc (Parameters::set_options): Check target endianness.
7658         (Parameters::set_target_once): Ditto.
7659         (Parameters::check_target_endianness): New method.
7660         (parameters_force_valid_target): If either -EL or -EB is specified,
7661         use it to define endianness of default target.
7662         * parameters.h (Parameters::check_target_endianness): New method
7663         declaration.
7664         * target.h (class Target): Change "endianity" to "endianness"
7665         in comments.
7666
7667 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7668
7669         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7670         * configure: Regenerate.
7671         * Makefile.in: Regenerate.
7672         * testsuite/Makefile.in: Regenerate.
7673
7674 2010-04-06  Cary Coutant  <ccoutant@google.com>
7675
7676         gcc PR lto/42757
7677         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7678         prevailing definitions of common symbols.
7679         * testsuite/plugin_test_6.sh: New test case.
7680         * testsuite/plugin_common_test_1.c: New test case.
7681         * testsuite/plugin_common_test_2.c: New test case.
7682         * testsuite/Makefile.am (plugin_test_6): New test case.
7683         * testsuite/Makefile.in: Regenerate.
7684
7685 2010-04-06  Nick Clifton  <nickc@redhat.com>
7686
7687         * po/vi.po: New Vietnamese translation.
7688
7689 2010-03-30  Doug Kwan  <dougkwan@google.com>
7690
7691         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7692
7693 2010-03-25  Doug Kwan  <dougkwan@google.com>
7694
7695         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7696         to avoid a conversion warning on a 32-bit host.
7697
7698 2010-03-24  Ian Lance Taylor  <iant@google.com>
7699
7700         * testsuite/script_test_3.t: Add a TLS segment.
7701         * testsuite/Makefile.am (check_PROGRAMS): Add
7702         tls_phdrs_script_test.
7703         (tls_phdrs_script_test_SOURCES): Define.
7704         (tls_phdrs_script_test_DEPENDENCIES): Define.
7705         (tls_phdrs_script_test_LDFLAGS): Define.
7706         (tls_phdrs_script_test_LDADD): Define.
7707         * testsuite/Makefile.in: Rebuild.
7708
7709 2010-03-23  Cary Coutant  <ccoutant@google.com>
7710
7711         * fileread.cc (find_or_make_view): Fix comment.
7712
7713 2010-03-23  Ian Lance Taylor  <iant@google.com>
7714
7715         * script-sections.cc (class Orphan_section_placement): Define
7716         PLACE_TLS and PLACE_TLS_BSS.
7717         (Orphan_section_placement::Orphan_section_placement): Initialize
7718         new places.
7719         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7720         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7721         (tls_script_test_SOURCES): Define.
7722         (tls_script_test_DEPENDENCIES): Define.
7723         (tls_script_test_LDFLAGS): Define.
7724         (tls_script_test_LDADD): Define.
7725         * testsuite/Makefile.in: Rebuild.
7726
7727 2010-03-22  Doug Kwan  <dougkwan@google.com>
7728
7729         * arm.cc (Arm_relocate_functions::abs8,
7730         Arm_relocate_functions::abs16): Use correct check for overflow
7731         specified in the ARM ELF specs.
7732         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7733         target of a BLX instruction specially.
7734         (Reloc_stub::stub_type_for_reloc): Ditto.
7735         (Relocate::relocate): Use symbolic names instead of numeric relocation
7736         codes to report error.
7737         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7738         workaround.
7739         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7740         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7741         thumb2_blx_out_of_range.stdout
7742         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7743         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7744         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7745         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7746         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7747         thumb2_blx_in_range, thumb2_blx_in_range.o,
7748         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7749         thumb2_blx_out_of_range.o): New rules.
7750         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7751         thumb2_blx_in_range and thumb2_blx_out_of_range.
7752         * testsuite/Makefile.in: Regenerate.
7753         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7754         * testsuite/thumb_blx_in_range.s: New file.
7755         * testsuite/thumb_blx_out_of_range.s: New file.
7756
7757 2010-03-22  Rafael Espindola  <espindola@google.com>
7758
7759         * archive.cc (Should_include): Move to archive.h.
7760         (should_include_member): Make it a member of Archive.
7761         (Lib_group): New.
7762         (Add_lib_group_symbols): New.
7763         * archive.h: Include options.h.
7764         (Archive_member): Moved from Archive.
7765         (Should_include): Moved from archive.cc.
7766         (Lib_group): New.
7767         (Add_lib_group_symbols): New.
7768         * dynobj.cc (do_should_include_member): New.
7769         * dynobj.h (do_should_include_member): New.
7770         * gold.cc (queue_initial_tasks): Update call to queue.
7771         * main.cc (main): Print lib group stats.
7772         * object.cc (do_should_include_member): New.
7773         * object.h: Include archive.h.
7774         (Object::should_include_member): New.
7775         (Object::do_should_include_member): New.
7776         (Sized_relobj::do_should_include_member): New.
7777         * options.cc (General_options::parse_start_lib): New.
7778         (General_options::parse_end_lib): New.
7779         (Input_arguments::add_file): Handle lib groups.
7780         (Input_arguments::start_group): Check we are not in a lib.
7781         (Input_arguments::start_lib): New.
7782         (Input_arguments::end_lib): New.
7783         * options.h (General_options): Add start_lib and end_lib.
7784         (Input_argument::lib_): New.
7785         (Input_argument::lib): New.
7786         (Input_argument::is_lib): New.
7787         (Input_file_lib): New.
7788         (Input_arguments::in_lib_): New.
7789         (Input_arguments::in_lib): New.
7790         (Input_arguments::start_lib): New.
7791         (Input_arguments::end_lib_): New.
7792         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7793         in unused members as preempted.
7794         (Sized_pluginobj::do_should_include_member): New.
7795         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7796         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7797         return the blocker.
7798         (Read_symbols::do_whole_lib_group): New.
7799         (Read_symbols::do_lib_group): New.
7800         (Read_symbols::do_read_symbols): Handle lib groups.
7801         (Read_symbols::get_name): Handle lib groups.
7802         * readsyms.h (Read_symbols): Add an archive member pointer.
7803         (Read_symbols::do_whole_lib_group): New.
7804         (Read_symbols::do_lib_group): New.
7805         (Read_symbols::member_): New.
7806         * script.cc (read_input_script): Update call to queue_soon.
7807
7808 2010-03-19  Doug Kwan  <dougkwan@google.com>
7809
7810         * arm.cc (Stub_table::Stub_table): Initialize new data members
7811         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7812         (Stub_table::add_reloc_stub): Assign stub offset and update
7813         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7814         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7815         New data members.
7816         (Stub_table::update_data_size_and_addralign): Use
7817         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7818         instead of going over all reloc stubs.
7819         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7820         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7821         Stringpool_template::offset_ to size of Stringpool_char.
7822         (Stringpool_template::new_key_offset): Remove code to initialize
7823         Stringpool_template::offset_.
7824         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7825         Stringpool_template::offset_ to zero.
7826
7827 2010-03-15  Doug Kwan  <dougkwan@google.com>
7828
7829         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7830         offset_.
7831         (Stringpool_template::new_key_offset): New method.
7832         (Stringpool_template::add_string): Assign offsets when adding new
7833         strings.
7834         (Stringpool_template::set_string_offsets): Do not set string offsets
7835         when not optimizing.
7836         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7837         member size_.
7838         (Chunked_vector::clear): Clear size_.
7839         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7840         (Chunked_vector::size): Return size_.
7841         (Chunked_vector::push_back): Use size_ to find insert position.
7842         (Chunked_vector::size_): New data member.
7843         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7844         (Stringpool_template::new_key_offset): New method declaration.
7845         (Stringpool_template::offset_): New data member.
7846
7847 2010-03-15   Rafael Espindola  <espindola@google.com>
7848
7849         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7850         Add_symbols' constructor.
7851         * readsyms.h (Add_symbols): Remove the input_group member.
7852
7853 2010-03-10  Ian Lance Taylor  <iant@google.com>
7854
7855         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7856         target to ask whether a reference to a symbol requires a stack
7857         split.
7858         * target.h (Target::is_call_to_non_split): New function.
7859         (Target::do_is_call_to_non_split): Declare virtual function.
7860         * target.cc: Include "symtab.h".
7861         (Target::do_is_call_to_non_split): New function.
7862         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7863
7864 2010-03-10  Cary Coutant  <ccoutant@google.com>
7865
7866         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7867         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7868         (File_read::open[2]): Add whole_file_view_ to list of views.
7869         (File_read::make_view): Remove test of whole_file_view_.
7870         (File_read::find_or_make_view): Create whole_file_view_ if
7871         necessary.
7872         (File_read::clear_views): Replace bool parameter with enum;
7873         adjust all callers.  Don't delete views with permanent data;
7874         do delete cached views and views from archives if
7875         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7876         if clearing the corresponding view.
7877         * fileread.h (File_read::Clear_views_mode): New enum.
7878         (File_read::View::is_permanent_view): New method.
7879         (File_read::clear_views): Replace bool parameter
7880         with enum; adjust all callers.
7881         * options.h (General_options): Change keep_files_mapped option;
7882         add map_whole_files.
7883         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7884         releasing the file.
7885         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7886         the file.
7887
7888 2010-03-10  David S. Miller  <davem@davemloft.net>
7889
7890         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7891
7892 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7893
7894         * icf.cc (get_section_contents): Add '@' marker after processing the
7895         merge reloc.
7896
7897 2010-03-08  Doug Kwan  <dougkwan@google.com>
7898
7899         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7900         due to a conversion warning.
7901         (Arm_relobj::update_output_local_symbol_count): Check for local
7902         symbol with unset output index.
7903
7904 2010-03-05  Ian Lance Taylor  <iant@google.com>
7905
7906         * options.h (class General_options): Add --spare-dynamic-tags.
7907         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7908         --spare-dynamic-tags.
7909
7910 2010-03-05  Ian Lance Taylor  <iant@google.com>
7911
7912         * incremental.cc: Include "libiberty.h".
7913
7914 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7915
7916         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7917         function, is_info_ member.
7918         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7919         (Versions::Versions): Update caller.
7920         (Versions::define_base_version): Likewise.
7921         (Versions::add_def): Likewise.
7922
7923 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7924
7925         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7926         (Scan::possible_function_pointer_reloc): New function.
7927         (Scan::local_reloc_may_be_function_pointer): Change to call
7928         possible_function_pointer_reloc.
7929         (Scan::global_reloc_may_be_function_pointer): Ditto.
7930         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7931         relocations in ".data.rel.ro._ZTV" section.
7932         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7933         * testsuite/icf_safe_so_test.cc: Ditto.
7934         * testsuite/icf_safe_test.cc: Ditto.
7935         * testsuite/icf_safe_test.sh: Ditto.
7936
7937 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7938             Ian Lance Taylor  <iant@google.com>
7939
7940         * target-reloc.h (relocate_section): Check the symbol table index
7941         for -1U before setting the local symbol index.
7942         (scan_relocatable_relocs): If copying the relocation, record that
7943         the local symbol is required.
7944         * object.h (Symbol_value::is_output_symtab_index_set): New
7945         function.
7946         (Symbol_value::may_be_discarded_from_output_symtab): New
7947         function.
7948         (Symbol_value::has_output_symtab_entry): New function.
7949         (Symbol_value::needs_output_symtab_entry): Remove.
7950         (Symbol_value::output_symtab_index): Make sure the symbol index is
7951         set.
7952         (Symbol_value::set_output_symtab_index): Make sure the symbol
7953         index is not set.  Make sure the new index is valid.
7954         (Symbol_value::set_must_have_output_symtab_entry): New function.
7955         (Symbol_value::has_output_dynsym_entry): New function.
7956         (Symbol_value::set_output_dynsym_index): Make sure the new index
7957         is valid.
7958         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7959         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7960         local symbol if permitted.
7961         (Sized_relobj::do_finalize_local_symbols): Call
7962         is_output_symtab_index_set rather than needs_output_symtab_entry.
7963         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7964         rather than needs_output_symtab_entry.  Call
7965         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7966         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7967         is_output_symtab_index_set rather than needs_output_symtab_entry.
7968         * testsuite/discard_locals_relocatable_test.c: New file.
7969         * testsuite/discard_locals_test.sh: Test -r.
7970         * testsuite/Makefile.am (check_DATA): Add
7971         discard_locals_relocatable_test1.syms,
7972         discard_local_relocatable_test2.syms.
7973         (MOSTLYCLEANFILES): Likewise.  Also add
7974         discard_locals_relocatable_test1.lout and
7975         discard_locals_relocatable_test2.out.
7976         (discard_locals_relocatable_test1.syms): New target.
7977         (discard_locals_relocatable_test.o): New target.
7978         (discard_locals_relocatable_test1.out): New target.
7979         (discard_locals_relocatable_test2.syms): New target.
7980         (discard_locals_relocatable_test2.out): New target.
7981         (various): Add missing ../ld-new dependencies.
7982         * testsuite/Makefile.in: Rebuild.
7983
7984 2010-03-03  Nick Clifton  <nickc@redhat.com>
7985
7986         * po/fi.po: New Finnish translation.
7987
7988 2010-03-01  Doug Kwan  <dougkwan@google.com>
7989
7990         * layout.cc (Layout::Layout): Force section types of .init_array*,
7991         .preinit_array* and .fini_array* sections.
7992         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7993         Fix check of return value of std::string::find.().
7994         (Output_section::Input_section_sort_compare::operator()): Remove
7995         comment about .init_array.
7996         (Output_section::Input_section_sort_init_fini_compare::operator()):
7997         New method.
7998         (Output_section::sort_attached_input_sections): Handle .init_array
7999         and .fini_array specially.
8000         * output.h (Output_section::Inut_section_sort_compare): Update
8001         comment.
8002         (Output_section::Input_section_sort_init_fini_compare): New struct.
8003
8004 2010-02-26  Doug Kwan  <dougkwan@google.com>
8005
8006         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8007         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8008         * testsuite/debug_msg.sh: Avoid matching source line number for
8009         use of global variable undef_int.
8010
8011 2010-02-26  Doug Kwan  <dougkwan@google.com>
8012
8013         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8014         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8015         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8016         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8017         * options.cc (General_options::General_options): Initialize member
8018         fix_v4bx_.
8019         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8020         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8021         and rm_no_fix_v4bx.stdout
8022         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8023         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8024         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8025         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8026         and arm_no_fix_v4bx.
8027         * Makefile.in: Regenerate.
8028         * testsuite/arm_fix_v4bx.s: New file.
8029         * testsuite/arm_fix_v4bx.sh: Ditto.
8030
8031 2010-02-24  Doug Kwan  <dougkwan@google.com>
8032
8033         * arm.cc (Target_arm::got_section): Make the .got section the first
8034         non RELRO section in the data segment.
8035         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8036         suffixes of section names.
8037
8038 2010-02-24  Doug Kwan  <dougkwan@google.com>
8039
8040         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8041         flags and attributes merging if an input file is a binary file.
8042         * fileread.cc (Input_file::open): Record format of original file.
8043         * fileread.h (Input_file::Format): New enum type.
8044         (Input_file::Input_file): Initialize data member format_.
8045         (Input_file::format): New method definition.
8046         (Input_file::format_):: New data member.
8047
8048 2010-02-24  Doug Kwan  <dougkwan@google.com>
8049
8050         * arm.cc (Arm_output_data_got): New class.
8051         (ARM_TCB_SIZE): New constant
8052         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8053         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8054         If user uses a script with a SECTIONS clause, issue only a warning
8055         for a misplaced EXIDX input section.  Otherwise, issue an error.
8056         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8057         garbage collection.
8058         (Target_arm::got_mode_index_entry): Handle static linking.
8059         (Target_arm::Scan::local): Ditto.
8060         (Target_arm::Scan::global): Ditto.
8061         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8062         all incorrectly implemented relocations.
8063         (Target_arm::fix_exidx_coverage): Pass layout to
8064         Arm_output_section::fix_exidx_coverage.
8065         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8066         from ".ARM.exidx." and ".ARM.extab.".
8067
8068 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8069
8070         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8071         section if it does not already exist.
8072         * attributes.cc (Attributes_section_data::Attributes_section_data):
8073         Don't crash if size is zero.
8074
8075 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8076             Ian Lance Taylor  <iant@google.com>
8077
8078         * gold.cc (queue_middle_tasks): If no input files were opened,
8079         exit.
8080         * workqueue.h (Task_function::Task_function): Assert that there is
8081         a blocker.
8082
8083 2010-02-22  Doug Kwan  <dougkwan@google.com>
8084
8085         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8086         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8087         types to avoid warnings due to different uint64_t implementations
8088         on different hosts.
8089
8090 2010-02-21  Doug Kwan  <dougkwan@google.com>
8091
8092         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8093         handling of the maximum backward branch offset.
8094         (Arm_relocate_functions::thumb_branch_common): Ditto.
8095         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8096         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8097         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8098         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8099         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8100         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8101         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8102         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8103         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8104         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8105         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8106         thumb2_bl_out_of_range.o): New rules.
8107         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8108         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8109         thumb2_bl_out_of_range
8110         * testsuite/Makefile.in: Regenerate.
8111         * testsuite/arm_bl_in_range.s: New file.
8112         * testsuite/arm_bl_out_of_range.s: Ditto.
8113         * testsuite/arm_branch_in_range.sh: Ditto.
8114         * testsuite/arm_branch_range.t: Ditto.
8115         * testsuite/thumb2_branch_range.t: Ditto.
8116         * testsuite/thumb_bl_in_range.s: Ditto.
8117         * testsuite/thumb_bl_out_of_range.s: Ditto.
8118         * testsuite/thumb_branch_range.t: Ditto.
8119
8120 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8121
8122         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8123         Add reloc offset information.
8124         * icf.cc (get_section_contents): Change iterators to point to the new
8125         vectors. Add reloc offset information to the contents.
8126         * icf.h (Icf::Sections_reachable_info): New typedef.
8127         (Icf::Sections_reachable_list): New typedef.
8128         (Icf::Offset_info): New typedef.
8129         (Icf::Reloc_info): New struct typedef.
8130         (Icf::Reloc_info_list): New typedef.
8131         (Icf::symbol_reloc_list): Delete method.
8132         (Icf::addend_reloc_list): Delete method.
8133         (Icf::section_reloc_list): Delete method.
8134         (Icf::reloc_info_list): New method.
8135         (Icf::reloc_info_list_): New member.
8136
8137 2010-02-19  Doug Kwan  <dougkwan@google.com>
8138
8139         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8140         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8141         * arm.cc (Arm_relocation_functions): New forward declaration.
8142         (Target_arm::Target_arm): Initialize new data members
8143         got_mod_index_offset_ and tls_base_symbol_defined_.
8144         (Target_arm::Relocate::relocate_tls): New method.
8145         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8146          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8147         New methods.
8148         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8149         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8150         (Target_arm::got_mod_index_offset_,
8151         Target_arm::tls_base_symbol_defined_): New data members.
8152         (Target_arm::Scan::local, Target::Scan::global,
8153         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8154         relocations.
8155
8156 2010-02-18  Doug Kwan  <dougkwan@google.com>
8157
8158         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8159         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8160         text section as a parameter becuase some broken tools may not set
8161         the link in section header.
8162         (Target_arm::has_got_section): New method.
8163         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8164         without any mapping symbol as data only.  Remove warning.
8165         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8166         link in its section header, try to discover the link by inspecting the
8167         REL31 relocation at the beginning of the section.
8168         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8169         in error message.
8170         (Target_arm::Scan::global): Treat any reference to the symbol
8171         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8172
8173 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8174
8175         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8176         (Scan::global_reloc_may_be_function_pointer): New function.
8177         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8178         (Scan::global_reloc_may_be_function_pointer): New function.
8179         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8180         (Scan::global_reloc_may_be_function_pointer): New function.
8181         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8182         (Scan::global_reloc_may_be_function_pointer): New function.
8183         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8184         (Scan::global_reloc_may_be_function_pointer): New function.
8185         (Scan::possible_function_pointer_reloc): New function.
8186         (Target_x86_64::can_check_for_function_pointers): New function.
8187         * gc.h (gc_process_relocs): Scan relocation types to determine if
8188         function pointers were taken for targets that support it.
8189         * icf.cc (Icf::find_identical_sections): Include functions for
8190         folding in safe ICF whose pointer is not taken.
8191         * icf.h (Secn_fptr_taken_set): New typedef.
8192         (fptr_section_id_): New member.
8193         (section_has_function_pointers): New function.
8194         (set_section_has_function_pointers): New function.
8195         (check_section_for_function_pointers): New function.
8196         * options.h: Fix comment for safe ICF option.
8197         * target.h (can_check_for_function_pointers): New function.
8198         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8199         Modify icf_safe_test for X86-64.
8200         * testsuite/Makefile.in: Regenerate.
8201         * testsuite/icf_safe_so_test.cc: New file.
8202         * testsuite/icf_safe_so_test.sh: New file.
8203         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8204         (main): Change to take pointer to function kept_func_3.
8205         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8206         folding is done correctly for X86-64.
8207
8208 2010-02-12  David S. Miller  <davem@davemloft.net>
8209
8210         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8211         is_symbolless parameter.
8212         (Output_reloc<SHT_REL>::is_symbolless): New.
8213         (Output_reloc<SHT_REL>::is_symbolless_): New.
8214         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8215         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8216         (Output_reloc<SHT_RELA>::is_symbolless): New.
8217         (Output_data_reloc::add_global): Handle is_symbolless.
8218         (Output_data_reloc::add_global_relative): Likewise.
8219         (Output_data_reloc::add_local): Likewise.
8220         (Output_data_reloc::add_local_relative): Likewise.
8221         (Output_data_reloc::add_symbolless_global_addend): New.
8222         (Output_data_reloc::add_symbolless_local_addend): New.
8223         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8224         is_symbolless.
8225         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8226         instead of ->is_relative_
8227         (Output_reloc::write): Likewise.
8228         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8229         (Output_reloc::write_rel): Simplify.
8230
8231         * sparc.cc (Target_sparc::Scan::local): Use
8232         ->add_symbolless_local_addend as needed.
8233         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8234         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8235         based upon relocation offset.
8236
8237 2010-02-11  Doug Kwan  <dougkwan@google.com>
8238
8239         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8240         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8241         beginning of function.
8242         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8243         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8244         parameter is_32bit in calls to should_apply_static_reloc.
8245         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8246         (check_DATA): Add arm_abs_global.stdout.
8247         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8248         arm_abs_global.stdout): New rules.
8249         (MOSTLLYCLEANFILES): Add arm_abs_global
8250         * Makefile.in: Regenerate.
8251         * testsuite/arm_abs_global.s: New file.
8252         * testsuite/arm_abs_global.sh: Ditto.
8253         * testsuite/arm_abs_lib.s: Ditto.
8254
8255 2010-02-11  Ian Lance Taylor  <iant@google.com>
8256
8257         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8258         Read_relocs task.
8259         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8260         Allocate_commons_task first.
8261         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8262         task, rather than symtab_lock_.
8263         (Gc_process_relocs::~Gc_process_relocs): New function.
8264         (Gc_process_relocs::is_runnable): Check this_blocker_.
8265         (Gc_process_relocs::locks): Use next_blocker_ rather than
8266         blocker_.
8267         (Scan_relocs::~Scan_relocs): New function.
8268         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8269         symtab_lock_.
8270         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8271         next_blocker_.
8272         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8273         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8274         constructor accordingly.
8275         (class Gc_process_relocs): Likewise.
8276         (class Scan_relocs): Likewise.
8277         * common.h (class Allocate_commons_task): Remove symtab_lock_
8278         field, and corresponding constructor parameter.
8279         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8280         symtab_lock_.
8281         (Allocate_commons_task::locks): Likewise.
8282
8283 2010-02-11  Ian Lance Taylor  <iant@google.com>
8284
8285         * gold-threads.h (class Once): Define.
8286         (class Initialize_lock): Rewrite as child of Once.
8287         * gold-threads.cc (class Once_initialize): Define.
8288         (once_pointer_control): New static variable.
8289         (once_pointer, once_arg): New static variables.
8290         (c_run_once): New static function.
8291         (Once::Once, Once::run_once, Once::internal_run): New functions.
8292         (class Initialize_lock_once): Remove.
8293         (initialize_lock_control): Remove.
8294         (initialize_lock_pointer): Remove.
8295         (initialize_lock_once): Remove.
8296         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8297         (Initialize_lock::initialize): Rewrite.
8298         (Initialize_lock::do_run_once): New function.
8299         * archive.cc (Archive::interpret_header): Only clear name if it is
8300         not already empty.
8301         * fileread.cc: Include "gold-threads.h"
8302         (file_counts_lock): New static variable.
8303         (file_counts_initialize_lock): Likewise.
8304         (File_read::release): Only increment counts when using --stats.
8305         Use a lock around the increment.
8306         * parameters.cc (class Set_parameters_target_once): Define.
8307         (set_parameters_target_once): New static variable.
8308         (Parameters::Parameters): Move here from parameters.h.
8309         (Parameters::set_target): Rewrite.
8310         (Parameters::set_target_once): New function.
8311         (Parameters::clear_target): Move here and rewrite.
8312         * parameters.h (class Parameters): Update declarations.  Add
8313         set_parameters_target_once_ field.
8314         (Parameters::Parameters): Move to parameters.cc.
8315         (Parameters::clear_target): Likewise.
8316         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8317         task.
8318         (Start_group::~Start_group): New function.
8319         (Start_group::is_runnable): New function.
8320         (Start_group::locks, Start_group::run): New functions.
8321         (Finish_group::run): Change saw_undefined to size_t.
8322         * readsyms.h (class Start_group): Define.
8323         (class Finish_group): Change saw_undefined_ field to size_t.
8324         (Finish_group::Finish_group): Remove saw_undefined and
8325         this_blocker parameters.  Change all callers.
8326         (Finish_group::set_saw_undefined): New function.
8327         (Finish_group::set_blocker): New function.
8328         * symtab.h (class Symbol_table): Change saw_undefined to return
8329         size_t.  Change saw_undefined_ field to size_t.
8330         * target-select.cc (Set_target_once::do_run_once): New function.
8331         (Target_selector::Target_selector): Initialize set_target_once_
8332         field.  Don't initialize lock_ and initialize_lock_ fields.
8333         (Target_selector::instantiate_target): Rewrite.
8334         (Target_selector::set_target): New function.
8335         * target-select.h (class Set_target_once): Define.
8336         (class Target_selector): Update declarations.  Make
8337         Set_target_once a friend.  Remove lock_ and initialize_lock_
8338         fields.  Add set_target_once_ field.
8339
8340 2010-02-10  Ian Lance Taylor  <iant@google.com>
8341
8342         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8343         queueing any tasks.
8344         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8345         (queue_middle_tasks): Add all blockers before queueing any tasks.
8346         (queue_final_tasks): Likewise.
8347         * token.h (Task_token::add_blockers): New function.
8348         * object.h (Input_objects::number_of_relobjs): New function.
8349
8350 2010-02-10  Ian Lance Taylor  <iant@google.com>
8351
8352         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8353         shared, not if not position independent.
8354         * x86_64.cc (Relocate::relocate_tls): Likewise.
8355         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8356         (tls_pie_pic_test): New target.
8357         * testsuite/Makefile.in: Rebuild.
8358
8359         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8360         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8361         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8362         * testsuite/Makefile.in: Rebuild.
8363
8364 2010-02-09  David S. Miller  <davem@davemloft.net>
8365
8366         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8367         R_SPARC_RELATIVE using ->add_local_relative().
8368         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8369
8370         * output.h (Output_data_dynamic::add_section_size): New method
8371         that takes two Output_data objects.
8372         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8373         entry param.  Handle it in initializers.
8374         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8375         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8376         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8377         arg.
8378         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8379         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8380         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8381         for dynrel_includes_plt.
8382         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8383         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8384         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8385         before .rela.plt
8386         (Target_sparc::do_finalize_sections): Update to pass true for
8387         dynrel_includes_plt.
8388         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8389         output before .rela.plt
8390         (Target_powerpc::do_finalize_sections): Update to pass true for
8391         dynrel_includes_plt when 32-bit.
8392
8393 2010-02-08  Doug Kwan  <dougkwan@google.com>
8394
8395         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8396         method.
8397         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8398         Arm_relobj::scan_section_for_cortex_a8_stubs,
8399         Arm_relobj::do_relocation_section): Instead of calling
8400         Output_section::output_address, use faster
8401         Arm_relobj::simple_input_section_output_address.
8402
8403 2010-02-08  David S. Miller  <davem@davemloft.net>
8404
8405         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8406         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8407         relocation helper function.
8408
8409         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8410         just like R_SPARC_GOT{10,13,22}.
8411         (Target_sparc::Scan::local): Likewise.
8412         (Target_sparc::Relocate:relocate): Likewise.
8413
8414 2010-02-06  Ian Lance Taylor  <iant@google.com>
8415
8416         * configure.ac: Rewrite targetobjs duplicate removal code to use
8417         only shell constructs.
8418         * configure: Rebuild.
8419
8420 2010-02-05  Doug Kwan  <dougkwan@google.com>
8421
8422         PR 11247
8423         * arm.cc (Arm_relobj::section_is_scannable): New method.
8424         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8425         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8426
8427 2010-02-04  Doug Kwan  <dougkwan@google.com>
8428
8429         PR 11247
8430         * arm-reloc-property.cc (cstdio): Include.
8431         * configure.ac (targetobjs): Remove duplicates.
8432         * configure: Regenerate.
8433         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8434         big and little endian version for a given address size.
8435
8436 2010-02-03  Doug Kwan  <dougkwan@google.com>
8437
8438         * arm-reloc-property.cc
8439         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8440         definition.
8441         * arm-reloc-property.h
8442         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8443         New method definition.
8444         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8445         declaration.
8446         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8447         overflow to N.
8448         (GOT_PREL): Change implemented to Y.
8449         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8450         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8451         (Arm_relocate_functions::movw_abs_nc): Remove method.
8452         (Arm_relocate_functions::movt_abs): Ditto.
8453         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8454         (Arm_relocate_functions::thm_movt_abs): Ditto.
8455         (Arm_relocate_functions::movw_rel_nc): Ditto.
8456         (Arm_relocate_functions::movw_rel): Ditto.
8457         (Arm_relocate_functions::movt_rel): Ditto.
8458         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8459         (Arm_relocate_functions:thm_movw_rel): Ditto.
8460         (Arm_relocate_functions:thm_movt_rel): Ditto.
8461         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8462         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8463         New method definitions.
8464         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8465         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8466         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8467         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8468         (Target_arm::Relocate::relocate): Check for non-static or
8469         unimplemented relocation code and exit early.  Change calls to
8470         Target_arm::reloc_uses_thumb_bit and
8471         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8472         instead.  Refactor code to handle similar relocations to increase
8473         code sharing.  Remove check for unsupported relocation code in switch
8474         statement.
8475         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8476         relocation property table to find out size.  Change error message to
8477         print out the name of a relocation code instead of the numeric value.
8478         (Target_arm::scan_reloc_for_stub): Use relocation property table
8479         instead of calling Target_arm::reloc_uses_thumb_bit().
8480
8481 2010-02-02  Doug Kwan  <dougkwan@google.com>
8482
8483         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8484         types of relaxed input section.
8485
8486 2010-02-02  Doug Kwan  <dougkwan@google.com>
8487
8488         * Makefile.am (HFILES): Add arm-reloc-property.h.
8489         (DEFFILES): New.
8490         (TARGETSOURCES): Add arm-reloc-property.cc
8491         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8492         (libgold_a_SOURCES): $(DEFFILES)
8493         * Makefile.in: Regenerate.
8494         * arm-reloc-property.cc: New file.
8495         * arm-reloc-property.h: New file.
8496         * arm-reloc.def: New file.
8497         * arm.cc: Update comments.
8498         (arm-reloc-property.h): New included header.
8499         (arm_reloc_property_table): New global variable.
8500         (Target_arm::do_select_as_default_target): New method definition.
8501         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8502         arm-reloc-property to targ_extra_obj.
8503         * parameters.cc (set_parameters_target): Call
8504         Target::select_as_default_target().
8505         * target.h (Target::select_as_default_target): New method definition.
8506         (Target::do_select_as_default_target): Same.
8507
8508 2010-02-01  Doug Kwan  <dougkwan@google.com>
8509
8510         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8511         first_output_text_section_.
8512         (Arm_exidx_fixup::first_output_text_section): New method definition.
8513         (Arm_exidx_fixup::first_output_text_section_): New data member.
8514         (Arm_exidx_fixup::process_exidx_section): Record the first text
8515         output section seen.
8516         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8517         and entsize in output section header.
8518
8519 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8520
8521         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8522         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8523         (Arm_relocate_functions::thm_alu11): New Method.
8524         (Arm_relocate_functions::thm_pc8): New Method.
8525         (Arm_relocate_functions::thm_pc12): New Method.
8526         (Target_arm::Scan::local): Handle the relocations.
8527         (Target_arm::Scan::global): Likewise.
8528         (Target_arm::Relocate::relocate): Likewise.
8529         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8530
8531 2010-01-29  Doug Kwan  <dougkwan@google.com>
8532
8533         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8534         of relocation types as ld.
8535
8536 2010-01-29  Doug Kwan  <dougkwan@google.com>
8537
8538         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8539         to public.
8540         (Arm_relocate_functions::thumb_branch_common): Ditto.
8541         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8542         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8543         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8544         Arm_relocate_functions::jump24): Remove.
8545         (Target_arm::Relocate::relocate): Adjust code to call
8546         Arm_relocation_functions::arm_branch_common and
8547         Arm_relocation_functions::thumb_branch_common instead of their removed
8548         wrappers.  Merge switch-cases together to reduce source code size.
8549
8550 2010-01-29  Doug Kwan  <dougkwan@google.com>
8551
8552         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8553         output_local_symbol_count_needs_update_.
8554         (Arm_relobj::output_local_symbol_count_needs_update,
8555          Arm_relobj::set_output_local_symbol_count_needs_update,
8556          Arm_relobj::update_output_local_symbol_count): New methods.
8557         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8558         member.
8559         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8560         of pointed function as in a R_ARM_PREL31 relocation.
8561         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8562         for output local symbol count updating.
8563         (Target_arm::do_relax): Update output local symbol counts in objects
8564         if necessary.
8565         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8566
8567 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8568
8569         * arm.cc: Added support for the ARM relocations:
8570         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8571         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8572         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8573         movw_prel_nc).
8574         (Arm_relocate_functions::movw_rel): New method.
8575         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8576         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8577         thm_movw_prel_nc).
8578         (Arm_relocate_functions::thm_movw_rel): New method.
8579         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8580         thm_movt_prel).
8581         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8582         relocations.
8583         (Target_arm::Scan::global): Likewise.
8584         (Target_arm::Relocate::relocate): Likewise.
8585         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8586         Likewise.
8587
8588 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8589
8590         * arm.cc: Added support for ARM group relocations.
8591         (Target_arm::reloc_needs_sym_origin): New method.
8592         (Arm_relocate_functions::calc_grp_kn): New method.
8593         (Arm_relocate_functions::calc_grp_residual): New method.
8594         (Arm_relocate_functions::calc_grp_gn): New method.
8595         (Arm_relocate_functions::arm_grp_alu): New Method.
8596         (Arm_relocate_functions::arm_grp_ldr): New Method.
8597         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8598         (Arm_relocate_functions::arm_grp_ldc): New Method.
8599         (Target_arm::Scan::local): Handle the ARM group relocations.
8600         (Target_arm::Scan::global): Likewise.
8601         (Target_arm::Relocate::relocate): Likewise.
8602         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8603         Likewise.
8604
8605 2010-01-26  Doug Kwan  <dougkwan@google.com>
8606
8607         * arm.cc (set): Include.
8608         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8609         pointer type.
8610         (Arm_output_section::Text_section_list): New type.
8611         (Arm_output_section::append_text_sections_to_list): New method.
8612         (Arm_output_section::fix_exidx_coverage): Ditto.
8613         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8614         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8615         Relobj::set_section_offset() instead of
8616         Sized_relobj::invalidate_section_offset().
8617         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8618         parameter for section headers. Ignore relocation sections for
8619         unallocated sections and EXIDX sections.
8620         (Target_arm::fix_exidx_coverage): New method.
8621         (Target_arm::output_section_address_less_than): New type.
8622         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8623         linked text section instead of the EXIDX section.
8624         (Arm_output_section::create_stub_group): Add an assertion to check
8625         that this is not an EXIDX output section.
8626         (Arm_output_section::append_text_sections_to_list): New method.
8627         (Arm_output_section::fix_exidx_coverage): Ditto.
8628         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8629         Arm_relobj::section_needs_reloc_stub_scanning.
8630         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8631         first pass.
8632         (Target_arm::fix_exidx_coverage): New method.
8633         * object.h (Relobj::set_output_section): New method.
8634         (Sized_relobj::invalidate_section_offset): Remove method.
8635         (Sized_relobj::do_invalidate_section_offset): Remove method.
8636         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8637
8638 2010-01-25  Doug Kwan  <dougkwan@google.com>
8639
8640         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8641         Fix warning due to signed and unsigned comparison on a 32-bit host.
8642
8643 2010-01-22  Doug Kwan  <dougkwan@google.com>
8644
8645         * arm.cc (Target_arm::do_relax): Record an output section for section
8646         offset adjustment it contains any stub table that has changed.
8647         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8648         offsets in an output section if necessary.
8649         * output.cc (Output_section::Output_section): Initialize
8650         section_offsets_need_adjustments_.
8651         (Output_section::add_input_section_for_script): Renamed to
8652         Output_section::add_simple_input_section.
8653         (Output_section::save_states): Add a comment.
8654         (Output_section::discard_states): New method defintion.
8655         (Output_section::adjust_section_offsets): Same.
8656         * output.h (Output_section::add_input_section_for_script): Renamed to
8657         Output_section::add_simple_input_section.
8658         (Output_section::discard_states): New method declaration.
8659         (Output_section::adjust_section_offsets): Same.
8660         (Output_section::section_offsets_need_adjustment,
8661         Output_section::set_section_offsets_need_adjustment): New method
8662         definitions.
8663         (Output_section::section_offsets_need_adjustment_): New data member.
8664         * script-sections.cc
8665         (Output_section_element_input::set_section_address): Adjust code for
8666         renaming of Output_section::add_input_section_for_script.
8667         (Orphan_output_section::set_section_address): Same.
8668
8669 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8670
8671         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8672         Fix_v4bx enum values .
8673         * gold/options.h (General_options): New option definitions.
8674         (General_options::fix_v4bx): New method.
8675         (General_options::Fix_v4bx): New enum.
8676         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8677         (General_options::parse_fix_v4bx_interworking): New method.
8678
8679 2010-01-22  Doug Kwan  <dougkwan@google.com>
8680
8681         * arm.cc (Arm_exidx_fixup): New class.
8682
8683 2010-01-21  Doug Kwan  <dougkwan@google.com>
8684
8685         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8686         classes.
8687         (Arm_exidx_section_offset_map): New type.
8688
8689 2010-01-21  Doug Kwan  <dougkwan@google.com>
8690
8691         * arm.cc (Arm_exidx_input_section): New class.
8692         (Arm_relobj::exidx_input_section_by_link,
8693         Arm_relobj::exidx_input_section_by_shndx,
8694         Arm_relobj::make_exidx_input_section): New methods.
8695         (read_arm_attributes_section): Remove.
8696         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8697         information about them.
8698         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8699         to here.
8700
8701 2010-01-20  Doug Kwan  <dougkwan@google.com>
8702
8703         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8704         Input_section_specifier to Section_id.
8705         (Target_arm::new_arm_input_section: Adjust code for change of key
8706         type.
8707         (Target_arm::find_arm_input_section): Ditto.
8708         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8709         (Section_id): Remove.
8710         (Garbage_collection::Section_id_hash): Remove.
8711         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8712         (Section_id): Remove.
8713         (Icf::Section_id_hash): Remove.
8714         * object.h (Section_id, Const_section_id, Section_id_hash,
8715         Const_section_id_hash): New type definitions.
8716         * output.cc (Output_section::add_relaxed_input_section): Change to
8717         use Const_section_id instead of Input_section_specifier as key type.
8718         (Output_section::add_merge_input_section): Ditto.
8719         (Output_section::build_relaxation_map): Change to use Section_id
8720         instead of Input_section_specifier as key type.
8721         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8722         Ditto.
8723         (Output_section::convert_input_sections_to_relaxed_sections): Change
8724         to use Const_section_id instead of Input_section_specifier as key type.
8725         (Output_section::find_merge_section): Ditto.
8726         (Output_section::find_relaxed_input_section): Ditto.
8727         * output.h (Input_section_specifier): Remove class.
8728         (Output_section::Output_section_data_by_input_section_map): Change
8729         key type to Const_section_id.
8730         (Output_section::Output_relaxed_input_section_by_input_section_map):
8731         Ditto.
8732         (Output_section::Relaxation_map): Change key type to Section_id.
8733
8734 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8735
8736         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8737         (class Arm_v4bx_stub): New class.
8738         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8739         (Stub_factory::make_arm_v4bx_stub): New method.
8740         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8741         (Stub_table::empty): Handle v4bx stubs.
8742         (Stub_table::add_arm_v4bx_stub): New method.
8743         (Stub_table::find_arm_v4bx_stub): New method.
8744         (Arm_relocate_functions::v4bx): New method.
8745         (Target_arm::fix_v4bx): New method.
8746         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8747         (Stub_table::relocate_stubs): Likewise.
8748         (Stub_table::do_write): Likewise.
8749         (Stub_table::update_data_size_and_addralign): Likewise.
8750         (Stub_table::finalize_stubs):  Likewise.
8751         (Target_arm::Scan::local): Likewise.
8752         (Target_arm::Scan::global): Likewise.
8753         (Target_arm::do_finalize_sections): Likewise.
8754         (Target_arm::Relocate::relocate): Likewise.
8755         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8756         Likewise.
8757         (Target_arm::scan_reloc_for_stub): Likewise.
8758         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8759
8760 2010-01-19  Ian Lance Taylor  <iant@google.com>
8761
8762         * output.cc (Output_section_headers::do_sized_write): Write large
8763         segment count to sh_info field.
8764         (Output_file_header::do_sized_write): For large segment count,
8765         write PN_XNUM to e_phnum field.
8766
8767 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8768
8769         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8770         (Arm_relocate_functions::thm_jump8): New function.
8771         (Arm_relocate_functions::thm_jump11): New function.
8772         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8773         R_ARM_THM_JUMP11.
8774         (Target_arm::Scan::global): Likewise.
8775         (Target_arm::Relocate::relocate): Likewise.
8776         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8777         Likewise.
8778
8779 2010-01-14  Doug Kwan  <dougkwan@google.com>
8780
8781         * arm.cc (map, utility): Include headers.
8782         (Target_arm::apply_cortex_a8_workaround): New method.
8783         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8784         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8785         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8786         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8787         the --[no-]fix-cortex-a8 command line options.
8788         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8789         (Target_arm::relocate_stub): Use addend in instruction template.
8790         * options.h (DEFINE_bool): Set the user-set flag.
8791         (General_options): Add --[no-]-fix-cortex options.
8792         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8793         : Update fast look-up map after conversion.
8794
8795 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8796
8797         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8798         in the first pass of do_layout.
8799
8800 2010-01-13  Doug Kwan  <dougkwan@google.com>
8801
8802         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8803         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8804         apparent compiler problem of not folding static constant integral
8805         data members of elfcpp::Elf_sizes<32>.
8806
8807 2010-01-13  Doug Kwan  <dougkwan@google.com>
8808
8809         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8810         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8811         Arm_relobj::scan_section_for_cortex_a8_erratum,
8812         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8813         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8814         sections to scan for relocation stubs into a new method
8815         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8816         relocation and Cortex-A8 stub scanning.
8817         (Target_arm::do_relax): Force stubs to be after stubbed sections
8818         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8819         the beginning of a new relaxation pass.  Update a comment.
8820         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8821
8822 2010-01-12  Ian Lance Taylor  <iant@google.com>
8823
8824         * target-reloc.h (visibility_error): New inline function.
8825         (relocate_section): Call visibility_error.
8826         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8827         (MOSTLYCLEANFILES): Likewise.
8828         (protected_4_pic.o, protected_3.err): New targets.
8829         * testsuite/protected_4.cc: New file.
8830
8831 2010-01-12  Doug Kwan  <dougkwan@google.com>
8832
8833         * arm.cc (Cortex_a8_reloc): New class.
8834         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8835         and cortex_a8_relocs_info_.
8836         (Target_arm::fix_cortex_a8): New method definition.
8837         (Target_arm::Cortex_a8_relocs_info): New type.
8838         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8839         New data member declarations.
8840         (Target_arm::scan_reloc_for_stub): Record information about
8841         relocations for THUMB branches that might be exempted from the
8842         Cortex-A8 workaround.
8843         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8844         at the beginning of a relaxation pass.
8845
8846 2010-01-12  Doug Kwan  <dougkwan@google.com>
8847
8848         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8849         (Arm_relobj::Mapping_symbol_position,
8850          Arm_reloj::Mapping_symbol_position_less,
8851          Arm_relobj::Mapping_symbols_info): New types.
8852         (Target_arm::is_mapping_symbol_name): New method definition.
8853         (Arm_relobj::do_count_local_symbols): Save information about mapping
8854         symbols.
8855
8856 2010-01-11  Doug Kwan  <dougkwan@google.com>
8857
8858         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8859         Arm_relocate_functions::thumb32_branch_upper,
8860         Arm_relocate_functions::thumb32_branch_lower,
8861         Arm_relocate_functions::thumb32_cond_branch_offset,
8862         Arm_relocate_functions::thumb32_cond_branch_upper,
8863         Arm_relocate_functions::thumb32_cond_branch_lower,
8864         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8865         branch offset encoding.
8866         (Arm_relocate_functions::thumb_branch_common): Use new branch
8867         offset encoding methods to avoid code duplication.
8868         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8869         (Stub_addend_reader::operator()): Use new branch encoding method
8870         to avoid code duplication.
8871
8872 2010-01-11  Doug Kwan  <dougkwan@google.com>
8873
8874         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8875         (Target_arm::do_finalize_sections): Define special EXIDX section
8876         symbols only if referenced.
8877         * gc.h (Garbage_collection::add_reference): New method.
8878         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8879         code duplication.
8880
8881 2010-01-11  Ian Lance Taylor  <iant@google.com>
8882
8883         * script.cc (Version_script_info::build_expression_list_lookup):
8884         Change complaing about duplicate wildcard match from error to
8885         warning.
8886
8887         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8888         of 2009-12-30.
8889         (Version_script_info::Version_script_info): Initialize globs_,
8890         default_version_, default_is_global_, and exact_.  Don't
8891         initialize globals_ or locals_.
8892         (Version_script_info::build_lookup_tables): Build local symbols
8893         first.
8894         (Version_script_info::unquote): New function.
8895         (Version_script_info::add_exact_match): New function.
8896         (Version_script_info::build_expression_list_lookup): Remove lookup
8897         parameter.  Add is_global parameter.  Change all callers.  Handle
8898         wildcard pattern specially.  Unquote pattern.  Call
8899         add_exact_match.
8900         (Version_script_info::get_name_to_match): New function.
8901         (Version_script_info::get_symbol_version): New function.
8902         (Version_script_info::get_symbol_version_helper): Remove.
8903         (Version_script_info::check_unmatched_names): Call unquote.
8904         * script.h (class Version_script_info): Change get_symbol_version
8905         to be non-inline and add is_global parameter; change all callers.
8906         Rewrite symbol_is_local.  Update declarations.  Define struct
8907         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8908         Remove globals_ and locals_ members.  Add exact_, globs_,
8909         default_version_, is_global_.
8910         (Version_script_info::Glob): Remove pattern, add expression and
8911         is_global.  Update constructor.  Change all callers.
8912         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8913         default version.
8914         (Versions::symbol_section_contents): If a symbol is undefined, or
8915         defined in a dynamic object, set the version index to
8916         VER_NDX_LOCAL.
8917         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8918         symbol_is_local.
8919         (Symbol_table::add_from_pluginobj): Likewise.
8920         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8921
8922 2010-01-11  Doug Kwan  <dougkwan@google.com>
8923
8924         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8925         (incremental_dump_LDADD): Add linking option for libintl.
8926         * Makefile.in: Regenerate.
8927
8928 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8929
8930         PR gold/11144
8931         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8932         instead of -Ds.
8933         * testsuite/Makefile.in: Regenerated.
8934
8935 2010-01-10  Doug Kwan  <dougkwan@google.com>
8936
8937         * options.h (DEFINE_var): Use parentheses around argument varname__
8938         in macro body to avoid any unintended subsequent substitutions.
8939
8940 2010-01-10  Ian Lance Taylor  <iant@google.com>
8941
8942         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8943         candidates before doing symbol resolution.
8944
8945         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8946         ODR candidates if only one is weak.
8947
8948 2010-01-08  Ian Lance Taylor  <iant@google.com>
8949
8950         * script.cc (Version_script_info::build_expression_list_lookup):
8951         Don't warn about ambiguous version, just record the ambiguity.
8952         (Version_script_info::get_symbol_version_helper): Give error if
8953         version is ambiguous.
8954
8955 2010-01-08  Doug Kwan  <dougkwan@google.com>
8956
8957         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8958         prev_data_size_ and prev_addralign_.  Remove initializer for
8959         deleted data member has_been_changed_.
8960         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8961         to determine if the table is empty.
8962         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8963         Remove.
8964         (Stub_table::add_reloc_stub): Define method in class definition
8965         instead of just declaring it there.
8966         (Stub_table::add_cortex_a8_stub): New method definition.
8967         (Stub_table::update_data_size_and_addralign): Ditto.
8968         (Stub_table::finalize_stubs): Ditto.
8969         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8970         (Stub_table::do_addralign_): Return address alignment in the
8971         (Stub_table::do_reset_address_and_file_offset): Define method in
8972         class definition instead of declaring it there.  Set current data
8973         size to be the data size of the previous pass.
8974         (Stub_table::set_final_data_size): Use current data size as the
8975         final data size.
8976         (Stub_table::relocate_stub): Change parameter type of stub from
8977         Reloc_stub pointer to Stub pointer.
8978         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8979         (Stub_table::Cortex_a8_stub_list): New typedef.
8980         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8981          Stub_table::prev_addralign_): New data member.
8982         (Arm_relobj::Arm_relobj): Initialize data member
8983         section_has_cortex_a8_workaround_.
8984         (Arm_relobj::section_has_cortex_a8_workaround,
8985          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8986          definitions.
8987         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8988         declarations.
8989         (Target_arm::relocate_stub): Change parameter type of stub from
8990         Reloc_stub pointer to Stub pointer.
8991         (Insn_template::size, Insn_template::alignment): Handle
8992         THUMB16_SPECIAL_TYPE.
8993         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8994          Stub_table::update_data_size_and_addralign,
8995          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8996         definitions.
8997         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8998         (Stub_table::do_write): Ditto.
8999         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9000
9001 2010-01-08  Ian Lance Taylor  <iant@google.com>
9002
9003         PR 11108
9004         * symtab.h (class Symbol): Remove fields is_target_special_ and
9005         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9006         (Symbol::is_defined_in_discarded_section): New function.
9007         (Symbol::set_is_defined_in_discarded_section): New function.
9008         (Symbol::has_plt_offset): Rewrite.
9009         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9010         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9011         Don't initialize is_target_special_ or has_plt_offset_.
9012         Initialize is_defined_in_discarded_section_.
9013         (Symbol_table::add_from_relobj): If appropriate, set
9014         is_defined_in_discarded_section.
9015         * resolve.cc (Symbol::override_base_with_special): Don't test
9016         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9017         * target-reloc.h (relocate_section): Do special handling for
9018         symbols defined in discarded sections for global symbols as well
9019         as local symbols.
9020
9021 2010-01-08  Ian Lance Taylor  <iant@google.com>
9022
9023         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9024         the SHT_SYMTAB case.
9025
9026 2010-01-08  Ian Lance Taylor  <iant@google.com>
9027
9028         * object.cc (Sized_relobj::do_layout): Don't get confused if
9029         layout_eh_frame returns NULL.
9030
9031 2010-01-08  Ian Lance Taylor  <iant@google.com>
9032
9033         PR 11084
9034         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9035         dynamic symbol table, use the normal symbol table.
9036         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9037         symbol table.
9038
9039 2010-01-08  Ian Lance Taylor  <iant@google.com>
9040
9041         PR 11072
9042         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9043         sections.
9044
9045 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9046
9047         * version.cc (print_version): Change to "Copyright 2010".
9048
9049 2010-01-08  Ian Lance Taylor  <iant@google.com>
9050
9051         PR 10287
9052         PR 11063
9053         * i386.cc (class Target_i386): Change return type of plt_section
9054         to be non-const.
9055         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9056         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9057         tls_desc_rel_ field.
9058         (Output_data_plt_i386::rel_tls_desc): New function.
9059         (Target_i386::rel_tls_desc_section): New function.
9060         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9061         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9062         R_386_TLS_DESC reloc in rel_tls_desc_section.
9063         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9064         Define struct Tlsdesc_info.
9065         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9066         (Target_x86_64::do_reloc_symbol_index): New function.
9067         (Target_x86_64::add_tlsdesc_info): New function.
9068         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9069         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9070         tlsdesc_rel_ field.
9071         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9072         all callers.
9073         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9074         (Target_x86_64::rela_tlsdesc_section): New function.
9075         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9076         handling.
9077         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9078         (Target_x86_64::do_reloc_addend): New function.
9079         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9080         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9081         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9082         (Output_reloc::type): New function.
9083         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9084         (Output_reloc::is_target_specific): New function.
9085         (Output_reloc::target_arg): New function.
9086         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9087         absolute relocs and target specific relocs.
9088         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9089         add_target_specific.
9090         (class Output_data_reloc) [SHT_RELA]: Likewise.
9091         * output.cc (Output_reloc::Output_reloc): Add four new versions
9092         for absolute relocs and target specific relocs.
9093         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9094         (Output_reloc::get_symbol_index): Likewise.
9095         (Output_reloc::local_section_offset): Check that local_sym_index_
9096         is not TARGET_CODE or 0.
9097         (Output_reloc::symbol_value): Likewise.
9098         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9099         reloc.
9100         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9101         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9102         functions.
9103         * layout.cc (add_target_dynamic_tags): Use output section for
9104         DT_PLTRELSZ and DT_JMPREL.
9105
9106 2010-01-07  Ian Lance Taylor  <iant@google.com>
9107
9108         PR 11061
9109         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9110         function.
9111         (class Output_data_reloc_generic): Define.
9112         (class Output_data_reloc_base): Change base class to
9113         Output_data_reloc_generic.  Change add() method to call
9114         bump_relative_reloc_count for a relative reloc.  Remove
9115         sort_relocs_ field.
9116         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9117         to sort_relocs().
9118         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9119         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9120         appropriate.
9121         * layout.h (class Layout): Update declaration.
9122
9123 2010-01-07  Ian Lance Taylor  <iant@google.com>
9124
9125         * output.h (class Output_data): Add const version of
9126         output_section and do_output_section.
9127         (class Output_section_data): Add const version of
9128         do_output_section.
9129         (class Output_section): Likewise.
9130         * layout.cc (Layout::add_target_dynamic_tags): New function.
9131         * layout.h (class Layout): Update declarations.
9132         * arm.cc (Target_arm::do_finalize_sections): Use
9133         add_target_dynamic_tags.
9134         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9135         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9136         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9137         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9138
9139 2010-01-07  Ian Lance Taylor  <iant@google.com>
9140
9141         PR 11042
9142         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9143         object as needed.
9144
9145 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9146             Ian Lance Taylor  <iant@google.com>
9147
9148         PR 11019
9149         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9150         Xindex::read_symtab_xindex.
9151
9152 2010-01-07  Doug Kwan  <dougkwan@google.com>
9153
9154         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9155         (Insn_template::thumb16_bcond_insn): New method declaration.
9156         (Insn_template): Fix spelling.
9157         (Stub::thumb16_special): New method declaration.
9158         (Stub::do_write): Define virtual method which was previously pure
9159         virtual.
9160         (Stub::do_thumb16_special): New method declaration.
9161         (Stub::do_fixed_endian_write): New template member.
9162         (Reloc_stub::do_write): Remove.
9163         (Reloc_stub::do_fixed_endian_write): Remove.
9164         (Cortex_a8_stub): New class definition.
9165         (Stub_factory::make_cortex_a8_stub): New method definition.
9166         (Stub_factory::Stub_factory): Add missing static storage class
9167         qualifier for elf32_arm_stub_a8_veneer_blx.
9168
9169 2010-01-07  Ian Lance Taylor  <iant@google.com>
9170
9171         PR 10980
9172         * options.h (class General_options): Add --warn-unresolved-symbols
9173         and --error-unresolved-symbols.
9174         * errors.cc (Errors::undefined_symbol): Implement
9175         --warn-unresolved-symbols.
9176
9177         * options.h (class General_options): Add -z text and -z textoff.
9178         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9179
9180 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9181
9182         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9183         (Garbage_collection::cident_sections): New function.
9184         (Garbage_collection::add_cident_section): New function.
9185         (Garbage_collection::cident_sections_): New member.
9186         (gc_process_relocs): Add references to sections whose names are C
9187         identifiers.
9188         * gold.h (cident_section_start_prefix): New constant.
9189         (cident_section_stop_prefix): New constant.
9190         (is_cident): New function.
9191         * layout.cc (Layout::define_section_symbols): Replace string constants
9192         with the newly defined constants.
9193         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9194         C identifiers.
9195         * testsuite/Makefile.am: Add gc_orphan_section_test.
9196         * testsuite/Makefile.in: Regenerate.
9197         * testsuite/gc_orphan_section_test.cc: New file.
9198         * testsuite/gc_orphan_section_test.sh: New file.
9199
9200 2010-01-06  Ian Lance Taylor  <iant@google.com>
9201
9202         PR 10980
9203         * options.h (class General_options): Add --warn-shared-textrel.
9204         * layout.cc (Layout::finish_dynamic_section): Implement
9205         --warn-shared-textrel.
9206
9207         PR 10980
9208         * options.h (class General_options): Add --warn-multiple-gp.
9209
9210 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9211
9212         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9213         $(THREADSLIB) and $(LIBDL).
9214         * Makefile.in: Rebuild.
9215
9216 2010-01-06  Ian Lance Taylor  <iant@google.com>
9217
9218         PR 10980
9219         * options.cc (General_options::parse_section_start): New function.
9220         (General_options::section_start): New function.
9221         (General_options::General_options): Initialize all members.
9222         * options.h: Include <map>
9223         (class General_options): Add --section-start.  Add section_starts_
9224         member.
9225         * layout.cc (Layout::attach_allocated_section_to_segment): If
9226         --section-start was used, set the address of the segment.  Remove
9227         local sort_sections.
9228         (Layout::relaxation_loop_body): If the address of the load segment
9229         has been set by --section-start, don't use it.
9230         * output.h (Output_segment::update_flags_for_output_section): New
9231         function.
9232         * output.cc (Output_segment::add_output_section): Call
9233         update_flags_for_output_section.
9234
9235 2010-01-05  Ian Lance Taylor  <iant@google.com>
9236
9237         PR 10980
9238         * options.h (class General_options): Add --undefined-version.
9239         * script.cc (struct Version_expression): Add was_matched_by_symbol
9240         field.
9241         (Version_script_info::matched_symbol): New function.
9242         (Version_script_info::get_symbol_version_helper): Call
9243         matched_symbol.
9244         (Version_script_info::check_unmatched_names): New function.
9245         * script.h (class Version_script_info): Update declarations.
9246         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9247
9248         * options.h (class General_options): Use DEFINE_bool_alias for
9249         allow_multiple_definition.
9250         * resolve.cc (Symbol_table::should_override): Don't test
9251         allow_multiple_definition.
9252
9253         PR 10980
9254         * options.h (class General_options): Add --cref.
9255         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9256         until after printing cref table.
9257         * cref.cc: Include "symtab.h".
9258         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9259         (Cref_table_compare::operator()): New function.
9260         (Cref_inputs::gather_cref): New function.
9261         (filecol): New static const.
9262         (Cref_inputs::print_cref): New function.
9263         (Cref::print_cref): New function.
9264         * cref.h: Include <cstdio>.
9265         (class Cref): Update declarations.
9266         * mapfile.h (Mapfile::file): New function.
9267         * object.h (class Object): Define Symbols.  Declare virtual
9268         do_get_global_symbols.
9269         (Object::get_global_symbols): New function.
9270         * object.cc (Input_objects::add_object): Pass object to cref_ if
9271         --cref.
9272         (Input_objects::archive_start): Likewise.
9273         (Input_objects::archive_stop): Likewise.
9274         (Input_objects::print_cref): New function.
9275         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9276         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9277         --cref.
9278         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9279         function.
9280         * plugin.h (class Sized_pluginobj): Update declarations.
9281
9282 2010-01-05  Ian Lance Taylor  <iant@google.com>
9283
9284         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9285         to is_default_version.  Rename insdef to insdefault.
9286         (Symbol_table::add_from_relobj): Rename def to is_default_version
9287         and local to is_forced_local.
9288         (Symbol_table::add_from_pluginobj): Likewise.
9289         (Symbol_table::add_from_dynobj): Likewise.
9290         (Symbol_table::define_special_symbol): Rename insdef to
9291         insdefault.
9292
9293 2010-01-04  Ian Lance Taylor  <iant@google.com>
9294
9295         PR 10980
9296         * options.h (class General_options): Add
9297         --allow-multiple-definition and -z muldefs.
9298         * resolve.cc (Symbol_table::should_override): Don't warn about a
9299         multiple symbol definition if --allow-multiple-definition or -z
9300         muldefs.
9301
9302         PR 10980
9303         * options.h (class General_options): Add --add-needed and
9304         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9305         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9306         error if --copy-dt-needed-entries aka --add-needed is used and
9307         would cause a change in behaviour.
9308
9309         PR 10980
9310         * options.h (class General_options): Add -G as a short version of
9311         --shared.  Add no-op options -assert, -g, and -i.
9312
9313 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9314
9315         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9316         check for .text or .gnu.linkonce.t sections.
9317         * icf.cc (Icf::find_identical_sections): Ditto.
9318         Change the detection for mangled function name within the section
9319         name.
9320         * icf.h (is_section_foldable_candidate): New function.
9321
9322 2009-12-30  Ian Lance Taylor  <iant@google.com>
9323
9324         PR 10980
9325         * options.h (class General_options): Permit two dashes with
9326         --retain-symbols-file.
9327
9328 2009-12-30  Ian Lance Taylor  <iant@google.com>
9329
9330         PR 10979
9331         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9332         don't put the file header and segment headers in the text
9333         segment.
9334
9335         PR 10979
9336         * common.cc (Sort_commons::operator()): Stabilize sort when both
9337         entries are NULL.
9338         (Symbol_table::do_allocate_commons_list): When allocating common
9339         symbols, skip a symbol which is no longer common.
9340         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9341         an object before checking its type.
9342         * testsuite/common_test_2.c: New file.
9343         * testsuite/common_test_3.c: New file.
9344         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9345         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9346         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9347         (common_test_2_pic.o, common_test_2.so): New targets.
9348         (common_test_3_pic.o, common_test_3.so): New targets.
9349         * testsuite/Makefile.in: Rebuild.
9350
9351         PR 10979
9352         * script.cc (read_input_script): If we see a new SECTIONS clause,
9353         and we have added an input section, give an error.
9354         * layout.h (class Layout): Add have_added_input_section function.
9355         Add have_added_input_section_ field.
9356         * layout.cc (Layout::Layout): Initialize
9357         have_added_input_section_.
9358         (Layout::layout): Set have_added_input_section_.
9359         (Layout::layout_eh_frame): Likewise.
9360
9361 2009-12-30  Ian Lance Taylor  <iant@google.com>
9362
9363         PR 10931
9364         * options.h (class General_options): Add --sort-common option.
9365         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9366         * common.cc (Sort_common): Add sort_order parameter to
9367         constructor.  Add sort_order_ field.
9368         (Sort_commons::operator): Check sort_order_.
9369         (Symbol_table::allocate_commons): Determine the sort order.
9370         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9371         Change all callers.
9372         (Symbol_table::do_allocate_commons_list): Likewise.
9373
9374 2009-12-30  Ian Lance Taylor  <iant@google.com>
9375
9376         PR 10916
9377         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9378         symbols from this object, don't change the visibility of an
9379         undefined symbol.
9380         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9381
9382 2009-12-30  Ian Lance Taylor  <iant@google.com>
9383
9384         PR 10861
9385         * script.h (class Version_script_info): Define Language enum.
9386         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9387         new fields globals_, locals_, and is_finalized_.
9388         * script.cc: Various formatting fixes.
9389         (class Parser_closure): Change language_stack_ from a vector of
9390         std::string to one of Version_script_info::Language.  Adjust all
9391         uses accordingly.
9392         (class Lazy_demangler): Remove.
9393         (struct Version_expression): Change language from std::string to
9394         Version_script_info::Language.
9395         (Version_script_info::Version_script_info): New function.
9396         (Version_script_info::~Version_script_info): Don't call clear.
9397         (Version_script_info::finalize): New function.
9398         (Version_script_info::build_lookup_tables): New function.
9399         (Version_script_info::build_expression_list_lookup): New
9400         function.
9401         (Version_script_info::get_symbol_version_helper): Rewrite to use
9402         lookup tables.
9403         (Version_script_info::print_expression_list): Adjust to use
9404         Version_script_info::Language.
9405         (script_push_lex_into_version_mode): Check that the version script
9406         has not been finalized.
9407         (version_script_push_lang): Change language string to
9408         Version_script_info::Language.
9409         * options.cc (Command_line::version_script): New function.
9410         * options.h (class General_options): Add finalize_dynamic_list
9411         function.  Change version_script from declaration to definition.
9412         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9413         * testsuite/version_script.map: Remove duplicate def of foo.
9414         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9415         version_script.map.
9416         * testsuite/Makefile.in: Rebuild.
9417
9418 2009-12-30  Ian Lance Taylor  <iant@google.com>
9419
9420         PR 10843
9421         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9422         if the input symbol index is 0, make the output symbol index 0.
9423
9424 2009-12-30  Ian Lance Taylor  <iant@google.com>
9425
9426         PR 10670
9427         * options.h (class General_options): Add -x/--discard-all.
9428         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9429         --discard-all.  If the local symbol needs a dynamic entry, check
9430         that before handling --discard-locals.
9431
9432 2009-12-30  Ian Lance Taylor  <iant@google.com>
9433
9434         PR 10450
9435         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9436         flags to PF_R.
9437         (Output_segment::add_output_section): Don't change the flags if
9438         the type is PT_TLS.
9439
9440         PR 10450
9441         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9442         GNU hash table if they need a dynamic value.  Otherwise, don't add
9443         them if they are defined in a dynamic object or are forced local.
9444
9445 2009-12-29  Ian Lance Taylor  <iant@google.com>
9446
9447         PR 10450
9448         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9449         .gnu.hash table for a 32-bit target.
9450
9451         PR 10450
9452         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9453         regular and a dynamic object only needs a dynamic symbol table
9454         entry if it is externally visible.
9455
9456         PR 10450
9457         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9458         constructor.  Add global_offset_table_ field.
9459         (Target_i386::got_section): Set global_offset_table_.
9460         (Target_i386::do_finalize_sections): Set global_offset_table_
9461         size.
9462         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9463         in constructor.  Add global_offset_table_ field.
9464         (Target_x86_64::got_section): Set global_offset_table_.
9465         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9466         size.
9467
9468         * layout.cc (Layout::Layout): Initialize increase_relro_.
9469         (Layout::get_output_section): Add is_relro, is_last_relro, and
9470         is_first_non_relro parameters.  Change all callers.
9471         (Layout::choose_output_section): Likewise.
9472         (Layout::add_output_section_data): Likewise.
9473         (Layout::make_output_section): Likewise.
9474         (Layout::set_segment_offsets): Clear increase_relro when using a
9475         linker script.
9476         * layout.h (class Layout): Add increase_relro method.  Add
9477         increase_relro_ field.  Update declarations.
9478         * output.cc (Output_section::Output_section): Initialize
9479         is_last_relro_ and is_first_non_relro_.
9480         (Output_segment::add_output_section): Group relro sections is
9481         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9482         (Output_segment::maximum_alignment): Remove relro handling.
9483         (Output_segment::set_section_addresses): Add increase_relro
9484         parameter.  Change all callers.  Add initial alignment to align
9485         relro sections on separate page.  Remove old relro handling.
9486         (Output_segment::set_section_list_addresses): Remove in_relro
9487         parameter.  Change all callers.
9488         (Output_segment::set_offset): Add increase parameter.  Change all
9489         callers.  Remove old relro handling.
9490         * output.h (class Output_section): Add new methods: is_last_relro,
9491         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9492         Add is_last_relro_ and is_first_non_relro_ fields.
9493         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9494         Create separate .got.plt section.  Call increase_relro.
9495         * x86_64.cc (Target_x86_64::got_section): Likewise.
9496         * testsuite/relro_script_test.t: Add .got.plt.
9497
9498         PR 10450
9499         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9500         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9501         (Layout::finalize): Call set_dynamic_symbol_size.
9502         (Layout::set_dynamic_symbol_size): New function.
9503         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9504         set_dynamic_symbol_size.
9505
9506         PR 10450
9507         * output.h (class Output_section): Add is_entsize_zero_ field.
9508         * output.cc (Output_section::Output_section): Initialize
9509         is_entsize_zero_.
9510         (Output_section::set_entsize): If two different entsizes are
9511         requested, force it to zero.
9512         (Output_section::add_input_section): Set flags for .debug_str
9513         before updating section flags.  Set entsize.
9514         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9515         and SHF_STRING if all input sections have those flags.
9516
9517 2009-12-29   Rafael Espindola  <espindola@google.com>
9518
9519         * main.cc (main): Fix the sys time reporting.
9520         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9521         reporting.
9522
9523 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9524
9525         * options.cc (General_options::parse_version): Allow -v to exit
9526         without an error if there is nothing to link.
9527
9528 2009-12-29  Ian Lance Taylor  <iant@google.com>
9529
9530         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9531         using a version of gcc before 4.1.
9532         * configure: Rebuild.
9533
9534 2009-12-28  Chris Demetriou  <cgd@google.com>
9535
9536         * attributes.cc (Output_attributes_section_data::do_write): Use
9537         std::vector::front rather than std::vector::data.
9538
9539 2009-12-28  Ian Lance Taylor  <iant@google.com>
9540
9541         * symtab.h (class Symbol_table): Add enum Defined.
9542         * resolve.cc (Symbol_table::should_override): Add defined
9543         parameter.  Change all callers.  Test whether object is NULL
9544         before calling a method on it.
9545         (Symbol_table::report_resolve_problem): Add defined parameter.
9546         Change all callers.
9547         (Symbol_table::should_override_with_special): Likewise.
9548         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9549         parameter.  Change all callers.
9550         (Symbol_table::do_define_in_output_data): Likewise.
9551         (Symbol_table::define_in_output_segment): Likewise.
9552         (Symbol_table::do_define_in_output_segment): Likewise.
9553         (Symbol_table::define_as_constant): Likewise.
9554         (Symbol_table::do_define_as_constant): Likewise.
9555         * script.h (class Symbol_assignment): Add is_defsym parameter to
9556         constructor; change all callers.
9557         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9558         parameter.  Change all callers.  Add is_defsym_ field.
9559         (class Parser_closure): Add parsing_defsym parameter to
9560         constructor; change all callers.  Add parsing_defsym accessor
9561         function.  Add parsing_defsym_ field.
9562
9563 2009-12-28  Ian Lance Taylor  <iant@google.com>
9564
9565         * gold.cc (queue_middle_tasks): Fix formatting.
9566         * object.cc (Relobj::is_section_name_included): Likewise.
9567
9568 2009-12-23  Ian Lance Taylor  <iant@google.com>
9569
9570         * i386.cc (Target_i386::do_calls_non_split): Recognize
9571         -fsplit-stack prologue for a function with a static chain.
9572         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9573         -fsplit-stack prologue when using %r11.
9574
9575 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9576
9577         * options.cc (General_options::parse_version): Make -v continue and do
9578         the link like GNU ld does.
9579
9580 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9581
9582         * Makefile.am (CCFILES): Add timer.cc.
9583         (HFILES): Add timer.h.
9584         * configure.ac: Check for sysconf and times.
9585         * main.cc: include timer.h.
9586         (main): Use Timer instead of get_run_time.
9587         * timer.cc: New.
9588         * timer.h: New.
9589         * workqueue.cc: include timer.h.
9590         (Workqueue::find_and_run_task):
9591         Report user, sys and wall time.
9592         * Makefile.in: Regenerate.
9593         * config.in: Regenerate.
9594         * configure: Regenerate.
9595
9596 2009-12-16  Doug Kwan  <dougkwan@google.com>
9597
9598         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9599         sections.
9600         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9601         relaxed input sections.
9602         * output.cc (Output_section::find_relaxed_input_section): Change
9603         return type to Output_relaxed_input_section pointer.  Adjust code
9604         for new type of relaxed_input_section_map_.
9605         * output.h (Output_section::find_relaxed_input_section): Change
9606         return type to Output_relaxed_input_section pointer.
9607         (Output_section::Output_relaxed_input_section_by_input_section_map):
9608         New type.
9609         (Output_section::relaxed_input_section_map_): Change type to
9610         Output_section::Output_relaxed_input_section_by_input_section_map.
9611         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9612         input section.
9613
9614 2009-12-15  Ian Lance Taylor  <iant@google.com>
9615
9616         * layout.cc (Layout::create_shstrtab): Only write out after input
9617         sections if we are compressing debug sections.
9618
9619 2009-12-15  Ian Lance Taylor  <iant@google.com>
9620
9621         * archive.cc (Archive::add_symbols): Only look up a symbol without
9622         a version if there is, in fact, a version.
9623
9624 2009-12-14  Ian Lance Taylor  <iant@google.com>
9625
9626         Revert -Wshadow changes, all changes from:
9627         2009-12-11  Doug Kwan  <dougkwan@google.com>
9628         2009-12-11  Nick Clifton  <nickc@redhat.com>
9629         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9630
9631 2009-12-11  Doug Kwan  <dougkwan@google.com>
9632
9633         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9634         due to -Wshadow.
9635         * attributes.cc (Object_attribute::size): Ditto.
9636         (Attributes_section_data::size): Ditto.
9637         (Attributes_section_data::Attributes_section_data): Ditto.
9638         (Output_attributes_section_data::do_write): Ditto.
9639         * attributes.h (Object_attribute::set_type): Ditto.
9640         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9641
9642 2009-12-11  Nick Clifton  <nickc@redhat.com>
9643
9644         * archive.cc: Fix shadowed variable warnings.
9645         * arm.cc: Likewise.
9646         * compressed_output.cc: Likewise.
9647         * compressed_output.h: Likewise.
9648         * configure: Likewise.
9649         * dwarf_reader.cc: Likewise.
9650         * dynobj.cc: Likewise.
9651         * dynobj.h: Likewise.
9652         * ehframe.cc: Likewise.
9653         * ehframe.h: Likewise.
9654         * errors.cc: Likewise.
9655         * expression.cc: Likewise.
9656         * fileread.cc: Likewise.
9657         * fileread.h: Likewise.
9658         * freebsd.h: Likewise.
9659         * i386.cc: Likewise.
9660         * icf.cc: Likewise.
9661         * incremental.h: Likewise.
9662         * layout.cc: Likewise.
9663         * layout.h: Likewise.
9664         * mapfile.cc: Likewise.
9665         * merge.cc: Likewise.
9666         * merge.h: Likewise.
9667         * object.cc: Likewise.
9668         * object.h: Likewise.
9669         * options.h: Likewise.
9670         * output.cc: Likewise.
9671         * output.h: Likewise.
9672         * parameters.cc: Likewise.
9673         * plugin.cc: Likewise.
9674         * powerpc.cc: Likewise.
9675         * reduced_debug_output.cc: Likewise.
9676         * reduced_debug_output.h: Likewise.
9677         * reloc.cc: Likewise.
9678         * reloc.h: Likewise.
9679         * resolve.cc: Likewise.
9680         * script-sections.cc: Likewise.
9681         * script.cc: Likewise.
9682         * script.h: Likewise.
9683         * sparc.cc: Likewise.
9684         * symtab.cc: Likewise.
9685         * symtab.h: Likewise.
9686         * target-select.cc: Likewise.
9687         * target-select.h: Likewise.
9688         * token.h: Likewise.
9689         * workqueue.cc: Likewise.
9690         * workqueue.h: Likewise.
9691         * x86_64.cc: Likewise.
9692
9693 2009-12-10  Doug Kwan  <dougkwan@google.com>
9694
9695         * arm.cc (attributes.h): New include.
9696         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9697         (Arm_relobj::~Arm_relobj): Delete object pointed by
9698         attributes_section_data_.
9699         (Arm_relobj::attributes_section_data): New method definition.
9700         (Arm_relobj::attributes_section_data_): New data member declaration.
9701         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9702         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9703         attributes_section_data_.
9704         (Arm_dynobj::attributes_section_data): New method definition.
9705         (Arm_dynobj::attributes_section_data_): New data member declaration.
9706         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9707         initialization value of may_use_blx_ to false.
9708         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9709         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9710         object attributes to compute results instead of hard-coding.
9711         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9712         Target_arm::get_secondary_compatible_arch,
9713         Target_arm::set_secondary_compatible_arch
9714         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9715         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9716         New method declarations.
9717         (Target_arm::get_aeabi_object_attribute): New method definition.
9718         (Target_arm::attributes_section_data_): New data member declaration.
9719         (read_arm_attributes_section): New template definition.
9720         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9721         (Arm_dynobj::do_read_symbols): Ditto.
9722         (Target_arm::do_finalize_sections): Merge attributes sections from
9723         input.  Check for BLX use after attributes section merging.
9724         Fix __exidx_start and __exidx_end visibility.  Create an
9725         .ARM.attributes section if necessary.
9726         (Target_arm::get_secondary_compatible_arch,
9727         Target_arm::set_secondary_compatible_arch,
9728         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9729         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9730         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9731         New method definitions.
9732
9733 2009-12-09  Ian Lance Taylor  <iant@google.com>
9734
9735         * plugin.cc (Plugin::load): Don't cast from void* to a function
9736         pointer.
9737
9738 2009-12-09  Ian Lance Taylor  <iant@google.com>
9739
9740         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9741         information fields.
9742
9743 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9744
9745         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9746         Replace two_file_shared_1.so with two_file_shared_2.so.
9747         * testsuite/Makefile.in: Regenerated.
9748
9749 2009-12-08  Doug Kwan  <dougkwan@google.com>
9750
9751         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9752         (HFILES): Add attributes.h and int_encoding.h.
9753         * Makefile.in: Regenerate.
9754         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9755         function definitions to int_encoding.cc
9756         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9757         prototypes to int_encoding.h
9758         * reduced_debug_output.cc (int_encoding.h): New include.
9759         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9760         function definitions to int_encoding.cc
9761         (insert_into_vector, read_from_pointer): Move template definitions to
9762         int_encoding.h
9763         * attributes.cc: New file.
9764         * attributes.h: New file.
9765         * int_encoding.cc: New file.
9766         * int_encoding.h: New file.
9767
9768 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9769
9770         PR gold/11055
9771         * incremental-dump.cc (dump_incremental_inputs): New.
9772         (main): Use dump_incremental_inputs.
9773
9774 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9775
9776         PR gold/10893
9777         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9778         checking elfcpp::STT_FUNC.
9779         (Target_i386::Relocate::relocate): Likewise.
9780         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9781
9782         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9783         symbols from shared libraries into normal FUNC symbols.
9784
9785         * symtab.h (Symbol): Add is_func and use it.
9786
9787 2009-12-05  Doug Kwan  <dougkwan@google.com>
9788
9789         * arm.cc (Target_arm::arm_info): Initialize new fields
9790         attributes_section and attributes_vendor.
9791         * i386.cc (Target_i386::i386_info): Same.
9792         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9793         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9794         fields attributes_section and attributes_vendor.
9795         * sparc.cc (Target_sparc::sparc_info): Same.
9796         * target.h (Target::attributes_section, Target::attributes_vendor,
9797         Target::is_attributes_section, Target::attribute_arg_type,
9798         Target::attributes_order): New method definitions.
9799         (Target::Target_info::attributes_section,
9800         Target::Target_info::attributes_vendor): New fields.
9801         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9802         virtual method definitions.
9803         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9804         attributes_section and attributes_vendor.
9805         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9806
9807 2009-12-05  Doug Kwan  <dougkwan@google.com>
9808
9809         * arm.cc: Update comments about interworking and stub generation.
9810         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9811         considered as non-PIC.
9812         (Arm_relocate_functions::base_abs): Fix formatting.
9813         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9814         of function to use GOT entry address instead of offset.
9815         (Target_arm::Scan::global): Issue an error if a symbol would need a
9816         PLT does not get one because it is untyped.  Remove code to create
9817         dynamic symbols for relative branches.
9818         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9819         takes unsigned integer instead of boolean.
9820
9821 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9822
9823         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9824         (two_file_test_LDADD): Likewise.
9825         (common_test_1_LDADD): Likewise.
9826         (exception_test_LDADD) Likewise.
9827         (weak_test_LDADD): Likewise.
9828         (many_sections_test_LDADD): Likewise.
9829         (initpri1_LDADD): Likewise.
9830         (script_test_1_LDADD): Likewise.
9831         (script_test_2_LDADD): Likewise.
9832         (justsyms_LDADD): Likewise.
9833         (binary_test_LDADD): Likewise.
9834         (large_LDADD): Likewise.
9835         * testsuite/Makefile.in: Regenerated.
9836
9837 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9838
9839         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9840         (Symbol_table::override_with_special): Likewise.
9841         (Symbol_table::add_from_object): Likewise.
9842
9843 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9844
9845         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9846         Don't set the data_offset twice.
9847
9848 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9849
9850         * testsuite/Makefile.in: Regenerate.
9851
9852 2009-12-03  Doug Kwan  <dougkwan@google.com>
9853
9854         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9855         (Target_arm::do_finalize_sections): Add parameter for symbol table
9856         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9857         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9858         parameter for symbol table pointer.
9859         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9860         an additional parameter for a pointer to symbol table.
9861         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9862         parameter for a symbol table pointer.
9863         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9864         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9865         Ditto.
9866         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9867         parameter for a symbol table pointer.
9868
9869 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9870
9871         * incremental.cc (Incremental_inputs_header)
9872         (Incremental_inputs_header_write, Incremental_inputs_entry)
9873         (Incremental_inputs_entry_write): Move ...
9874         * incremental.h (Incremental_inputs_header)
9875         (Incremental_inputs_header_write, Incremental_inputs_entry)
9876         (Incremental_inputs_entry_write): here.
9877
9878 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9879
9880         * incremental.cc (make_sized_incremental_binary): Set the target.
9881         Error if it is incompatible.
9882         * output.h (Output_file): Add filename method.
9883
9884 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9885
9886         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9887         from the get_* methods.
9888
9889 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9890
9891         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9892         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9893         Write 0 for the data_offset of scripts.
9894
9895 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9896
9897         * testsuite/Makefile.am: Add the incremental_test.sh test.
9898         * testsuite/incremental_test.sh: New.
9899         * testsuite/incremental_test_1.c: New.
9900         * testsuite/incremental_test_2.c: New.
9901
9902 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9903
9904         * incremental-dump.cc (main): Fix typos.
9905
9906 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9907
9908         PR gold/11025
9909         * incremental-dump.cc (main): Use llu to print 64 bit values.
9910
9911 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9912             H.J. Lu  <hongjiu.lu@intel.com>
9913
9914         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9915         $(LIBDL).
9916         (incremental_dump_LDADD): Likewise.
9917         * Makefile.in: Regenerated.
9918
9919 2009-11-25  Doug Kwan  <dougkwan@google.com>
9920
9921         Revert:
9922
9923         2009-11-25  Doug Kwan  <dougkwan@google.com>
9924
9925                 * arm.cc (Target_arm::Target_arm): Move method definition
9926                 outside of class definition.  Add code to handle
9927                 --target1-rel, --target1-abs and --target2= options.
9928                 (Target_arm::get_reloc_reloc_type): Change method to be
9929                 non-static and const.
9930                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9931                 New data member declaration.
9932                 (Target_arm::Scan::local, Target_arm::Scan::global,
9933                 Target_arm::Relocate::relocate,
9934                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9935                 Adjust call to Target_arm::get_real_reloc_type.
9936                 (Target_arm::get_real_reloc_type): Use command line options
9937                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9938                 * options.h (--target1-rel, --target1-abs, --target2): New
9939                 ARM-only options.
9940
9941 2009-11-25  Doug Kwan  <dougkwan@google.com>
9942
9943         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9944         class definition.  Add code to handle --target1-rel, --target1-abs
9945         and --target2= options.
9946         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9947         and const.
9948         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9949         member declaration.
9950         (Target_arm::Scan::local, Target_arm::Scan::global,
9951         Target_arm::Relocate::relocate,
9952         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9953         call to Target_arm::get_real_reloc_type.
9954         (Target_arm::get_real_reloc_type): Use command line options to
9955         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9956         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9957         options.
9958
9959 2009-11-25  Doug Kwan  <dougkwan@google.com>
9960
9961         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9962         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9963         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9964         formatting.
9965         (Arm_relocate_functions::thm_call): Replace body with a call to
9966         Arm_relocate_functions::thumb_branch_common.
9967         (Arm_relocate_functions::thm_jump24,
9968         Arm_relocate_functions::thm_xpc22): New method definitions.
9969         (Arm_relocate_functions::thumb_branch_common): New method definition.
9970         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9971         operator.
9972         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9973         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9974
9975 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9976
9977         * Makefile.am: Build incremental-dump
9978         * Makefile.in: Regenerate.
9979         * incremental-dump.cc: New.
9980         * incremental.cc (Incremental_inputs_header_data,
9981         Incremental_inputs_entry_data): Move to incremental.h
9982         * incremental.h: (Incremental_inputs_header_data,
9983         Incremental_inputs_entry_data): Move from incremental.cc
9984
9985 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9986
9987         * incremental.cc (Incremental_inputs_header,
9988         Incremental_inputs_header_write, Incremental_inputs_entry,
9989         Incremental_inputs_entry_write): Add a typedef with the data type.
9990
9991 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9992
9993         * incremental.cc (Incremental_inputs_header,
9994         Incremental_inputs_header_write, Incremental_inputs_entry,
9995         Incremental_inputs_entry_write): Update comment about which
9996         type has the filed descriptions.
9997
9998 2009-11-15  Doug Kwan  <dougkwan@google.com>
9999
10000         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10001         (Arm_relocate_functions::arm_branch_common): Change method defintion
10002         in class definition to a method declaration and update list of formal
10003         parameters.
10004         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10005         Arm_relocation_functions::jump24): Adjust call to
10006         Arm_relocate_functions::arm_branch_common.  Update list of formal
10007         parameters.
10008         (Arm_relocate_functions::xpc25): New method definition.
10009         (Arm_relocate_functions::arm_branch_common): Move method defintion
10010         out from class definition.  Use stubs for mode-switching and extending
10011         branch ranges.
10012         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10013         specially.  Change code to enable use of stubs in ARM branches.
10014
10015 2009-11-10  Doug Kwan  <dougkwan@google.com>
10016
10017         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10018         in method declaration.
10019         (Target_arm::relocate_stub): New method declaration.
10020         (Target_arm::default_target): Change to return a pointer instead of
10021         a const reference.
10022         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10023         Target_arm::default_target.
10024         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10025         method definition.
10026         (Target_arm::relocate_section): Adjust view.
10027         (Target_arm::relocate_stub): New method definition.
10028
10029 2009-11-10  Doug Kwan  <dougkwan@google.com>
10030
10031         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10032         a format warning.
10033         * incremental.cc (open_incremental_binary): Initialized local
10034         variables to avoid warnings.
10035         * object.cc (make_elf_object): Ditto.
10036         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10037         a format warning.
10038
10039 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10040
10041         PR gold/10930
10042         * testsuite/plugin_test.c: Include "config.h".
10043
10044 2009-11-09  Doug Kwan  <dougkwan@google.com>
10045
10046         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10047         (arm_symbol_value): Remove.
10048         (Arm_relocate_functions::arm_branch_common,
10049         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10050         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10051         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10052         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10053         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10054         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10055         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10056         Arm_relocate_functions::thm_mobw_abs_nc,
10057         Arm_relocate_functions::thm_mov_abs,
10058         Arm_relocate_functions::movw_prel_nc,
10059         Arm_relocate_functions::thm_movt_abs,
10060         Arm_relocate_functions::movt_prel,
10061         Arm_relocate_functions::thm_movw_prel_nc,
10062         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10063         (Target_arm::Relocate::relocate): Only decompose address into two
10064         parts if relocation type uses the thumb-bit and pass the actual
10065         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10066         calls to methods in Arm_relocate_functions for this change.
10067
10068 2009-11-08  Ian Lance Taylor  <iant@google.com>
10069
10070         PR 10925
10071         * reloc.cc: Instantiate
10072         Sized_relobj::initialize_input_to_output_maps and
10073         Sized_relobj:free_input_to_output_maps.
10074
10075 2009-11-06  Ian Lance Taylor  <iant@google.com>
10076
10077         PR 10876
10078         * defstd.cc (in_segment): Set only_if_ref true for "end".
10079
10080 2009-11-06  Doug Kwan  <dougkwan@google.com>
10081
10082         * arm.cc (class Reloc_stub): Correct a comment.
10083         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10084         (Target_arm::scan_section_for_stubs): New method declaration.
10085         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10086         Change methods from private to protected.
10087         (Target_arm::do_may_relax): New method definition.
10088         (Target_arm::do_relax, Target_arm::group_sections,
10089         Target_arm::scan_reloc_for_stub,
10090         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10091         (Target_arm::arm_input_section_map_): New data member declaration.
10092         (Target_arm::scan_reloc_for_stub,
10093         Target_arm::scan_reloc_section_for_stubs,
10094         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10095         Target_arm::do_relax): New method definitions.
10096
10097 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10098
10099         * configure.ac: Check for (struct stat)::st_mtim
10100         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10101         * config.in: Regenerate.
10102         * configure: Regenerate.
10103
10104 2009-11-05  Ian Lance Taylor  <iant@google.com>
10105
10106         PR 10910
10107         * output.cc (Output_segment::add_output_section): Add missing
10108         return statement.
10109
10110 2009-11-04  Ian Lance Taylor  <iant@google.com>
10111
10112         PR 10880
10113         * object.h (class Object): Add is_needed and set_is_needed
10114         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10115         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10116         defined in a dynamic object and referenced by a regular object,
10117         set is_needed for the dynamic object.
10118         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10119         if the file is marked with as_needed and it is not needed.
10120
10121 2009-11-04  Ian Lance Taylor  <iant@google.com>
10122
10123         PR 10887
10124         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10125         tags if data is discarded by linker script.
10126         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10127         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10128         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10129         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10130
10131 2009-11-04  Ian Lance Taylor  <iant@google.com>
10132
10133         * layout.cc (Layout::get_output_section): Add is_interp and
10134         is_dynamic_linker_section parameters.  Change all callers.
10135         (Layout::choose_output_section): Likewise.
10136         (Layout::make_output_section): Likewise.
10137         (Layout::add_output_section_data): Add is_dynamic_linker_section
10138         parameter.  Change all callers.
10139         * layout.h (class Layout): Update declarations.
10140         * output.h (class Output_section): Add is_interp, set_is_interp,
10141         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10142         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10143         generate_code_fills_at_write_ to a bitfield.
10144         * output.cc (Output_section::Output_sections): Initialize new
10145         fields.
10146         (Output_segment::add_output_section): Add do_sort parameter.
10147         Change all callers.
10148
10149 2009-11-03  Ian Lance Taylor  <iant@google.com>
10150
10151         PR 10860
10152         * options.h (class General_options): Add --warn-common.
10153         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10154         merging two common symbols.
10155         (Symbol_table::should_override): Handle --warn-common when merging
10156         a common symbol with a defined symbol.  Use report_resolve_problem
10157         for multiple definitions.
10158         (Symbol_table::report_resolve_problem): New function.
10159         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10160
10161 2009-11-03  Doug Kwan  <dougkwan@google.com>
10162
10163         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10164         stub_factory_.
10165         (Target_arm::stub_factory): New method definition.
10166         (Target_arm::new_arm_input_section,
10167         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10168         Target_arm::reloc_uses_thumb_bit): New method declarations.
10169         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10170         New type definitions.
10171         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10172         member declarations.
10173         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10174         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10175         New method definitions.
10176
10177 2009-11-03  Ian Lance Taylor  <iant@google.com>
10178
10179         * options.h (class General_options): Add --warn_constructors.
10180
10181 2009-11-03  Ian Lance Taylor  <iant@google.com>
10182
10183         PR 10893
10184         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10185         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10186
10187 2009-11-03  Ian Lance Taylor  <iant@google.com>
10188
10189         PR 10895
10190         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10191         --msgid-bugs-address.
10192         (install-pdf): New target.
10193         (install-data_yes): Look up one directory to find mkinstalldirs.
10194
10195 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10196
10197         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10198         tree.
10199
10200 2009-10-30  Doug Kwan  <dougkwan@google.com>
10201
10202         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10203
10204 2009-10-30  Doug Kwan  <dougkwan@google.com>
10205
10206         * arm.cc (Stub_addend_reader): New struct template definition
10207         and partial specializations.
10208         (Stub_addend_reader::operator()): New method definition for a
10209         partially specialized template.
10210
10211 2009-10-30  Doug Kwan  <dougkwan@google.com>
10212
10213         * arm.cc (Arm_relobj::processor_specific_flags): New method
10214         definition.
10215         (Arm_relobj::do_read_symbols): New method declaration.
10216         (Arm_relobj::processor_specific_flags_): New data member declaration.
10217         (Arm_dynobj): New class definition.
10218         (Target_arm::do_finalize_sections): Add input_objects parameter.
10219         (Target_arm::do_adjust_elf_header): New method declaration.
10220         (Target_arm::are_eabi_versions_compatible,
10221         (Target_arm::merge_processor_specific_flags): New method declaration.
10222         (Target_arm::do_make_elf_object): New overloaded method definitions
10223         and declaration.
10224         (Arm_relobj::do_read_symbols): New method definition.
10225         (Arm_dynobj::do_read_symbols): Ditto.
10226         (Target_arm::do_finalize_sections): Add input_objects parameters.
10227         Merge processor-specific flags from all input objects.
10228         (Target_arm::are_eabi_versions_compatible,
10229         Target_arm::merge_processor_specific_flags,
10230         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10231         New method definitions.
10232         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10233         Input_objects pointer type parameter.
10234         * layout.cc (Layout::finalize): Pass input objects to target's.
10235         finalize_sections function.
10236         * output.cc (Output_file_header::do_sized_write): Set ELF file
10237         header's processor-specific flags.
10238         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10239         Input_objects pointer type parameter.
10240         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10241         * target.h (Input_objects): New forward class declaration.
10242         (Target::processor_specific_flags,
10243         Target::are_processor_specific_flags_sect): New method definitions.
10244         (Target::finalize_sections): Add input_objects parameter.
10245         (Target::Target): Initialize processor_specific_flags_ and
10246         are_processor_specific_flags_set_.
10247         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10248         parameter.
10249         (Target::set_processor_specific_flags): New method definition.
10250         (Target::processor_specific_flags_,
10251         Target::are_processor_specific_flags_set_): New data member
10252         declarations.
10253         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10254         Input_objects pointer type parameter.
10255
10256 2009-10-30  Doug Kwan  <dougkwan@google.com>
10257
10258         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10259
10260 2009-10-28  Ian Lance Taylor  <iant@google.com>
10261
10262         * object.h (class Relobj): Drop options parameter from
10263         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10264         do_scan_relocs, do_relocate.  Change all callers.
10265         (class Sized_relobj): Drop options parameters from
10266         do_gc_process_relocs, do_scan_relocs, do_relocate,
10267         do_relocate_sections, relocate_sections, emit_relocs_scan,
10268         emit_relocs_scan_reltype.  Change all callers.
10269         (struct Relocate_info): Remove options field and all references to
10270         it.
10271         * reloc.h (class Read_relocs): Remove options constructor
10272         parameter and options_ field.  Change all callers.
10273         (class Gc_process_relocs, class Scan_relocs): Likewise.
10274         (class Relocate_task): Likewise.
10275         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10276         all callers.
10277         (scan_relocatable_relocs): Likewise.
10278         * target.h (class Sized_target): Remove options parameter from
10279         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10280         all callers.
10281         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10282         callers.
10283         * arm.cc: Update functions to remove options parameters.
10284         * i386.cc: Likewise.
10285         * powerpc.cc: Likewise.
10286         * sparc.cc: Likewise.
10287         * x86_64.cc: Likewise.
10288         * testsuite/testfile.cc: Likewise.
10289
10290 2009-10-28  Doug Kwan  <dougkwan@google.com>
10291
10292         * arm.cc (Arm_relobj): New class definition.
10293         (Arm_relobj::scan_sections_for_stubs,
10294         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10295         New method definitions.
10296
10297 2009-10-28  Cary Coutant  <ccoutant@google.com>
10298
10299         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10300         (Plugin::cleanup_done_): New member.
10301         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10302         (Plugin_manager::cleanup_done_): Remove.
10303         (Plugin_manager::add_input_file): Edit error message.
10304         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10305         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10306
10307 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10308
10309         * fileread.cc: (File_read::View::~View): Use the new
10310         data_ownership_ filed.
10311         (File_read::~File_read): Dispose the new whole_file_view_.
10312         (File_read::open): Mmap the whole file if needed.
10313         (File_read::open): Use whole_file_view_ instead of contents_.
10314         (File_read::find_view): Use whole_file_view_ if applicable.
10315         (File_read::do_read): Use whole_file_view_ instead of contents_.
10316         (File_read::make_view): Use whole_file_view_ instead of contents_,
10317         update File_read::View::View call.
10318         (File_read::find_or_make_view): Update File_read::View::View
10319         call.
10320         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10321         remove contents_
10322         (File_read::View::Data_ownership): New enum.
10323         (File_read::View::View): Replace bool mapped_ with Data_ownership
10324         argument.
10325         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10326         (File_read::View::data_ownership_): New field.
10327         (File_read::contents_): Remove (replaced by whole_file_view_).
10328         (File_read::whole_file_view_): New field.
10329         * options.h (class General_options): Add --keep-files-mapped.
10330
10331 2009-10-27  Cary Coutant  <ccoutant@google.com>
10332
10333         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10334         * testsuite/Makefile.am (plugin_test_5): New test case.
10335         * testsuite/Makefile.in: Regenerate.
10336
10337 2009-10-25  Doug Kwan  <dougkwan@google.com>
10338
10339         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10340         from private to protected to allow access by child class.
10341         (Sized_relobj::do_relocate_sections): New method declaration.
10342         (Sized_relobj::relocate_sections): Virtualize.
10343         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10344         Sized_relobj::relocate_sections.  Instantiate template explicitly
10345         for different target sizes and endianity.
10346
10347 2009-10-24  Doug Kwan  <dougkwan@google.com>
10348
10349         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10350         (Arm_input_section::as_arm_input_section): New method.
10351         (Arm_output_section): New class definition.
10352         (Arm_output_section::create_stub_group,
10353         Arm_output_section::group_sections): New method definitions.
10354
10355 2009-10-22  Doug Kwan  <dougkwan@google.com>
10356
10357         * arm.cc (Arm_input_section): New class definition.
10358         (Arm_input_section::init, Arm_input_section:do_write,
10359         Arm_input_section::set_final_data_size,
10360         Arm_input_section::do_reset_address_and_file_offset): New method
10361         definitions.
10362
10363 2009-10-21  Doug Kwan  <dougkwan@google.com>
10364
10365         * arm.cc (Stub_table, Arm_input_section): New forward class
10366         declarations.
10367         (Stub_table): New class defintion.
10368         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10369         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10370         New method definition.
10371
10372 2009-10-21  Doug Kwan  <dougkwan@google.com>
10373
10374         * arm.cc: Update copyright comments.
10375         (Target_arm): New forward class template declaration.
10376         (Arm_address): New type.
10377         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10378         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10379         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10380         constants.
10381         (Insn_template): Same.
10382         (DEF_STUBS): New macro.
10383         (Stub_type): New enum type.
10384         (Stub_template): New class definition.
10385         (Stub): Same.
10386         (Reloc_stub): Same.
10387         (Stub_factory): Same.
10388         (Target_arm::Target_arm): Initialize may_use_blx_ and
10389         should_force_pic_veneer_.
10390         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10391         Target_arm::should_force_pic_veneer,
10392         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10393         Target_arm::using_thumb_only, Target_arm:;default_target): New
10394         method defintions.
10395         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10396         New data member declarations.
10397         (Insn_template::size, Insn_template::alignment): New method defintions.
10398         (Stub_template::Stub_template): New method definition.
10399         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10400         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10401         (Stub_factory::Stub_factory): New method definition.
10402         * gold.h (string_hash): New template.
10403         * output.h (Input_section_specifier::hash_value): Use
10404         gold::string_hash.
10405         (Input_section_specifier::string_hash): Remove.
10406         * stringpool.cc (Stringpool_template::string_hash): Use
10407         gold::string_hash.
10408
10409 2009-10-20  Doug Kwan  <dougkwan@google.com>
10410
10411         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10412         symbols of relaxed input sections.
10413         * output.h (Output_section::find_relaxed_input_section): Make
10414         method public.
10415
10416 2009-10-16  Doug Kwan  <dougkwan@google.com>
10417
10418         * dynobj.cc (Versions::Versions): Initialize version_script_.
10419         Only insert base version symbol definition for a shared object
10420         if version script defines any version versions.
10421         (Versions::define_base_version): New method definition.
10422         (Versions::add_def): Check that base version is not needed.
10423         (Versions::add_need): Define base version lazily.
10424         * dynobj.h (Versions::define_base_version): New method declaration.
10425         (Versions::needs_base_version_): New data member declaration.
10426         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10427         (check_DATA): Add no_version_test.stdout.
10428         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10429         New make rules.
10430         * testsuite/Makefile.in: Regenerate.
10431         * testsuite/no_version_test.c: New file.
10432         * testsuite/no_version_test.sh: Ditto.
10433
10434 2009-10-16  Doug Kwan  <dougkwan@google.com>
10435
10436         * expression.cc (class Segment_start_expression): New class definition.
10437         (Segment_start_expression::value): New method definition.
10438         (script_exp_function_segment_start): Return a new
10439         Segment_start_expression.
10440         * gold/script-c.h (script_saw_segment_start_expression): New function
10441         prototype.
10442         * script-sections.cc (Script_sections::Script_sections): Initialize
10443         SAW_SEGMENT_START_EXPRESSION_ to false.
10444         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10445         and -Tbbs options to specify section addresses if given in
10446         command line and no SEGMENT_START expression is seen in a script.
10447         * script-sections.h (Script_sections::saw_segment_start_expression,
10448         Script_sections::set_saw_segment_start_expression): New method
10449         definition.
10450         (Script_sections::saw_segment_start_expression_): New data member
10451         declaration.
10452         * script.cc (script_saw_segment_start_expression): New function.
10453         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10454         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10455         script_test_7.sh and script_test_8.sh.
10456         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10457         script_test_8.stdout.
10458         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10459         (script_test_6, script_test_6.stdout, script_test_7,
10460         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10461         * Makefile.in: Regenerate.
10462         * testsuite/script_test_6.sh: New file.
10463         * testsuite/script_test_6.t: Same.
10464         * testsuite/script_test_7.sh: Same.
10465         * testsuite/script_test_7.t: Same.
10466         * testsuite/script_test_8.sh: Same.
10467
10468 2009-10-16  Doug Kwan  <dougkwan@google.com>
10469
10470         * output.cc (Output_segment::set_section_list_address): Cast
10471         expressions to unsigned long long type to avoid format warnings.
10472
10473 2009-10-15  Ian Lance Taylor  <iant@google.com>
10474
10475         * script.cc (Script_options::add_symbol_assignment): Always add a
10476         dot assignment to script_sections_.
10477         * script-sections.cc (Script_sections::add_dot_assignment):
10478         Initialize if necessary.
10479
10480         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10481         program headers with no load segment if there is a linker script.
10482
10483         * layout.cc (Layout::set_segment_offsets): Align the file offset
10484         to the segment aligment for -N or -n with no load segment.
10485         * output.cc (Output_segment::add_output_section): Don't crash if
10486         the first section is a TLS section.
10487         (Output_segment::set_section_list_addresses): Print an error
10488         message if the address moves backward in a linker script.
10489         * script-sections.cc
10490         (Output_section_element_input::set_section_addresses): Don't
10491         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10492         (Orphan_output_section::set_section_addresses): Likewise.
10493
10494 2009-10-15  Doug Kwan  <dougkwan@google.com>
10495
10496         * layout.cc (Layout::finish_dynamic_section): Generate tags
10497         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10498         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10499         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10500
10501 2009-10-14  Ian Lance Taylor  <iant@google.com>
10502
10503         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10504         fields.
10505         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10506         data_shdr fields of relinfo.
10507         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10508         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10509         R_386_TLS_LDO_32, adjust based on section flags.
10510         (Target_i386::Relocate::fix_up_ldo): Remove.
10511
10512 2009-10-13  Ian Lance Taylor  <iant@google.com>
10513
10514         Add support for -pie.
10515         * options.h (class General_options): Add -pie and
10516         --pic-executable.
10517         (General_options::output_is_position_independent): Test -pie.
10518         (General_options::output_is_executable): Return true if not shared
10519         and not relocatable.
10520         (General_options::output_is_pie): Remove.
10521         * options.cc (General_options::finalize): Reject incompatible uses
10522         of -pie.
10523         * gold.cc (queue_middle_tasks): A -pie link is not static.
10524         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10525         * symtab.cc (Symbol::final_value_is_known): Return false if
10526         output_is_position_independent.
10527         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10528         output_is_position_independent.
10529         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10530         output_is_position_independent.
10531         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10532         output_is_position_independent.
10533         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10534         two_file_pie_test.
10535         (basic_pie_test.o, basic_pie_test): New targets.
10536         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10537         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10538         (two_file_pie_test): New target.
10539         * testsuite/Makefile.in: Rebuild.
10540         * README: Remove note saying that -pie is not supported.
10541
10542 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10543
10544         * options.h (class General_options): Add -init and -fini.
10545         * layout.cc (Layout::finish_dynamic_section): Emit
10546         given init and fini functions.
10547
10548 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10549
10550         * gc.h (gc_process_relocs): Check if icf is enabled using new
10551         function.
10552         * gold.cc (queue_initial_tasks): Likewise.
10553         (queue_middle_tasks): Likewise.
10554         * object.cc (do_layout): Likewise.
10555         * symtab.cc (is_section_folded): Likewise.
10556         * main.cc (main): Likewise.
10557         * reloc.cc (Read_relocs::run): Likewise.
10558         (Sized_relobj::do_scan_relocs): Likewise.
10559         * icf.cc (is_function_ctor_or_dtor): New function.
10560         (Icf::find_identical_sections): Check if function is ctor or dtor when
10561         safe icf is chosen.
10562         * options.h (General_options::icf): Change option to be an enum.
10563         (Icf_status): New enum.
10564         (icf_enabled): New method.
10565         (icf_safe_folding): New method.
10566         (set_icf_status): New method.
10567         (icf_status_): New variable.
10568         * (options.cc) (General_options::finalize): Set icf_status_.
10569         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10570         icf_test and icf_keep_unique_test to use the --icf enum flag.
10571         * testsuite/icf_safe_test.sh: New file.
10572         * testsuite/icf_safe_test.cc: New file.
10573
10574 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10575
10576         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10577         includes to gc.h and icf.h.
10578         * arm.cc: Include gc.h.
10579         * gold.cc: Likewise.
10580         * i386.cc: Likewise.
10581         * powerpc.cc: Likewise.
10582         * sparc.cc: Likewise.
10583         * x86_64.cc: Likewise.
10584         * gc.h: Include icf.h.
10585
10586 2009-10-11  Ian Lance Taylor  <iant@google.com>
10587
10588         * plugin.cc: Include "gold.h" before other header files.
10589
10590 2009-10-10  Chris Demetriou  <cgd@google.com>
10591
10592         * options.h (Input_file_argument::Input_file_type): New enum.
10593         (Input_file_argument::is_lib_): Replace with...
10594         (Input_file_argument::type_): New member.
10595         (Input_file_argument::Input_file_argument): Take Input_file_type
10596         'type' rather than boolean 'is_lib' as second argument.
10597         (Input_file_argument::is_lib): Use type_.
10598         (Input_file_argument::is_searched_file): New function.
10599         (Input_file_argument::may_need_search): Handle is_searched_file.
10600         * options.cc (General_options::parse_library): Support -l:filename.
10601         (General_options::parse_just_symbols): Update for Input_file_argument
10602         changes.
10603         (Command_line::process): Likewise.
10604         * archive.cc (Archive::get_file_and_offset): Likewise.
10605         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10606         * script.cc (read_script_file, script_add_file): Likewise.
10607         * fileread.cc (Input_file::Input_file): Likewise.
10608         (Input_file::will_search_for): Handle is_searched_file.
10609         (Input_file::open): Likewise.
10610         * readsyms.cc (Read_symbols::get_name): Likewise.
10611         * testsuite/Makefile.am (searched_file_test): New test.
10612         * testsuite/Makefile.in: Regenerate.
10613         * testsuite/searched_file_test.cc: New file.
10614         * testsuite/searched_file_test_lib.cc: New file.
10615
10616 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10617             Ian Lance Taylor  <iant@google.com>
10618
10619         * descriptor.cc: Include <cstdio> and "binary-io.h".
10620         (Descriptors::open): Open the files in binary mode always.
10621         * script.cc (Lex::get_token): Treat \r as whitespace.
10622
10623 2009-10-09  Ian Lance Taylor  <iant@google.com>
10624
10625         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10626
10627 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10628             Ian Lance Taylor  <iant@google.com>
10629
10630         * configure.ac: Check for readv function also.
10631         * fileread.cc (readv): Define if not HAVE_READV.
10632         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10633         does not exist.
10634         * config.in: Regenerate.
10635         * configure: Regenerate.
10636
10637 2009-10-09  Doug Kwan  <dougkwan@google.com>
10638
10639         * layout.cc (Layout::make_output_section): Call target hook to make
10640         ordinary output section.
10641         (Layout::finalize): Adjust parameter list of call the
10642         Target::may_relax().
10643         * layout.h (class Layout::section_list): New method.
10644         * merge.h (Output_merge_base::entsize): Change visibility to public.
10645         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10646         New methods.
10647         (Output_merge_string::do_is_string): New method.
10648         * object.cc (Sized_relobj::do_setup): renamed from
10649         Sized_relobj::set_up.
10650         * object.h (Sized_relobj::adjust_shndx,
10651         Sized_relobj::initializ_input_to_output_maps,
10652         Sized_relobj::free_input_to_output_maps): Change visibilities to
10653         protected.
10654         (Sized_relobj::setup): Virtualize.
10655         (Sized_relobj::do_setup): New method declaration.
10656         (Sized_relobj::invalidate_section_offset,
10657         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10658         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10659         * options.cc (parse_int): New function.
10660         * options.h (parse_int): New declaration.
10661         (DEFINE_int): New macro.
10662         (stub_group_size): New option.
10663         * output.cc (Output_section::Output_section): Initialize memebers
10664         merge_section_map_, merge_section_by_properties_map_,
10665         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10666         (Output_section::add_input_section): Handled deferred code-fill
10667         generation and remove an old comment.
10668         (Output_section::add_relaxed_input_section): New method definition.
10669         (Output_section::add_merge_input_section): Use merge section by
10670         properties map to speed to search.  Update merge section maps
10671         as appropriate.
10672         (Output_section::build_relaxation_map): New method definition.
10673         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10674         Same.
10675         (Output_section::relax_input_section): Renamed to
10676         Output_section::convert_input_sections_to_relaxed_sections and change
10677         interface to take a vector of pointers to relaxed sections.
10678         (Output_section::find_merge_section,
10679         Output_section::find_relaxed_input_section): New method definitions.
10680         (Output_section::is_input_address_mapped,
10681         Output_section::output_offset, Output_section::output_address):
10682         Use output section data maps to speed up searching.
10683         (Output_section::find_starting_output_address): Add comments.
10684         (Output_section::do_write,
10685         Output_section::write_to_postprocessing_buffer): Do code-fill
10686         generation as appropriate.
10687         (Output_section::get_input_sections): Invalidate relaxed input section
10688         map.
10689         (Output_section::restore_states): Adjust type of checkpoint .
10690         Invalidate relaxed input section map.
10691         * output.h (Output_merge_base): New class declaration.
10692         (Input_section_specifier): New class defintion.
10693         (class Output_relaxed_input_section) Change base class to
10694         Output_section_data_build.
10695         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10696         base class initializer.
10697         (Output_section::add_relaxed_input_section): New method declaration.
10698         (Output_section::Input_section): Change visibility to protected.
10699         (Output_section::Input_section::relobj,
10700         Output_section::Input_section::shndx): Handle relaxed input sections.
10701         Output_section::input_sections) Change visibility to protected.  Also
10702         define overload to return a non-const pointer.
10703         (Output_section::Merge_section_properties): New class defintion.
10704         (Output_section::Merge_section_by_properties_map,
10705         Output_section::Output_section_data_by_input_section_map,
10706         Output_section::Relaxation_map): New types.
10707         (Output_section::relax_input_section): Rename method to
10708         Output_section::convert_input_sections_to_relaxed_sections and change
10709         interface to take a vector of relaxed section pointers.
10710         (Output_section::find_merge_section,
10711         Output_section::find_relaxed_input_section,
10712         Output_section::build_relaxation_map,
10713         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10714         New method declarations.
10715         (Output_section::merge_section_map_
10716         Output_section::merge_section_by_properties_map_,
10717         Output_section::relaxed_input_section_map_,
10718         Output_section::is_relaxed_input_section_map_valid_,
10719         Output_section::generate_code_fills_at_write_): New data members.
10720         * script-sections.cc
10721         (Output_section_element_input::set_section_addresses): Call
10722         current_data_size and addralign methods of relaxed input sections.
10723         (Orphan_output_section::set_section_addresses): Call current_data_size
10724         and addralign methods of relaxed input sections.
10725         * symtab.cc (Symbol_table::compute_final_value): Extract template
10726         from the body of Symbol_table::sized_finalize_symbol.
10727         (Symbol_table::sized_finalized_symbol): Call
10728         Symbol_table::compute_final_value.
10729         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10730         (Symbol_table::compute_final_value): New templated method declaration.
10731         * target.cc (Target::do_make_output_section): New method defintion.
10732         * target.h (Target::make_output_section): New method declaration.
10733         (Target::relax): Add more parameters for input objects, symbol table
10734         and layout.  Adjust call to do_relax.
10735         (Target::do_make_output_section): New method declaration.
10736         (Target::do_relax): Add parameters for input objects, symbol table
10737         and layout.
10738
10739 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10740
10741         * pread.c: Include stdio.h.
10742
10743 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10744
10745         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10746         defined.
10747
10748 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10749
10750         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10751         Change read_shndx type to unsigned int.
10752         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10753         int.
10754         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10755         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10756         Change read_shndx type to unsigned int.
10757         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10758         int.
10759         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10760         * layout.cc (Layout::create_symtab_sections): Cast the result of
10761         local_symcount * symsize to off_t in the gold_assert.
10762
10763 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10764
10765         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10766         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10767         R_ARM_BASE_ABS.
10768         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10769         (Arm_relocate_functions::thm_abs5): New function.
10770         (Arm_relocate_functions::abs12): New function.
10771         (Arm_relocate_functions::abs16): New function.
10772         (Arm_relocate_functions::base_abs): New function.
10773         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10774         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10775         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10776         R_ARM_BASE_ABS.
10777         (Scan::global): Likewise.
10778         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10779         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10780         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10781         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10782         R_ARM_BASE_ABS.
10783
10784 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10785
10786         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10787         (Arm_relocate_functions::movt_prel): New function.
10788         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10789         (Arm_relocate_functions::thm_movt_prel): New function.
10790         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10791         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10792         (Scan::global, Relocate::relocate): Likewise.
10793         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10794
10795 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10796
10797         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10798         Incremental_checker.
10799         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10800         unsigned int.
10801         (class Incremental_inputs_header): New class.
10802         (Incremental_inputs_header_writer): Edit comment.
10803         (Incremental_inputs_entry): New class.
10804         (Incremental_inputs_entry_writer): Edit comment.
10805         (Sized_incremental_binary::do_find_incremental_inputs_section):
10806         Add *strtab_shndx parameter, fill it.
10807         (Sized_incremental_binary::do_check_inputs): New method.
10808         (Incremental_checker::can_incrementally_link_output_file): Use
10809         Sized_incremental_binary::check_inputs.
10810         (Incremental_inputs::report_command_line): Save command line in
10811         command_line_.
10812         * incremental.h:
10813         (Incremental_binary::find_incremental_inputs_section): New
10814         method.
10815         (Incremental_binary::do_find_incremental_inputs_section): Add
10816         strtab_shndx parameter.
10817         (Incremental_binary::do_check_inputs): New pure virtual method.
10818         (Sized_incremental_binary::do_check_inputs): Declare.
10819         (Incremental_checker::Incremental_checker): Add incremental_inputs
10820         parameter, use it to initialize incremental_inputs_.
10821         (Incremental_checker::incremental_inputs_): New field.
10822         (Incremental_checker::command_line): New method.
10823         (Incremental_checker::inputs): New method.
10824         (Incremental_checker::command_line_): New field.
10825
10826 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10827
10828         * incremental.cc: Include <cstdarg> and "target-select.h".
10829         (vexplain_no_incremental): New function.
10830         (explain_no_incremental): New function.
10831         (Incremental_binary::error): New method.
10832         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10833         method.
10834         (make_sized_incremental_binary): New function.
10835         (open_incremental_binary): New function.
10836         (can_incrementally_link_file): Add checks if output is ELF and has
10837         inputs section.
10838         * incremental.h: Include "elfcpp_file.h" and "output.h".
10839         (Incremental_binary): New class.
10840         (Sized_incremental_binary): New class.
10841         (open_incremental_binary): Declare.
10842         * object.cc (is_elf_object): Use
10843         elfcpp::Elf_recognizer::is_elf_file.
10844         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10845         * output.h (Output_file::filesize): New method.
10846
10847 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10848
10849         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10850         New function.
10851         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10852         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10853         function.
10854         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10855         function.
10856         (Arm_relocate_functions::movw_abs_nc): New function.
10857         (Arm_relocate_functions::movt_abs): New function.
10858         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10859         (Arm_relocate_functions::thm_movt_abs): New function.
10860         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10861         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10862         (Scan::global): Likewise.
10863         (Relocate::relocate): Likewise.
10864         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10865
10866 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10867
10868         * arm.cc (Arm_relocate_functions::got_prel) New function.
10869         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10870         (Relocate::relocate): Likewise.
10871         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10872
10873 2009-10-06  Ian Lance Taylor  <iant@google.com>
10874
10875         * options.h (class General_options): Define
10876         split_stack_adjust_size parameter.
10877         * object.h (class Object): Add uses_split_stack_ and
10878         has_no_split_stack_ fields.  Add uses_split_stack and
10879         has_no_split_stack accessor functions.  Declare
10880         handle_split_stack_section.
10881         (class Reloc_symbol_changes): Define.
10882         (class Sized_relobj): Define Function_offsets.  Declare
10883         split_stack_adjust, split_stack_adjust_reltype, and
10884         find_functions.
10885         * object.cc (Object::handle_split_stack_section): New function.
10886         (Sized_relobj::do_layout): Call handle_split_stack_section.
10887         * dynobj.cc (Sized_dynobj::do_layout): Call
10888         handle_split_stack_section.
10889         * reloc.cc (Sized_relobj::relocate_sections): Call
10890         split_stack_adjust for executable sections in split_stack
10891         objects.  Pass reloc_map to relocate_section.
10892         (Sized_relobj::split_stack_adjust): New function.
10893         (Sized_relobj::split_stack_adjust_reltype): New function.
10894         (Sized_relobj::find_functions): New function.
10895         * target-reloc.h: Include "object.h".
10896         (relocate_section): Add reloc_symbol_changes parameter.  Change
10897         all callers.
10898         * target.h (class Target): Add calls_non_split method.  Declare
10899         do_calls_non_split virtual method.  Declare match_view and
10900         set_view_to_nop.
10901         * target.cc: Include "elfcpp.h".
10902         (Target::do_calls_non_split): New function.
10903         (Target::match_view): New function.
10904         (Target::set_view_to_nop): New function.
10905         * gold.cc (queue_middle_tasks): Give an error if mixing
10906         split-stack and non-split-stack objects with -r.
10907         * i386.cc (Target_i386::relocate_section): Add
10908         reloc_symbol_changes parameter.
10909         (Target_i386::do_calls_non_split): New function.
10910         * x86_64.cc (Target_x86_64::relocate_section): Add
10911         reloc_symbol_changes parameter.
10912         (Target_x86_64::do_calls_non_split): New function.
10913         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10914         parameter.
10915         * powerpc.cc (Target_powerpc::relocate_section): Add
10916         reloc_symbol_changes parameter.
10917         * sparc.cc (Target_sparc::relocate_section): Add
10918         reloc_symbol_changes parameter.
10919         * configure.ac: Call AM_CONDITIONAL for the default target.
10920         * configure: Rebuild.
10921         * testsuite/Makefile.am (TEST_AS): New variable.
10922         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10923         (check_DATA): Add split_i386 and split_x86_64 files.
10924         (SPLIT_DEFSYMS): Define.
10925         (split_i386_[1234n].o): New targets.
10926         (split_i386_[124]): New targets.
10927         (split_i386_[1234r].stdout): New targets.
10928         (split_x86_64_[1234n].o): New targets.
10929         (split_x86_64_[124]): New targets.
10930         (split_x86_64_[1234r].stdout): New targets.
10931         (MOSTLYCLEANFILES): Add new executables.
10932         * testsuite/split_i386.sh: New file.
10933         * testsuite/split_x86_64.sh: New file.
10934         * testsuite/split_i386_1.s: New file.
10935         * testsuite/split_i386_2.s: New file.
10936         * testsuite/split_i386_3.s: New file.
10937         * testsuite/split_i386_4.s: New file.
10938         * testsuite/split_i386_n.s: New file.
10939         * testsuite/split_x86_64_1.s: New file.
10940         * testsuite/split_x86_64_2.s: New file.
10941         * testsuite/split_x86_64_3.s: New file.
10942         * testsuite/split_x86_64_4.s: New file.
10943         * testsuite/split_x86_64_n.s: New file.
10944         * testsuite/testfile.cc (Target_test): Update relocation_section
10945         function.
10946         * testsuite/Makefile.in: Rebuild.
10947
10948 2009-10-06  Ian Lance Taylor  <iant@google.com>
10949
10950         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10951         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10952         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10953         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10954         the address on ldo_addrs_.
10955         (Target_i386::Relocate::fix_up_ldo): New function.
10956
10957 2009-10-06   Rafael Espindola  <espindola@google.com>
10958
10959         * plugin.cc (add_input_library): New.
10960         (Plugin::load): Add add_input_library to tv.
10961         (Plugin_manager::add_input_file): Add the is_lib argument.
10962         (add_input_file): Update call to Plugin_manager::add_input_file.
10963         (add_input_library): New.
10964         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10965
10966 2009-09-30  Doug Kwan  <dougkwan@google.com>
10967
10968         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10969         symbol and call Symbol::may_need_copy_reloc to determine if
10970         a copy reloc is needed.
10971         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10972         nocopyreloc is given in command line.
10973         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10974         given in command line.
10975         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10976         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10977         of the removed Target_i386::may_need_copy_reloc.
10978         * options.h (copyreloc): New option with default value false.
10979         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10980         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10981         instead of the removed Target_powerpc::may_need_copy_reloc.
10982         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10983         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10984         instead of the removed Target_sparc::may_need_copy_reloc.
10985         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10986         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10987         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10988         instead of the removed Target_x86_64::may_need_copy_reloc.
10989
10990 2009-09-30  Ian Lance Taylor  <iant@google.com>
10991
10992         * object.h (class Object): Remove target_ field, and target,
10993         sized_target, and set_target methods.
10994         (Object::sized_target): Remove.
10995         (class Sized_relobj): Update declarations.  Remove sized_target.
10996         * object.cc (Sized_relobj::setup): Remove target parameter.
10997         Change all callers.
10998         (Input_objects::add_object): Don't do anything with the target.
10999         (make_elf_sized_object): Add punconfigured parameter.  Change all
11000         callers.  Set or test parameter target.
11001         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11002         Change all callers.
11003         * parameters.cc (Parameters::set_target): Change parameter type to
11004         be non-const.
11005         (Parameters::default_target): Remove.
11006         (set_parameters_target): Change parameter type to be non-const.
11007         (parameters_force_valid_target): New function.
11008         (parameters_clear_target): New function.
11009         * parameters.h (class Parameters): Update declarations.  Remove
11010         default_target method.  Add sized_target and clear_target
11011         methods.  Change target_ to be non-const.
11012         (set_parameters_target): Update declaration.
11013         (parameters_force_valid_target): Declare.
11014         (parameters_clear_target): Declare.
11015         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11016         as NULL if we aren't searching.
11017         (Add_symbols::run): Don't check for compatible target.
11018         * fileread.cc (Input_file::open_binary): Call
11019         parameters_force_valid_target.
11020         * gold.cc (queue_middle_tasks): Likewise.
11021         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11022         set_target on object.
11023         * dynobj.h (class Sized_dynobj): Update declarations.
11024         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11025         make_elf_object returns NULL.
11026         (Archive::include_member): Don't check whether object target is
11027         compatible.
11028         * output.cc (Output_section::add_input_section): Get target from
11029         parameters.
11030         (Output_section::relax_input_section): Likewise.
11031         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11032         parameters.
11033         (Sized_relobj::do_scan_relocs): Likewise.
11034         (Sized_relobj::relocate_sections): Likewise.
11035         * resolve.cc (Symbol_table::resolve): Likewise.
11036         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11037         parameter.  Change all callers.
11038         (Symbol_table::add_from_object): Get target from parameters.
11039         (Symbol_table::add_from_relobj): Don't check object target.
11040         (Symbol_table::add_from_dynobj): Likewise.
11041         (Symbol_table::define_special_symbol): Get target from
11042         parameters.
11043         * symtab.h (class Symbol_table): Update declaration.
11044         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11045         parameter.  Change all callers.  Clear parameter target.
11046         (Binary_test): Test target here.
11047         * testsuite/object_unittest.cc (gold_testsuite): Remove
11048         target_test_pointer parameter.  Change all callers.
11049         (Object_test): Test target here.
11050
11051 2009-09-26  Ian Lance Taylor  <iant@google.com>
11052
11053         * testsuite/initpri1.c: Don't try to use constructor priorities if
11054         compiling with gcc before 4.3.
11055
11056 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11057
11058         * testsuite/retain_symbols_file_test.sh (check_present): Change
11059         output file name to retain_symbols_file_test.stdout.
11060         (check_absent): Likewise.
11061
11062 2009-09-18  Craig Silverstein  <csilvers@google.com>
11063
11064         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11065         * options.cc: Include <cerrno> and <fstream>.
11066         (General_options::finalize): Parse -retain-symbols-file tag.
11067         * options.h: New flag.
11068         (General_options): New method should_retain_symbol, new
11069         variable symbols_to_retain.
11070         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11071         should_retain_symbol map.
11072         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11073         * testsuite/Makefile.in: Regenerate.
11074         * testsuite/retain_symbols_file_test.sh: New file.
11075
11076 2009-09-18  Nick Clifton  <nickc@redhat.com>
11077
11078         * po/es.po: Updated Spanish translation.
11079
11080 2009-09-17  Doug Kwan  <dougkwan@google.com>
11081
11082         * debug.h (DEBUG_RELAXATION): New constant.
11083         (DEBUG_ALL): Add DEBUG_RELAXATION.
11084         (debug_string_to_enum): Add relaxation debug option.
11085         * layout.cc
11086         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11087         Layout::Relaxation_debug_check::read_sections,
11088         Layout::Relaxation_debug_check::read_sections): New method definitions.
11089         (Layout::Layout): Initialize data members
11090         record_output_section_data_from_scrips_,
11091         script_output_section_data_list_ and relaxation_debug_check_.
11092         (Layout::save_segments, Layout::restore_segments,
11093         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11094         Layout::relaxation_loop_body): New method definitions.
11095         (Layout::finalize): Support relaxation.  Move section layout code to
11096         Layout::relaxation_loop_body.
11097         (Layout::set_asection_address_from_script): Move code for orphan
11098         section placement out.
11099         (Layout::place_orphan_sections_in_script): New method definition.
11100         * layout.h (Output_segment_headers, Output_file_header):
11101         New forward class declarations.
11102         (Layout::~Layout): Define.
11103         (Layout::new_output_section_data_from_script): New method definition.
11104         (Layout::place_orphan_sections_in_script): New method declaration.
11105         (Layout::Segment_states): New type declaration.
11106         (Layout::save_segments, Layout::restore_segments,
11107         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11108         Layout::relaxation_loop_body): New method declarations.
11109         (Layout::Output_section_data_list): New type declaration.
11110         (Layout::Relaxation_debug_check): New class definition.
11111         (Layout::record_output_section_data_from_script_,
11112         Layout::script_output_section_data_list_, Layout::segment_states_,
11113         Layout::relaxation_debug_check_): New data members.
11114         * output.cc: (Output_section_headers::do_size): New method definition.
11115         (Output_section_headers::Output_section_headers): Move size
11116         computation to Output_section_headers::do_size.
11117         (Output_segment_headers::do_size): New method definition.
11118         (Output_file_header::Output_file_header): Move size computation to
11119         Output_file_header::do_size and call it.
11120         (Output_file_header::do_size): New method definition.
11121         (Output_data_group::Output_data_group): Adjust call to
11122         Output_section_data.
11123         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11124         (Output_symtab_xindex::do_write): Add array bound check.
11125         (Output_section::Input_section::print_to_mapfile): Handle
11126         RELAXED_INPUT_SECTION_CODE.
11127         (Output_section::Output_section): Initialize data member checkpoint_.
11128         (Output_section::~Output_section): Delete checkpoint object pointed
11129         by checkpoint_.
11130         (Output_section::add_input_section): Always add an Input_section if
11131         relaxing.
11132         (Output_section::add_merge_input_section): Add assert.
11133         (Output_section::relax_input_section): New method definition.
11134         (Output_section::set_final_data_size): Set load address to zero for
11135         an unallocated section.
11136         (Output_section::do_address_and_file_offset_have_reset_values):
11137         New method definition.
11138         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11139         Handle relaxed input section.
11140         (Output_section::sort_attached_input_sections): Checkpoint input
11141         section list lazily.
11142         (Output_section::get_input_sections): Change type of input_sections to
11143         list of Simple_input_section pointers.  Checkpoint input section list
11144         lazily.  Also handle relaxed input sections.
11145         (Output_section::add_input_section_for_script): Take a reference to
11146         a Simple_input_section object instead of Relobj pointer and section
11147         index as parameter.  Handle relaxed input sections.
11148         (Output_section::save_states, Output_section::restore_states): New
11149         method definitions.
11150         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11151         (Output_data::is_data_size_fixed): New method definition.
11152         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11153         if it is fixed.
11154         (Output_data::address_and_file_offset_have_reset_values): New method
11155         definition.
11156         (Output_data::do_address_and_file_offset_have_reset_values): New method
11157         definition.
11158         (Output_data::set_data_size): Check that data size is not fixed.
11159         (Output_data::fix_data_size): New method definition.
11160         (Output_data::is_data_size_fixed_): New data member.
11161         (Output_section_headers::set_final_data_size): New method definition.
11162         (Output_section_headers::do_size): New method declaration.
11163         (Output_segment_headers::set_final_data_size): New method definition.
11164         (Output_segment_headers::do_size): New method declaration.
11165         (Output_file_header::set_final_data_size)::New method definition.
11166         (Output_file_header::do_size)::New method declaration.
11167         (Output_section_data::Output_section_data): Add new parameter
11168         is_data_size_fixed and use it to fix data size.
11169         (Output_data_const::Output_data_const): Adjust call to base class
11170         constructor and fix data size.
11171         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11172         base class constructor and fix data size.
11173         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11174         base class constructor and fix data size.
11175         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11176         class constructor and fix data size.
11177         (Output_data_group::set_final_data_size): New method definition.
11178         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11179         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11180         class constructor and fix data size.
11181         (Output_relaxed_input_section): New class definition.
11182         (Output_section::Simple_input_section): New class definition.
11183         (Output_section::get_input_sections): Adjust parameter list.
11184         (Output_section::add_input_section_for_script): Same.
11185         (Output_section::save_states, Output_section::restore_states,
11186         Output_section::do_address_and_file_offset_have_reset_values,
11187         (Output_section::Input_section::Input_section): Handle
11188         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11189         Output_relaxed_input_section.
11190         (Output_section::Input_section::is_input_section,
11191         Output_section::Input_section::set_output_section): Handle relaxed
11192         input section.
11193         (Output_section::Input_section::is_relaxed_input_section,
11194         Output_section::Input_section::output_section_data,
11195         Output_section::Input_section::relaxed_input_section): New method
11196         definitions.
11197         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11198         value.
11199         (Output_section::Input_section::u1_): Update comments.
11200         (Output_section::Input_section::u2_): Add new union member poris.
11201         (Output_section::Checkpoint_output_section): New classs definition.
11202         (Output_section::relax_input_section): New method declaration.
11203         (Output_section::checkpoint_): New data member.
11204         (Output_segment): Update comments.
11205         (Output_segment::Output_segment): Un-privatize copy constructor.
11206         (Output_segment::operator=): Un-privatize.
11207         * script-sections.cc (Output_section_element::Input_section_list):
11208         Change element type to Output_section::Simple_input_section.
11209         (Output_section_element_dot_assignment::set_section_addresses):
11210         Register output section data for relaxation clean up.
11211         (Output_data_exression::Output_data_expression): Adjust call to base
11212         constructor to fix data size.
11213         (Output_section_element_data::set_section_addresses): Register
11214         Output_data_expression object for relaxation clean up.
11215         (struct Input_section_info): Replace Relobj pointer and section index
11216         pair with Output_section::Simple_input_section and Convert struct to a
11217         class.
11218         (Input_section_sorter::operator()): Adjust access to
11219         Input_section_info data member to use accessors.
11220         (Output_section_element_input::set_section_addresses): Use layout
11221         parameter.  Adjust code to use Output_section::Simple_input_section
11222         and Input_secction_info classes.  Register filler for relaxation
11223         clean up.
11224         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11225         and section index pair with Output_section::Simple_input_section
11226         class.  Adjust code accordingly.
11227         (Phdrs_element::release_segment): New method definition.
11228         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11229         segment list.
11230         (Script_sections::release_segments): New method definition.
11231         * gold/script-sections.h (Script_sections::release_segments): New
11232         method declaration.
11233         * gold/target.h (Target::may_relax, Target::relax,
11234         Target::do_may_relax, Target::do_relax): New method definitions.
11235
11236 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11237
11238         * arm.cc (has_signed_unsigned_overflow): New function.
11239         (Arm_relocate_functions::abs8): New function.
11240         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11241         (Target_arm::Scan::global): Likewise.
11242         (Target_arm::relocate::relocate): Likewise.
11243         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11244         Likewise.
11245
11246 2009-09-16  Cary Coutant  <ccoutant@google.com>
11247
11248         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11249         * testsuite/Makefile.in: Regenerate.
11250
11251 2009-09-11  Nick Clifton  <nickc@redhat.com>
11252
11253         * po/gold.pot: Updated by the Translation project.
11254
11255 2009-09-08  Cary Coutant  <ccoutant@google.com>
11256
11257         * output.cc (Output_file::open): Add execute permission to empty file.
11258         * testsuite/Makefile.am (permission_test): New test.
11259         * testsuite/Makefile.in: Regenerate.
11260
11261 2009-09-02  Ian Lance Taylor  <iant@google.com>
11262
11263         * output.cc (Output_file::resize): Call map_no_anonymous rather
11264         than map.
11265
11266 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11267
11268         * gold.cc: Include "incremental.h".
11269         (queue_initial_tasks): Call Incremental_checker methods.
11270         * incremental.cc: Include "output.h".
11271         (Incremental_checker::can_incrementally_link_output_file): New
11272         method.
11273         * incremental.h (Incremental_checker): New class.
11274
11275         * output.cc (Output_file::open_for_modification): New method.
11276         (Output_file::map_anonymous): Changed return type to bool.  Record
11277         map in base_ field.
11278         (Output_file::map_no_anonymous): New method, broken out of map.
11279         (Output_file::map): Use map_no_anonymous and map_anonymous.
11280         * output.h (class Output_file): Update declarations.
11281
11282 2009-08-24  Cary Coutant  <ccoutant@google.com>
11283
11284         * options.h (Command_line::Pre_options): New class.
11285         (Command_line::pre_options): New member.
11286         * options.cc (gold::options::ready_to_register): New variable.
11287         (One_option::register_option): Do nothing if not registering options.
11288         Assert if same short option registered twice.
11289         (General_options::General_options): Turn off option registration when
11290         done constructing.
11291         (Command_line::Pre_options::Pre_options): New constructor.
11292
11293 2009-08-24  Cary Coutant  <ccoutant@google.com>
11294
11295         * options.h (General_options::no_keep_memory): Remove incorrect
11296         short option.
11297
11298 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11299
11300         * Makefile.am (am__skiplex, am__skipyacc): New.
11301         * Makefile.in: Regenerate.
11302
11303 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11304
11305         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11306         (INCLUDES): ... this.
11307         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11308         (AM_CPPFLAGS): Renamed from ...
11309         (INCLUDE): ... this.
11310         * Makefile.in, testsuite/Makefile.in: Regenerate.
11311
11312         * Makefile.in: Regenerate.
11313         * aclocal.m4: Likewise.
11314         * config.in: Likewise.
11315         * configure: Likewise.
11316         * testsuite/Makefile.in: Likewise.
11317
11318         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11319         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11320         * Makefile.in: Regenerate.
11321         * testsuite/Makefile.in: Regenerate.
11322
11323 2009-08-19  Cary Coutant  <ccoutant@google.com>
11324
11325         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11326         symbols in shared libraries overridden by hidden or internal symbols
11327         in the main program.
11328
11329 2009-08-19  Chris Demetriou  <cgd@google.com>
11330
11331         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11332         checking source file names in error messages.
11333
11334 2009-08-18  Doug Kwan  <dougkwan@google.com>
11335
11336         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11337         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11338         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11339         an elfcpp::Ehdr as parameter.
11340         * object.cc (Object::set_target): Remove the version that looks up
11341         a target and sets it.
11342         (Sized_relobj::setup): Take a Target object instead of
11343         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11344         (make_elf_sized_object): Find target and ask target to
11345         make an ELF object.
11346         * object.h: (Object::set_target): Remove the version that looks up
11347         a target and sets it.
11348         (Sized_relobj::setup): Take a Target object instead of
11349         an elfcpp:Ehdr as parameter.
11350         * target.cc: Include dynobj.h.
11351         (Target::do_make_elf_object_implementation): New.
11352         (Target::do_make_elf_object): New.
11353         * target.h (Target::make_elf_object): New template declaration.
11354         (Target::do_make_elf_object): New method declarations.
11355         (Target::do_make_elf_object_implementation): New template declaration.
11356
11357 2009-08-14  Ian Lance Taylor  <iant@google.com>
11358
11359         * gold.h (FUNCTION_NAME): Define.
11360         (gold_unreachable): Use FUNCTION_NAME.
11361
11362 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11363
11364         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11365         symbol in the --keep-unique list is not found.
11366
11367 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11368
11369         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11370         been maked as --keep-unique.
11371         (Icf::unfold_section): New function.
11372         * icf.h (Icf::unfold_section): New function.
11373         * options.h (General_options::keep_unique): New option.
11374         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11375         * testsuite/Makefile.in: Regenerate.
11376         * testsuite/icf_keep_unique_test.sh: New file.
11377         * testsuite/icf_keep_unique_test.cc: New file.
11378
11379 2009-08-12  Cary Coutant  <ccoutant@google.com>
11380
11381         PR 10471
11382         * resolve.cc (Symbol_table::resolve): Check for references from
11383         dynamic objects to hidden and internal symbols.
11384         * testsuite/Makefile.am (hidden_test.sh): New test.
11385         * testsuite/Makefile.in: Regenerate.
11386         * testsuite/hidden_test.sh: New script.
11387         * testsuite/hidden_test_1.c: New test source.
11388         * testsuite/hidden_test_main.c: New test source.
11389
11390 2009-08-11  Doug Kwan  <dougkwan@google.com>
11391
11392         * arm.cc: Update comments.
11393         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11394         segment to locate the .ARM.exidx section if present.
11395
11396 2009-08-09  Doug Kwan  <dougkwan@google.com>
11397
11398         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11399         patch.
11400
11401 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11402         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11403         compiler warnings.
11404
11405 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11406
11407         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11408         valid tls_segment only for non-debug-section relocations.
11409         * testsuite/Makefile.am: Add gc_tls_test.
11410         * testsuite/Makefile.in: Regenerate.
11411         * testsuite/gc_tls_test.cc: New file.
11412         * testsuite/gc_tls_test.sh: New file.
11413
11414 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11415
11416         * icf.cc: New file.
11417         * icf.h: New file.
11418         * Makefile.am (CCFILES): Add icf.cc.
11419         (HFILES): Add icf.h
11420         * Makefile.in: Regenerate.
11421         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11422         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11423         section, symbol and addend information for the relocs.
11424         * gold.cc (queue_middle_tasks): Call identical code folding.
11425         * gold.h: Add defines for multimap.
11426         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11427         to the call of finalize_local_symbols.
11428         * main.cc (main): Create object of class Icf.
11429         * object.cc (Sized_relobj::do_layout): Allow this function to be
11430         called twice during icf.
11431         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11432         to sections marked as identical by icf.
11433         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11434         when available.
11435         (Sized_relobj::do_section_entsize): New function.
11436         * object.h (Object::section_entsize): New function.
11437         (Object::do_section_entsize): New pure virtual function.
11438         (Relobj::finalize_local_symbols): Add new parameter.
11439         (Relobj::do_section_entsize): New function.
11440         * options.h (General_options::icf): New option.
11441         (General_options::icf_iterations): New option.
11442         (General_options::print_icf_sections): New option.
11443         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11444         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11445         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11446         icf.
11447         * symtab.cc (Symbol_table::is_section_folded): New function.
11448         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11449         to sections marked as identical by icf.
11450         * symtab.h (Symbol_table::set_icf): New function.
11451         (Symbol_table::icf): New function.
11452         (Symbol_table::is_section_folded): New function.
11453         (Symbol_table::icf_): New data member.
11454         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11455         * testsuite/Makefile.am: Add commands to build icf_test.
11456         * testsuite/Makefile.in: Regenerate.
11457         * testsuite/icf_test.sh: New file.
11458         * testsuite/icf_test.cc: New file.
11459
11460 2009-07-24  Chris Demetriou  <cgd@google.com>
11461
11462         * layout.cc (is_compressible_debug_section): Fix incorrect
11463         comment about compressed section names.
11464
11465 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11466
11467         PR 10419
11468         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11469
11470 2009-07-16  Ian Lance Taylor  <iant@google.com>
11471
11472         PR 10400
11473         * layout.h: #include <map>.
11474         (class Kept_section): Change from struct to class.  Add accessors
11475         and setters.  Add section size to Comdat_group mapping.  Change
11476         Comdat_group to std::map.  Add is_comdat_ field.  Add
11477         linkonce_size field in union.
11478         (class Layout): Update declaration of find_or_add_kept_section.
11479         Don't declare find_kept_object.
11480         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11481         parameter.  Add object, shndx, is_comdat, and is_group_name
11482         parameters.  Change all callers.  Adjust for new Kept_section.
11483         (Layout::find_kept_object): Remove.
11484         * object.cc (Sized_relobj::include_section_group): Update use of
11485         Kept_section.  Rename secnum to shndx.  Only record
11486         Kept_comdat_section if sections are the same size.
11487         (Sized_relobj::include_linkonce_section): Update use of
11488         Kept_section.  Only record Kept_comdat_section if sections are the
11489         same size.  Set size of linkonce section.
11490         (Sized_relobj::map_to_kept_section): Update call to
11491         get_kept_comdat_section.
11492         * object.h (class Sized_relobj): Rename fields in
11493         Kept_comdat_section to drop trailing underscores; change object
11494         field to Relobj*.  Change Kept_comdat_section_table to store
11495         struct rather than pointer.
11496         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11497         Add kept_object and kept_shndx parameters.  Change all callers.
11498         (Sized_relobj::get_kept_comdat_section): Change return type to
11499         bool.  Add kept_object and kept_shndx parameters.  Change all
11500         callers.
11501         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11502         Layout::find_or_add_kept_section.
11503
11504 2009-07-09  Ian Lance Taylor  <iant@google.com>
11505
11506         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11507         Reserve space in the hash table.
11508
11509 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11510
11511         * fileread.cc (File_read::get_mtime): New method.
11512         * fileread.h (Timespec): New structure.
11513         (File_read::get_mtime): New method.
11514         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11515         Renamed from timestamp_nsec.
11516         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11517         Elf_Xword.
11518         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11519         timestamp_nsec.
11520         (Incremental_inputs::report_archive): Save mtime; style fix.
11521         (Incremental_inputs::report_obejct): Save mtime; style fix.
11522         (Incremental_inputs::report_script): Save mtime; style fix.
11523         (Incremental_inputs::finalize_inputs): Style fix.
11524         (Incremental_inputs::finalize): Style fix.
11525         (Incremental_inputs::create_input_section_data): Store inputs
11526         mtime.
11527         * incremental.h (Incremental_inputs::report_script): Add mtime
11528         argument.
11529         (Incremental_inputs::Input_info::Input_info): Intialize only one
11530         union member.
11531         (Incremental_inputs::Input_info::archive): Move to nameless
11532         union.
11533         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11534         (Incremental_inputs::Input_info::script): Move to nameless union.
11535         (Incremental_inputs::mtime): New field.
11536         * script.cc (read_input_script): Pass file mtime to
11537         Incremental_input.
11538         * script.h (Script_info::inputs): Style fix.
11539
11540 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11541
11542         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11543         instead of 32.
11544
11545 2009-06-24  Ian Lance Taylor  <iant@google.com>
11546
11547         PR 10156
11548         * layout.cc (Layout::choose_output_section): If we find an
11549         existing section, update the flags.
11550         (Layout::create_notes): New function, broken out of
11551         Layout::finalize.
11552         (Layout::finalize): Don't create note sections.
11553         (Layout::create_note): Don't crash if linker script discards
11554         section.
11555         (Layout::create_gold_note): Likewise.
11556         (Layout::create_build_id): Likewise.  Don't set
11557         after_input_sections on the section.
11558         (Layout::create_executable_stack_info): Remove target parameter.
11559         Change caller.
11560         * layout.h (class Layout): Declare create_notes.  Update
11561         declaration of create_executable_stack_info.
11562         * gold.cc (queue_middle_tasks): Call create_notes.
11563         * output.cc (Output_section::update_flags_for_input_section): Move
11564         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11565         invalid.
11566         * output.h (Output_data::mark_address_invalid): New function.
11567         (class Output_section): Only declare, not define,
11568         update_flags_for_input_section.  Remove set_flags.
11569
11570 2009-06-24  Ian Lance Taylor  <iant@google.com>
11571
11572         * script-sections.cc (Output_section_definition::
11573         set_section_addresses): Rename shadowing local load_address to
11574         laddr.
11575
11576 2009-06-24  Ian Lance Taylor  <iant@google.com>
11577
11578         PR 10244
11579         * reloc.cc (relocate_sections): Skip empty relocation sections.
11580
11581 2009-06-23  Ian Lance Taylor  <iant@google.com>
11582
11583         PR 10156
11584         * layout.cc (Layout::create_note): Use choose_output_section
11585         rather than make_output_section.
11586
11587 2009-06-23  Ian Lance Taylor  <iant@google.com>
11588
11589         PR 10237
11590         * options.cc (General_options::parse_V): Set printed_version_.
11591         (General_options::General_options): Initialize printed_version_.
11592         * options.h (class General_options): Add printed_version_ field.
11593         * gold.cc (queue_initial_tasks): If there are no input files,
11594         don't give a fatal error if we printed the version information.
11595         (queue_middle_tasks): If using -r with a shared object, give a
11596         fatal error rather than an ordinary error.
11597
11598 2009-06-23  Ian Lance Taylor  <iant@google.com>
11599
11600         PR 10219
11601         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11602         (Layout::make_output_section): Set have_stabstr_section_ if we see
11603         a .stab*str section.
11604         (Layout::finalize): Call link_stabs_sections.
11605         (Layout::link_stabs_sections): New file.
11606         * layout.h (class Layout): Add have_stabstr_section_ field.
11607         Declare link_stabs_sections.
11608
11609 2009-06-23  Doug Kwan  <dougkwan@google.com>
11610
11611         * Makefile.am (libgold_a_LIBADD): New.
11612         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11613         * Makefile.in: Regenerate.
11614         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11615         * configure: Regenerate.
11616         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11617         * fileread.cc: Include sys/state.h
11618         * gold.h: Declare memmem and strndup if found missing.
11619         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11620
11621 2009-06-23  Ian Lance Taylor  <iant@google.com>
11622
11623         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11624         * configure: Rebuild.
11625
11626 2009-06-23  Ian Lance Taylor  <iant@google.com>
11627
11628         PR 10147
11629         * object.cc (Object::section_contents): Don't try to get a view if
11630         the section has length zero.
11631         (Object::handle_gnu_warning_section): If the section is empty, use
11632         the name of the section as the warning.
11633
11634 2009-06-23  Ian Lance Taylor  <iant@google.com>
11635
11636         PR 10133
11637         * stringpool.h (class Stringpool_template): Add optimize_ field.
11638         (Stringpool_template::set_optimize): New function.
11639         * stringpool.cc (Stringpool_template::Stringpool_template):
11640         Initialize optimize_ field.
11641         (Stringpool_template::set_string_offsets): Test local optimize
11642         fild rather than parameter.
11643         * layout.cc (Layout::Layout): Call set_optimize on the section
11644         name stringpool.
11645
11646 2009-06-22  Ian Lance Taylor  <iant@google.com>
11647
11648         PR 10030
11649         * yyscript.y: Parse TARGET.
11650         * script.cc (script_set_target): New function.
11651         * script-c.h (script_set_target): Declare.
11652         * options.cc (General_options::string_to_object_format): Rename
11653         from string_to_object_format in anonymous namespace.  Change
11654         callers.
11655         * options.h (class General_options): Declare
11656         string_to_object_format.
11657
11658 2009-06-22  Ian Lance Taylor  <iant@google.com>
11659
11660         * script-sections.cc (Script_sections::create_segments): Don't put
11661         program headers in a PT_LOAD segment if -n or -N.
11662
11663 2009-06-22  Ian Lance Taylor  <iant@google.com>
11664
11665         PR 10141
11666         * options.h (class General_options): Add -z lazy and -z now.  Sort
11667         -z options into alphabetical order.
11668         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11669
11670 2009-06-21  Ian Lance Taylor  <iant@google.com>
11671
11672         * layout.cc (Layout::make_output_section): Call
11673         Target::new_output_section.
11674         (Layout::attach_allocated_section_to_segment): Put large section
11675         sections in a separate load segment with the large segment flag
11676         set.
11677         (Layout::segment_precedes): Sort large data segments after other
11678         load segments.
11679         (align_file_offset): New static function.
11680         (Layout::set_segment_offsets): Use align_file_offset.
11681         * output.h (class Output_section): Add is_small_section_ and
11682         is_large_section_ fields.
11683         (Output_section::is_small_section): New function.
11684         (Output_section::set_is_small_section):  New function.
11685         (Output_section::is_large_section): New function.
11686         (Output_section::set_is_large_section): New function.
11687         (Output_section::is_large_data_section): New function.
11688         (class Output_segment): Add is_large_data_segment_ field.
11689         (Output_segment::is_large_data_segment): New function.
11690         (Output_segment::set_is_large_data_segment): New function.
11691         * output.cc (Output_section::Output_section): Initialize new
11692         fields.
11693         (Output_segment::Output_segment): Likewise.
11694         (Output_segment::add_output_section): Add assertion that large
11695         data sections always go in large data segments.  Force small data
11696         sections to the end of the list of data sections.  Force small BSS
11697         sections to the start of the list of BSS sections.  For large BSS
11698         sections to the end of the list of BSS sections.
11699         * symtab.h (class Symbol): Declare is_common_shndx.
11700         (Symbol::is_defined): Check Symbol::is_common_shndx.
11701         (Symbol::is_common): Likewise.
11702         (class Symbol_table): Define enum Commons_section_type.  Update
11703         declarations.  Add small_commons_ and large_commons_ fields.
11704         * symtab.cc (Symbol::is_common_shndx): New function.
11705         (Symbol_table::Symbol_table): Initialize new fields.
11706         (Symbol_table::add_from_object): Put small and large common
11707         symbols in the right list.
11708         (Symbol_table::sized_finalized_symbol): Check
11709         Symbol::is_common_shndx.
11710         (Symbol_table::sized_write_globals): Likewise.
11711         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11712         common symbol lists.  Don't call do_allocate_commons_list if the
11713         list is empty.
11714         (Symbol_table::do_allocate_commons_list): Remove is_tls
11715         parameter.  Add comons_section_type parameter.  Change all
11716         callers.  Handle small and large common symbols.
11717         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11718         Symbol::is_common_shndx.
11719         * resolve.cc (symbol_to_bits): Likewise.
11720         * target.h (Target::small_common_shndx): New function.
11721         (Target::small_common_section_flags): New function.
11722         (Target::large_common_shndx): New function.
11723         (Target::large_common_section_flags): New function.
11724         (Target::new_output_section): New function.
11725         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11726         small_common_section_flags, and large_common_section_flags
11727         fields.
11728         (Target::do_new_output_section): New virtual function.
11729         * arm.cc (Target_arm::arm_info): Initialize new fields.
11730         * i386.cc (Target_i386::i386_info): Likewise.
11731         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11732         Likewise.
11733         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11734         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11735         (Target_x86_64::do_new_output_section): New function.
11736         * configure.ac: Define conditional MCMODEL_MEDIUM.
11737         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11738         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11739         (large_LDFLAGS): Define.
11740         * testsuite/large.c: New file.
11741         * testsuite/testfile.cc (Target_test::test_target_info):
11742         Initialize new fields.
11743         * configure, testsuite/Makefile.in: Rebuild.
11744
11745 2009-06-05  Doug Kwan  <dougkwan@google.com>
11746
11747         * Makefile.am (CCFILES): Add target.cc.
11748         * Makefile.in: Regenerate.
11749         * i386.cc (class Target_i386): Define new virtual method to
11750         override do_is_local_label_name in parent.
11751         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11752         local symbols if --discard-locals or -X is given.
11753         * options.h (class General_options): Declare new options
11754         '--discard-locals' and '-X' for discarding locals.
11755         * target.h (class Target): Define new methods is_local_label_name.
11756         Declare new virtual method do_is_local_label_name.
11757         * target.cc: New file.
11758         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11759         (check_SCRIPTS): Add discard_locals_test.sh.
11760         (check_DATA): Add discard_local_tests.syms.
11761         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11762         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11763         * testsuite/Makefile.in: Regenerate.
11764         * testsuite/discard_locals_test.c: New file.
11765         * testsuite/discard_locals_test.sh: Same.
11766
11767 2009-06-05  Doug Kwan  <dougkwan@google.com>
11768
11769         * object.cc (Sized_relobj::Sized_relobj): Initialize
11770         discarded_eh_frame_shndx_ to -1U.
11771         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11772         section.
11773         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11774         a discarded .eh_frame section.
11775         (Sized_relobj::do_finalize_local_symbols): Ditto.
11776         * object.h (class Sized_relobj): Declare new member
11777         discarded_eh_frame_shndx_.
11778         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11779         (local_labels_test.o, local_labels_test): New rules.
11780         * testsuite/Makefile.in: Regenerate.
11781
11782 2009-06-04  Doug Kwan  <dougkwan@google.com>
11783
11784         * layout.cc (Layout::section_name_mapping): Add mapping for
11785         special ARM sections.
11786
11787 2009-06-03  Doug Kwan  <dougkwan@google.com>
11788
11789         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11790         (utils::has_overflow): Same.
11791
11792 2009-06-03  Ian Lance Taylor  <iant@google.com>
11793
11794         * layout.cc (Layout::section_name_mapping): New array, replacing
11795         Layout::linkonce_mapping.
11796         (Layout::section_name_mapping_count): New variable, replacing
11797         Layout::linkonce_mapping_count.
11798         (Layout::linkonce_output_name): Remove.
11799         (Layout::output_section_name): Rewrite.
11800         * layout.h (class Layout): Rename Linkonce_mapping to
11801         Section_name_mapping, linkonce_mapping to section_name_mapping,
11802         linkonce_mapping_count to section_name_mapping_count.  Don't
11803         declare linkonce_output_name.
11804
11805 2009-06-03  Doug Kwan  <dougkwan@google.com>
11806
11807         * gold/arm.cc (namespace utils): New.
11808         (Target_arm::reloc_is_non_pic): Define new method.
11809         (class Arm_relocate_functions): New.
11810         (Target_arm::Relocate::relocate): Handle relocation types used by
11811         Android.
11812
11813 2009-06-03  Ian Lance Taylor  <iant@google.com>
11814
11815         * arm.cc (Target_arm::scan::global): Use || instead of |.
11816
11817 2009-06-02  Doug Kwan  <dougkwan@google.com>
11818
11819         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11820         issued_non_pic_error_.
11821         (class Target_arm::Scan): Declare new method check_non_pic.
11822         Define new method symbol_needs_plt_entry.
11823         Declare new data member issued_non_pic_error_.
11824         (class Target_arm::Relocate): Declare new method
11825         should_apply_static_reloc.
11826         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11827         (Target_arm::Scan::check_non_pic): Define new method.
11828         (Target_arm::Scan::local): Handle a small subset of reloc types used
11829         by Android.
11830         (Target_arm::Scan::local): Same.
11831         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11832
11833 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11834
11835         * incremental.cc (Incremental_inputs::report_command_line): Filter
11836         out --incremental-* options.
11837
11838 2009-05-29  Doug Kwan  <dougkwan@google.com>
11839
11840         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11841         template class.
11842         (class Target_arm): Update comment.
11843         (Target_arm::Target_arm): Initialize new data members GOT_,
11844         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11845         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11846         and Target_arm::rel_dyn_section.
11847         Declare new_enum Target_arm::Got_type.
11848         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11849         and DYNBSS_.
11850         Update commments for member do_dynsym_value.
11851         (Target_arm::got_size, Target_arm::plt_section,
11852         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11853         new methods inside class defintion.
11854         (Target_arm::got_section): Define new method.
11855         (Target_arm::rel_dyn_section): Same.
11856         (Output_data_plt_arm): New template class.
11857         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11858         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11859         (Output_data_plt_arm::add_entry): Same.
11860         (Output_data_plt_arm::first_plt_entry): Define new
11861         static data member for PLT instruction template.
11862         (Output_data_plt_arm::plt_entry): Same.
11863         (Output_data_plt_arm::do_write): Define new method.
11864         (Target_arm::make_plt_entry): Same.
11865         (Target_arm::do_finalize_sections): Same.
11866         (Target_arm::do_dynsym_value): Same.
11867
11868 2009-05-28  Doug Kwan  <dougkwan@google.com>
11869
11870         * Makefile.am (TARGETSOURCES): Add arm.cc.
11871         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11872         * Makefile.in: Regenerate.
11873         * arm.cc: New file.
11874         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11875
11876 2009-05-26  Doug Kwan  <dougkwan@google.com>
11877
11878         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11879         (General_options::check_excluded_libs): Strip off directories in
11880         archive name before matching like GNU ld does.
11881         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11882         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11883         (exclude_libs_test_LDFLAGS): Add linker option
11884         -Wl,--exclude-libs,libexclude_libs_test_3
11885         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11886         an explicit archive without using -l.
11887         (alt/libexclude_libs_test_3.a): New make rule.
11888         * testsuite/Makefile.in: Regenerate.
11889         * testsuite/exclude_libs_test.c : Declare lib3_default().
11890         (main): Call it.
11891         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11892         * exclude_libs_test_3.c: New file.
11893
11894 2009-05-26  Nick Clifton  <nickc@redhat.com>
11895
11896         * po/id.po: New Indonesian translation.
11897         * po/gold.pot: Updated template file.
11898
11899 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11900
11901         * testsuite/Makefile.am: Add -ffunction-sections to compile
11902         gc_comdat_test files.  Add -Wl,--gc-sections to build
11903         gc_comdat_test.
11904         * testsuite/Makefile.in: Regenerate.
11905         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11906
11907 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11908
11909         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11910         kept comdat section was garbage collected.
11911         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11912         * testsuite/Makefile.in: Regenerate.
11913         * testsuite/gc_comdat_test.sh: New file.
11914         * testsuite/gc_comdat_test_1.cc: New file.
11915         * testsuite/gc_comdat_test_2.cc: New file.
11916
11917 2009-05-19  Doug Kwan  <dougkwan@google.com>
11918
11919         * archive.cc (Archive::Archive): Move constructor from archive.h
11920         to here.  Initialize no_export_.
11921         (Archive::get_elf_object_for_member): Set no_export flag of object.
11922         * archive.h (Archive::Archive): Move constructor body to
11923         archive.cc.
11924         (Archive::no_export): New method.
11925         (Archive::no_export_): New field.
11926         * object.h (Object::Object): Initialize no_export_ to false.
11927         (Object::no_export, Object::set_no_export): New methods.
11928         (Object::no_export_): New field.
11929         * options.cc (General_options::parse_exclude_libs): New method.
11930         (General_options::check_excluded_libs) Same.
11931         * options.h (exclude_libs): New option.
11932         (General_options::check_excluded_libs): New method declaration.
11933         (General_options::excluded_libs_): New field.
11934         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11935         default or protected visibility if an object has no-export flag set.
11936         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11937         (check_SCRIPTS): Add exclude_libs_test.sh.
11938         (check_DATA): Add exclude_libs_test.syms.
11939         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11940         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11941         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11942         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11943         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11944         libexclude_libs_test_2.a): New rules.
11945         * testsuite/Makefile.in: Regenerate.
11946         * testsuite/exclude_libs_test.c: New file.
11947         * testsuite/exclude_libs_test.sh: Ditto.
11948         * testsuite/exclude_libs_test_1.c: Ditto.
11949         * testsuite/exclude_libs_test_2.c: Ditto.
11950
11951 2009-05-15  Ian Lance Taylor  <iant@google.com>
11952
11953         * configure.ac: Check for declarations for cases where libiberty.h
11954         checks HAVE_DECL_xxx.
11955         * configure, config.in: Rebuild.
11956
11957 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11958
11959         * gold.h (Incremental_argument_list): Remove (invalid) forward
11960         declaration.
11961         * incremental.cc (Incremental_inputs::report_achive): New method.
11962         (Incremental_inputs::report_object): New method.
11963         (Incremental_inputs::report_script): New method.
11964         (Incremental_inputs::finalize_inputs): New method.
11965         (Incremental_inputs::finalize): Call finalize_inputs().
11966         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11967         Create inputs entries.
11968         * incremental.h (Incremental_input_type): New enum.
11969         (Incremental_inputs::Incremental_input): Initialize new fields.
11970         (Incremental_inputs::report_inputs): New method.
11971         (Incremental_inputs::report_achive): New method.
11972         (Incremental_inputs::report_object): New method.
11973         (Incremental_inputs::report_script): New method.
11974         (Incremental_inputs::finalize_inputs): New method.
11975         (Incremental_inputs::Input_info): New struct.
11976         (Incremental_inputs::Input_info_map): New typedef.
11977         (Incremental_inputs::lock_): New field.
11978         (Incremental_inputs::Inputs_): New field.
11979         (Incremental_inputs::Inputs_map): New field.
11980         * main.cc (main): Call Incremental_input::report_inputs.
11981         * options.h (Input_argument_list): Typedef moved from
11982         Input_arguments.
11983         (Input_file_group::Files): Remove, use ::Input_argument_list.
11984         (Input_file_group::Input_argument_list): Remove, use
11985         ::Input_argument_list.
11986         * plugin.cc (Plugin_manager::add_input_file): Add error in
11987         incremental build.
11988         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11989         functions.
11990         * script.cc (read_input_script): Call
11991         Incremental_input::report_script.
11992         * script.h (Script_info): New class.
11993
11994 2009-04-27  Ian Lance Taylor  <iant@google.com>
11995
11996         * x86_64.cc (do_adjust_output_section): Set entsize to
11997         plt_entry_size.
11998
11999 2009-04-23  Elliott Hughes  <enh@google.com>
12000
12001         * output.cc (Output_file::close): After short writes, continue
12002         writing from the correct offset in the buffer being written.
12003
12004 2009-04-23  Chris Demetriou  <cgd@google.com>
12005
12006         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12007         * configure: Regenerate.
12008         * config.in: Regenerate.
12009         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12010         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12011
12012 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12013
12014         * incremental.cc (Incremental_inputs_header_data): Renamed from
12015         Incremental_input_header_data.
12016         (Incremental_inputs_header_data::data_size): New field.
12017         (Incremental_inputs_header_data::put_input_file_count): Renamed
12018         from input_file_count.
12019         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12020         from command_line_offset.
12021         (Incremental_inputs_header_data::put_reserved): Renamed from
12022         put_reserved.
12023         (Incremental_inputs_entry_data): Renamed from
12024         Incremental_input_entry_data.
12025         (Incremental_inputs_entry_data::data_size): New field.
12026         (Incremental_inputs::report_command_line): New method.
12027         (Incremental_inputs::finalize): New method.
12028         (Incremental_inputs::create_incremental_inputs_data): New method.
12029         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12030         * incremental.h: New file.
12031         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12032         (Layout::finalize): Create incremental inputs section in
12033         incremental builds.
12034         (Layout::create_incremental_info_sections): New method.
12035         * layout.h (Layout::incremental_inputs): New method.
12036         (Layout::create_incremental_info_sections): New method.
12037         (Layout::incremental_inputs_): New field.
12038         * main.cc (main): Notify Incremental_input of the command line.
12039
12040 2009-04-01  Ian Lance Taylor  <iant@google.com>
12041             Mikolaj Zalewski  <mikolajz@google.com>
12042
12043         * gold.h (reserve_unordered_map): Define, three versions, one for
12044         each version of Unordered_map.
12045         * layout.cc (Layout::Layout): Remove options parameter.  Add
12046         number_of_input_files parameter.  Don't initialize options_.
12047         Initialize number_of_input_files_ and resized_signatures_.  Move
12048         sections_are_attached_.
12049         (Layout::layout_group): Reserve space for group_signatures_.
12050         (Layout::find_or_add_kept_section): Change name parameter to be a
12051         reference.  Resize signatures_ map when it gets large enough.
12052         (Layout::layout_eh_frame): Use parameters->options() instead of
12053         this->options_.
12054         (Layout::make_output_section): Likewise.
12055         (Layout::attach_allocated_section_to_segment): Likewise.
12056         (Layout::finalize, Layout::create_executable_stack): Likewise.
12057         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12058         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12059         * layout.h (class Layout): Update declarations.  Remove options_
12060         field.  Add number_of_input_files_ and resized_signatures_
12061         fields.  Move sections_are_attached_ field.
12062         * main.cc (main): Pass number of input files to Layout
12063         constructor.  Don't pass options.
12064
12065 2009-03-30  Ian Lance Taylor  <iant@google.com>
12066
12067         * ffsll.c (ffsll): Correct implementation.
12068
12069 2009-03-27  Ian Lance Taylor  <iant@google.com>
12070
12071         * ffsll.c: New file.
12072         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12073         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12074         * ftruncate.c (ftruncate): Declare before definition.
12075         * mremap.c (mremap): Likewise.
12076         * pread.c (pread): Likewise.
12077         * configure, Makefile.in, config.in: Rebuild.
12078
12079         * mremap.c: New file.
12080         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12081         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12082         (mremap): Declare if HAVE_MREMAP is not defined.
12083         * configure, Makefile.in, config.in: Rebuild.
12084
12085 2009-03-27  Cary Coutant  <ccoutant@google.com>
12086
12087         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12088         position independent.
12089         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12090         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12091
12092 2009-03-24  Cary Coutant  <ccoutant@google.com>
12093
12094         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12095         an executable.
12096         (needs_dynamic_reloc): Likewise.
12097
12098 2009-03-24  Ian Lance Taylor  <iant@google.com>
12099
12100         * yyscript.y (file_cmd): Recognize EXTERN.
12101         (extern_name_list, extern_name_list_body): New nonterminals.
12102         * script.cc (script_add_extern): Define.
12103         * script-c.h (script_add_extern): Declare.
12104
12105 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12106
12107         * object.cc (is_elf_object): Define.
12108         * object.h (is_elf_object): Declare.
12109         * archive.cc (Archive::get_elf_object_for_member): Call
12110         is_elf_object.
12111         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12112
12113 2009-03-24  Elliott Hughes  <enh@google.com>
12114
12115         * output.cc (Output_file::map_anonymous): Define.
12116         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12117         try an anonymous one.  Report the size if the mmap fails.
12118         * output.h (class Output_file): Declare map_anonymous.
12119
12120 2009-03-24  Ian Lance Taylor  <iant@google.com>
12121
12122         * target-select.cc (instantiate_target): Don't acquire the lock if
12123         the instantiated_target_ field has already been set.
12124
12125 2009-03-23  Ian Lance Taylor  <iant@google.com>
12126
12127         * gold-threads.h (class Initialize_lock): Define.
12128         * gold-threads.cc (class Initialize_lock_once): Define.
12129         (initialize_lock_control): New static variable.
12130         (initialize_lock_pointer): New static variable.
12131         (initialize_lock_once): New static function.
12132         (Initialize_lock::Initialize_lock): Define.
12133         (Initialize_lock::initialize): Define.
12134         * target-select.h: Include "gold-threads.h".
12135         (class Target_selector): Add lock_ and initialize_lock_ fields.
12136         Don't define instantiate_target, just declare it.
12137         * target-select.cc (Target_selector::Target_selector): Initialize
12138         new fields.
12139         (Target_selector::instantiate_target): Define.
12140         * descriptors.h: Include "gold-threads.h".
12141         (class Descriptors): Add initialize_lock_ field.
12142         * descriptors.cc (Descriptors::Descriptors): Initialize new
12143         field.
12144         (Descriptors::open): Use initialize_lock_ field
12145         * errors.h (class Errors): Add initialize_lock_ field.
12146         * errors.cc (Errors::Errors): Initialize new field.
12147         (Errors::initialize_lock): Use initialize_lock_ field.
12148         * powerpc.cc (class Target_selector_powerpc): Remove
12149         instantiated_target_ field.  In do_recognize call
12150         instantiate_target rather than do_instantiate_target.  In
12151         do_instantiate_target just allocate a new target.
12152         * sparc.cc (class Target_selector_sparc): Likewise.
12153
12154         * freebsd.h: New file.
12155         * i386.cc: Include "freebsd.h".
12156         (Target_i386): Derive from Target_freebsd rather than
12157         Sized_target.
12158         (Target_selector_i386): Derive from Target_selector_freebsd rather
12159         than Target_selector.
12160         * x86_64.cc: Include "freebsd.h".
12161         (Target_x86_64): Derive from Target_freebsd rather than
12162         Sized_target.
12163         (Target_selector_x86_64): Derive from Target_selector_freebsd
12164         rather than Target_selector.
12165         * target.h (class Target): Add adjust_elf_header and
12166         do_adjust_elf_header.
12167         * output.cc (Output_file_header:: do_sized_write): Call target
12168         adjust_elf_header routine.
12169         * configure.tgt: Set targ_osabi.
12170         * configure.ac: Define GOLD_DEFAULT_OSABI.
12171         * parameters.cc (Parameters::default_target): Pass
12172         GOLD_DEFAULT_OSABI to select_target.
12173         * target-select.h (class Target_selector): Make instantiate_target
12174         protected rather than private.
12175         * Makefile.am (HFILES): Add freebsd.h.
12176         * configure, Makefile.in, config.in: Rebuild.
12177
12178         * merge.cc (do_add_input_section): Correct pend value.  Change
12179         message about last entry not being null terminated from error to
12180         warning.
12181
12182 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12183
12184         * incremental.cc: New file.
12185         * Makefile.am (CCFILES): Add incremental.cc.
12186         * Makefile.in: Rebuild.
12187
12188 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12189
12190         * layout.cc (Layout::output_section_name): Preserve names
12191         of '.note.' sections.
12192
12193 2009-03-19  Ian Lance Taylor  <iant@google.com>
12194
12195         * descriptors.cc (Descriptors::open): Check that the options are
12196         valid before using them.
12197
12198 2009-03-18  Ian Lance Taylor  <iant@google.com>
12199
12200         * script-sections.h: Include <list>.
12201         (class Script_sections): Change Sections_elements from std::vector
12202         to std::list.  Typedef public Elements_iterator.  Add
12203         orphan_section_placement_, data_segment_align_start_, and
12204         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12205         field.
12206         * script-sections.cc (class Orphan_section_placement): New class.
12207         (class Sections_element): Add virtual functions is_relro and
12208         orphan_section_init.  Remove virtual function place_orphan_here.
12209         (class Output_section_definition): Add is_relro and
12210         orphan_section_init.  Remove place_orphan_here.
12211         (class Orphan_output_section): Likewise.
12212         (Script_sections::Script_sections): Update for field changes.
12213         (Script_sections::data_segment_align): Set saw_data_segment_align_
12214         and data_segment_align_start_, not data_segment_align_index.
12215         (Script_sections::data_segment_relro_end): Check
12216         saw_data_segment_align_.  Use data_segment_align_start_ rather
12217         than data_segment_align_index_.
12218         (Script_sections::place_orphan): Rewrite to use
12219         Orphan_section_placement.
12220
12221 2009-03-17  Ian Lance Taylor  <iant@google.com>
12222
12223         * archive.cc (Archive::add_symbols): Check for a version attached
12224         to the symbol name in the archive map.
12225         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12226         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12227         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12228         (ver_test_11.a): New target.
12229         * testsuite/Makefile.in: Rebuild.
12230
12231         * configure.ac: Check for chsize and posix_fallocate.  Replace
12232         ftruncate.
12233         * ftruncate.c: New file, from gnulib.
12234         * output.cc (posix_fallocate): Define dummy version if not
12235         HAVE_POSIX_FALLOCATE.
12236         (Output_file::map): Call posix_fallocate rather than lseek and
12237         write.
12238         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12239         * configure, Makefile.in, config.in: Rebuild.
12240
12241 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12242
12243         * layout.h (Layout::create_note): Add section_name parameter.
12244         * layout.cc (Layout::create_note): Likewise.
12245         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12246
12247 2009-03-17  Ian Lance Taylor  <iant@google.com>
12248
12249         * descriptors.cc: Include "options.h".
12250         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12251         (Descriptors::open): Always use O_CLOEXEC when opening a new
12252         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12253         then set FD_CLOEXEC.
12254
12255         * sparc.cc (class Target_sparc): Add has_got_section.
12256         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12257         make sure we have a GOT section.
12258
12259         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12260         (Target_sparc::Scan::local): Likewise.
12261         (Target_sparc::Scan::global): Likewise.
12262         (Target_sparc::Relocate::relocate): Likewise.
12263         (Target_sparc::Relocate::relocate_tls): Likewise.
12264
12265         * symtab.cc (Symbol_table::define_default_version): New function,
12266         broken out of add_from_object.
12267         (Symbol_table::add_from_object): Call define_default_version.
12268         (Symbol_table::define_special_symbol): Add resolve_oldsym
12269         parameter.  Change all callers.  If the version for a symbol comes
12270         from a version script, resolve it with the symbol with the same
12271         name with no version.  Also add the symbol without a version if
12272         appropriate.
12273         (do_define_in_output_data): If resolving with oldsym, don't delete
12274         sym.
12275         (do_define_in_output_segment): Likewise.
12276         (do_define_as_constant): Likewise.
12277         * symtab.h (class Symbol_table): Update declarations.
12278
12279 2009-03-13  Ian Lance Taylor  <iant@google.com>
12280
12281         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12282         (Read_symbols::requeue): New function.
12283         (Read_symbols::do_read_symbols): If make_elf_object fails because
12284         the target type is not configured, and the file was searched for,
12285         issue a warning and retry with the next directory.
12286         (Add_symbols::run): If the file has an incompatible format, and
12287         it was searched for, requeue the Read_symbols task.  On error,
12288         release the object.
12289         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12290         dirindex parameter to constructor.  Change all callers.  Declare
12291         incompatible_warning and requeue.
12292         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12293         input_argument_ and input_group_ fields.  Add them to
12294         constructor.  Change all callers.
12295         (class Read_script): Add dirindex_ field.  Add it to constructor.
12296         Change all callers.
12297         * archive.cc (Archive::setup): Remove input_objects parameter.
12298         Change all callers.
12299         (Archive::get_file_and_offset): Likewise.
12300         (Archive::read_all_symbols): Likewise.
12301         (Archive::read_symbols): Likewise.
12302         (Archive::get_elf_object_for_member): Remove input_objects
12303         parameter.  Add punconfigured parameter.  Change all callers.
12304         (Archive::add_symbols): Change return type to bool.  Check return
12305         value of include_member.
12306         (Archive::include_all_members): Likewise.
12307         (Archive::include_member): Change return type to bool.  Return
12308         false if first included object has incompatible target.  Set
12309         included_member_ field.
12310         (Add_archive_symbols::run): If add_symbols returns false, requeue
12311         Read_symbols task.
12312         * archive.h (class Archive): Add included_member_ field.
12313         Initialize it in constructor.  Add input_file and searched_for
12314         methods.  Update declarations.
12315         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12316         input_argument_ fields.  Add them to constructor.  Change all
12317         callers.
12318         * script.cc: Include "target-select.h".
12319         (class Parser_closure): Add skip_on_incompatible_target_ and
12320         found_incompatible_target_ fields.  Add
12321         skip_on_incompatible_target parameter to constructor.  Change all
12322         callers.  Add methods skip_on_incompatible_target,
12323         clear_skip_on_incompatible_target, found_incompatible_target, and
12324         set_found_incompatible_target.
12325         (read_input_script): Add dirindex parameter.  Change all callers.
12326         If parser finds an incompatible target, requeue Read_symbols
12327         task.
12328         (script_set_symbol): Clear skip_on_incompatible_target in
12329         closure.
12330         (script_add_assertion, script_parse_option): Likewise.
12331         (script_start_sections, script_add_phdr): Likewise.
12332         (script_check_output_format): New function.
12333         * script.h (read_input_script): Update declaration.
12334         * script-c.h (script_check_output_format): Declare.
12335         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12336         (ignore_cmd): Remove OUTPUT_FORMAT.
12337         * fileread.cc (Input_file::Input_file): Add explicit this.
12338         (Input_file::will_search_for): New function.
12339         (Input_file::open): Add pindex parameter.  Change all callers.
12340         * fileread.h (class Input_file): Add input_file_argument method.
12341         Declare will_search_for.  Update declarations.
12342         * object.cc (make_elf_object): Add punconfigured parameter.
12343         Change all callers.
12344         * object.h (class Object): Make input_file public.  Add
12345         searched_for method.
12346         (make_elf_object): Update declaration.
12347         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12348         restart search.
12349         * dirsearch.h (class Dirsearch): Update declaration.
12350         * options.h (class General_options): Add --warn-search-mismatch.
12351         * parameters.cc (Parameters::is_compatible_target): New function.
12352         * parameters.h (class Parameters): Declare is_compatible_target.
12353         * workqueue.cc (Workqueue::add_blocker): New function.
12354         * workqueue.h (class Workqueue): Declare add_blocker.
12355
12356         * fileread.cc (Input_file::open): Remove options parameter.
12357         Change all callers.
12358         (Input_file::open_binary): Likewise.
12359         * script.cc (read_input_script): Likewise.
12360         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12361         options parameter from constructor.  Change all callers.
12362         (class Read_script): Likewise.
12363         * fileread.h (class Input_file): Update declarations.
12364         * script.h (read_input_script): Update declaration.
12365
12366 2009-03-10  Nick Clifton  <nickc@redhat.com>
12367
12368         * po/es.po: New Spanish translation.
12369
12370 2009-03-06  Cary Coutant  <ccoutant@google.com>
12371
12372         * options.cc (parse_short_option): Keep dash_z from registering itself.
12373
12374 2009-03-03  Ian Lance Taylor  <iant@google.com>
12375
12376         PR 9918
12377         * target-reloc.h (relocate_section): Pass output_section to
12378         relocate.
12379         * i386.cc (Target_i386::should_apply_static_reloc): Add
12380         output_section parameter.  Change all callers.
12381         (Target_i386::Relocate::relocate): Add output_section parameter.
12382         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12383         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12384         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12385         * testsuite/two_file_shared.sh: New script.
12386         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12387         (check_DATA): Add two_file_shared.dbg.
12388         (two_file_shared.dbg): New target.
12389         * testsuite/Makefile.in: Rebuild.
12390
12391 2009-03-01  Ian Lance Taylor  <iant@google.com>
12392
12393         * configure.ac: Check for byteswap.h.
12394         * configure: Rebuild.
12395         * config.in: Rebuild.
12396
12397 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12398
12399         * layout.cc (Layout::find_or_add_kept_section): New function.
12400         (Layout::add_comdat): Removed.
12401         * layout.h (struct Kept_section): Move out of class Layout.
12402         Remove trailing underscores from field names.  Add group_sections
12403         field.  Rename group_ field to is_group.  Change all uses.
12404         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12405         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12406         comdat_groups_ field.
12407         (Sized_relobj::include_section_group): Use
12408         find_or_add_kept_section and Kept_section::group_sections.
12409         (Sized_relobj::include_linkonce_section): Likewise.
12410         * object.cc (class Sized_relobj): Don't define Comdat_group or
12411         Comdat_group_table.  Remove find_comdat_group and
12412         add_comdat_group.  Remove comdat_groups_ field.
12413         * plugin.cc (include_comdat_group): Use
12414         Layout::find_or_add_kept_section.
12415
12416 2009-02-28  Ian Lance Taylor  <iant@google.com>
12417
12418         * README: --gc-sections and map files are now supported.  Document
12419         some build requirements.
12420
12421         PR 6992
12422         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12423         relocatable link set the value of the section symbol to zero.
12424         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12425         relocatable link don't include the section address in the local
12426         symbol value.
12427
12428 2009-02-27  Ian Lance Taylor  <iant@google.com>
12429
12430         PR 6811
12431         * options.h (class Search_directory): Add is_system_directory.
12432         (class General_options): Declare is_in_system_directory.
12433         * options.cc (get_relative_sysroot): Make static.
12434         (get_default_sysroot): Make static.
12435         (General_optoins::is_in_system_directory): New function.
12436         * fileread.cc (Input_file::is_in_system_directory): New function.
12437         * fileread.h (class Input_file): Declare is_in_system_directory.
12438         * object.h (class Object): Add is_in_system_directory.
12439         (class Input_objects): Remove system_library_directory_ field.
12440         * object.cc (Input_objects::add_object): Don't set
12441         system_library_directory_.
12442         (input_objects::found_in_system_library_directory): Remove.
12443         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12444         parameter.  Change all callers.
12445         (Symbol_table::sized_write_globals): Likewise.
12446         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12447         Call Object::is_in_system_directory.
12448         * symtab.h (class Symbol_table): Update declarations.
12449
12450         PR 5990
12451         * descriptors.h (Open_descriptor): Add is_on_stack field.
12452         * descriptors.cc (Descriptors::open): If the descriptor is on the
12453         top of the stack, remove it.  Initialize is_on_stack field.
12454         (Descriptors::release): Only add pod to stack if it is not on the
12455         stack already.
12456         (Descriptors::close_some_descriptor): Clear stack_next and
12457         is_on_stack fields.
12458
12459         PR 7091
12460         * output.cc (Output_section::find_starting_output_address): Rename
12461         from starting_output_address; add PADDR parameter; change return
12462         type.
12463         * output.h (class Output_section): Declare
12464         find_starting_output_address instead of starting_output_address.
12465         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12466         section symbol for which we can't find a merge section.
12467
12468         PR 9836
12469         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12470         hidden or internal, force the symbol to be local.
12471         * resolve.cc (Symbol::override_visibility): Define.
12472         (Symbol::override_base): Use override_visibility.
12473         (Symbol_table::resolve): Likewise.
12474         (Symbol::override_base_with_special): Likewise.
12475         (Symbol_table::override_with_special): If the visibility is hidden
12476         or internal, force the symbol to be local.
12477         * symtab.h (class Symbol): Add set_visibility and
12478         override_visibility.
12479         * testsuite/ver_test_1.sh: New file.
12480         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12481         (check_DATA): Add ver_test_1.syms.
12482         (ver_test_1.syms): New target.
12483         * testsuite/Makefile.in: Rebuild.
12484
12485 2009-02-25  Cary Coutant  <ccoutant@google.com>
12486
12487         * layout.cc (Layout::choose_output_section): Don't rename sections
12488         when using a linker script that has a SECTIONS clause.
12489         * Makefile.in: Regenerate.
12490
12491         * testsuite/Makefile.am (script_test_5.sh): New test case.
12492         * testsuite/Makefile.in: Regenerate.
12493         * testsuite/script_test_5.cc: New file.
12494         * testsuite/script_test_5.sh: New file.
12495         * testsuite/script_test_5.t: New file.
12496
12497 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12498
12499         * archive.cc (Archive::include_member): Update calls to add_symbols.
12500         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12501         the Layout argument.
12502         * dynobj.h (do_add_symbols): Add the Layout argument.
12503         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12504         Layout argument.
12505         * object.h (Object::add_symbols): Add the Layout argument.
12506         (Object::do_add_symbols): Add the Layout argument.
12507         (Sized_relobj::do_add_symbols): Add the Layout argument.
12508         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12509         Unify the two versions.
12510         (Add_plugin_symbols): Remove.
12511         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12512         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12513         (Add_plugin_symbols): Remove.
12514         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12515         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12516         (Add_symbols::run): Make it work with Pulginobj.
12517
12518 2009-02-06  Ian Lance Taylor  <iant@google.com>
12519
12520         * object.cc (Sized_relobj::do_layout): Make info message start
12521         with lower case letter.
12522
12523 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12524
12525         * binary.cc: Fix file comment.
12526
12527         * options.h (enum Incremental_disposition): Define.
12528         (class General_options): Add new options: --incremental,
12529         --incremental_changed, --incremental_unchanged,
12530         --incremental_unknown.  Add incremental_disposition_ and
12531         implicit_incremental_ fields.
12532         (General_options::incremental_disposition): New function.
12533         (class Position_dependent_options): Add incremental_disposition
12534         option.
12535         (Position_dependent_options::copy_from_options): Set incremental
12536         dispositions.
12537         * options.cc (General_options::parse_incremental_changed): New
12538         function.
12539         (General_options::parse_incremental_unchanged): New function.
12540         (General_options::parse_incremental_unknown): New function.
12541         (General_options::General_options): Initialize new fields
12542         incremental_disposition_ and implicit_incremental_.
12543         (General_options::finalize): Check for uasge of --incremental-*
12544         without --incremental.
12545
12546 2009-02-06  Chris Demetriou  <cgd@google.com>
12547
12548         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12549         pointer and to report location as the file name associated with
12550         the symbol.
12551         (gold_undefined_symbol_at_location): New function to replace the
12552         old gold_undefined_symbol functionality.
12553         * target-reloc.h (relocate_section): Update to use
12554         gold_undefined_symbol_at_location.
12555         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12556         Call gold_undefined_symbol function rather than gold_error.
12557         * errors.h (Errors::undefined_symbol): Take location as a
12558         string, rather than calculating it from a relocation.
12559         * errors.cc (Errors::fatal): Print "fatal error:" before the
12560         formatted message.
12561         (Errors::error, Errors::error_at_location): Print "error: "
12562         before the formatted message.
12563         (Errors::undefined_symbol): Take location as a string, rather
12564         than calculating it from a relocation.
12565         (gold_undefined_symbol_at_location): New function akin to
12566         old gold_undefined_symbol, calculates location from relocation.
12567         (gold_undefined_symbol): Change to take only a Symbol pointer
12568         and to report location as the file name associated with the symbol.
12569         * testsuite/debug_msg.sh: Update for changed error messages.
12570         * testsuite/undef_symbol.sh: Likewise.
12571
12572 2009-02-04  Duncan Sands  <baldrick@free.fr>
12573
12574         PR 9812
12575         * reduced_debug_output.h
12576         (Output_reduced_debug_abbrev_section::failed): Use format for
12577         gold_warning.
12578         (Output_reduced_debug_info_section::faild): Likewise.
12579
12580 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12581
12582         * script.cc (Lazy_demangler): New class.
12583         (Version_script_info::get_symbol_version_helper): Demangle a
12584         symbol only once.
12585
12586 2009-01-29  Cary Coutant  <ccoutant@google.com>
12587
12588         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12589         to __tls_get_addr.
12590         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12591
12592 2009-01-28  Ian Lance Taylor  <iant@google.com>
12593
12594         * version.cc (version_string): Bump to 1.9.
12595
12596         * gold.h: Include <cstring> and <stdint.h>.
12597         * version.cc: Include <cstdio>.
12598         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12599         warning.
12600         * reduced_debug_output.cc (insert_into_vector): Rename from
12601         Insert_into_vector; change all callers.  Use Swap_unaligned to
12602         avoid aliasing issue; remove union since it is unnecessary.
12603
12604 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12605
12606         * Makefile.am (CCFILES): Add gc.cc.
12607         (HFILES): Add gc.h.
12608         * Makefile.in: Regenerate.
12609         * gold.cc (Gc_runner): New class.
12610         (queue_initial_tasks): Call garbage collection related tasks
12611         when corresponding options are invoked.
12612         (queue_middle_gc_tasks): New function.
12613         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12614         processed early before laying out sections during garbage collection.
12615         * gold.h (queue_middle_gc_tasks): New function.
12616         (is_prefix_of): Move from "layout.cc".
12617         * i386.cc (Target_i386::gc_process_relocs): New function.
12618         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12619         * main.cc (main): Create object of class "Garbage_collection".
12620         * object.cc (Relobj::copy_symbols_data): New function.
12621         (Relobj::is_section_name_included): New function.
12622         (Sized_relobj::do_layout): Allow this function to be called twice
12623         during garbage collection and defer layout of section during the
12624         first call.
12625         * object.h (Relobj::get_symbols_data): New function.
12626         (Relobj::is_section_name_included): New function.
12627         (Relobj::copy_symbols_data): New function.
12628         (Relobj::set_symbols_data): New function.
12629         (Relobj::get_relocs_data): New function.
12630         (Relobj::set_relocs_data): New function.
12631         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12632         (Relobj::gc_process_relocs): New function.
12633         (Relobj::do_gc_process_relocs): New pure virtual function.
12634         (Relobj::sd_): New data member.
12635         (Sized_relobj::is_output_section_offset_invalid): New function.
12636         (Sized_relobj::do_gc_process_relocs): New function.
12637         * options.h (General_options::gc_sections): Modify to not be a no-op.
12638         (General_options::print_gc_sections): New option.
12639         * plugin.cc (Plugin_finish::run): Remove function call to
12640         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12641         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12642         * reloc.cc (Read_relocs::run): Add task to process relocs and
12643         determine unreferenced sections when doing garbage collection.
12644         (Gc_process_relocs): New class.
12645         (Sized_relobj::do_gc_process_relocs): New function.
12646         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12647         sections that are garbage collected.
12648         * reloc.h (Gc_process_relocs): New class.
12649         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12650         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12651         symbols whose corresponding sections are garbage collected.
12652         (Symbol_table::Symbol_table): Add new parameter for the garbage
12653         collection object.
12654         (Symbol_table::gc_mark_undef_symbols): New function.
12655         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12656         (Symbol_table::gc_mark_dyn_syms): New function.
12657         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12658         as garbage.
12659         (Symbol_table::add_from_object): Likewise.
12660         (Symbol_table::add_from_relobj): When building shared objects, do not
12661         treat externally visible symbols as garbage.
12662         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12663         table information for static and relocatable links.
12664         * symtab.h (Symbol_table::set_gc): New function.
12665         (Symbol_table::gc): New function.
12666         (Symbol_table::gc_mark_undef_symbols): New function.
12667         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12668         (Symbol_table::gc_mark_dyn_syms): New function.
12669         (Symbol_table::gc_): New data member.
12670         * target.h (Sized_target::gc_process_relocs): New pure virtual
12671         function.
12672         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12673         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12674
12675 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12676
12677         * options.h (General_options::gc_sections): Define as a no-op for now.
12678         (General_options::no_keep_memory): Ditto.
12679         (General_options::Bshareable): Define.
12680         * options.cc (General_options::finalize): Honor -Bshareable.
12681
12682 2009-01-20  Andreas Schwab  <schwab@suse.de>
12683
12684         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12685         read the value in the contents, since we don't use it.  Use the
12686         template endianness when writing.
12687         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12688
12689 2009-01-19  Andreas Schwab  <schwab@suse.de>
12690
12691         * configure.tgt (powerpc64-*): Fix targ_obj.
12692
12693 2009-01-15  Ian Lance Taylor  <iant@google.com>
12694
12695         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12696         local symbols when stripping all symbols.
12697
12698 2009-01-14  Cary Coutant  <ccoutant@google.com>
12699
12700         * output.cc (Output_reloc): Add explicit instantiations.
12701
12702 2009-01-14  Cary Coutant  <ccoutant@google.com>
12703
12704         * archive.cc (Archive::get_elf_object_for_member): Remove call
12705         to File_read::claim_for_plugin.
12706         * descriptors.cc (Descriptors::open): Remove reference to
12707         is_claimed.
12708         (Descriptors::claim_for_plugin): Remove.
12709         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12710         (Descriptors::is_claimed): Remove.
12711         (claim_descriptor_for_plugin): Remove.
12712         * fileread.cc (File_read::claim_for_plugin): Remove.
12713         * fileread.h (File_read::claim_for_plugin): Remove.
12714         (File_read::descriptor): Reopen descriptor if necessary.
12715         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12716         (Plugin_manager::all_symbols_read): Add task parameter. Change
12717         all callers.
12718         (Plugin_manager::get_input_file): New function.
12719         (Plugin_manager::release_input_file): New function.
12720         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12721         corresponding data member.
12722         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12723         and pass to base constructor. Change all callers.
12724         (get_input_file, release_input_file): New functions.
12725         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12726         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12727         (Plugin_manager::all_symbols_read): Add task parameter.
12728         (Plugin_manager::get_input_file): New function.
12729         (Plugin_manager::release_input_file): New function.
12730         (Plugin_manager::task_): New data member.
12731         (Pluginobj::Pluginobj): Add filesize parameter.
12732         (Pluginobj::filename): New function.
12733         (Pluginobj::descriptor): New function.
12734         (Pluginobj::filesize): New function.
12735         (Pluginobj::filesize_): New data member.
12736         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12737         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12738         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12739
12740         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12741         with archive libraries.
12742         * testsuite/Makefile.in: Regenerate.
12743         * testsuite/plugin_test.c (struct sym_info): New type.
12744         (get_input_file, release_input_file): New static variables.
12745         (onload): Capture new transfer vector entries.
12746         (claim_file_hook): Stop reading at end of file according to filesize.
12747         Factor out parsing of readelf output into separate function.
12748         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12749         APIs and get the source file name from the symbol table.  Convert
12750         source file name to corresponding object file name.  Print info
12751         message when adding new input files.
12752         (parse_readelf_line): New function.
12753         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12754         * testsuite/plugin_test_2.sh: Likewise.
12755         * testsuite/plugin_test_3.sh: Likewise.
12756         * testsuite/plugin_test_4.sh: New test case.
12757
12758 2009-01-07  Ian Lance Taylor  <iant@google.com>
12759
12760         * version.cc (version_string): Bump to 1.8.
12761
12762 2008-12-23  Cary Coutant  <ccoutant@google.com>
12763
12764         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12765         * plugin.cc (Plugin_manager::finish): Rename as
12766         layout_deferred_objects.  Move cleanup to separate function.
12767         (Plugin_manager::cleanup): New function.
12768         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12769         separately.
12770         * plugin.h (Plugin_manager::finish): Rename as
12771         layout_deferred_objects.
12772         (Plugin_manager::cleanup): New function.
12773         (Plugin_manager::cleanup_done): New field.
12774
12775 2008-12-23  Cary Coutant  <ccoutant@google.com>
12776
12777         * plugin.cc (is_visible_from_outside): New function.
12778         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12779         so we don't return "IR only" status for exported symbols or -r links.
12780
12781         * testsuite/Makefile.am (plugin_test_3): New test case.
12782         * testsuite/Makefile.in: Regenerate.
12783         * testsuite/plugin_test_3.sh: New file.
12784
12785 2008-12-22  Cary Coutant  <ccoutant@google.com>
12786
12787         * object.cc (Sized_relobj::layout_section): New function.
12788         (Sized_relobj::do_layout): Defer layout of input sections until after
12789         plugin has provided replacement files.
12790         (Sized_relobj::do_layout_deferred_sections): New function.
12791         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12792         (Relobj::layout_deferred_sections): New function.
12793         (Relobj::do_layout_deferred_sections): New function.
12794         (Sized_relobj::do_layout_deferred_sections): New function.
12795         (Sized_relobj::layout_section): New function.
12796         (Sized_relobj::Deferred_layout): New structure.
12797         (Sized_relobj::deferred_layout_): New field.
12798         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12799         Change all callers.  Layout deferred sections.
12800         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12801         references.
12802         (Plugin_hook::run): Move code from do_plugin_hook inline.
12803         (Plugin_hook::do_plugin_hook): Remove.
12804         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12805         (Plugin_manager::finish): Renamed, was cleanup.
12806         (Plugin_manager::should_defer_layout): New function.
12807         (Plugin_manager::add_deferred_layout_object): New function.
12808         (Plugin_manager::Deferred_layout_list): New type.
12809         (Plugin_manager::deferred_layout_objects_): New field.
12810         (Plugin_hook::do_plugin_hook): Remove.
12811
12812 2008-12-17  Ian Lance Taylor  <iant@google.com>
12813
12814         * options.h (class General_options): Add --no case for
12815         --export-dynamic.
12816
12817 2008-12-16  Cary Coutant  <ccoutant@google.com>
12818
12819         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12820         vector.
12821         (Plugin_manager::claim_file): Create plugin object even if
12822         plugin did not call the add_symbols callback.
12823         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12824         asking for more symbols than were added.
12825         * testsuite/Makefile.am (plugin_test_1): Add test case with
12826         no global symbols.
12827         (empty.syms): New target.
12828         * testsuite/Makefile.in: Regenerate.
12829         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12830         message. Don't call add_symbols if no globals.
12831         (all_symbols_read_hook): Don't provide replacement for empty
12832         claimed file.
12833
12834 2008-12-12  Ian Lance Taylor  <iant@google.com>
12835
12836         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12837         r_type == 0 for a local symbol with r_sym == 0.
12838         (scan_relocatable_relocs): Pass r_sym to
12839         local_non_section_strategy.
12840         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12841         r_sym parameter.
12842
12843         * configure.ac: Update test for TLS descriptors: they are
12844         supported as of glibc 2.9.
12845         * configure: Rebuild.
12846
12847 2008-12-11  Ian Lance Taylor  <iant@google.com>
12848
12849         PR 7091
12850         * target-reloc.h (Default_scan_relocatable_relocs): For each
12851         function, map r_type == 0 to RELOC_DISCARD.
12852
12853 2008-12-10  Cary Coutant  <ccoutant@google.com>
12854
12855         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12856         object to override a kept COMDAT group from a plugin object.
12857
12858 2008-12-09  Ian Lance Taylor  <iant@google.com>
12859
12860         PR 7088
12861         * yyscript.y (file_cmd): Handle INPUT.
12862
12863         * testsuite/initpri1.c: Change all declarations to be full
12864         prototypes by adding void, to avoid compiler warnings.
12865
12866 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12867
12868         * options.cc (General_options::parse_plugin_opt): New.
12869         (General_options::add_plugin): The argument now is just the filename.
12870         (General_options::add_plugin_option): New.
12871         * options.h (plugin_opt): New.
12872         (add_plugin): Change argument name.
12873         (add_plugin_option): New.
12874         * plugin.cc (Plugin::load): Don't parse the plugin option.
12875         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12876         (Plugin::add_option): New.
12877         (Plugin::args_): Change type.
12878         (Plugin::filename_): New.
12879         (Plugin_manager::add_plugin_option): New.
12880         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12881         * testsuite/Makefile.in: Regenerate.
12882
12883 2008-12-05  Cary Coutant  <ccoutant@google.com>
12884
12885         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12886         Handle --strip-lto-sections option.
12887         * options.h (strip_lto_sections): New option.
12888
12889 2008-12-01  Cary Coutant  <ccoutant@google.com>
12890
12891         * plugin.cc (ld_plugin_message): Change format parameter to const.
12892         Fix mismatch between new[] and delete.
12893
12894 2008-11-14  Cary Coutant  <ccoutant@google.com>
12895
12896         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12897         instead of -1U.
12898
12899 2008-11-05  Craig Silverstein  <csilvers@google.com>
12900
12901         * options.cc (General_options::parse_dynamic_list): New function.
12902         * options.h (General_options): New flags dynamic_list,
12903         dynamic_list_data, dynamic_list_cpp_new, and
12904         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12905         (General_options::in_dynamic_list): New function.
12906         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12907         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12908         (Lex::can_continue_name): Likewise.
12909         (yylex): Likewise.
12910         (read_script_file): New parameter script_options.
12911         (read_dynamic_list): New function.
12912         (Script_options::define_dynamic_list): New function.
12913         (dynamic_list_keyword_parsecodes): New variable.
12914         (dynamic_list_keywords): New variable.
12915         * script.h (Script_options::define_dynamic_list): New function
12916         prototype.
12917         (read_dynamic_list): New function prototype.
12918         * symtab.cc (strprefix): New macro.
12919         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12920         dynamic_list_data, dynamic_list_cpp_new, and
12921         dynamic_list_cpp_typeinfo.
12922         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12923         (dynamic_list_expr): New rule.
12924         (dynamic_list_nodes): Likewise.
12925         (dynamic_list_node): Likewise.
12926         * testsuite/Makefile.am (dynamic_list): New test.
12927         * testsuite/Makefile.in: Regenerated.
12928         * testsuite/dynamic_list.t: New file.
12929         * testsuite/dynamic_list.sh: New file.
12930
12931 2008-11-05  Craig Silverstein  <csilvers@google.com>
12932
12933         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12934         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12935         (t11_last): Likewise.
12936         * testsuite/ver_test_6.c (main): Likewise.
12937
12938 2008-10-07  Cary Coutant  <ccoutant@google.com>
12939
12940         * options.c (General_options::finalize): Add check for -static and
12941         -shared.
12942         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12943         is not empty.
12944
12945 2008-10-02  Cary Coutant  <ccoutant@google.com>
12946
12947         * plugin.cc (make_sized_plugin_object): Fix conditional
12948         compilation to work when not all targets are enabled.
12949
12950 2008-09-29  Cary Coutant  <ccoutant@google.com>
12951
12952         * archive.cc (Archive::get_file_and_offset): Use filename instead
12953         of name to get library path.
12954         (Archive::include_member): Unlock external member of a thin archive.
12955
12956         * testsuite/Makefile.am (TEST_AR): New variable.
12957         (thin_archive_test_1): New test.
12958         (thin_archive_test_2): New test.
12959         * testsuite/Makefile.in: Regenerate.
12960         * testsuite/thin_archive_main.cc: New file.
12961         * testsuite/thin_archive_test_1.cc: New file.
12962         * testsuite/thin_archive_test_2.cc: New file.
12963         * testsuite/thin_archive_test_3.cc: New file.
12964         * testsuite/thin_archive_test_4.cc: New file.
12965
12966 2008-09-29  Cary Coutant  <ccoutant@google.com>
12967
12968         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12969         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12970         instead of -1U.
12971         (Sized_relobj::do_finalize_local_symbols): Likewise.
12972         (Sized_relobj::map_to_kept_section): Likewise.
12973         * object.h (Sized_relobj::invalid_address): New constant.
12974         (Sized_relobj::do_output_section_offset): Check for invalid_address
12975         and return -1ULL.
12976         * output.cc (Output_reloc::local_section_offset): Use constant
12977         invalid_address instead of -1U.
12978         (Output_reloc::get_address): Likewise.
12979         (Output_section::output_address): Change -1U to -1ULL.
12980         * output.h (Output_reloc::invalid_address): New constant.
12981         * reloc.cc (Sized_relobj::write_sections): Use constant
12982         invalid_address instead of -1U.
12983         (Sized_relobj::relocate_sections): Likewise.
12984         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12985         values for merge sections.
12986         * target-reloc.h (relocate_for_relocatable): Use constant
12987         invalid_address instead of -1U.
12988
12989 2008-09-19  Cary Coutant  <ccoutant@google.com>
12990
12991         Add plugin functionality for link-time optimization (LTO).
12992         * configure.ac (plugins): Add --enable-plugins option.
12993         * configure: Regenerate.
12994         * config.in: Regenerate.
12995         * Makefile.am (LIBDL): New variable.
12996         (CCFILES): Add plugin.cc.
12997         (HFILES): Add plugin.h.
12998         (ldadd_var): Add LIBDL.
12999         * Makefile.in: Regenerate.
13000
13001         * archive.cc: Include "plugin.h".
13002         (Archive::setup): Don't preread archive symbols when using a plugin.
13003         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13004         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13005         files.
13006         (Archive::include_member): Add symbols from plugin objects.
13007         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13008         * descriptors.cc (Descriptors::open): Check for file descriptors
13009         abandoned by plugins.
13010         (Descriptors::claim_for_plugin): New function.
13011         * descriptors.h (Descriptors::claim_for_plugin): New function.
13012         (Open_descriptor::is_claimed): New field.
13013         (claim_descriptor_for_plugin): New function.
13014         * fileread.cc (File_read::claim_for_plugin): New function.
13015         * fileread.h (File_read::claim_for_plugin): New function.
13016         (File_read::descriptor): New function.
13017         * gold.cc: Include "plugin.h".
13018         (queue_initial_tasks): Add task to call plugin hooks for generating
13019         new object files.
13020         * main.cc: Include "plugin.h".
13021         (main): Load plugin libraries.
13022         * object.h (Pluginobj): Declare.
13023         (Object::pluginobj): New function.
13024         (Object::do_pluginobj): New function.
13025         (Object::set_target): New function.
13026         * options.cc: Include "plugin.h".
13027         (General_options::parse_plugin): New function.
13028         (General_options::General_options): Initialize plugins_ field.
13029         (General_options::add_plugin): New function.
13030         * options.h (Plugin_manager): Declare.
13031         (General_options): Add --plugin option.
13032         (General_options::has_plugins): New function.
13033         (General_options::plugins): New function.
13034         (General_options::add_plugin): New function.
13035         (General_options::plugins_): New field.
13036         * plugin.cc: New file.
13037         * plugin.h: New file.
13038         * readsyms.cc: Include "plugin.h".
13039         (Read_symbols::do_read_symbols): Check for archive before checking
13040         for ELF file.  Call plugin hooks to claim files.
13041         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13042         from a real object file; force override when processing replacement
13043         files.
13044         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13045         (Symbol::init_base_object): Likewise.
13046         (Symbol::init_base_output_data): Likewise.
13047         (Symbol::init_base_output_segment): Likewise.
13048         (Symbol::init_base_constant): Likewise.
13049         (Symbol::init_base_undefined): Likewise.
13050         (Symbol::output_section): Assert that object is not a plugin.
13051         (Symbol_table::add_from_pluginobj): New function.
13052         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13053         undefined.
13054         (Symbol_table::sized_write_globals): Likewise.
13055         (Symbol_table::add_from_pluginobj): Instantiate template.
13056         * symtab.h (Sized_pluginobj): Declare.
13057         (Symbol::in_real_elf): New function.
13058         (Symbol::set_in_real_elf): New function.
13059         (Symbol::in_real_elf_): New field.
13060         (Symbol_table::add_from_pluginobj): New function.
13061
13062         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13063         (LIBDL): New variable.
13064         (LDADD): Add LIBDL.
13065         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13066         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13067         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13068         (MOSTLYCLEANFILES): Likewise.
13069         * testsuite/Makefile.in: Regenerate.
13070         * testsuite/plugin_test.c: New file.
13071         * testsuite/plugin_test_1.sh: New file.
13072         * testsuite/plugin_test_2.sh: New file.
13073
13074 2008-09-16  Ian Lance Taylor  <iant@google.com>
13075
13076         * target-reloc.h (relocate_section): Check whether a symbol is
13077         defined by the ABI before reporting an undefined symbol error.
13078         * target.h (Target::is_defined_by_abi): Make parameter const.
13079         (Target::do_is_defined_by_abi): Likewise.
13080         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13081         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13082         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13083         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13084         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13085         * testsuite/Makefile.in: Rebuild.
13086
13087         * fileread.cc (make_view): Add casts to avoid warning.
13088
13089 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13090
13091         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13092         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13093
13094 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13095
13096         * options.h (General_options::output_is_executable): New.
13097         (General_options::output_is_pie): New.
13098         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13099         for shared libraries.
13100         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13101
13102 2008-09-11  Chris Demetriou  <cgd@google.com>
13103
13104         * options.h (origin): New -z option.
13105         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13106         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13107         in DT_FLAGS_1.
13108
13109 2008-09-05  Cary Coutant  <ccoutant@google.com>
13110
13111         * fileread.cc (File_read::make_view): Add check for attempt to map
13112         beyond end of file.
13113
13114 2008-09-05  Cary Coutant  <ccoutant@google.com>
13115
13116         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13117         explicit instantiations.
13118
13119 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13120
13121         PR gold/6858
13122         * options.cc (General_options::finalize): Allow undefined symbols
13123         in shlibs if linking -shared.
13124
13125         PR gold/6859
13126         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13127         symbols as not needing a dynsym entry.
13128
13129 2008-08-20  Craig Silverstein  <csilvers@google.com>
13130
13131         * fileread.cc (File_read::open): Do not lock the file unless it
13132         was successfully opened.
13133
13134 2008-08-14  Cary Coutant  <ccoutant@google.com>
13135
13136         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13137         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13138         * testsuite/tls_test.cc (struct int128): 128-bit struct
13139         for testing TLS relocs with non-zero addend.
13140         (v12): New TLS variable.
13141         (t12): New test.
13142         (t_last): Add check for v12.
13143         * testsuite/tls_test.h (t12): New function.
13144         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13145
13146 2008-08-13  Ian Lance Taylor  <iant@google.com>
13147
13148         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13149         set tls_segment_ or relro_segment_.
13150         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13151         when appropriate.
13152         * output.h (Output_section::clear_is_relro): New function.
13153         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13154         sections specially even when output_data_ is empty.
13155         (Output_segment::maximum_alignment): When first section is relro,
13156         only force alignment for PT_LOAD segments.
13157         * script.cc (script_data_segment_align): New function.
13158         (script_data_segment_relro_end): New function.
13159         * script-c.h (script_data_segment_align): Declare.
13160         (script_data_segment_relro_end): Declare.
13161         * script-sections.h (class Script_sections): Declare
13162         data_segment_align and data_segment_relro_end.  Add fields
13163         segment_align_index_ and saw_relro_end_.
13164         * script-sections.cc (class Sections_element): Add set_is_relro
13165         virtual function.  Add new bool* parameter to place_orphan_here.
13166         Add get_output_section virtual function.
13167         (class Output_section_definition): Add set_is_relro.  Add new
13168         bool* parameter to place_orphan_here.  Add get_output_section.
13169         Add is_relro_ field.
13170         (Output_section_definition::Output_section_definition): Initialize
13171         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13172         and is_relro_ fields.
13173         (Output_section_definition::place_orphan_here): Add is_relro
13174         parameter.
13175         (Output_section_definition::set_section_addresses): Set relro for
13176         output section.
13177         (Output_section_definition::alternate_constraint): Likewise.
13178         (class Orphan_output_section): Add new bool* parameter to
13179         place_orphan_here.  Add get_output_section.
13180         (Orphan_output_section::place_orphan_here): Add is_relro
13181         parameter.
13182         (Script_sections::Script_sections): Initialize
13183         data_segment_align_index_ and saw_relro_end_.
13184         (Script_sections::data_segment_align): New function.
13185         (Script_sections::data_segment_relro_end): New function.
13186         (Script_sections::place_orphan): Set or clear is_relro.
13187         (Script_sections::set_section_addresses): Force alignment of first
13188         TLS section.
13189         * yyscript.y (exp): Call script_data_segment_align and
13190         script_data_segment_relro_end.
13191         * testsuite/relro_script_test.t: New file.
13192         * testsuite/relro_test.cc (using_script): Declare.
13193         (t1, t2): Test using_script.
13194         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13195         (relro_script_test_SOURCES): Define.
13196         (relro_script_test_DEPENDENCIES): Define.
13197         (relro_script_test_LDFLAGS): Define.
13198         (relro_script_test_LDADD): Define.
13199         (relro_script_test.so): New target.
13200         * testsuite/Makefile.in: Rebuild.
13201
13202 2008-08-06  Cary Coutant <ccoutant@google.com>
13203
13204         * archive.cc (Archive::total_archives, Archive::total_members)
13205         (Archive::total_members_loaded): New variables.
13206         (Archive::setup): Add parameter.  Add option to preread
13207         archive symbols.
13208         (Archive::read_armap): Add counter.
13209         (Archive::get_file_and_offset): New function.
13210         (Archive::get_elf_object_for_member): New function.
13211         (Archive::read_all_symbols): New function.
13212         (Archive::read_symbols): New function.
13213         (Archive::add_symbols): Add counters.
13214         (Archive::include_all_members): Use armap to find members if it's
13215         already built.
13216         (Archive::include_member): Skip reading symbols if already read.
13217         Factored code into Archive::get_file_and_offset and
13218         Archive::get_elf_object_for_member.  Changed call to
13219         Mapfile::report_include_archive_member.
13220         (Archive::print_stats): New function.
13221         * archive.h: Declare Object and Read_symbols_data classes.
13222         (Archive::Archive): Add initializers for new members.
13223         (Archive::setup): Add parameter.
13224         (Archive::print_stats): New function.
13225         (Archive::total_archives, Archive::total_members)
13226         (Archive::total_members_loaded): New variables.
13227         (Archive::get_file_and_offset): New function.
13228         (Archive::get_elf_object_for_member): New function.
13229         (Archive::read_all_symbols): New function.
13230         (Archive::read_symbols): New function.
13231         (Archive::Archive_member): New class.
13232         (Archive::members_): New member.
13233         (Archive::num_members_): New member.
13234         * main.cc: Include archive.h.
13235         (main): Call Archive::print_stats.
13236         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13237         archive parameter; member_name is now the fully-decorated name.
13238         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13239         * options.h: (General_options): Add --preread-archive-symbols option.
13240         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13241         Archive::setup.
13242
13243 2008-08-04  Ian Lance Taylor  <iant@google.com>
13244
13245         * symtab.h (Symbol::use_plt_offset): New function.
13246         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13247         * powerpc.cc (Relocate::relocate): Likewise.
13248         * sparc.cc (Relocate::relocate): Likewise.
13249         * x86_64.cc (Relocate::relocate): Likewise.
13250         * testsuite/weak_plt.sh: New test.
13251         * testsuite/weak_plt_main.cc: New test.
13252         * testsuite/weak_plt_shared.cc: New test.
13253         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13254         (check_PROGRAMS): Add weak_plt.
13255         (check_DATA): Add weak_plt_shared.so.
13256         (weak_plt_main_pic.o, weak_plt): New targets.
13257         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13258         * testsuite/Makefile.in: Rebuild.
13259
13260         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13261         gcctestdir/ld.
13262         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13263         * testsuite/Makefile.in: Rebuild.
13264
13265 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13266
13267         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13268         * Makefile.in: Regenerate.
13269         * po/POTFILES.in: Regenerate.
13270
13271 2008-07-29  Ian Lance Taylor  <iant@google.com>
13272
13273         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13274         symbols before other symbols.
13275         * testsuite/script_test_2.cc (test_addr): Declare.
13276         (test_addr_alias): Declare.
13277         (main): Check that test_addr and test_addr_alias have the right
13278         values.
13279         * testsuite/script_test_2.t: Define test_addr_alias and
13280         test_addr.
13281
13282 2008-07-24  Ian Lance Taylor  <iant@google.com>
13283
13284         PR 5990
13285         * descriptors.cc: New file.
13286         * descriptors.h: New file.
13287         * gold-threads.h (class Hold_optional_lock): New class.
13288         * fileread.cc: Include "descriptors.h".
13289         (File_read::~File_read): Release descriptor rather than closing
13290         it.
13291         (File_read::open) [file]: Call open_descriptor rather than open.
13292         Set is_descriptor_opened_.
13293         (File_read::open) [memory]: Assert that descriptor is not open.
13294         (File_read::reopen_descriptor): New function.
13295         (File_read::release): Release descriptor.
13296         (File_read::do_read): Make non-const.  Reopen descriptor.
13297         (File_read::read): Make non-const.
13298         (File_read::make_view): Reopen descriptor.
13299         (File_read::do_readv): Likewise.
13300         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13301         Update declarations.
13302         * layout.cc: Include "descriptors.h".
13303         (Layout::create_build_id): Use open_descriptor rather than open.
13304         * output.cc: Include "descriptors.h".
13305         (Output_file::open): Use open_descriptor rather than open.
13306         * archive.cc (Archive::const_iterator): Change Archive to be
13307         non-const.
13308         (Archive::begin, Archive::end): Make non-const.
13309         (Archive::count_members): Likewise.
13310         * archive.h (class Archive): Update declarations.
13311         * object.h (Object::read): Make non-const.
13312         * Makefile.am (CCFILES): Add descriptors.cc.
13313         (HFILES): Add descriptors.h.
13314         * Makefile.in: Rebuild.
13315
13316         PR 6716
13317         * gold.h: Always include <clocale>.  Add Solaris workarounds
13318         following code in binutils/sysdep.h.
13319
13320         PR 6048
13321         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13322         this->eh_frame_hdr_ is NULL before using it.
13323
13324         * dynobj.cc (Versions::Versions): Update comment.
13325
13326         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13327         the base version name.
13328
13329         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13330         array size plus one.
13331         (Stringpool_template::set_string_offsets): Subtract one from key
13332         before using it as an array index.
13333         (Stringpool_template::get_offset_with_length): Likewise.
13334         (Stringpool_template::write_to_buffer): Likewise.
13335         * stringpool.h (Stringpool_template::get_offset_from_key):
13336         Likewise.
13337
13338 2008-07-23  Ian Lance Taylor  <iant@google.com>
13339
13340         PR 6658
13341         * object.h (Merged_symbol_value::value): Do our best to handle a
13342         negative addend.
13343
13344         PR 6647
13345         * script.cc (Version_script_info::get_versions): Don't add empty
13346         version tag to return value.
13347         (Version_script_info::get_symbol_version_helper): Change return
13348         type to bool.  Add pversion parameter.  Change all callers.
13349         (script_register_vers_node): Don't require a non-NULL tag.
13350         * script.h (class Version_script_info): Update declarations.
13351         (Version_script_info::get_symbol_version): Change return type to
13352         bool.  Add version parameter.  Change all callers.
13353         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13354         handling.  Handle an empty version from a version script.
13355         (Symbol_table::define_special_symbol): Likewise.
13356         * testsuite/ver_test_10.script: New file.
13357         * testsuite/ver_test_10.sh: New file.
13358         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13359         (check_DATA): Add ver_test_10.syms.
13360         (ver_test_10.syms, ver_test_10.so): New target.
13361         * testsuite/Makefile.in: Rebuild.
13362
13363 2008-07-23  Simon Baldwin  <simonb@google.com>
13364
13365         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13366         to zero for undefined symbols from dynamic libraries.
13367
13368 2008-07-23  Ian Lance Taylor  <iant@google.com>
13369
13370         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13371         Change all callers.
13372         * symtab.h (class Symbol_table): Update declaration.
13373         * testsuite/ver_test_9.cc: New file.
13374         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13375         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13376         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13377         (ver_test_9.so, ver_test_9.o): New targets.
13378         * testsuite/Makefile.in: Rebuild.
13379
13380 2008-07-22  Ian Lance Taylor  <iant@google.com>
13381
13382         * options.h (class General_options): Define --check-sections.
13383         * layout.cc (Layout::set_segment_offsets): Handle
13384         --check-sections.
13385
13386         * options.h (class General_options): Define -n/--nmagic and
13387         -N/--omagic.
13388         * options.cc (General_options::finalize): For -n/--nmagic or
13389         -N/--omagic, set -static.
13390         * layout.cc (Layout::attach_allocated_section_to_segment): If
13391         -N/--omagic, don't put read-only and read-write sections in
13392         different segments.
13393         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13394         finding a read-only segment.
13395         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13396         don't set the minimum segment alignment to the common page size,
13397         and don't set the file offset to the address modulo the page size.
13398         * script-sections.cc (Script_sections::create_segments): If
13399         -n/--omagic, don't put read-only and read-write sections in
13400         different segments.
13401
13402         * cref.cc: New file.
13403         * cref.h: New file.
13404         * options.h (class General_options): Add --print-symbol-counts.
13405         * main.cc (main): Issue defined symbol report if requested.
13406         * archive.cc (Archive::interpret_header): Make into a const member
13407         function.
13408         (Archive::add_symbols): Call Input_objects::archive_start and
13409         archive_stop.
13410         (Archive::const_iterator): Define new class.
13411         (Archive::begin, Archive::end): New functions.
13412         (Archive::include_all_members): Rewrite to use iterator.
13413         (Archive::count_members): New function.
13414         * archive.h (class Archive): Update declarations.
13415         (Archive::filename): New function.
13416         * object.cc: Include "cref.h".
13417         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13418         (Sized_relobj::do_get_global_symbol_counts): New function.
13419         (Input_objects::add_object): Add object to cross-referencer.
13420         (Input_objects::archive_start): New function.
13421         (Input_objects::archive_stop): New function.
13422         (Input_objects::print_symbol_counts): New function.
13423         * object.h: Declare Cref and Archive.
13424         (Object::get_global_symbol_counts): New function.
13425         (Object::do_get_global_symbol_counts): New pure virtual function.
13426         (class Sized_relobj): Add defined_count_ field.  Update
13427         declarations.
13428         (class Input_objects): Add cref_ field.  Update constructor.
13429         Update declarations.
13430         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13431         defined_count_.
13432         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13433         symbol counts.
13434         (Sized_dynobj::do_get_global_symbol_counts): New function.
13435         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13436         defined_count_.  Update declarations.  Define Symbols typedef.
13437         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13438         parameter.  Change all callers.
13439         (Symbol_table::add_from_dynobj): Add sympointers and defined
13440         parameters.  Change all callers.
13441         * symtab.h (class Symbol_table): Update declarations.
13442         * Makefile.am (CCFILES): Add cref.cc.
13443         (HFILES): Add cref.h.
13444         * Makefile.in: Rebuild.
13445
13446 2008-07-22  Simon Baldwin  <simonb@google.com>
13447
13448         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13449         to zero when writing undefined symbols.
13450
13451 2008-07-22  Ian Lance Taylor  <iant@google.com>
13452
13453         * output.cc (Output_section::add_input_section): Don't try to
13454         merge empty merge sections.
13455
13456 2008-07-21  Craig Silverstein  <csilvers@google.com>
13457
13458         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13459         Include symbol version in error message.
13460
13461 2008-07-20  Chris Demetriou  <cgd@google.com>
13462
13463         * configure.ac (gold_cv_c_random_seed): New configured variable.
13464         (RANDOM_SEED_CFLAGS): New substituted variable.
13465         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13466         * configure: Rebuild.
13467         * Makefile.in: Likewise.
13468         * testsuite/Makefile.in: Likewise.
13469
13470 2008-07-18  Ian Lance Taylor  <iant@google.com>
13471
13472         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13473         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13474         * testsuite/ver_test_main.cc (main): Call t4.
13475         (t4, t4_2a): Define.
13476         * testsuite/ver_test_2.cc (t4_2): Define.
13477         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13478         * testsuite/ver_test_4.cc (t4_2a): Define.
13479         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13480         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13481
13482 2008-07-17  Ian Lance Taylor  <iant@google.com>
13483
13484         * dynobj.cc (Versions::add_def): If we give an error about a
13485         missing version, go ahead and create the version anyhow.
13486
13487 2008-07-10  Ian Lance Taylor  <iant@google.com>
13488
13489         Handle output sections with more than 0x7fffffff bytes.
13490         * object.h (class Relobj): Change map_to_output_ to
13491         output_sections_, and just keep a section pointer.  Change all
13492         uses.  Move comdat group support to Sized_relobj.
13493         (Relobj::is_section_specially_mapped): Remove.
13494         (Relobj::output_section): Remove poff parameter.  Change all
13495         callers.
13496         (Relobj::output_section_offset): New function.
13497         (Relobj::set_section_offset): Rewrite.
13498         (Relobj::map_to_output): Remove.
13499         (Relobj::output_sections): New function.
13500         (Relobj::do_output_section_offset): New pure virtual function.
13501         (Relobj::do_set_section_offset): Likewise.
13502         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13503         group support from Relobj.  Update declarations.
13504         (Sized_relobj::get_output_section_offset): New function.
13505         (Sized_relobj::do_output_section_offset): New function.
13506         (Sized_relobj::do_set_section_offset): New function.
13507         * object.cc (Relobj::output_section_address): Remove.
13508         (Sized_relobj::Sized_relobj): Initialize new fields.
13509         (Sized_relobj::include_section_group): Cast find_kept_object to
13510         Sized_relobj.
13511         (Sized_relobj::include_linkonce_section): Likewise.
13512         (Sized_relobj::do_layout): Use separate arrays for output section
13513         and output offset.
13514         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13515         output_sections.
13516         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13517         output_sections and section_offsets.
13518         (Sized_relobj::write_local_symbols): Likewise.
13519         (map_to_kept_section): Compute output address directly.
13520         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13521         output_sections and section_offsets.
13522         (Sized_relobj::write_sections): Likewise.
13523         (Sized_relobj::relocate_sections): Likewise.
13524         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13525         * output.h (class Output_reloc): Update declarations.  Change
13526         u2_.relobj to Sized_relobj*.
13527         (class Output_data_reloc): Change add functions to use
13528         Sized_relobj*.
13529         * output.cc (Output_reloc::Output_reloc): Change relobj to
13530         Sized_relobj*.
13531         (Output_reloc::local_section_offset): Change return type to
13532         Elf_Addr.  Use get_output_section_offset.
13533         (Output_reloc::get_address): Likewise.
13534         (Output_section::is_input_address_mapped): Don't call
13535         is_section_specially_mapped.
13536         (Output_section::output_offset): Likewise.
13537         (Output_section::output_address): Likewise.
13538         (Output_section::starting_output_address): Likewise.
13539         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13540         parameter to Sized_relobj*.
13541         (Copy_relocs::need_copy_reloc): Likewise.
13542         (Copy_relocs::save): Likewise.
13543         * copy-relocs.h (class Copy_relocs): Update declarations.
13544         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13545         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13546         * target-reloc.h (relocate_for_relocatable): Change
13547         offset_in_output_section type to Elf_Addr.  Change code that uses
13548         it as well.
13549         * layout.cc (Layout::layout): Always set *off.
13550         * mapfile.cc (Mapfile::print_input_section): Use
13551         output_section_offset.
13552         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13553         Sized_relobj*.
13554         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13555         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13556         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13557
13558 2008-07-03  Ian Lance Taylor  <iant@google.com>
13559
13560         * layout.cc (Layout::include_section): Do not discard unrecognized
13561         SHT_STRTAB sections.
13562
13563 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13564
13565         * script.cc (Lex::can_continue_name): Make '?' allowable in
13566         version-script names.
13567         * testsuite/version_script.map: Change glob pattern to use '?'
13568
13569 2008-06-30  Manish Singh  <yosh@gimp.org>
13570
13571         PR 6585
13572         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13573         Correct typo.
13574
13575 2008-06-30  Ian Lance Taylor  <iant@google.com>
13576
13577         PR 6660
13578         PR 6682
13579         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13580         versions]: Don't try to read the value in the contents, since we
13581         don't use it.  Use the template endianness when writing.
13582
13583 2008-06-25  Cary Coutant  <ccoutant@google.com>
13584
13585         * fileread.cc (File_read::make_view): Assert on zero-length view.
13586         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13587         symbol table when there are no symbols to read.
13588
13589 2008-06-23  Craig Silverstein  <csilvers@google.com>
13590
13591         * version.cc (version_string): Bump to 1.7
13592
13593 2008-06-18  Craig Silverstein  <csilvers@google.com>
13594
13595         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13596         constant 0xFFFF to type Valtype.
13597         (Powerpc_relocate_functions::rel16_ha): Likewise.
13598
13599 2008-06-17  Ian Lance Taylor  <iant@google.com>
13600
13601         * output.h (Output_section::Input_section): Initialize p2align_ to
13602         zero for Output_section_data constructors.
13603         (Output_section::Input_section::addralign): If not an input
13604         section, return the alignment of the Output_section_data.
13605         * testsuite/copy_test.cc: New file.
13606         * testsuite/copy_test_1.cc: New file.
13607         * testsuite/copy_test_2.cc: New file.
13608         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13609         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13610         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13611         (copy_test_1_pic.o, copy_test_1.so): New targets.
13612         (copy_test_2_pic.o, copy_test_2.so): New targets.
13613         * testsuite/Makefile.in: Rebuild.
13614
13615         * script-sections.cc (Script_sections::place_orphan): Initialize
13616         local variable exact.
13617
13618 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13619
13620         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13621
13622 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13623             David S. Miller  <davem@davemloft.net>
13624
13625         * powerpc.cc: New file.
13626         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13627         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13628         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13629         * Makefile.in: Rebuild.
13630
13631 2008-06-09  Ian Lance Taylor  <iant@google.com>
13632
13633         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13634         <exception>.
13635         (throwing, orig_terminate): New static variables.
13636         (terminate_handler): New static function.
13637         (t2): Set terminate handler.
13638
13639 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13640
13641         PR 6584
13642         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13643         alignment.
13644
13645 2008-05-30  Cary Coutant  <ccoutant@google.com>
13646
13647         * archive.cc (Archive::include_all_members) Correct to step
13648         over symbol table and extended name table in thin archives.
13649
13650 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13651
13652         PR 6407
13653         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13654         calculation.
13655
13656 2008-05-28  Caleb Howe  <cshowe@google.com>
13657
13658         * reduced_debug_output.cc: New file.
13659         * reduced_debug_output.h: New file.
13660         * options.h (class General_options): Add --strip-debug-non-line.
13661         * options.cc (General_options::finalize): Add strip_debug_non_line
13662         to the strip heirarchy.
13663         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13664         fields.
13665         * layout.cc: Include "reduced_debug_output.h".
13666         (Layout::Layout): Initialize new fields.
13667         (line_only_debug_sections): New static array.
13668         (is_lines_only_debug_sections): New static inline function.
13669         (Layout::include_section): Handle --strip-debug-non-line.
13670         (Layout::make_output_section): If --strip-debug-non-line, build
13671         new output sections for .debug_abbrev and .debug_info.
13672         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13673         gold.  Warn about possible overflow.
13674         (read_signed_LEB_128): Likewise.
13675         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13676         (read_signed_LEB_128): Declare.
13677         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13678         (HFILES): Add reduced_debug_output.h.
13679         * Makefile.in: Rebuild.
13680
13681 2008-05-21  Ian Lance Taylor  <iant@google.com>
13682
13683         * mapfile.cc: New file.
13684         * mapfile.h: New file.
13685         * options.h (class General_options): Add -M/--print-map and -Map.
13686         * options.cc (General_options::finalize): Make -M equivalent to
13687         -Map -.
13688         * main.cc: Include <cstdio> and "mapfile.h".
13689         (main): Open mapfile if requested.
13690         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13691         constructor.  Change caller.
13692         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13693         (queue_middle_tasks): Likewise.
13694         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13695         declarations.
13696         * archive.cc: Include "mapfile.h".
13697         (Archive::add_symbols): Add mapfile parameter.  Change all
13698         callers.  Pass mapfile, symbol, and reason to include_member.
13699         (Archive::include_all_members): Add mapfile parameter.  Change all
13700         callers.
13701         (Archive::include_member): Add mapfile, sym, and why parameters.
13702         Change all callers.  Report inclusion to map file.
13703         * archive.h: Include "fileread.h".
13704         (class Archive): Update declarations.
13705         (Archive::file): New const method.
13706         (class Add_archive_symbols): Add mapfile_ field.  Update
13707         constructor.  Change all callers.
13708         * readsyms.h (class Read_symbols): Likewise.
13709         (class Finish_group): Likewise.
13710         (class Read_script): Likewise.
13711         * common.cc: Include "mapfile.h".
13712         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13713         all callers.
13714         (Symbol_table::do_allocate_commons): Likewise.
13715         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13716         symbol allocation to mapfile.
13717         * common.h (class Allocate_commons_task): Add mapfile_ field.
13718         Update constructor.  Change all callers.
13719         * symtab.h (class Symbol_table): Update declarations.
13720         * layout.cc: Include "mapfile.h".
13721         (Layout_task_runner::run): Print information to mapfile.
13722         (Layout::create_gold_note): Change Output_data_fixed_space to
13723         Output_data_zero_fill.
13724         (Layout::create_build_id): Likewise.
13725         (Layout::print_to_mapfile): New function.
13726         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13727         constructor.  Change caller.
13728         (class Layout): Declare print_to_mapfile.
13729         * output.cc (Output_section::Input_section::print_to_mapfile): New
13730         function.
13731         (Output_section::add_input_section): If producing a map, always
13732         add to input_sections_ list.
13733         (Output_section::do_print_to_mapfile): New function.
13734         (Output_segment::print_sections_to_mapfile): New function.
13735         (Output_segment::print_section_list_to_mapfile): New function.
13736         * output.h: Include "mapfile.h".
13737         (Output_data::print_to_mapfile): New function.
13738         (Output_data::do_print_to_mapfile): New virtual function.
13739         (Output_segment_headers::do_print_to_mapfile): New function.
13740         (Output_file_header::do_print_to_mapfile): New function.
13741         (Output_data_const::do_print_to_mapfile): New function.
13742         (class Output_data_const_buffer): Add map_name_ field.  Update
13743         constructor.  Change all callers.  Add do_print_to_mapfile
13744         function.
13745         (class Output_data_fixed_space): Likewise.
13746         (class Output_data_space): Likewise.
13747         (class Output_data_zero_fill): New class.
13748         (Output_data_strtab::do_print_to_mapfile): New function.
13749         (Output_data_reloc_base::do_print_to_mapfile): New function.
13750         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13751         (Output_data_group::do_print_to_mapfile): New function.
13752         (Output_data_got::do_print_to_mapfile): New function.
13753         (Output_data_dynamic::do_print_to_mapfile): New function.
13754         (Output_symtab_xindex::do_print_to_mapfile): New function.
13755         (class Output_section): Declare do_print_to_mapflie.  Declare
13756         print_to_mapfile in Input_section.
13757         (class Output_segment): Declare new functions.
13758         * object.h (Sized_relobj::symbol_count): New function.
13759         * script-sections.cc
13760         (Output_section_element_dot_assignment::set_section_addresses):
13761         Change Output_data_fixed_space to Output_data_zero_fill.
13762         (Output_data_expression::do_print_to_mapfile): New function.
13763         * script.cc (read_input_script): Add mapfile parameter.  Change
13764         all callers.
13765         * script.h (read_input_script): Update declaration.
13766         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13767         (Eh_frame::do_print_to_mapfile): New function.
13768         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13769         (Output_merge_string::do_print_to_mapfile): New function.
13770         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13771         function.
13772         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13773         function.
13774         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13775         function.
13776         * Makefile.am (CCFILES): Add mapfile.cc.
13777         (HFILES): Add mapfile.h.
13778         * Makefile.in: Rebuild.
13779
13780 2008-05-19  Ian Lance Taylor  <iant@google.com>
13781
13782         * options.h (class General_options): Add -z relro.
13783         * layout.cc (Layout::Layout): Initialize relro_segment_.
13784         (Layout::add_output_section_data): Return the output section.
13785         (Layout::make_output_section): Rcognize relro sections and mark
13786         them appropriately.
13787         (Layout::attach_allocated_section_to_segment): Put relro sections
13788         in a PT_GNU_RELRO segment.
13789         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13790         section as relro.
13791         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13792         PT_TLS segments.
13793         (Layout::linkonce_mapping): Map d.rel.ro.local to
13794         .data.rel.ro.local.
13795         (Layout::output_section_name): Us .data.rel.ro.local for any
13796         section which begins with that.
13797         * layout.h (class Layout): Update add_output_section_data
13798         declaration.  Add relro_segment_ field.
13799         * output.cc (Output_section::Output_section): Initialize is_relro_
13800         and is_relro_local_ fields.
13801         (Output_segment::add_output_section): Group relro sections.
13802         (Output_segment::is_first_section_relro): New function.
13803         (Output_segment::maximum_alignment): If there is a relro section,
13804         align the segment to the common page size.
13805         (Output_segment::set_section_addresses): Track whether we are
13806         looking at relro sections.  If the last section is a relro
13807         section, align to the common page size.
13808         (Output_segment::set_section_list_addresses): Add in_relro
13809         parameter.  Change all callers.  Align to the page size when
13810         moving from relro to non-relro section.
13811         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13812         segment.
13813         * output.h (class Output_section): Add is_relro_ and
13814         is_relro_local_ fields.
13815         (Output_section::is_relro): New function.
13816         (Output_section::set_is_relro): New function.
13817         (Output_section::is_relro_local): New function.
13818         (Output_section::set_is_relro_local): New function.
13819         (class Output_segment): Update declarations.
13820         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13821         * sparc.cc (Target_sparc::got_section): Likewise.
13822         * x86_64.cc (Target_x86_64::got_section): Likewise.
13823         * testsuite/relro_test_main.cc: New file.
13824         * testsuite/relro_test.cc: New file.
13825         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13826         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13827         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13828         (relro_test.so, relro_test_pic.o): New targets.
13829         * testsuite/Makefile.in: Rebuild.
13830
13831 2008-05-16  Ian Lance Taylor  <iant@google.com>
13832
13833         * output.cc (Output_segment::add_output_section): Remove front
13834         parameter.
13835         * output.h (class Output_segment): Remove
13836         add_initial_output_section and overloaded add_output_section.
13837         Update declaration of remaining add_output_section.
13838         * layout.cc (Layout::create_interp): Call add_output_section
13839         rather than add_initial_output_section.
13840         (Layout::finish_dynamic_section): Likewise.
13841
13842         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13843         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13844         know the dynamic type.
13845         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13846         field.  Initialize it in constructor.
13847         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13848         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13849         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13850         reloc.
13851
13852         * output.cc (Output_reloc::get_address): Change return type to
13853         Elf_Addr.
13854         * output.h (class Output_reloc): Update get_address declaration.
13855         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13856         for section addresses.
13857
13858 2008-05-09  Ian Lance Taylor  <iant@google.com>
13859
13860         PR 6493
13861         * gold.cc (gold_nomem): Use return value of write.
13862
13863 2008-05-08  Ian Lance Taylor  <iant@google.com>
13864
13865         * symtab.c (Symbol::init_base_output_data): Add version
13866         parameter.  Change all callers.
13867         (Symbol::init_base_output_segment): Likewise.
13868         (Symbol::init_base_constant): Likewise.
13869         (Symbol::init_base_undefined): Likewise.
13870         (Sized_symbol::init_output_data): Likewise.
13871         (Sized_symbol::init_output_segment): Likewise.
13872         (Sized_symbol::init_constant): Likewise.
13873         (Sized_symbol::init_undefined): Likewise.
13874         (Symbol_table::do_define_in_output_data): If the new symbol has a
13875         version, mark it as the default.
13876         (Symbol_table::do_define_in_output_segment): Likewise.
13877         (Symbol_table::do_define_as_constant): Likewise.
13878         * symtab.h (class Symbol): Update declarations.
13879         (class Sized_symbol): Likewise.
13880         * resolve.cc (Symbol::override_version): New function.
13881         (Symbol::override_base): Call override_version.
13882         (Symbol::override_base_with_special): Likewise.
13883         * testsuite/ver_script_8.script: New file.
13884         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13885         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13886         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13887         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13888
13889 2008-05-06  Ian Lance Taylor  <iant@google.com>
13890
13891         PR 6049
13892         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13893         functions.
13894         (class General_options): Remove existing --undefined, and add
13895         --no-undefined instead.  Add new --undefined as synonym for -u.
13896         * archive.cc (Archive::add_symbols): Check whether symbol was
13897         named with -u.
13898         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13899         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13900         all uses.  Add IS_UNDEFINED.  Update declarations to split
13901         different versions of init_base.  Declare init_base_undefined.
13902         (Symbol::is_defined): Handle IS_UNDEFINED.
13903         (Symbol::is_undefined): Likewise.
13904         (Symbol::is_weak_undefined): Call is_undefined.
13905         (Symbol::is_absolute): Handle IS_CONSTANT.
13906         (class Sized_symbol): Update declarations to split different
13907         versions of init.  Declare init_undefined.
13908         (class Symbol_table): Declare new functions.
13909         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13910         Change all callers.
13911         (Symbol::init_base_output_data): Likewise.
13912         (Symbol::init_base_output_segment): Likewise.
13913         (Symbol::init_base_constant): Likewise.
13914         (Symbol::init_base_undefined): New function.
13915         (Sized_symbol::init_object): Rename from init.  Change all
13916         callers.
13917         (Sized_symbol::init_output_data): Likewise.
13918         (Sized_symbol::init_output_segment): Likewise.
13919         (Sized_symbol::init_constant): Likewise.
13920         (Sized_symbol::init_undefined): New function.
13921         (Symbol_table::add_undefined_symbols_from_command_line): New
13922         function.
13923         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13924         function.
13925         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13926         (Symbol::output_section): Likewise.
13927         (Symbol::set_output_section): Likewise.
13928         (Symbol_table::sized_finalize_symbol): Likewise.
13929         (Symbol_table::sized_write_globals): Likewise.
13930         * resolve.cc (Symbol_table::should_override): Likewise.
13931         (Symbol::override_base_with_special): Likewise.
13932
13933         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13934         symbol, change it to have default visibility.
13935         * testsuite/protected_1.cc: New file.
13936         * testsuite/protected_2.cc: New file.
13937         * testsuite/protected_3.cc: New file.
13938         * testsuite/protected_main_1.cc: New file.
13939         * testsuite/protected_main_2.cc: New file.
13940         * testsuite/protected_main_3.cc: New file.
13941         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13942         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13943         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13944         (protected_1.so): New target.
13945         (protected_1_pic.o, protected_2_pic.o): New targets.
13946         (protected_3_pic.o): New target.
13947         (check_PROGRAMS): Add protected_2.
13948         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13949         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13950         * testsuite/Makefile.in: Rebuild.
13951
13952         * options.h (DEFINE_var): Add set_user_set_##varname__.
13953         (DEFINE_bool_alias): New macro.
13954         (class General_options): Define -Bstatic using DEFINE_bool_alias
13955         rather than DEFINE_special.  Add --undefined as an alias for -z
13956         defs.
13957         * options.cc (General_options::parse_Bstatic): Remove.
13958
13959         * options.h (class General_options): Add --fatal-warnings.
13960         * main.cc (main): Implement --fatal-warnings.
13961         * errors.h (Errors::warning_count): New function.
13962
13963         * options.h (class General_options): Add -Bsymbolic-functions.
13964         * symtab.h (Symbol::is_preemptible): Check for
13965         -Bsymbolic-functions.
13966
13967 2008-05-05  Ian Lance Taylor  <iant@google.com>
13968
13969         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13970         as noVARNAME rather than no-VARNAME.
13971         (class General_options): Add option -z combreloc.
13972         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13973         get_address.
13974         (Output_reloc::sort_before) [SHT_REL]: New function.
13975         (Output_reloc::sort_before) [SHT_RELA]: New function.
13976         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13977         Sort_relocs_comparison.
13978         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13979         parameter.  Change all callers.
13980         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13981         sort_relocs parameter.  Change all callers.
13982         * output.cc (Output_reloc::get_address): New function, broken out
13983         of write_rel.
13984         (Output_reloc::write_rel): Call it.
13985         (Output_reloc::compare): New function.
13986         (Output_data_reloc_base::do_write): Optionally sort relocs.
13987
13988         * configure.ac: If targ_extra_obj is set, link it in.
13989         * configure.tgt: Initialize all variables.
13990         (x86_64*): Set targ_extra_obj and targ_extra_size.
13991         * configure: Rebuild.
13992
13993         * object.cc (Sized_relobj::include_section_group): Adjust section
13994         indexes read from group data.  Build vector to pass to
13995         layout_group.
13996         * layout.cc (Layout::layout_group): Add flags and shndxes
13997         parameters.  Remove contents parameter.  Change caller.  Update
13998         explicit instantiations.
13999         * layout.h (class Layout): Update layout_group declaration.
14000         * output.cc (Output_data_group::Output_data_group): Add flags and
14001         input_shndxes parameters.  Remove contents parameter.  Change
14002         caller.
14003         (Output_data_group::do_write): Change input_sections_ to
14004         input_shndxes_.
14005         * output.h (class Output_data_group): Update constructor
14006         declaration.  Rename input_sections_ to input_shndxes_.
14007         * testsuite/many_sections_test.cc: Add template.
14008
14009 2008-04-30  Cary Coutant  <ccoutant@google.com>
14010
14011         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14012
14013         * layout.cc (Layout::include_section): Refactored check for debug
14014         info section.
14015         (Layout::add_comdat): Add new parameters.  Change type
14016         of signature parameter.  Add object and shndx to signatures table.
14017         (Layout::find_kept_object): New function.
14018         * layout.h: Include <cstring>.
14019         (Layout::is_debug_info_section): New function.
14020         (Layout::add_comdat): Add new parameters.
14021         (Layout::find_kept_object): New function.
14022         (Layout::Kept_section): New struct.
14023         (Layout::Signatures): Change type of map range.
14024         * object.cc (Relobj::output_section_address): New function.
14025         (Sized_relobj::include_section_group): Add new parameters.  Change
14026         calls to Layout::add_comdat.  Change to build table of kept comdat
14027         groups and table mapping discarded sections to kept sections.
14028         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14029         (Sized_relobj::do_layout): Change calls to include_section_group and
14030         include_linkonce_section.
14031         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14032         value to zero when section is discarded.
14033         (Sized_relobj::map_to_kept_section): New function.
14034         * object.h (Relobj::output_section_address): New function.
14035         (Relobj::Comdat_group): New type.
14036         (Relobj::find_comdat_group): New function.
14037         (Relobj::Comdat_group_table): New type.
14038         (Relobj::Kept_comdat_section): New type.
14039         (Relobj::Kept_comdat_section_table): New type.
14040         (Relobj::add_comdat_group): New function.
14041         (Relobj::set_kept_comdat_section): New function.
14042         (Relobj::get_kept_comdat_section): New function.
14043         (Relobj::comdat_groups_): New field.
14044         (Relobj::kept_comdat_sections_): New field.
14045         (Symbol_value::input_value): Update comment.
14046         (Sized_relobj::map_to_kept_section) New function.
14047         (Sized_relobj::include_linkonce_section): Add new parameter.
14048         * target-reloc.h (Comdat_behavior): New type.
14049         (get_comdat_behavior): New function.
14050         (relocate_section): Add code to map a discarded section to the
14051         corresponding kept section when applying a relocation.
14052
14053 2008-04-30  Craig Silverstein  <csilvers@google.com>
14054
14055         * dwarf_reader.cc (next_generation_count): New static var.
14056         (Addr2line_cache_entry): New struct.
14057         (addr2line_cache): New static var.
14058         (Dwarf_line_info::one_addr2line): Added caching.
14059         (Dwarf_line_info::clear_addr2line_cache): New function.
14060         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14061         cache-size parameter.
14062         (Dwarf_line_info::one_addr2line_cache): New function.
14063         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14064         new cache-size argument to one_addr2line(), and clear cache.
14065
14066 2008-04-28  Cary Coutant  <ccoutant@google.com>
14067
14068         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14069         R_386_PC8 relocations.
14070
14071 2008-04-23  Ian Lance Taylor  <iant@google.com>
14072
14073         * object.cc (Sized_relobj::include_section_group): Check for
14074         invalid section group.
14075
14076         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14077         header size.
14078
14079         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14080         than read for file header.
14081         * archive.cc (Archive::include_member): Likewise.
14082
14083 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14084
14085         * aclocal.m4: Regenerate.
14086         * configure: Regenerate.
14087
14088 2008-04-19  Ian Lance Taylor  <iant@google.com>
14089
14090         * version.cc (version_string): Bump to 1.6.
14091
14092         * testsuite/Makefile.am (many_sections_r_test): New target.
14093         (many_sections_r_test_SOURCES): Remove.
14094         (many_sections_r_test_DEPENDENCIES): Remove.
14095         (many_sections_r_test_LDFLAGS): Remove.
14096         (many_sections_r_test_LDADD): Remove.
14097
14098         * object.cc (Sized_relobj::do_add_symbols): Always pass
14099         local_symbol_count_ to add_from_relobj.
14100
14101         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14102         every thousand variables.
14103         * testsuite/Makefile.in: Rebuild.
14104
14105         * object.cc (Xindex::initialize_symtab_xindex): New function.
14106         (Xindex::read_symtab_xindex): New function.
14107         (Xindex::sym_xindex_to_shndx): New function.
14108         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14109         available.
14110         (Sized_relobj::do_initialize_xindex): New function.
14111         (Sized_relobj::do_read_symbols): Adjust section links.
14112         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14113         parameter.  Change all callers.
14114         (Sized_relobj::include_section_group): Adjust section links and
14115         symbol section indexes.
14116         (Sized_relobj::do_layout): Adjust section links.
14117         (Sized_relobj::do_count_local_symbols): Adjust section links and
14118         symbol section indexes.
14119         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14120         ordinary and special symbols.
14121         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14122         dynsym_xindex parameters.  Change all callers.  Adjust section
14123         links.  Use SHN_XINDEX when needed.
14124         (Sized_relobj::get_symbol_location_info): Adjust section links.
14125         Don't get fooled by special symbols.
14126         * object.h (class Xindex): Define.
14127         (class Object): Add xindex_ parameter.  Declare virtual functoin
14128         do_initialize_xindex.
14129         (Object::adjust_sym_shndx): New function.
14130         (Object::set_xindex): New protected function.
14131         (class Symbol_value): Add is_ordinary_shndx_ field.
14132         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14133         (Symbol_value::value): Assert ordinary section.
14134         (Symbol_value::initialize_input_to_output_map): Likewise.
14135         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14136         Change all callers.
14137         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14138         all callers.
14139         (class Sized_relobj): Update declarations.
14140         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14141         parameter.  Change all callers.
14142         (Sized_relobj::adjust_shndx): New function.
14143         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14144         field.
14145         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14146         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14147         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14148         (Sized_dynobj::read_dynsym_section): Adjust section links.
14149         (Sized_dynobj::read_dynamic): Likewise.
14150         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14151         section links.
14152         (Sized_dynobj::do_initialize_xindex): New function.
14153         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14154         do_initialize_xindex.
14155         (Sized_dynobj::adjust_shndx): New function.
14156         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14157         dynsym_xindex_ fields.
14158         (Layout::finalize): Add a call to set_section_indexes before
14159         creating the symtab sections.
14160         (Layout::set_section_indexes): Don't do anything if the section
14161         already has a section index.
14162         (Layout::create_symtab_sections): Add shnum parameter.  Change
14163         caller.  Create .symtab_shndx section if needed.
14164         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14165         caller.
14166         (Layout::allocated_output_section_count): New function.
14167         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14168         needed.
14169         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14170         fields.  Update declarations.
14171         (Layout::symtab_xindex): New function.
14172         (Layout::dynsym_xindex): New function.
14173         (class Write_symbols_task): Add layout_ field.
14174         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14175         Change caller.
14176         * output.cc (Output_section_headers::Output_section_headers): Add
14177         shstrtab_section parameter.  Change all callers.
14178         (Output_section_headers::do_sized_write): Store overflow values
14179         for section count and section string table section index in
14180         section header zero.
14181         (Output_file_header::do_sized_write): Check for overflow of
14182         section count and section string table section index.
14183         (Output_symtab_xindex::do_write): New function.
14184         (Output_symtab_xindex::endian_do_write): New function.
14185         * output.h (class Output_section_headers): Add shstrtab_section_.
14186         Update declarations.
14187         (class Output_symtab_xindex): Define.
14188         (Output_section::has_out_shndx): New function.
14189         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14190         field.
14191         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14192         Change all callers.
14193         (Sized_symbol::init): Likewise.
14194         (Symbol::output_section): Check for ordinary symbol.
14195         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14196         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14197         callers.
14198         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14199         Change all callers.  Simplify handling of symbols from sections
14200         not included in the link.
14201         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14202         distinction.
14203         (Weak_alias_sorter::operator()): Assert that symbols are
14204         ordinary.
14205         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14206         distinction.
14207         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14208         parameters.  Change all callers.
14209         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14210         symbol distinction.  Use SHN_XINDEX when needed.
14211         (Symbol_table::write_section_symbol): Add symtab_xindex
14212         parameter.  Change all callers.
14213         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14214         SHN_XINDEX when needed.
14215         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14216         declarations.
14217         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14218         (Symbol::is_defined): Check is_ordinary.
14219         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14220         (Symbol::is_absolute, Symbol::is_common): Likewise.
14221         (class Sized_symbol): Update declarations.
14222         (class Symbol_table): Update declarations.
14223         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14224         parameters.  Change all callers.
14225         (Sized_symbol::override): Likewise.
14226         (Symbol_table::override): Likewise.
14227         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14228         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14229         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14230         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14231         to be in an ordinary section.
14232         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14233         object and is_ordinary parameters.  Change all callers.
14234         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14235         Change all callers.  Don't add undefined or non-ordinary symbols
14236         to reloc_map_.
14237         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14238         Change all callers.
14239         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14240         declarations.
14241         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14242         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14243         (Sized_relobj::relocate_sections): Likewise.
14244         * target-reloc.h (scan_relocs): Adjust section symbol index.
14245         (scan_relocatable_relocs): Likewise.
14246         * i386.cc (Scan::local): Check for ordinary symbols.
14247         * sparc.cc (Scan::local): Likewise.
14248         * x86_64.cc (Scan::local): Likewise.
14249         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14250         to symbol_section_and_value.
14251         * testsuite/many_sections_test.cc: New file.
14252         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14253         (check_PROGRAMS): Add many_sections_test.
14254         (many_sections_test_SOURCES): Define.
14255         (many_sections_test_DEPENDENCIES): Define.
14256         (many_sections_test_LDFLAGS): Define.
14257         (BUILT_SOURCES): Add many_sections_define.h.
14258         (many_sections_define.h): New target.
14259         (BUILT_SOURCES): Add many_sections_check.h.
14260         (many_sections_check.h): New target.
14261         (check_PROGRAMS): Add many_sections_r_test.
14262         (many_sections_r_test_SOURCES): Define.
14263         (many_sections_r_test_DEPENDENCIES): Define.
14264         (many_sections_r_test_LDFLAGS): Define.
14265         (many_sections_r_test_LDADD): Define.
14266         (many_sections_r_test.o): New target.
14267         * testsuite/Makefile.in: Rebuild.
14268
14269 2008-04-17  Cary Coutant  <ccoutant@google.com>
14270
14271         * errors.cc (Errors::info): New function.
14272         (gold_info): New function.
14273         * errors.h (Errors::info): New function.
14274         * gold.h (gold_info): New function.
14275         * object.cc (Input_objects::add_object): Print trace output.
14276         * options.cc (options::parse_set): New function.
14277         (General_options::parse_wrap): Deleted.
14278         (General_options::General_options): Deleted initializer.
14279         * options.h (options::String_set): New typedef.
14280         (options::parse_set): New function.
14281         (DEFINE_set): New macro.
14282         (General_options::wrap): Changed to use DEFINE_set. Changed
14283         callers of any_wrap_symbols and is_wrap_symbol.
14284         (General_options::trace, General_options::trace_symbol):
14285         New options.
14286         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14287         (General_options::wrap_symbols_): Deleted.
14288         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14289
14290 2008-04-17  David S. Miller  <davem@davemloft.net>
14291
14292         * options.cc (General_options::parse_V): New function.
14293         * options.h: Add entries for -V and -Qy.
14294
14295 2008-04-17  Ian Lance Taylor  <iant@google.com>
14296
14297         * common.cc (Symbol_table::allocate_commons): Remove options
14298         parameter.  Change caller.
14299         (Symbol_table::do_allocate_commons): Remove options parameter.
14300         Change caller.  Just call do_allocate_commons_list twice.
14301         (Symbol_table::do_allocate_commons_list): New function, broken out
14302         of do_allocate_commons.
14303         * common.h (class Allocate_commons_task): Remove options_ field.
14304         Update constructor.
14305         * symtab.cc (Symbol_table::Symbol_table): Initialize
14306         tls_commons_.
14307         (Symbol_table::add_from_object): Put TLS common symbols on
14308         tls_commons_ list.
14309         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14310         which are IN_OUTPUT_DATA.
14311         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14312         allocate_commons and do_allocate_commons declarations.  Declare
14313         do_allocate_commons_list.
14314         * gold.cc (queue_middle_tasks): Update creation of
14315         Allocate_commons_task to not pass options.
14316         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14317         (TLS_TEST_C_FLAGS): New variable.
14318         (tls_test_c_pic.o): New target.
14319         (tls_test_shared.so): Link in tls_test_c_pic.o.
14320         (tls_test_c_pic_ie.o): New target.
14321         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14322         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14323         (tls_test_c.o): New target.
14324         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14325         (tls_pic_test_LDADD): Likewise.
14326         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14327         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14328         (tls_test_c_gnu2.o): New target.
14329         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14330         tls_test_c_gnu2.o.
14331         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14332         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14333         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14334         * testsuite/tls_test.cc: Include "config.h".
14335         (t_last): Call t11_last.
14336         * testsuite/tls_test.h (t11, t11_last): Declare.
14337         * testsuite/tls_test_c.c: New file.
14338         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14339         * configure.ac: Check for OpenMP support.
14340         * configure, config.in, Makefile.in: Rebuild.
14341         * testsuite/Makefile.in: Rebuild.
14342
14343 2008-04-16  Cary Coutant  <ccoutant@google.com>
14344
14345         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14346         (Target_i386::tls_base_symbol_defined_): New field.
14347         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14348         (Target_i386::Scan::global): Likewise.
14349         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14350         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14351         (Target_x86_64::tls_base_symbol_defined_): New field.
14352         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14353         (Target_x86_64::Scan::global): Likewise.
14354
14355 2008-04-16  Cary Coutant  <ccoutant@google.com>
14356
14357         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14358         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14359         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14360         building shared libraries.
14361         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14362         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14363         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14364         * testsuite/Makefile.in: Rebuild.
14365         * testsuite/weak_undef.h: New file.
14366         * testsuite/weak_undef_file1.cc: Add extra test cases.
14367         * testsuite/weak_undef_file2.cc: Likewise.
14368         * testsuite/weak_undef_test.cc: Likewise.
14369
14370 2008-04-16  David S. Miller  <davem@davemloft.net>
14371
14372         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14373         Add issued_non_pic_error_ field.  Declare check_non_pic.
14374         (Target_sparc::Scan::check_non_pic): New function.
14375         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14376         (Target_sparc::Scan::global): Likewise.
14377
14378         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14379         * configure: Rebuild.
14380
14381         * options.h (DEFINE_enable): New macro.
14382         (new_dtags): New enable option.
14383         (initfirst, interpose, loadfltr, nodefaultlib,
14384         nodelete, nodlopen, nodump): New -z options.
14385         * layout.cc (Layout:finish_dynamic_section): If new
14386         dtags enabled, emit DT_RUNPATH.  Also, emit a
14387         DT_FLAGS_1 containing any specified -z flags.
14388
14389 2008-04-16  Ian Lance Taylor  <iant@google.com>
14390
14391         * copy-relocs.cc: New file.
14392         * copy-relocs.h: New file.
14393         * reloc.cc: Remove Copy_relocs code.
14394         * reloc.h: Likewise.
14395         * reloc-types.h (struct Reloc_types) [both versions]: Add
14396         get_reloc_addend_noerror.
14397         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14398         variants of add_global which take an addend which must be zero.
14399         * i386.cc: Include "copy-relocs.h".
14400         (class Target_i386): Change type of copy_relocs_ to variable,
14401         update initializer.
14402         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14403         Change all callers.
14404         (Target_i386::do_finalize_sections): Change handling of
14405         copy_relocs_.
14406         * sparc.cc: Include "copy-relocs.h".
14407         (class Target_sparc): Change type of copy_relocs_ to variable,
14408         update initializer.
14409         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14410         Change all callers.
14411         (Target_sparc::do_finalize_sections): Change handling of
14412         copy_relocs_.
14413         * x86_64.cc: Include "copy-relocs.h".
14414         (class Target_x86_64): Change type of copy_relocs_ to variable,
14415         update initializer.
14416         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14417         class.  Change all callers.
14418         (Target_x86_64::do_finalize_sections): Change handling of
14419         copy_relocs_.
14420         * Makefile.am (CCFILES): Add copy-relocs.cc.
14421         (HFILES): Add copy-relocs.h.
14422
14423         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14424
14425         * testsuite/script_test_4.sh: Permit leading zeroes.
14426
14427 2008-04-15  Ian Lance Taylor  <iant@google.com>
14428
14429         * script-sections.cc (Script_sections::create_segments): Use
14430         header_size_adjustment even when there is enough room for the
14431         headers.
14432         * testsuite/script_test_4.sh: New file.
14433         * testsuite/script_test_4.t: New file.
14434         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14435         (check_DATA): Add script_test_4.stdout.
14436         (MOSTLYCLEANFILES): Likewise.
14437         (script_test_4): New target.
14438         (script_test_4.stdout): New target.
14439         * testsuite/Makefile.in: Rebuild.
14440
14441         * sparc.cc: Add definitions for Output_data_plt_sparc class
14442         constants.
14443
14444 2008-04-14  David S. Miller  <davem@davemloft.net>
14445
14446         * sparc.cc: New file.
14447         * Makefile.am (TARGETSOURCES): Add sparc.cc
14448         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14449         * configure.tgt: Document targ_extra_size and
14450         targ_extra_big_endian.  Add entries for sparc-* and
14451         sparc64-*.
14452         * configure.ac: Handle targ_extra_size and
14453         targ_extra_big_endian.
14454         * Makefile.in: Rebuild.
14455         * configure: Likewise.
14456         * po/POTFILES.in: Likewise.
14457         * po/gold.pot: Likewise.
14458
14459 2008-04-14  Ian Lance Taylor  <iant@google.com>
14460
14461         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14462         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14463         in the name/type/flags to section mapping.  Don't call
14464         allocate_output_section.
14465         (Layout::choose_output_section): Change parameter from adjust_name
14466         to is_input_section.  Don't permit input sections after sections
14467         are attached to segments.  Don't call allocate_output_section.
14468         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14469         not write_enable_output_section.
14470         (Layout::make_output_section): Don't push to
14471         unattached_section_list_ nor call attach_to_segment.  Call
14472         attach_section_to_segment if sections are attached.
14473         (Layout::attach_sections_to_segments): New function.
14474         (Layout::attach_section_to_segment): New function.
14475         (Layout::attach_allocated_section_to_segment): Rename from
14476         attach_to_segment.  Remove flags parameter.
14477         (Layout::allocate_output_section): Remove function.
14478         (Layout::write_enable_output_section): Remove function.
14479         * layout.h (class Layout): Update for above changes.  Add new
14480         field sections_are_attached_.
14481         * output.h (Output_section::update_flags_for_input_section): New
14482         function.
14483         * output.cc (Output_section::add_input_section): Call
14484         update_flags_for_input_section.
14485         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14486
14487 2008-04-11  Cary Coutant  <ccoutant@google.com>
14488
14489         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14490         thought unnecessary.
14491         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14492
14493 2008-04-11  Ian Lance Taylor  <iant@google.com>
14494
14495         * output.h (class Output_section_data): Remove inline definition
14496         of set_addralign.
14497         * output.cc (Output_section_data::set_addralign): New function.
14498
14499 2008-04-11  Cary Coutant  <ccoutant@google.com>
14500
14501         Add support for TLS descriptors for i386 and x86_64.
14502         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14503         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14504         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14505         GOT_TYPE_TLS_DESC.
14506         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14507         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14508         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14509         relocations.
14510         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14511         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14512         Fix problem with initial-exec relocations.
14513         (Target_i386::Relocate::relocate_tls): Likewise.
14514         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14515         relaxation.
14516         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14517         support for section-plus-offset dynamic table entries.
14518         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14519         (Output_data_dynamic::Dynamic_entry): Add support for
14520         section-plus-offset dynamic table entries.
14521         (Output_data_dynamic::Classification): Likewise.
14522         (Output_data_dynamic::classification_): Renamed offset_.
14523         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14524         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14525         (Target_x86_64::make_plt_section): New function.
14526         (Target_x86_64::reserve_tlsdesc_entries): New function.
14527         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14528         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14529         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14530         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14531         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14532         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14533         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14534         add extra PLT entry for TLS descriptors.
14535         (Output_data_plt_x86_64::got_): New field.
14536         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14537         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14538         fields.
14539         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14540         descriptors.
14541         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14542         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14543         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14544         R_386_TLS_DESC_CALL relocations.
14545         (Target_x86_64::Scan::global): Likewise.
14546         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14547         for TLS descriptors.
14548         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14549         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14550         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14551         GD-to-IE relaxation.
14552         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14553         and TLS_DESCRIPTORS.
14554         * Makefile.in: Rebuild.
14555         * configure: Rebuild.
14556         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14557         (tls_test_shared2.so): New target.
14558         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14559         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14560         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14561         (tls_shared_gd_to_ie_test_LDADD): New variable.
14562         (tls_shared_gnu2_gd_to_ie_test): New target.
14563         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14564         New targets.
14565         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14566         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14567         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14568         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14569         (tls_shared_gnu2_test): New target.
14570         (tls_test_gnu2_shared.so): New target.
14571         (tls_shared_gnu2_test_SOURCES): New variable.
14572         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14573         (tls_shared_gnu2_test_LDFLAGS): New variable.
14574         (tls_shared_gnu2_test_LDADD): New variable.
14575         * testsuite/Makefile.in: Rebuild.
14576         * testsuite/Makefile.
14577
14578 2008-04-11  Ian Lance Taylor  <iant@google.com>
14579
14580         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14581         justsyms.t.
14582         * testsuite/Makefile.in: Rebuild.
14583
14584         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14585         long.
14586         * testsuite/script_test_2.cc (main): Adjust test.
14587
14588 2008-04-11  David S. Miller  <davem@davemloft.net>
14589             Ian Lance Taylor  <iant@google.com>
14590
14591         * options.h (General_options): Add entries for '-Y' and
14592         '-relax'.
14593         * options.cc (General_options:finalize): If -Y was used, add those
14594         entries to the library path instead of the default "/lib" and
14595         "/usr/lib".
14596
14597 2008-04-11  David S. Miller  <davem@davemloft.net>
14598
14599         * testsuite/justsyms.t: Start at 0x100.
14600         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14601         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14602         long.
14603         * testsuite/script_test_2.cc: Adjust string and section length
14604         checks.
14605
14606 2008-04-09  Ian Lance Taylor  <iant@google.com>
14607
14608         PR gold/5996
14609         * script-sections.cc (Sections_element::allocate_to_segment): Add
14610         orphan parameter.
14611         (Output_section_definition::allocate_to_segment): Likewise.
14612         (Orphan_output_section::allocate_to_segment): Likewise.
14613         (Script_sections::attach_sections_using_phdrs_clause): Don't
14614         propagate non-PT_LOAD segments to orphan sections.
14615         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14616         readelf rather than objdump.
14617         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14618         .interp section and PT_INTERP segment are the same size.
14619         * testsuite/Makefile.in: Rebuild.
14620
14621         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14622         aliases for symbols defined in the same object.
14623         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14624         (weak_alias_test_SOURCES): New variable.
14625         (weak_alias_test_DEPENDENCIES): New variable.
14626         (weak_alias_test_LDFLAGS): New variable.
14627         (weak_alias_test_LDADD): New variable.
14628         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14629         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14630         (weak_alias_test_3.o): New target.
14631         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14632         * testsuite/weak_alias_test_main.cc: New file.
14633         * testsuite/weak_alias_test_1.cc: New file.
14634         * testsuite/weak_alias_test_2.cc: New file.
14635         * testsuite/weak_alias_test_3.cc: New file.
14636
14637 2008-04-08  Ian Lance Taylor  <iant@google.com>
14638
14639         * options.h (class General_options): Add --noinhibit-exec option.
14640         * main.cc (main): Check --noinhibit-exec.
14641
14642         * options.h (class General_options): Define --wrap as a special
14643         option.  Add wrap_symbols_ field.
14644         (General_options::any_wrap_symbols): New function.
14645         (General_options::is_wrap_symbol): New function.
14646         * options.cc (General_options::parse_wrap): New function.
14647         (General_options::General_options): Initialize wrap_symbols_.
14648         * symtab.cc (Symbol_table::wrap_symbol): New function.
14649         (Symbol_table::add_from_object): Handle --wrap.
14650         * symtab.h (class Symbol_table): Declare wrap_symbol.
14651         * target.h (Target::wrap_char): New function.
14652         (Target::Target_info): Add wrap_char field.
14653         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14654         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14655         * testsuite/testfile.cc (Target_test::test_target_info):
14656         Likewise.
14657
14658         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14659         there is one.
14660
14661         * layout.h (class Layout): Add added_eh_frame_data_ field.
14662         * layout.cc (Layout::Layout): Initialize new field.
14663         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14664         output section until we find a section we merged successfully.
14665         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14666         that the size be non-zero.
14667
14668         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14669         qualifier.
14670
14671 2008-04-08  Craig Silverstein  <csilvers@google.com>
14672
14673         * configure.ac: Export new conditional variable HAVE_ZLIB.
14674         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14675         on HAVE_ZLIB.
14676         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14677         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14678
14679 2008-04-07  Ian Lance Taylor  <iant@google.com>
14680
14681         * version.cc (version_string): Set to "1.5".
14682
14683         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14684         Add issued_non_pic_error_ field.  Declare check_non_pic.
14685         (Target_x86_64::Scan::check_non_pic): New function.
14686         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14687         (Target_x86_64::Scan::global): Likewise.
14688
14689         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14690         addend parameter.  Change caller.  Handle merge sections.
14691         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14692         Address to Addend.  Don't add in the result of
14693         local_section_offset, pass down the addend and use the returned
14694         value.
14695         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14696         Update declarations of local_section_offset and symbol_value.
14697         * testsuite/two_file_test_1.cc (t18): New function.
14698         * testsuite/two_file_test_2.cc (f18): New function.
14699         * testsuite/two_file_test_main.cc (main): Call t18.
14700         * testsuite/two_file_test.h (t18, f18): Declare.
14701
14702         * configure.ac: Don't test for objdump, c++filt, or readelf.
14703         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14704         conditionals.
14705         (TEST_READELF): New variable.
14706         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14707         (check_PROGRAMS): Add two_file_strip_test.
14708         (two_file_strip_test): New target.
14709         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14710         (two_file_same_shared_strip_test_SOURCES): New variable.
14711         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14712         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14713         (two_file_same_shared_strip_test_LDADD): New variable.
14714         (two_file_shared_strip.so): New target.
14715         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14716         (ver_test_5.syms, ver_test_7.syms): Likewise.
14717         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14718         (strip_test_3.stdout): Use TEST_OBJDUMP.
14719         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14720
14721 2008-04-04  Cary Coutant  <ccoutant@google.com>
14722
14723         * symtab.h (Symbol::is_weak_undefined): New function.
14724         (Symbol::is_strong_undefined): New function.
14725         (Symbol::is_absolute): New function.
14726         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14727         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14728         absolute symbols.
14729         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14730         (weak_undef_test): New target.
14731         * testsuite/Makefile.in: Rebuild.
14732         * testsuite/weak_undef_file1.cc: New file.
14733         * testsuite/weak_undef_file2.cc: New file.
14734         * testsuite/weak_undef_test.cc: New file.
14735
14736 2008-04-03  Craig Silverstein  <csilvers@google.com>
14737
14738         * compressed_output.h (class Output_compressed_section): Use
14739         unsigned buffer.
14740         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14741         add zlib header.
14742         (zlib_compressed_suffix): Removed.
14743         (Output_compressed_section::set_final_data_size): Use unsigned
14744         buffers.
14745         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14746         Fix linker invocation.
14747         (flagstest_o_specialfile_and_compress_debug_sections):
14748         Likewise.
14749         * testsuite/Makefile.in: Regenerated.
14750
14751 2008-04-02  David S. Miller  <davem@davemloft.net>
14752
14753         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14754         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14755
14756 2008-04-02  Craig Silverstein  <csilvers@google.com>
14757
14758         * TODO: New file.
14759
14760 2008-04-02  Ian Lance Taylor  <iant@google.com>
14761
14762         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14763         parameters.  Update for new key type to views_.  Change all
14764         callers.
14765         (File_read::read): Adjust for byteshift in returned view.
14766         (File_read::add_view): New function, broken out of
14767         find_and_make_view.
14768         (File_read::make_view): New function, broken out of
14769         find_and_make_view.
14770         (File_read::find_or_make_view): Add offset and aligned
14771         parameters.  Rewrite accordingly.  Change all callers.
14772         (File_read::get_view): Add offset and aligned parameters.  Adjust
14773         for byteshift in return value.
14774         (File_read::get_lasting_view): Likewise.
14775         * fileread.h (class File_read): Update declarations.
14776         (class File_read::View): Add byteshift_ field.  Add byteshift to
14777         constructor.  Add byteshift method.
14778         * archive.h (Archive::clear_uncached_views): New function.
14779         (Archive::get_view): Add aligned parameter.  Change all callers.
14780         * object.h (Object::get_view): Add aligned parameter.  Change all
14781         callers.
14782         (Object::get_lasting_view): Likewise.
14783
14784         * fileread.cc (File_read::release): Don't call clear_views if
14785         there are multiple objects.
14786         * fileread.h (File_read::clear_uncached_views): New function.
14787         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14788         on the archive.
14789
14790 2008-03-31  Cary Coutant  <ccoutant@google.com>
14791
14792         Add thin archive support.
14793         * archive.cc (Archive::armagt): New const.
14794         (Archive::setup): Remove task parameter and calls to unlock.
14795         (Archive::unlock_nested_archives): New function.
14796         (Archive::read_header): Add nested_off parameter. Change
14797         all callers.
14798         (Archive::interpret_header): Likewise.
14799         (Archive::include_all_members): Change to handle thin
14800         archives.
14801         (Archive::include_member): Likewise.
14802         * archive.h (Archive::Archive): Add new parameters and
14803         initializers.
14804         (Archive::armagt): New const.
14805         (Archive::setup): Remove task parameter.
14806         (Archive::unlock_nested_archives): New function.
14807         (Archive::read_header): Add nested_off parameter.
14808         (Archive::interpret_header): Likewise.
14809         (Archive::Nested_archive_table): New typedef.
14810         (Archive::is_thin_archive_): New field.
14811         (Archive::nested_archives_): New field.
14812         (Archive::options_): New field.
14813         (Archive::dirpath_): New field.
14814         (Archive::task_): New field.
14815         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14816         for thin archives.  Pass additional parameters to
14817         Archive::Archive.  Unlock the archive file after calling
14818         Archive::setup.
14819
14820 2008-03-29  Ian Lance Taylor  <iant@google.com>
14821
14822         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14823         version symbol to be local.
14824         * testsuite/ver_test_4.sh: New file.
14825         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14826         (check_DATA): Add ver_test_4.syms.
14827         (ver_test_4.syms): New target.
14828         * testsuite/Makefile.in: Rebuild.
14829
14830         * output.cc
14831         (Output_section::Input_section_sort_entry::has_priority): New
14832         function.
14833         (Output_section::Input_section_sort_entry::match_file_name): New
14834         function.
14835         (Output_section::Input_section_sort_entry::match_section_name):
14836         Remove.
14837         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14838         Remove.
14839         (Output_section::Input_section_sort_entry::match_section_file):
14840         Remove.
14841         (Output_section::Input_section_sort_compare::operator()): Rewrite
14842         using new Input_section_sort_entry functions.  Sort crtbegin and
14843         crtend first.  Sort sections with no priority before sections with
14844         a priority.
14845         * testsuite/initpri1.c (d3): Check j != 4.
14846         (cd5): New constructor/destructor function.
14847         (main): Check j != 2.
14848
14849         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14850         new symbol when resolving, don't call set_is_default.
14851         * testsuite/ver_test_7.cc: New file.
14852         * testsuite/ver_test_7.sh: New file.
14853         * testsuite/Makefile.am (ver_test_7.so): New target.
14854         (ver_test_7.o): New target.
14855         (check_SCRIPTS): Add ver_test_7.sh.
14856         (check_DATA): Add ver_test_7.syms.
14857         (ver_test_7.syms): New target.
14858
14859 2008-03-28  Ian Lance Taylor  <iant@google.com>
14860
14861         * layout.cc (Layout::layout): If we see an input section with a
14862         name that needs sorting, set the must_sort flag for the output
14863         section.
14864         (Layout::make_output_section): If the name of the output section
14865         indicates that it might require sorting, set the may_sort flag.
14866         * output.h (Output_section::may_sort_attached_input_sections): New
14867         function.
14868         (Output_section::set_may_sort_attached_input_sections): New
14869         function.
14870         (Output_section::must_sort_attached_input_sections): New
14871         function.
14872         (Output_section::set_must_sort_attached_input_sections): New
14873         function.
14874         (class Output_section): Declare Input_section_sort_entry.  Define
14875         Input_section_sort_compare.  Declare
14876         sort_attached_input_sections.  Add new fields:
14877         may_sort_attached_input_sections_,
14878         must_sort_attached_input_sections_,
14879         attached_input_sections_are_sorted_.
14880         * output.cc (Output_section::Output_section): Initialize new
14881         fields.
14882         (Output_section::add_input_section): Add an entry to
14883         input_sections_ if may_sort or must_sort are true.
14884         (Output_section::set_final_data_size): Call
14885         sort_attached_input_sections if necessary.
14886         (Output_section::Input_section_sort_entry): Define new class.
14887         (Output_section::Input_section_sort_compare::operator()): New
14888         function.
14889         (Output_section::sort_attached_input_sections): New function.
14890         * configure.ac: Check whether the compiler supports constructor
14891         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14892         * testsuite/initpri1.c: New file.
14893         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14894         CONSTRUCTOR_PRIORITY.
14895         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14896         (initpri1_LDFLAGS): New variable.
14897         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14898
14899 2008-03-27  Ian Lance Taylor  <iant@google.com>
14900
14901         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14902         * testsuite/common_test_1.c: New file.
14903         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14904         (common_test_1_SOURCES): New variable.
14905         (common_test_1_DEPENDENCIES): New variable.
14906         (common_test_1_LDFLAGS): New variable.
14907
14908         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14909         and commons_ correctly when NAME/VERSION does not override
14910         NAME/NULL.
14911         * testsuite/ver_test_6.c: New file.
14912         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14913         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14914         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14915
14916 2008-03-26  Ian Lance Taylor  <iant@google.com>
14917
14918         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14919         of an undefined symbol from a version script.
14920         * testsuite/Makefile.am (ver_test_5.so): New target.
14921         (ver_test_5.o): New target.
14922         (check_SCRIPTS): Add ver_test_5.sh.
14923         (check_DATA): Add ver_test_5.syms.
14924         (ver_test_5.syms): New target.
14925         * testsuite/ver_test_5.cc: New file.
14926         * testsuite/ver_test_5.script: New file.
14927         * testsuite/ver_test_5.sh: New file.
14928         * Makefile.in, testsuite/Makefile.in: Rebuild.
14929
14930         PR gold/5986
14931         Fix problems building gold with gcc 4.3.0.
14932         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14933         (gold_error_at_location, gold_warning_at_location): Use it.
14934         * configure.ac: Check whether we can compile and use a template
14935         function with a printf attribute.
14936         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14937         when jumping over bytes.
14938         * object.cc: Instantiate Object::read_section_data.
14939         * debug.h: Include <cstring>
14940         * dwarf_reader.cc: Include <algorithm>
14941         * main.cc: Include <cstring>.
14942         * options.cc: Include <cstring>.
14943         * output.cc: Include <cstring>.
14944         * script.cc: Include <cstring>.
14945         * script.h: Include <string>.
14946         * symtab.cc: Include <cstring> and <algorithm>.
14947         * target-select.cc: Include <cstring>.
14948         * version.cc: Include <string>.
14949         * testsuite/testmain.cc: Include <cstdlib>.
14950         * configure, config.in: Rebuild.
14951
14952 2008-03-25  Ian Lance Taylor  <iant@google.com>
14953
14954         * options.cc: Include "../bfd/bfdver.h".
14955         (options::help): Print bug reporting address.
14956
14957         * version.cc (print_version): Adjust output for current value of
14958         BFD_VERSION_STRING.
14959
14960         * NEWS: New file.
14961
14962         * options.cc (options::help): Print list of supported targets.
14963         * target-select.h: Include <vector>.
14964         (class Target_selector): Make machine_, size_, and is_big_endian_
14965         fields const.  Add bfd_name_ and instantiated_target_ fields.
14966         (Target_selector::Target_selector): Add bfd_name parameter.
14967         (Target_selector::recognize): Make non-virtual, call
14968         do_recognize.
14969         (Target_selector::recognize_by_name): Make non-virtual, call
14970         do_recognize_by_name.
14971         (Target_selector::supported_names): New function.
14972         (Target_selector::bfd_name): New function.
14973         (Target_selector::do_instantiate_target): New pure virtual
14974         function.
14975         (Target_selector::do_recognize): New virtual function.
14976         (Target_selector::do_recognize_by_name): New virtual function.
14977         (Target_selector::instantiate_target): New private function.
14978         (supported_target_names): Declare.
14979         * target-select.cc (Target_selector::Target_selector): Update for
14980         new parameter and fields.
14981         (select_target_by_name): Check that the name matches before
14982         calling recognize_by_name.
14983         (supported_target_names): New function.
14984         * i386.cc (class Target_selector_i386): Update Target_selector
14985         constructor call.  Remove recognize and recognize_by_name.  Add
14986         do_instantiate_target.
14987         * x86_64.cc (class Target_selector_x86_64): Likewise.
14988         * testsuite/testfile.cc (class Target_selector_test): Update for
14989         changes to Target_selector.
14990
14991         * README: Rewrite, with some notes on unsupported features.
14992
14993 2008-03-24  Cary Coutant  <ccoutant@google.com>
14994
14995         * i386.cc (Target_i386::Got_type): New enum declaration.
14996         (Target_i386::Scan::local): Updated callers of Output_data_got
14997         member functions.
14998         (Target_i386::Scan::global): Likewise.
14999         (Target_i386::Relocate::relocate): Likewise.
15000         (Target_i386::Relocate::relocate_tls): Likewise.
15001         * object.h (Got_offset_list): New class.
15002         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15003         (Sized_relobj::local_got_offset): Likewise.
15004         (Sized_relobj::set_local_got_offset): Likewise.
15005         (Sized_relobj::local_has_tls_got_offset): Removed.
15006         (Sized_relobj::local_tls_got_offset): Removed.
15007         (Sized_relobj::set_local_tls_got_offset): Removed.
15008         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15009         * output.cc (Output_data_got::add_global): Added got_type parameter.
15010         (Output_data_got::add_global_with_rel): Likewise.
15011         (Output_data_got::add_global_with_rela): Likewise.
15012         (Output_data_got::add_global_pair_with_rel): New function.
15013         (Output_data_got::add_global_pair_with_rela): New function.
15014         (Output_data_got::add_local): Added got_type parameter.
15015         (Output_data_got::add_local_with_rel): Likewise.
15016         (Output_data_got::add_local_with_rela): Likewise.
15017         (Output_data_got::add_local_pair_with_rel): New function.
15018         (Output_data_got::add_local_pair_with_rela): New function.
15019         (Output_data_got::add_global_tls): Removed.
15020         (Output_data_got::add_global_tls_with_rel): Removed.
15021         (Output_data_got::add_global_tls_with_rela): Removed.
15022         (Output_data_got::add_local_tls): Removed.
15023         (Output_data_got::add_local_tls_with_rel): Removed.
15024         (Output_data_got::add_local_tls_with_rela): Removed.
15025         * output.h (Output_data_got::add_global): Added got_type parameter.
15026         (Output_data_got::add_global_with_rel): Likewise.
15027         (Output_data_got::add_global_with_rela): Likewise.
15028         (Output_data_got::add_global_pair_with_rel): New function.
15029         (Output_data_got::add_global_pair_with_rela): New function.
15030         (Output_data_got::add_local): Added got_type parameter.
15031         (Output_data_got::add_local_with_rel): Likewise.
15032         (Output_data_got::add_local_with_rela): Likewise.
15033         (Output_data_got::add_local_pair_with_rel): New function.
15034         (Output_data_got::add_local_pair_with_rela): New function.
15035         (Output_data_got::add_global_tls): Removed.
15036         (Output_data_got::add_global_tls_with_rel): Removed.
15037         (Output_data_got::add_global_tls_with_rela): Removed.
15038         (Output_data_got::add_local_tls): Removed.
15039         (Output_data_got::add_local_tls_with_rel): Removed.
15040         (Output_data_got::add_local_tls_with_rela): Removed.
15041         * resolve.cc (Symbol::override_base_with_special): Removed
15042         reference to has_got_offset_ field.
15043         * symtab.cc (Symbol::init_fields): Replaced initialization
15044         of got_offset_ with got_offsets_.  Removed initialization
15045         of has_got_offset_
15046         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15047         (Symbol::got_offset): Likewise.
15048         (Symbol::set_got_offset): Likewise.
15049         (Symbol::has_tls_got_offset): Removed.
15050         (Symbol::tls_got_offset): Removed.
15051         (Symbol::set_tls_got_offset): Removed.
15052         (Symbol::got_offset_): Removed.
15053         (Symbol::tls_mod_got_offset_): Removed.
15054         (Symbol::tls_pair_got_offset_): Removed.
15055         (Symbol::got_offsets_): New field.
15056         (Symbol::has_got_offset): Removed.
15057         (Symbol::has_tls_mod_got_offset): Removed.
15058         (Symbol::has_tls_pair_got_offset): Removed.
15059         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15060         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15061         member functions.
15062         (Target_x86_64::Scan::global): Likewise.
15063         (Target_x86_64::Relocate::relocate): Likewise.
15064         (Target_x86_64::Relocate::relocate_tls): Likewise.
15065
15066 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15067
15068         * yyscript.y: Fix spelling error in comment.
15069
15070 2008-03-24  Ian Lance Taylor  <iant@google.com>
15071
15072         * options.h (class General_options): Define build_id option.
15073         * layout.h (class Layout): Declare write_build_id, create_note,
15074         create_build_id.  Add build_id_note_ member.
15075         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15076         "libiberty.h", "md5.h", "sha1.h".
15077         (Layout::Layout): Initialize eh_frame_data_,
15078         eh_frame_hdr_section_, and build_id_note_.
15079         (Layout::finalize): Call create_build_id.
15080         (Layout::create_note): New function, broken out of
15081         Layout::create_gold_note.
15082         (Layout::create_gold_note): Call create_note.
15083         (Layout::create_build_id): New function.
15084         (Layout::write_build_id): New function.
15085         (Close_task_runner::run): Call write_build_id.
15086
15087         * x86_64.cc: Correct license to GPLv3.
15088
15089 2008-03-23  Ian Lance Taylor  <iant@google.com>
15090
15091         * options.cc: Include "demangle.h".
15092         (parse_optional_string): New function.
15093         (parse_long_option): Handle takes_optional_argument.
15094         (parse_short_option): Update dash_z initializer.  Handle
15095         takes_optional_argument.
15096         (General_options::General_options): Initialize do_demangle_.
15097         (General_options::finalize): Set do_demangle_.  Handle demangling
15098         style.
15099         * options.h (parse_optional_string): Declare.
15100         (struct One_option): Add optional_arg field.  Update constructor.
15101         Update call constructor calls.  Add takes_optional_argument
15102         function.
15103         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15104         (DEFINE_optional_string): Define.
15105         (General_options::demangle): Change from DEFINE_bool to
15106         DEFINE_optional_string.
15107         (General_options::no_demangle): New function.
15108         (General_options::do_demangle): New function.
15109         (General_options::set_do_demangle): New function.
15110         (General_options::execstack_status_): Move definition to end of
15111         class definition.
15112         (General_options::static_): Likewise.
15113         (General_options::do_demangle_): New field.
15114         * object.cc (big_endian>::get_symbol_location_info): Call
15115         Options::do_demangle, not Options::demangle.
15116         * symtab.cc (demangle): Likewise.
15117
15118 2008-03-22  Ian Lance Taylor  <iant@google.com>
15119
15120         * gold.h: Include <cstddef> and <sys/types.h>
15121         * options.h: Include <cstring>.
15122
15123 2008-03-21  Ian Lance Taylor  <iant@google.com>
15124
15125         * Added source code to GNU binutils.
15126 \f
15127 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15128
15129 Copying and distribution of this file, with or without modification,
15130 are permitted in any medium without royalty provided the copyright
15131 notice and this notice are preserved.
15132
15133 Local Variables:
15134 mode: change-log
15135 left-margin: 8
15136 fill-column: 74
15137 version-control: never
15138 End: